handle – I must get BTC addresses from a 12 phrase phrase, however I do not perceive what to do subsequent

0
54


To get from the seed to the BIP84 handle (supposed for the P2WPKH), you need to observe the derivation path defines in BIP84 commonplace and apply the suitable derivation operation.

The derivation path outlined on this commonplace is: m/84’/0’/0’/0/0 the place m stands for the grasp key, the signal / denotes the extent of the tree and the quantity between the / denote the index of key in that stage. With the ' signal, it’s indicated that the important thing was of hardened sort (hardened derivation was utilized). If there isn’t any such signal, the important thing a results of the traditional derivation.

So first what we have to do is to get the grasp key from the seed. To do that, we observe the BIP32 part for the grasp key era. It says that after producing the seed, we have to use the HMAC-SHA512 operate the place the secret’s Bitcoin seed and the information is the seed. In our case:

KEY: Bitcoin seed
DATA: 59dc4d5348b364f9024e2af7d6bcd6fd115a95a5dfe33b213ddac6d1ed4b77175b05e727605c62c98bd110d0952dcb38de9f16c94e55b82603af77d5226be5f5

For this goal, you should utilize a web-based software like this. Set the values as I did within the following picture. I hold mentioning on-line instruments (it was simpler for me to make use of them when writing the reply), nonetheless, you can too use well-tested programming libraries in several programming languages.

enter image description here

The result’s the next:

f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b231c547d66d20e80779c2b7a48e9d59f989ae8c3e2bf3e8eb752aae9fb555ad5123

Left 32 bytes symbolize grasp/root personal key and the suitable 32 bytes symbolize grasp/root chain code. Thus:

MASTER PRIVATE KEY: f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b231
MASTER CHAIN CODE: c547d66d20e80779c2b7a48e9d59f989ae8c3e2bf3e8eb752aae9fb555ad5123

On the location you supplied they symbolize BIP32 Root Key as a zprv base58check encoded prolonged personal key. However that is only a approach of presenting it, nothing else.

