So in mastering bitcoin it mentioned that to generate child key,The left-half 256 bits of the hash are added to the parent key so if we add that it will be 512 bits.But we need 256 bit so do we hash that string (parent key + left hash) with SHA256 and get the 256 bit child private key?

1 Answer 1


There is concatenation where 256 bits placed next to another 256 bits makes 512 bits. However, what you are referring to (generating a child key) uses scalar addition. A 256 bit number (256 bit parent private key) is added to another 256 bit number (left 256 bits of the SHA512) and the result modulo p (p = 2^256-2^32-977) is another 256 bit number.

  • So we will hash that 512 bits using SHA256 to get the private key?
    – Athul A
    Commented Oct 4, 2022 at 20:27
  • @AthulA: No as I say in the answer you add the 256 bit parent private key to the left 256 bits of the SHA512 modulo p. The result is 256 bits. If you need an explanation of modular arithmetic this might be helpful github.com/jimmysong/programmingbitcoin/blob/master/… Commented Oct 4, 2022 at 21:21
  • @MichaelFolkson Hi Michael, are you sure that concatenation should be used and not regular addition? Here they say that the + operation is performed between the left side of the hash and the parent's private key. However, nowhere is it indicated that this is a special type of addition. The only thing indicated is that if you work with coordinates, then the + indicates a "special operation" (Addition (+) of two coordinate pair is defined as application of the EC group operation.).
    – dassd
    Commented Apr 4, 2023 at 12:58
  • 1
    @Filip: I explain the difference between concatenation and scalar addition in the answer. And yes the question asker was mistaken in assuming concatenation should be used here. So me and you are in agreement (maybe the answer could be worded a little better) Commented Apr 4, 2023 at 13:07
  • 2
    @MichaelFolkson My fault then. I misinterpreted your answer. All the best!
    – dassd
    Commented Apr 4, 2023 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.