Backup of a bitcoind wallet using the extended private masterkey only

1

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?

electrotype

Posted 2019-10-20T19:11:09.367

Reputation: 151

Answers

1

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.

Andrew Chow

Posted 2019-10-20T19:11:09.367

Reputation: 40 910

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!)electrotype 2019-10-20T22:07:29.703

1Yes. 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.Andrew Chow 2019-10-20T23:03:37.950