Friday, June 27, 2025
Homeบิทคอยน์handle - I must get BTC addresses from a 12 phrase phrase,...

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


To get from the seed to the BIP84 handle (meant for the P2WPKH), you could comply with 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 comply with 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 bottom line is Bitcoin seed and the information is the seed. In our case:

KEY: Bitcoin seed
DATA: 59dc4d5348b364f9024e2af7d6bcd6fd115a95a5dfe33b213ddac6d1ed4b77175b05e727605c62c98bd110d0952dcb38de9f16c94e55b82603af77d5226be5f5

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

enter image description here

The result’s the next:

f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b231c547d66d20e80779c2b7a48e9d59f989ae8c3e2bf3e8eb752aae9fb555ad5123

Left 32 bytes signify grasp/root non-public key and the best 32 bytes signify grasp/root chain code. Thus:

MASTER PRIVATE KEY: f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b231
MASTER CHAIN CODE: c547d66d20e80779c2b7a48e9d59f989ae8c3e2bf3e8eb752aae9fb555ad5123

On the location you offered they signify BIP32 Root Key as a zprv base58check encoded prolonged non-public key. However that is only a method of presenting it, nothing else.

Now that we’ve got our grasp non-public key, we have to generate its baby keys. Wanting on the derivation path, we are able to 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 necessary to notice that the indexes for hardened youngsters begin at 2^31. So the index for the eighty fifth hardened baby is definitely 2147483732 (hex: 80000054). For the first baby it might be 2147483648 (hex: 80000000).

So to get the eighty fifth hardened baby, following the BIP32 part to derive the hardened baby non-public key from the dad or mum’s non-public key, the very first thing we have to do is use the HMAC-SHA512 operate the place the bottom line is the dad or mum’s chain code and the date is the concatenation of 0x00, the dad or mum’s non-public key and baby 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 best 32 bytes signify the kid’s chain key, and to get the kid’s non-public key, the subsequent factor we have to do is add the left half of the consequence (4eb98f36d3bd9c27c2d74ae497e2dba29e3af8365b1de8fc29dd2f39b8111017) and the dad or mum’s non-public key (f36ab72ee8ddc6c9288a3a26dc5f1009198bd37169dfb6ddc93b7c237b63b231). Additionally, the MOD operation must be carried out on the obtained consequence. 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 photos present how to do that utilizing this on-line software.

enter image description here

enter image description here

So, the eighty fifth hardened baby non-public key and its chain code are:

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

Completely the identical mechanism is used to get the subsequent 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 non-public key just isn’t forwarded, however the public key. Due to this fact, primarily based on the non-public key, it’s first obligatory to seek out its public key. I can’t go into the small print of this.

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

So, for the non-public key f4f8cb21aae3e6b3df7acee3f65bb592824b770ecbbc6ebe1efa4479d4950978, the corresponding uncompressed public secret is:

04576DF6CA4FA6D5347899277169CD38646F74E35A391F85DBDAFD3DE697F106979CDEA7B904A7B6F254BD3635ABEDCB140CBBDBBC2A81E7CB7223259B846E7BB2

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

PRIVATE KEY: f4f8cb21aae3e6b3df7acee3f65bb592824b770ecbbc6ebe1efa4479d4950978
PUBLIC KEY: 02576df6ca4fa6d5347899277169cd38646f74e35a391f85dbdafd3de697f10697

Now we’ve got the whole lot we have to discover a non-hardened baby non-public key. BIP32 says that we have to use HMAC-SHA512 operate the place the bottom line is dad or mum chain code, and the date is the concatenation of the (now) dad or mum public key and the kid index. So the inputs to the HMAC-SHA512 are:

KEY: f871e9c89e2ad059573dbd49bc14f6d1d2b1d444027ec12c23d2ede7b921175f
DATA: 02576df6ca4fa6d5347899277169cd38646f74e35a391f85dbdafd3de697f1069700000000

The additional course of is precisely the identical as with hardened derivation. The left half of the result’s added with the dad or mum’s non-public key, after which the MOD operation is carried out. On this method, the kid’s non-public secret is obtained. The correct aspect of the consequence represents the chain code of the kid. Thus:

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

And for the final baby (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 got acquired 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 must do RIPEMD160 (SHA256 (public key)). So we’ve got 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 are able to use this on-line software.

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

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

ความเห็นล่าสุด