I'm trying to use a mnemonic seed to generate a bitcoin-core wallet. I know core does not support bip39, but it does support bip32 and sethdseed should make it possible to use the seed generated by a given mnemonic.

What I'm trying to do is to generate a seed using https://github.com/iancoleman/bip39 and use that xprv to feed sethdseed on an empty wallet created on bitcoin core.

The main problem I'm facing is that the format required by the bitcoin core wallet is not available, and I'm not being able to generate it on any way:

I've just created a new wallet just for testing and make a dump, it reads something like:

# extended private masterkey: xprv9s21ZrQH143K3ndNedb7hus3kpzuUyAafU9zvKxgqgveg4623gViHrSrkiaweK2WfNNbdANyEa6D9GceWtiyWHPtSdyUCpVweg8A6wdqG7g

L5613pTNa7wks3DVt9HrPYDR1aBpMHn3qpxBLfQyDR4kKgaBrNRS 2019-07-14T21:57:10Z hdseed=1 # addr=32AoHsZ6AvTPxiqkACTMbMcdPhD4Xye1nM
KyAP4Jf5APLei25PbfeohPWaRNmCj2yQjwWtreqM4ixXJR23Dxo7 2019-07-14T21:57:11Z reserve=1 # addr=36DxZaj6JEXgSSdTtsN6yEdULgGrfc5A5W hdkeypath=m/0'/0'/9'

So it says that the masterkey given translate on the given hdseed

xprv = xprv9s21ZrQH143K3ndNedb7hus3kpzuUyAafU9zvKxgqgveg4623gViHrSrkiaweK2WfNNbdANyEa6D9GceWtiyWHPtSdyUCpVweg8A6wdqG7g
should translate in some way to:
hdseed = L5613pTNa7wks3DVt9HrPYDR1aBpMHn3qpxBLfQyDR4kKgaBrNRS

But I could not found any way to get from one to the other.

It seems that there is already an isssue on bip39, about this, without results.

I've tested using bitcoinjs-lib with the following code without luck:

const bip32 = require('bip32')
const bitcoin = require('bitcoinjs-lib')
const xpriv = 'xprv9s21ZrQH143K3ndNedb7hus3kpzuUyAafU9zvKxgqgveg4623gViHrSrkiaweK2WfNNbdANyEa6D9GceWtiyWHPtSdyUCpVweg8A6wdqG7g'

const node = bip32.fromBase58(xpriv, bitcoin.networks.bitcoin)


But it does generate 'L1UsWzEdexKrXmNaM8b4dyv4TsMHouVFgKhFANuhomHJjNbniWdx'.

1 Answer 1


You simply cannot. The HD seed is used to derive the master private key, not the other way around. This derivation uses a hash function so it only works in one direction: HD seed to master private key. Given the master private key, you cannot get the HD seed used to produce it.

BIP 39 mnemonics are used to create a HD seed which is then used to create the master private key. However BIP 39 specifies that the HD seed be created using SHA512 (within PBKDF2) so it will always output a 512 bit seed. But Bitcoin Core cannot take 512 bit seeds, so you cannot use a BIP 39 mnemonic with Bitcoin Core at all.

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.