bip32 hd wallets – How do you Derive Addresses from a BIP49 Master Public Key?


I am trying to derive addresses from a master public key (aka extended public key) in python. I don’t fully understand the math behind the key derivation, but have been able to decode the master public key from base58 to bin and encode the bin to hex. This is now where I am stuck at, I have all the info from the hex including the chain code, but am not sure what to do with the chain code hex. I have tried many different versions of encoded/decoded master public keys and some of them generated addresses, but the addresses were not properly derived from the original master public key.

Master Public Key (base58): ypub6WpT17zUsUE5oPuekrZEHkzk4bF4j9S3CM8VMx3BpiQwxxWMS914zVWEyMRBAJHQiQZRbtX4VLDYo4Y8WQZXCgSkzwEAJ73ToepntwymZ8g

Master Public Key (hex):

I have been using to compare if I was ever able to successfully derive the first address in index 0 with BIP49 selected. All of the values on correlates with characters in the master public key hex above.

This is the correct public key which is generated for the address in index 0:

How would I be able to use the chain code hex from the master public key hex to generate the public key above for the derivation path m/49'/0'/0'/0 and then use that public key to generate the corresponding address in python?

Source link

Leave a reply