LearnBitcoin

Bitcoin Dev Archive 2015

Bip 32 Question

2 messages, 12 Jun 2015. Started by James Poole.

James Poole, William Swanson

Permalink Original thread on gnusha.org

James Poole permalink original

Looking at the BIP32 definition, I hit a line that I would appreciate clarification on.

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

Under the section "Private parent key → private child key" there is a step:

"The returned child key ki is parse256(IL) + kpar (mod n)."

Can someone help me understand what "n" is in the context of this algorithm? I very well could be looking right at it, but wanted to double check if I am missing something.

Thanks, James

William Swanson in reply to James Poole permalink original

The `n` is the curve order, as shown here:

https://en.bitcoin.it/wiki/Secp256k1

This step is necessary to keep you on the curve. The secp256k1_ec_privkey_tweak_add function from libsecp256k1 handles this automatically, but if you use OpenSSL or some non-EC math library, you probably have to do it yourself.

-William

On Fri, Jun 12, 2015 at 11:22 AM, James Poole <james@microtrx•com> wrote:

Quoted text (15 lines)
> Looking at the BIP32 definition, I hit a line that I would appreciate
> clarification on.
>
> https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
>
> Under the section "Private parent key → private child key" there is a step:
>
> "The returned child key ki is parse256(IL) + kpar (mod n)."
>
> Can someone help me understand what "n" is in the context of this algorithm?
> I very well could be looking right at it, but wanted to double check if I am
> missing something.
>
> Thanks,
> James