Now that we have now our grasp personal key, we have to generate its youngster keys. Wanting on the derivation path, we will see that subsequent what we have to generate is the eighty fifth key on the second stage. The hardened derivation is used (it has the signal ').

Earlier than we proceed, it is vital to notice that the indexes for hardened youngsters begin at 2^31. So the index for the eighty fifth hardened youngster is definitely 2147483732 (hex: 80000054). For the first youngster it could be 2147483648 (hex: 80000000).

So to get the eighty fifth hardened youngster, following the BIP32 part to derive the hardened youngster personal key from the mum or dad’s personal key, the very first thing we have to do is use the HMAC-SHA512 operate the place the secret’s the mum or dad’s chain code and the date is the concatenation of 0x00, the mum or dad’s personal key and youngster index. So the inputs for the HMAC-SHA512 are:

KEY: c547d66d20e80779c2b7a48e9d59f989ae8c3e2bf3e8eb752aae9fb555ad5123
DATA: 00f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b23180000054

You may once more use the identical on-line software. The result’s:

4eb98f36d3bd9c27c2d74ae497e2dba29e3af8365b1de8fc29dd2f39b8111017841d3b7767023d0d985618d4a6b8d466aaac220155cb1fb18739836a86f2c223

Subsequent, following BIP32, the suitable 32 bytes symbolize the kid’s chain key, and to get the kid’s personal key, the following factor we have to do is add the left half of the outcome (4eb98f36d3bd9c27c2d74ae497e2dba29e3af8365b1de8fc29dd2f39b8111017) and the mum or dad’s personal key (f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b231). Additionally, the MOD operation must be carried out on the obtained outcome. The secp256k1 elliptic curve order is used for this. Order of the secp256k1 elliptic curve is FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141. Subsequent two footage present how to do that utilizing this on-line software.

enter image description here

enter image description here

So, the eighty fifth hardened youngster personal key and its chain code are:

CHILD PRIVATE KEY: 42244665bc9b62f0eb61850b7441ebacfd17eec115b4ff9e33464cd0633e8107
CHILD CHAIN CODE: 841d3b7767023d0d985618d4a6b8d466aaac220155cb1fb18739836a86f2c223

Completely the identical mechanism is used to get the following two youngsters within the BIP84 derivation path. The one distinction is that the index of the kid is 0, that’s 2147483648 (hex: 80000000) since it’s a hardened derivation. That is why I’ll write solely the outcomes.

m/84’/0′

CHILD PRIVATE KEY: 68155c2b225b592f73e2f812a307d9a15f4cb352cf3fc12e80fea185c63a176e
CHILD CHAIN CODE: 52da1bc66383744a78001a8b504d5d28c1fea7b98a95c361a8d8cc23fb371345

m/84’/0’/0′

CHILD PRIVATE KEY: f4f8cb21aae3e6b3df7acee3f65bb592824b770ecbbc6ebe1efa4479d4950978
CHILD CHAIN CODE: f871e9c89e2ad059573dbd49bc14f6d1d2b1d444027ec12c23d2ede7b921175f

The remaining two youngsters we have to discover (m/84’/0’/0’/0 and m/84’/0’/0’/0/0) are derived utilizing non-hardened (regular) derivation. The process is kind of the identical, with the truth that within the HMAC-SHA512 operate, the personal key just isn’t forwarded, however the public key. Subsequently, primarily based on the personal key, it’s first obligatory to seek out its public key. I cannot go into the main points of this.

To discover a public key from a personal key, you should utilize this on-line software.

So, for the personal key f4f8cb21aae3e6b3df7acee3f65bb592824b770ecbbc6ebe1efa4479d4950978, the corresponding uncompressed public key’s:

04576DF6CA4FA6D5347899277169CD38646F74E35A391F85DBDAFD3DE697F106979CDEA7B904A7B6F254BD3635ABEDCB140CBBDBBC2A81E7CB7223259B846E7BB2

The issue right here is that we want a compressed public key, so we will once more use one of many on-line software. So the compressed public key’s:

PRIVATE KEY: f4f8cb21aae3e6b3df7acee3f65bb592824b770ecbbc6ebe1efa4479d4950978
PUBLIC KEY: 02576df6ca4fa6d5347899277169cd38646f74e35a391f85dbdafd3de697f10697

Now we have now every little thing we have to discover a non-hardened youngster personal key. BIP32 says that we have to use HMAC-SHA512 operate the place the secret’s mum or dad chain code, and the date is the concatenation of the (now) mum or dad public key and the kid index. So the inputs to the HMAC-SHA512 are:

KEY: f871e9c89e2ad059573dbd49bc14f6d1d2b1d444027ec12c23d2ede7b921175f
DATA: 02576df6ca4fa6d5347899277169cd38646f74e35a391f85dbdafd3de697f1069700000000

The additional course of is strictly the identical as with hardened derivation. The left half of the result’s added with the mum or dad’s personal key, after which the MOD operation is carried out. On this approach, the kid’s personal key’s obtained. The proper aspect of the outcome represents the chain code of the kid. Thus:

RESULT: ef2ca2404a289aefb8ed2327215ed0660524d470394e06d4c6cd665e23191ffd1ba81f4c432bba50b8c1089b4030e4edf71ada1ac83962f745dc3769525d004c
CHILD PRIVATE KEY: e4256d61f50c81a39867f20b17ba85f9ccc16e9855c1d55725f54c4b2777e834
CHILD CHAIN CODE: 1ba81f4c432bba50b8c1089b4030e4edf71ada1ac83962f745dc3769525d004c

And for the final youngster (m/84’/0’/0’/0/0):

PARENT PRIVATE KEY: e4256d61f50c81a39867f20b17ba85f9ccc16e9855c1d55725f54c4b2777e834
PARENT PUBLIC KEY: 03ad87f5eb4b30ba3aa1b4713cacb4d722b47d729ac0b24c4c9810d4d2d11981ed
CHILD PRIVATE KEY: 879bef1ec302343d2c722fbfbd313165f2e1ef4828b0e74249bcef6e15ec55db
CHILD CHAIN CODE: f0aebf37903b4bd76d90456771c6673ff2b09bbd58435d54afb69089e30791ca
CHILD PUBLIC KEY: 0299c5b020a59dbe0059292b9c78f869ed82768de29184cd60feafd33db3f4e0e2

And that’s that. We’ve obtained the general public key for the trail m/84’/0’/0’/0/0. The one factor left is to calculate the handle and encode it with bech32. To get a P2WPKH handle in Bitcoin, you should do RIPEMD160 (SHA256 (public key)). So we have now the next:

PUBLIC KEY: 0299c5b020a59dbe0059292b9c78f869ed82768de29184cd60feafd33db3f4e0e2
SHA256(PUBLIC KEY): 2152377138127c59daf69fc627325d1b1b76c775a3c1e5063dd6f265cf7bb4b1
RIPEMD160(SHA256(PUBLIC KEY)): a791cf441333a2ecfafeb144342994c31146fa4f

On the finish we simply must encode a791cf441333a2ecfafeb144342994c31146fa4f in bech32. For that, we will use this on-line software.

This fashion we get the handle you requested for (bc1q57gu73qnxw3we7h7k9zrg2v5cvg5d7j0g5y6d4).

LEAVE A REPLY

Please enter your comment!
Please enter your name here