Wallet: how to generate public extended key?

0

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,

Aleyango

Posted 2017-08-19T18:00:37.353

Reputation: 3

maybe this helps to get it sorted: http://chimera.labs.oreilly.com/books/1234000001802/ch04.html#hd_wallets and you may want to check https://bitcoin.stackexchange.com/questions/tagged/bip32 and https://bitcoin.stackexchange.com/questions/tagged/bip32+hd-wallet. Let us know, if you are still missing something :-)

pebwindkraft 2017-08-19T18:33:35.693

Answers

0

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.

MeshCollider

Posted 2017-08-19T18:00:37.353

Reputation: 8 735