<blockquote>
  <p>I want to know why the two tools are giving different results</p>
</blockquote>

<p>Bitcoin Core uses <a href="https://bitcoin.stackexchange.com/questions/87834/hardened-keys-vs-normal-keys-a-simpler-explanation/87835#87835">hardened derivation</a> to derive child private keys from the master private key. You can check the embedded link for more details, but in summary it means that the software uses parent private keys within the hash function to generate child private keys. This compares to non-hardened derivation which uses parent public keys in the hash function. Since Bitcoin Core uses hardened derivation while the online tool that you mentioned uses non-hardened derivation (and also different paths), there is a natural mismatch in the keys generated by the two of them.</p>

<p>Bitcoin Core generates private keys using the hierarchical deterministic key generation using the path m/0'/0'/k' where k is the k<sup>th</sup> key generated from the master private key. Most wallets use the path m/44'/0'/0'/0/k for generating the k<sup>th</sup> receiving key.</p>

<blockquote>
  <p>Bitcoin Core generates its private master key from hdseed? And if so, is that operation reversible?</p>
</blockquote>

<p>HD seed is used to generate the master private key using a hash function. So the operation is only one way and cannot work the other way.</p>

<blockquote>
  <p>Is the way in which I am generating the hdseed from the mnemonic correct?</p>
</blockquote>

