<p>You must add <code>'TREZOR'</code> to your second line:</p>

<p><code>const seed = Bip39.mnemonicToSeed(MNEMONIC, 'TREZOR');</code></p>

<p>Then it should work.</p>

<p>You can see this in the BIP39 test cases in the BitcoinJS repo:</p>

<p><a href="https://github.com/bitcoinjs/bip39/blob/4fce199e73f7ab68bdf9f7382dc10f7e1adaa499/test/index.js#L13-L33" rel="nofollow noreferrer">https://github.com/bitcoinjs/bip39/blob/4fce199e73f7ab68bdf9f7382dc10f7e1adaa499/test/index.js#L13-L33</a></p>

<pre><code>function testVector (description, wordlist, password, v, i) {
  var ventropy = v[0]
  var vmnemonic = v[1]
  var vseedHex = v[2]

  test('for ' + description + '(' + i + '), ' + ventropy, function (t) {
    t.plan(5)

    t.equal(bip39.mnemonicToEntropy(vmnemonic, wordlist), ventropy, 'mnemonicToEntropy returns ' + ventropy.slice(0, 40) + '...')
    t.equal(bip39.mnemonicToSeedHex(vmnemonic, password), vseedHex, 'mnemonicToSeedHex returns ' + vseedHex.slice(0, 40) + '...')
    t.equal(bip39.entropyToMnemonic(ventropy, wordlist), vmnemonic, 'entropyToMnemonic returns ' + vmnemonic.slice(0, 40) + '...')

    function rng () { return Buffer.from(ventropy, 'hex') }
    t.equal(bip39.generateMnemonic(undefined, rng, wordlist), vmnemonic, 'generateMnemonic returns RNG entropy unmodified')
    t.equal(bip39.validateMnemonic(vmnemonic, wordlist), true, 'validateMnemonic returns true')
  })
}

vectors.english.forEach(function (v, i) { testVector('English', undefined, 'TREZOR', v, i) })
vectors.japanese.forEach(function (v, i) { testVector('Japanese', WORDLISTS.japanese, '㍍ガバヴァぱばぐゞちぢ十人十色', v, i) })
vectors.custom.forEach(function (v, i) { testVector('Custom', WORDLISTS.custom, undefined, v, i) })
</code></pre>

CC BY-SA 4.0
2019-03-14T01:43:26.143Z
2019-03-14T01:43:26.143Z
user3074620
<p>Could not resist providing the even more succinct results below that uses simple UNIX and <a href="https://github.com/libbitcoin/libbitcoin-explorer/wiki" rel="nofollow noreferrer"><strong>bitcoin-explorer</strong></a> commands:</p>

<p><code>% echo "ffffffffffffffffffffffffffffffff" | bx mnemonic-new</code></p>

<p><strong>zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong</strong></p>

<p><code>% echo "ffffffffffffffffffffffffffffffff" | bx mnemonic-new | bx mnemonic-to-seed -p "TREZOR"</code></p>

<p><strong>ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069</strong></p>

<p><code>% echo "ffffffffffffffffffffffffffffffff" | bx mnemonic-new | bx mnemonic-to-seed -p "TREZOR" | bx hd-new</code></p>

<p><strong>xprv9s21ZrQH143K2V4oox4M8Zmhi2Fjx5XK4Lf7GKRvPSgydU3mjZuKGCTg7UPiBUD7ydVPvSLtg9hjp7MQTYsW67rZHAXeccqYqrsx8LcXnyd</strong></p>

CC BY-SA 4.0
2019-03-15T01:32:37.663Z
2019-03-15T01:32:37.663Z
skaht
<p>On the page of <a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" rel="nofollow noreferrer">BIP39 specs</a> there's test vector array from Trezor <a href="https://github.com/trezor/python-mnemonic/blob/master/vectors.json" rel="nofollow noreferrer">link</a>. It looks like this:</p>

<pre><code>["ffffffffffffffffffffffffffffffff",

 "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong",

 "ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069",

 "xprv9s21ZrQH143K2V4oox4M8Zmhi2Fjx5XK4Lf7GKRvPSgydU3mjZuKGCTg7UPiBUD7ydVPvSLtg9hjp7MQTYsW67rZHAXeccqYqrsx8LcXnyd"
],
</code></pre>

<p>When I try to use any of these mnemonic phrases I can't get matching <code>xpriv...</code> form any of these samples using <a href="https://github.com/bitcoinjs/bip39" rel="nofollow noreferrer">Bip39 JS lib</a>.</p>

<p>For example:</p>

<pre><code>const MNEMONIC = "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong";
const seed = Bip39.mnemonicToSeed(MNEMONIC);
console.log("Seed =", seed.toString("hex"));

const rootNode = Bip32.fromSeed(seed, Bitcoin.networks.bitcoin);
console.log("Bip32 Root key =", rootNode.toBase58());
</code></pre>

<p>returns totally different results</p>

<pre><code>Seed = b6a6d8921942dd9806607ebc2750416b289adea669198769f2e15ed926c3aa92bf88ece232317b4ea463e84b0fcd3b53577812ee449ccc448eb45e6f544e25b6
Bip32 Root key = xprv9s21ZrQH143K2PfMvkNViFc1fgumGqBew45JD8SxA59Jc5M66n3diqb92JjvaR61zT9P89Grys12kdtV4EFVo6tMwER7U2hcUmZ9VfMYPLC
</code></pre>

<p>How can I get these <code>c5525...</code> and <code>xpriv...</code> and what is it exactly? </p>

