2

If I understand correctly, bitcoind makes use of a extended private masterkey in order to deterministically generate private/public keys for a wallet.

Using the dumpwallet command, I'm able to get access to this extended private masterkey.

My questions:

1) If I only backup that extended private masterkey, would I be able to recreate the wallet entirely in case my application crashes? Or do I really need to backup the wallet file itself? (Let's say I do not import addresses that were not generated by bitcoind itself.)

2) I heard that changing the passphrase of a wallet would change the extended private masterkey... Is that true?

3) If #2 is true, can I simply backup all generated extended private masterkeys (every time I change the passphrase) to be able to recreate the wallet entirely using those multiple extended private masterkeys? What would be the command to run to recreate the wallet from more than one extended private masterkeys?

1 Answer 1

3

1) If I only backup that extended private masterkey, would I be able to recreate the wallet entirely in case my application crashes? Or do I really need to backup the wallet file itself? (Let's say I do not import addresses that were not generated by bitcoind itself.)

No. Bitcoin Core does not allow your to create a wallet from the master private key. There is no way to import it into a newly created wallet or to create a new wallet with a master extended private key.

2) I heard that changing the passphrase of a wallet would change the extended private masterkey... Is that true?

Only setting the password will change it. Subsequent password changes will not change any of the private keys in your wallet.


An important thing to note here is that Bitcoin Core does not use an extended private key. Rather it uses a HD seed (as defined in BIP 32). When keys are being generated, that seed is hashed to get the extended master private key, and from there the child keys are derived. That extended master private key is never stored in the wallet file itself.

Instead of backing up the master private key, you could instead backup the HD seed. This can also be found in the dumpwallet output and it will be listed as hdseed=1. It will look like a normal private key and be presented in Wallet Import Format.

Once you have the seed, you can create a new wallet and set it to use your backed up seed using the sethdseed command.

4
  • If I understand, I backup this special hdseed=1 private key, and I'll then be able to recreate the wallet from scratch, even if I set and change the passphrase after that? (Thanks a lot for the help!) Commented Oct 20, 2019 at 22:07
  • 1
    Yes. The HD seed is effectively the same thing as the extended master private key. However, other wallets probably won't be able to import it.
    – Ava Chow
    Commented Oct 20, 2019 at 23:03
  • @AndrewChow: Do you mean the exact HD algorithms of Bitcoin Core are not standard (or can be considered a de-facto standard) and any vendor is actually free to implement HD in any way differently than what Bitcoin Core does?
    – Mercedes
    Commented Oct 12, 2021 at 16:14
  • @Mercedes No, Bitcoin Core follows BIP 32. It is just that Bitcoin Core does not expose the same information that other wallets typically do.
    – Ava Chow
    Commented Oct 12, 2021 at 16:51

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.