1

I created a mnemonics and it is hashed using pbdkf2 function to get a root seed. So this root seed should be hashed again with HMAC-SHA512 to get the master key (Master private key and chain code). So for a HMAC-SAH512 we need a key and data, so in this case what should be the key? Data should be the root seed and what should I give as key in hmac function.

I gave "Bitcoin Seed" as key and generated a hash, but it is not matching the output showed on Ian Coleman's bip39 website.

1 Answer 1

2

The BIP32 Root Key described on iancoleman tool is called master node, serialized in base58.

enter image description here

The HMAC function needs a key (the string "Bitcoin seed" encoded in bytes), a data (the seed) and the hash function (sha512).

In python, it looks like:

master_node = hmac.new(b'Bitcoin seed', bytes.fromhex(mseed), digestmod="sha512").digest()

Serializing...

  • version = '0488ade4'
  • depth = '00'
  • fingerprint = '00000000'
  • index = '00000000'
  • private = first 32 bytes of master node
  • chaincode = last 32 bytes of master node

Sum, checksum, encode everything and you'll get there.

Follow the steps of chapter 5 -> https://learnmeabitcoin.com/technical/extended-keys

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.