<p>The <strong>BIP32 Root Key</strong> described on iancoleman tool is called <strong>master node</strong>, serialized in base58.</p>
<p><a href="https://i.sstatic.net/RkaMk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RkaMk.png" alt="enter image description here" /></a></p>
<p>The HMAC function needs a key (the string &quot;Bitcoin seed&quot; encoded in bytes), a data (the seed) and the hash function (sha512).</p>
<p>In python, it looks like:</p>
<pre><code>master_node = hmac.new(b'Bitcoin seed', bytes.fromhex(mseed), digestmod=&quot;sha512&quot;).digest()
</code></pre>
<p><strong>Serializing...</strong></p>
<ul>
<li>version = '0488ade4'</li>
<li>depth = '00'</li>
<li>fingerprint = '00000000'</li>
<li>index = '00000000'</li>
<li>private = first 32 bytes of master node</li>
<li>chaincode = last 32 bytes of master node</li>
</ul>
<p>Sum, checksum, encode everything and you'll get there.</p>
<p>Follow the steps of chapter 5 -&gt; <a href="https://learnmeabitcoin.com/technical/extended-keys" rel="nofollow noreferrer">https://learnmeabitcoin.com/technical/extended-keys</a></p>

CC BY-SA 4.0
2022-12-28T23:11:31.583Z
2022-12-28T23:11:31.583Z
phantom
<p>I created a mnemonics and it is hashed using <code>pbdkf2</code> 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.</p>
<p>I gave &quot;Bitcoin Seed&quot; as key and generated a hash, but it is not matching the output showed on <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">Ian Coleman's bip39 website</a>.</p>

<wallet><hash><bip32-hd-wallets><mnemonic-seed>
How do I generate master key from the root seed
Athul A
# How do I generate master key from the root seed

(Asked by: username_0 on 2022-12-28)

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](https://iancoleman.io/bip39/).

**Tags:** wallet, hash, bip32-hd-wallets, mnemonic-seed


---

## 1 answers

### Answer by username_1 on 2022-12-28. Score: 2

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

[![enter image description here](https://i.sstatic.net/RkaMk.png)](https://i.sstatic.net/RkaMk.png)

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>


---

