<p>Bitcoin Core uses the <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Master_key_generation" rel="nofollow noreferrer">method described in BIP 32</a> to generate the master private key from a seed. The seed here is WIF private key. To get the master private key from the seed, you will need to decode the WIF private key to get the byte sequence that it represents. Then you can hash it as described in BIP 32 and encode it to get the master private key.</p>

<p>You can use <code>bx</code> to do this:</p>

<pre><code>bx wif-to-ec &lt;WIF key&gt; | bx hd-new
</code></pre>

CC BY-SA 4.0
2019-03-23T16:04:55.177Z
Thanks very much for answer quickly my 2 posts. `bx hd-new --version 70615956` for testnet and it works great.
onepix
CC BY-SA 4.0
2019-03-22T17:48:25.040Z
2019-03-22T17:48:25.040Z
Ava Chow
<ul>
<li>Using <code>bitcoin-cli -datadir=X sethdseed true "WIF_KEY"</code> the current wallet within datadir is updated</li>
<li>Then, using <code>bitcoin-cli -datadir=X dumpwallet my_dump.txt</code> shows a fresh new <br> <strong># extended private masterkey: tpriv...</strong>, which is determiniscally generated from the <strong>WIF_KEY</strong></li>
</ul>

<p>Now, using the <strong># extended private masterkey</strong> I could indeed generate the same address than bitcoin core with the <code>m/0'/0'/i'</code> derivated path.</p>

<p>How could I compute the <strong># extended private masterkey</strong> without dumping the wallet, using tools like <code>libbitcoin bx</code> ?</p>

<p>Also, the dumping file show a <br><code>WIF_KEY 2019-03-22T14:43:55Z hdseed=1 # addr=mnMEP6P92XKxKfEM5v2SxzLBMVB2tf7Lsj hdkeypath=s</code> <br>which is exactly the <code>m/44'/1'/0'/0/0</code> from the <strong>WIF_KEY</strong> passed in <code>sethdseed</code> cmd, why ?</p>

<bitcoin-core><bip32-hd-wallets><bitcoin-cli>
Bitcoin Core 0.17 sethdseed then dumpwallet how to recompute extended private masterkey?
onepix
# Bitcoin Core 0.17 sethdseed then dumpwallet how to recompute extended private masterkey?

(Asked by: username_0 on 2019-03-22)

* Using `bitcoin-cli -datadir=X sethdseed true "WIF_KEY"` the current wallet within datadir is updated
* Then, using `bitcoin-cli -datadir=X dumpwallet my_dump.txt` shows a fresh new   
   **# extended private masterkey: tpriv...**, which is determiniscally generated from the **WIF\_KEY**

Now, using the **# extended private masterkey** I could indeed generate the same address than bitcoin core with the `m/0'/0'/i'` derivated path.

How could I compute the **# extended private masterkey** without dumping the wallet, using tools like `libbitcoin bx` ?

Also, the dumping file show a   
`WIF_KEY 2019-03-22T14:43:55Z hdseed=1 # addr=mnMEP6P92XKxKfEM5v2SxzLBMVB2tf7Lsj hdkeypath=s`   
which is exactly the `m/44'/1'/0'/0/0` from the **WIF\_KEY** passed in `sethdseed` cmd, why ?

**Tags:** bitcoin-core, bip32-hd-wallets, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2019-03-22. Score: 2 | Accepted answer

Bitcoin Core uses the [method described in BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Master_key_generation) to generate the master private key from a seed. The seed here is WIF private key. To get the master private key from the seed, you will need to decode the WIF private key to get the byte sequence that it represents. Then you can hash it as described in BIP 32 and encode it to get the master private key.

You can use `bx` to do this:

```
bx wif-to-ec <WIF key> | bx hd-new

```

> **Comments:**
> **username_0**: Thanks very much for answer quickly my 2 posts. `bx hd-new --version 70615956` for testnet and it works great.  

---

