Author

Topic: [BIP32] Difference between BIP32 Extended Key and Derived Private Key ? (Read 3158 times)

newbie
Activity: 40
Merit: 0
So, for what you guys tell me here, the BIP32 Extended Key is the true address structure to generate from (the first address list).  So what does the second Derived Private Key represent, since it seems to generate a valid address child chain?
The derived key is an extended key that is derived from the first extended key.

OK, thanks.  I think I understand it now.  There is lots of derivation paths than can give you many different HD wallets, all from a single Extended Master Key.
staff
Activity: 3374
Merit: 6530
Just writing some code
So, for what you guys tell me here, the BIP32 Extended Key is the true address structure to generate from (the first address list).  So what does the second Derived Private Key represent, since it seems to generate a valid address child chain?
The derived key is an extended key that is derived from the first extended key.
newbie
Activity: 40
Merit: 0
OK, thanks guys for all the helps.  I guess I mostly understand how BIP32 works.  One final question

Using this site as an example

http://bip32.org/


I am using "crazy horse battery staple" passphrase to generate an example BIP32

BIP32 Extended Key
xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8im bZKLYVBxFPND1pniTZ81vKfd45EHKX73

Inputting this into Electrum, this generates these child address
Code:
0 1LpNMg5bpLfStunETxq6BQecf5Jc5kUvf1
1 1QJ47NXJ1cf9iDK6yAEkL3wGRNbRn89VNp
0 1LpNMg5bpLfStunETxq6BQecf5Jc5kUvf1
2 13BhQDyuZv4zac8YPKpcycTPZyiRdJbYXb
1 1QJ47NXJ1cf9iDK6yAEkL3wGRNbRn89VNp
0 1LpNMg5bpLfStunETxq6BQecf5Jc5kUvf1
...

OK, so if I input the Derived Private Key into Electrum, it generates these addresses
Derived Private Key
xprv9wHokC2KXdTSpEepFcu53hMDUHYfAtTaLEJEMyxBPAMf78hJg17WhL5FyeDUQH5KWmGjGgEb2j7 4gsZqgupWpPbZgP6uFmP8MYEy5BNbyET
Code:
0 1A28RXgCaoNXRynA7rwQSrFiWwBcFCPgE7
1 12pc2Qp4U4sFnu9q6HsK8msR2GTqgkgTm7
2 1AsuEsy6AqbFkA7n8Yjb2q7zfgSwMeq8MN
0 1A28RXgCaoNXRynA7rwQSrFiWwBcFCPgE7
3 1H8UaFibaK4TzRDKR7dbYnM3vzKDim6aH9
1 12pc2Qp4U4sFnu9q6HsK8msR2GTqgkgTm7
...



So, these address are show 2 different HD address structure child tree generated. 



So, for what you guys tell me here, the BIP32 Extended Key is the true address structure to generate from (the first address list).  So what does the second Derived Private Key represent, since it seems to generate a valid address child chain?
sr. member
Activity: 248
Merit: 250
To import a deterministic wallet into Electrum, you would use a private key in the extended private key format encoded with the base58 check encoding.

Yep, pretty clear explanation.
staff
Activity: 3374
Merit: 6530
Just writing some code
An extended private key is a format.

A derived private key is any private key that is deterministically generated from another private key.

Any private key can use the extended private key format to give wallets information about how to derive that key given the master private key that it was derived from.

So, which key do I use to import into Electrum or something?
To import a deterministic wallet into Electrum, you would use a private key in the extended private key format encoded with the base58 check encoding.
newbie
Activity: 40
Merit: 0
You have one master key (extended key) and can produce a lot of derived keys from it. But each derived key can be master key as well, so there is extended form for it.

Hello konovalets, thank you for the reply.  So, let me see if I understand correctly?  I have been studying the BIP32 page


BIP Extended Key -> many different Derived Private Key

Derived Private Key + chain code = Extended key


So, which key do I use to import into Electrum or something?

So does generation go like

Private Key -> BIP Extended key -> Child Key ?


sr. member
Activity: 248
Merit: 250
You have one master key (extended key) and can produce a lot of derived keys from it. But each derived key can be master key as well, so there is extended form for it.
sr. member
Activity: 248
Merit: 250
Extended keys

In what follows, we will define a function that derives a number of child keys from a parent key. In order to prevent these from depending solely on the key itself, we extend both private and public keys first with an extra 256 bits of entropy. This extension, called the chain code, is identical for corresponding private and public keys, and consists of 32 bytes.

We represent an extended private key as (k, c), with k the normal private key, and c the chain code. An extended public key is represented as (K, c), with K = point(k) and c the chain code.

Each extended key has 2^31 normal child keys, and 2^31 hardened child keys. Each of these child keys has an index. The normal child keys use indices 0 through 2^31-1. The hardened child keys use indices 2^31 through 2^32-1. To ease notation for hardened key indices, a number iH represents i+2^31.

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Extended_keys
newbie
Activity: 40
Merit: 0
I have been trying to study up on BIP32, read the relevant documentation, but still confused on a point

http://bip32.org/

Playing around with codes on this site, I get 2 different xprv keys (the example given is just for the default password "crazy horse battery staple")

BIP32 Extended Key
xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8im bZKLYVBxFPND1pniTZ81vKfd45EHKX73

Derived Private Key
xprv9wHokC2KXdTSpEepFcu53hMDUHYfAtTaLEJEMyxBPAMf78hJg17WhL5FyeDUQH5KWmGjGgEb2j7 4gsZqgupWpPbZgP6uFmP8MYEy5BNbyET


So I am a bit confused now what the difference is between these 2 xprv keys?  I tried to input both into Electrum recovery wallet, and they both accepted, but gave different address tree structures. 

Can anyone help clear this up for me?

Jump to: