Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: MatthewLM on October 18, 2013, 04:00:46 PM



Title: BIP0032 Mistake
Post by: MatthewLM on October 18, 2013, 04:00:46 PM
I was reading through BIP0032 and I found what is clearly a mistake here: https://en.bitcoin.it/wiki/BIP_0032#Public_child_key_derivation

This is wrong:

Ki = (IL + Kpar)*G = IL*G + Kpar

It should be:

Ki = (IL + kpar)*G = IL*G + Kpar

It confused me at first until I realised it was a mistake. It's only a small thing but other people might also get confused.

Also having "(mod n)" is pointless. It's known that the elliptic curve operations are done over a finite field and "(mod n)" is not shown consistently.

Other than that, everything makes sense to me.


Title: Re: BIP0032 Mistake
Post by: gmaxwell on October 18, 2013, 04:09:52 PM
Also having "(mod n)" is pointless. It's known that the elliptic curve operations are done over a finite field and "(mod n)" is not shown consistently.
The places where mod n is used are not EC operations.

Thanks for the other report: It looks like someone confused edited the page while no one was watching:
https://en.bitcoin.it/w/index.php?title=BIP_0032&diff=40588&oldid=39104


Title: Re: BIP0032 Mistake
Post by: MatthewLM on October 18, 2013, 04:14:51 PM
Quote
The places where mod n is used are not EC operations.

Of-course, silly me.  ;) It all makes sense then.


Title: Re: BIP0032 Mistake
Post by: Crowex on October 18, 2013, 06:23:13 PM
I was reading through BIP0032 and I found what is clearly a mistake here: https://en.bitcoin.it/wiki/BIP_0032#Public_child_key_derivation

This is wrong:

Ki = (IL + Kpar)*G = IL*G + Kpar



I pointed that mistake out over a month ago. I was wondering if someone was going to change it.  :)


Title: Re: BIP0032 Mistake
Post by: gmaxwell on October 18, 2013, 07:13:51 PM
I pointed that mistake out over a month ago.
Where?


Title: Re: BIP0032 Mistake
Post by: Crowex on October 18, 2013, 07:29:03 PM
 it was at the end of this topic, I'm not sure how I link directly to it

Bitcoin / Development & Technical Discussion / Re: BIP0032 HD Wallet private key derivation incorrect?


Title: Re: BIP0032 Mistake
Post by: Crowex on October 18, 2013, 08:09:30 PM
https://bitcointalk.org/index.php?topic=287866.msg3135820#msg3135820


Title: Re: BIP0032 Mistake
Post by: MatthewLM on October 20, 2013, 08:22:34 PM
I found something else which doesn't make sense to me. I assume on this page "wif" means Wallet Import Format: https://en.bitcoin.it/wiki/BIP_0032_TestVectors

Then why do none of them start with 5? The first one listed is L52XzL2cMkHxqxBXRyEpnPQZGUs3uKiL3R11XbAdHigRzDozKZeW but when I run the private key though my code I get 5KasyVKwgbH5VmDomdJdevZXRMMrbdbeKa8kkYkFJrLKk4hxAP9.

Does anyone know what the problem is?


Title: Re: BIP0032 Mistake
Post by: Jan on October 20, 2013, 08:54:42 PM
I found something else which doesn't make sense to me. I assume on this page "wif" means Wallet Import Format: https://en.bitcoin.it/wiki/BIP_0032_TestVectors

Then why do none of them start with 5? The first one listed is L52XzL2cMkHxqxBXRyEpnPQZGUs3uKiL3R11XbAdHigRzDozKZeW but when I run the private key though my code I get 5KasyVKwgbH5VmDomdJdevZXRMMrbdbeKa8kkYkFJrLKk4hxAP9.

Does anyone know what the problem is?

The encoding starts with L or K if the public key is supposed to be compressed, and 5 otherwise.


Title: Re: BIP0032 Mistake
Post by: MatthewLM on October 20, 2013, 09:09:38 PM
OK thanks. I couldn't find any documentation anywhere on that, but I should be able to find it now. I don't see the point in having data as to  whether or not the public keys are compressed? Shouldn't WIF be only about the private keys where you can generate publics keys and represent them either compressed or uncompressed after importing?

EDIT: No I get it. You will need to know what type of public key is used to know what address is used.


Title: Re: BIP0032 Mistake
Post by: gmaxwell on October 20, 2013, 09:26:19 PM
Keys resulting from BIP32 must always be compressed, it's part of the specification.


Title: Re: BIP0032 Mistake
Post by: MatthewLM on October 20, 2013, 09:51:32 PM
Yes of-course but the WIF wasn't designed for BIP0032. BIP0032 doesn't actually specify an import method. If master keys were generated such that the chain code was a hash of the private key you could import the HD master key by using a WIF code.