So Bitcoin uses an HD wallet and thanks to that it can store keys in a hierarchy. But how exactly and in what format are they stored? Is each private and public key stored as a separate file? Are they stored in textual or binary format? Does Bitcoin use a database to store them?

The only resource I found is the source code of Bitcoin Core but are there any books or sites where I can find explanations about this?

  • I don't know if it really gives the detail you want but there is Mastering Bitcoin by Andreas M. Antonopoulos. This has chapters on bitcoin-core and on HD wallets. I suspect all the keys are in wallet.data and that a variant of Berkeley-DB key-value pair "database" format is used. Commented Jun 2, 2020 at 14:10

1 Answer 1


No they are not stored, the child keys are calculated from the master when needed as they are deterministic, not random.

Here are some references:



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.