Search code examples
cryptographyethereumbitcoin

what is the corresponding private key of public child key with HD wallet?


I have read the bip32, but have some confusions.

If I have all the useful information about HD wallet and generate a new public child key with a public parent key, public chain code and index number, how I spend the funds in the new address corresponding the new public child key?

Or in others words, what is the corresponding private key of the new public child key when I sign a new transaction?


Solution

  • I have solved this question after reviewing the bip32 proposal again, and post the answer to help others.

    Answesr:

    The corresponding private key of a new public child key with HD wallet is the new private child key.

    Why:

    First, please see the partial picture of bip32 below:

    enter image description here

    There are two procedures:

    1. Procedure: private parent key -> private child key.

    2. Procedure: public parent key -> public child key.

    As you can see the content with red box in the picture, the two calculation result of I are same between two procedures.

    For point(k_par)=K_par, the two calculation result of I are same.

    Then, the answer of this question is that the corresponding private key of new public child key is the new private child key. This means that:

    The k_i in the upper circle is the private key of K_i in the lower circle which is the public key.

    As the elliptic curve group is an additive group, it means that:

    [(x1+x2) (mod n)]*G = x1*G + x2*G,

    where G is the generator of elliptic curve group, n is the order of elliptic curve group, and x1, x2 are private keys.

    Then, we focus on this situation, and it is easy to get with the content in the two circle:

    [parse_256(I_l) + k_par (mod n)]*G=point(parse_256(I_l)) + K_par,

    because two I_l are same and k_par is the corresponding private key of K_par.

    For more information, please contact me with the e-mail: [email protected]