<p>UPDATE:</p>

<p>as <a href="https://bitcoin.stackexchange.com/questions/85293/how-to-use-bip39-test-vectors/85295#85295">user3074620</a> suggested, I tried to use 'TREZOR' password, as it's works!</p>

<p>here's <a href="https://repl.it/repls/AdequateCandidCoolingfan" rel="nofollow noreferrer">code to play</a> someone is interested.</p>

<mnemonic-seed>
How to use BIP39 test vectors?
lebed2045
# How to use BIP39 test vectors?

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

On the page of [BIP39 specs](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) there's test vector array from Trezor [link](https://github.com/trezor/python-mnemonic/blob/master/vectors.json). It looks like this:

```
["ffffffffffffffffffffffffffffffff",

 "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong",

 "ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069",

 "xprv9s21ZrQH143K2V4oox4M8Zmhi2Fjx5XK4Lf7GKRvPSgydU3mjZuKGCTg7UPiBUD7ydVPvSLtg9hjp7MQTYsW67rZHAXeccqYqrsx8LcXnyd"
],

```

When I try to use any of these mnemonic phrases I can't get matching `xpriv...` form any of these samples using [Bip39 JS lib](https://github.com/bitcoinjs/bip39).

For example:

```
const MNEMONIC = "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong";
const seed = Bip39.mnemonicToSeed(MNEMONIC);
console.log("Seed =", seed.toString("hex"));

const rootNode = Bip32.fromSeed(seed, Bitcoin.networks.bitcoin);
console.log("Bip32 Root key =", rootNode.toBase58());

```

returns totally different results

```
Seed = b6a6d8921942dd9806607ebc2750416b289adea669198769f2e15ed926c3aa92bf88ece232317b4ea463e84b0fcd3b53577812ee449ccc448eb45e6f544e25b6
Bip32 Root key = xprv9s21ZrQH143K2PfMvkNViFc1fgumGqBew45JD8SxA59Jc5M66n3diqb92JjvaR61zT9P89Grys12kdtV4EFVo6tMwER7U2hcUmZ9VfMYPLC

```

How can I get these `c5525...` and `xpriv...` and what is it exactly?

UPDATE:

as [username_1](https://bitcoin.stackexchange.com/questions/85293/how-to-use-bip39-test-vectors/85295#85295) suggested, I tried to use 'TREZOR' password, as it's works!

here's [code to play](https://repl.it/repls/AdequateCandidCoolingfan) someone is interested.

**Tags:** mnemonic-seed


---

## 2 answers

### Answer by username_1 on 2019-03-14. Score: 0 | Accepted answer

You must add `'TREZOR'` to your second line:

`const seed = Bip39.mnemonicToSeed(MNEMONIC, 'TREZOR');`

Then it should work.

You can see this in the BIP39 test cases in the BitcoinJS repo:

<https://github.com/bitcoinjs/bip39/blob/4fce199e73f7ab68bdf9f7382dc10f7e1adaa499/test/index.js#L13-L33>

```
function testVector (description, wordlist, password, v, i) {
  var ventropy = v[0]
  var vmnemonic = v[1]
  var vseedHex = v[2]

  test('for ' + description + '(' + i + '), ' + ventropy, function (t) {
    t.plan(5)

    t.equal(bip39.mnemonicToEntropy(vmnemonic, wordlist), ventropy, 'mnemonicToEntropy returns ' + ventropy.slice(0, 40) + '...')
    t.equal(bip39.mnemonicToSeedHex(vmnemonic, password), vseedHex, 'mnemonicToSeedHex returns ' + vseedHex.slice(0, 40) + '...')
    t.equal(bip39.entropyToMnemonic(ventropy, wordlist), vmnemonic, 'entropyToMnemonic returns ' + vmnemonic.slice(0, 40) + '...')

    function rng () { return Buffer.from(ventropy, 'hex') }
    t.equal(bip39.generateMnemonic(undefined, rng, wordlist), vmnemonic, 'generateMnemonic returns RNG entropy unmodified')
    t.equal(bip39.validateMnemonic(vmnemonic, wordlist), true, 'validateMnemonic returns true')
  })
}

vectors.english.forEach(function (v, i) { testVector('English', undefined, 'TREZOR', v, i) })
vectors.japanese.forEach(function (v, i) { testVector('Japanese', WORDLISTS.japanese, '㍍ガバヴァぱばぐゞちぢ十人十色', v, i) })
vectors.custom.forEach(function (v, i) { testVector('Custom', WORDLISTS.custom, undefined, v, i) })

```


---

### Answer by username_2 on 2019-03-15. Score: 0

Could not resist providing the even more succinct results below that uses simple UNIX and [**bitcoin-explorer**](https://github.com/libbitcoin/libbitcoin-explorer/wiki) commands:

`% echo "ffffffffffffffffffffffffffffffff" | bx mnemonic-new`

**zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong**

`% echo "ffffffffffffffffffffffffffffffff" | bx mnemonic-new | bx mnemonic-to-seed -p "TREZOR"`

**ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069**

`% echo "ffffffffffffffffffffffffffffffff" | bx mnemonic-new | bx mnemonic-to-seed -p "TREZOR" | bx hd-new`

**xprv9s21ZrQH143K2V4oox4M8Zmhi2Fjx5XK4Lf7GKRvPSgydU3mjZuKGCTg7UPiBUD7ydVPvSLtg9hjp7MQTYsW67rZHAXeccqYqrsx8LcXnyd**


---

