My question is how the bitcoin core client generates a (master) private key(s)?

I know from other wallets, that they take the mnemonic and generate a HD wallet master key. With the master key, the other keys can be generated.

To my question. How does the bitcoin core software do it? I've never seen a mnemonic there.

  • Does it use a mnemonic?
  • I know about the backupwallet command to make a backup.
    Is there nothing like a mnemonic I can use? If there isn't, do I have to constantly do backups?

Bitcoind does not support BIP39, which encodes a seed (128, 160, 192, 224, 256 bits) in a mnemonic phrase, from which the 512b HD root seed is later generated via PBKDF2 (Password-Based Key Derivation Function 2). This 512b root seed is used to derive the (extended) master keys.

For wallets without BIP39, the 512b HD root seed is directly supplied as entropy, without the intermediary step involving an encoded mnemonic phrase and PBKDF2.

Backing up the wallet.dat file. https://bitcoin.stackexchange.com/a/22722/90088

Amended: Bitcoin Core wallets will deterministically derive new extended key pairs and addresses as wallet usage progresses, which is reflected and updated in the wallet.dat file. However, when restoring a wallet from an older wallet file, the wallet will (re)derive all standard child key derivation paths, whilst (re)scanning the blockchain to determine past usage of these keys in transactions, thereby recreating the last used hd wallet state. The wallet can be fully restored, even if the wallet file backup is not the most recent one because of this rescan.

  • So could you expand on ` the 512b HD root seed is directly supplied as entropy`? The 512b HD root seed is randomly generated. What's used for the randomness(entropy)? – dvg Jan 20 at 16:23
  • And that means that I have to continously make backups from my keys because I don't have a seed ? – dvg Jan 20 at 16:25
  • 1
    @dvg New Bitcoin Core wallets do use BIP32 (with hardened derivation), so the keys are deterministic, and you don't need a new backup all the time. There just is no text form of the master key. – Pieter Wuille Jan 20 at 17:03
  • @PieterWuille Thanks. I have amended the answer accordingly. – James C. Jan 20 at 17:24
  • Thx @PieterWuille & JamesC. for the helpful responses! – dvg Jan 20 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.