As far as I understand, when I want to create an HD Wallet, do I need a private key that is derived into an extended public key?

So, my question is, if I am coding a portfolio of bitcoin in java, how can I generate this public extended key from a private key (I assume that the private key is like a private password right?)?

Thanks for your help,


1 Answer 1


Generally the private key and chain code (these 2 parts make up the extended private key) are generated at the same time from a seed. The seed can be either a randomly generated number, or derived from a 12 word mnemonic like BIP 39 details. Once you have a seed, BIP 32 explains:

Calculate I = HMAC-SHA512(Key = "Bitcoin seed", Data = yourSeed) Split I into two 32-byte sequences, IL and IR. Use parse256(IL) as master secret key, and IR as master chain code.

So basically you take the 512 bit hash of the seed, and split it into two 256 bit halves, one of which is the private key and the other is the chain code. And from the private key, you can obtain the public key.

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.