<p>It looks to be correct but on other aspect, the mnemonic that you provided in the question is not valid (I'm unsure if it was intentional) as the checksum does not match up with the entropy.</p>

CC BY-SA 4.0
2020-01-21T15:08:49.277Z
[BIP-39](https://iancoleman.io/bip39/) works with hardened derivation. Calculate the derived private key with `m / 0 '/ 0' ` and then derive the keys
wic
CC BY-SA 4.0
2020-01-21T18:47:50.073Z
@wic it can, but the paths are different.
Ugam Kamat
CC BY-SA 4.0
2020-01-29T22:53:35.413Z
I use `bx mnemonic-to-seed` command to verify mnemonic and it is correct, because if it is not correct, it return exception
wic
CC BY-SA 4.0
2020-01-08T04:49:57.300Z
2020-01-08T05:40:17.993Z
2020-01-08T05:40:17.993Z
Ugam Kamat
<p>I have the following problem in Bitcoin Core. With this command:</p>



<pre><code>echo carpet begin bacon master draft fortune food cherry cage axis vault clown | \
bx mnemonic-to-seed | \
bx hd-new -v 70615956 | \
bx hd-to-ec -c bx-testnet.cfg | \
sed 's/$/01/' | \
bx base58check-encode -v 239
</code></pre>

<p>What I am doing is from the mnemonic <code>carpet begin bacon master draft fortune food cherry cage axis vault clown</code>, I am generating an <code>hdseed</code> for Bitcoin Core in <strong>regtest</strong>. Results:</p>

<pre><code>cNQQqyR81GZXU3Pa1pK1gQQp6jgni5HyLYM99nL2JpzVRmdCyrFE
</code></pre>

<p>Then I use the command:</p>

<pre><code>bitcoin-cli -regtest sethdseed true cNQQqyR81GZXU3Pa1pK1gQQp6jgni5HyLYM99nL2JpzVRmdCyrFE
</code></pre>

<p>Where I change the <code>hdseed</code> for which I just got you and Bitcoin Core generates a key pool. When I put that same mnemonic on the page <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">BIP39</a> it gives me as root key the same that gives me the command up to this part:</p>



<pre><code>echo carpet begin bacon master draft fortune food cherry cage axis vault clown | \
bx mnemonic-to-seed | \
bx hd-new -v 70615956
</code></pre>

<p>which is: <code>tprv8ZgxMBicQKsPd5cY6ZZzsRzkcfDANp2y3jFtYNQZsp953sXiFNP9ZFod1fAhkgtCJZGvTcLJVdhFCj7VDNu68nuP4m2QGLcd4JpkteG8Ccc</code></p>

<p>However, the derivations of private keys generated by Bitcoin Core do not coincide with those of <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">BIP39</a>, nor does the BIP32 root key of <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">BIP39</a> coincide with the private masterkey of Bitcoin Core, while the <code>hdseed</code> if it matches the one that happens in the command. Both the derivations, hdseed and the Bitcoin Core master key are obtained with the command <code>bitcoin-cli -regtest dumpwallet test_wallet</code></p>

<p>I get two big unknowns:</p>

<ol>
<li>Is the way in which I am generating the hdseed from the mnemonic correct?</li>
<li>Bitcoin Core generates its private master key from <code>hdseed</code>? And if so, is that operation reversible?</li>
</ol>

<p><strong>But in general I want to know why they are giving different!!!</strong></p>

<p>Thanks in advance.</p>

<bitcoin-core><bip32-hd-wallets><bitcoin-cli><regtest>
Why keys generated in Bitcoin Core mismatch that from online generators despite using the same seed?
wic
# Why keys generated in Bitcoin Core mismatch that from online generators despite using the same seed?

(Asked by: username_0 on 2020-01-08)

I have the following problem in Bitcoin Core. With this command:

```
echo carpet begin bacon master draft fortune food cherry cage axis vault clown | \
bx mnemonic-to-seed | \
bx hd-new -v 70615956 | \
bx hd-to-ec -c bx-testnet.cfg | \
sed 's/$/01/' | \
bx base58check-encode -v 239

```

What I am doing is from the mnemonic `carpet begin bacon master draft fortune food cherry cage axis vault clown`, I am generating an `hdseed` for Bitcoin Core in **regtest**. Results:

```
cNQQqyR81GZXU3Pa1pK1gQQp6jgni5HyLYM99nL2JpzVRmdCyrFE

```

Then I use the command:

```
bitcoin-cli -regtest sethdseed true cNQQqyR81GZXU3Pa1pK1gQQp6jgni5HyLYM99nL2JpzVRmdCyrFE

```

Where I change the `hdseed` for which I just got you and Bitcoin Core generates a key pool. When I put that same mnemonic on the page [BIP39](https://iancoleman.io/bip39/) it gives me as root key the same that gives me the command up to this part:

```
echo carpet begin bacon master draft fortune food cherry cage axis vault clown | \
bx mnemonic-to-seed | \
bx hd-new -v 70615956

```

which is: `tprv8ZgxMBicQKsPd5cY6ZZzsRzkcfDANp2y3jFtYNQZsp953sXiFNP9ZFod1fAhkgtCJZGvTcLJVdhFCj7VDNu68nuP4m2QGLcd4JpkteG8Ccc`

However, the derivations of private keys generated by Bitcoin Core do not coincide with those of [BIP39](https://iancoleman.io/bip39/), nor does the BIP32 root key of [BIP39](https://iancoleman.io/bip39/) coincide with the private masterkey of Bitcoin Core, while the `hdseed` if it matches the one that happens in the command. Both the derivations, hdseed and the Bitcoin Core master key are obtained with the command `bitcoin-cli -regtest dumpwallet test_wallet`

I get two big unknowns:

1. Is the way in which I am generating the hdseed from the mnemonic correct?
2. Bitcoin Core generates its private master key from `hdseed`? And if so, is that operation reversible?

**But in general I want to know why they are giving different!!!**

Thanks in advance.

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


---

## 1 answers

### Answer by username_1 on 2020-01-08. Score: 2

> I want to know why the two tools are giving different results

Bitcoin Core uses [hardened derivation](https://bitcoin.stackexchange.com/questions/87834/hardened-keys-vs-normal-keys-a-simpler-explanation/87835#87835) to derive child private keys from the master private key. You can check the embedded link for more details, but in summary it means that the software uses parent private keys within the hash function to generate child private keys. This compares to non-hardened derivation which uses parent public keys in the hash function. Since Bitcoin Core uses hardened derivation while the online tool that you mentioned uses non-hardened derivation (and also different paths), there is a natural mismatch in the keys generated by the two of them.

Bitcoin Core generates private keys using the hierarchical deterministic key generation using the path m/0'/0'/k' where k is the kth key generated from the master private key. Most wallets use the path m/44'/0'/0'/0/k for generating the kth receiving key.

> Bitcoin Core generates its private master key from hdseed? And if so, is that operation reversible?

HD seed is used to generate the master private key using a hash function. So the operation is only one way and cannot work the other way.

> Is the way in which I am generating the hdseed from the mnemonic correct?

It looks to be correct but on other aspect, the mnemonic that you provided in the question is not valid (I'm unsure if it was intentional) as the checksum does not match up with the entropy.

> **Comments:**
> **username_0**: [BIP-39](https://iancoleman.io/bip39/) works with hardened derivation. Calculate the derived private key with `m / 0 '/ 0' ` and then derive the keys  
> **username_1**: @username_0 it can, but the paths are different.  
> **username_0**: I use `bx mnemonic-to-seed` command to verify mnemonic and it is correct, because if it is not correct, it return exception  

---

