2

After reading BIP44, I saw

Purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation.

I believe 0x8000002C is 128 as an integer, how does this equate to 44' however?

I also believe that the ' means that it is a "hardened key", is it hardened because 128 is between 0 and 2^32 - 1 ? Which means that the only key that can derive it, is the private key?

To further elaborate my thinking, which may or may not be right:

These are the levels:

m / purpose' / coin_type' / account' / change / address_index

purpose, coin_type and account, all have to be derived with the private key. They will always be between 0 and 2^32 -1

I have also come to believe that if we have derive a change address with the xpub, then if we derive the same path with xpriv, we can spend from that change address?

For example, if I receive some funds to the change address with path:

m / 44' / 0' / 0' / 0 / 0

Then to spend from this specific address, I would need the private key that corresponds to it. To get it, I would use the xpriv on this path?

  • Not a full answer, but you should read BIP32. It explains what hardened derivation is, and what is possible with and without it. – Pieter Wuille Apr 25 '18 at 22:12
  • @pieter-wuille Alright, I will re-read it again. I was hoping to get some clarification as I am reading an implementation of it and it does not seem to be following the guide. Edit: you are the author haha, the bearded one. Thanks for BIP32, will give it another gander! – Kyle Graham Apr 25 '18 at 22:28
  • Also, change addresses would have the path m/44'/0'/0'/1/n. – Raghav Sood Apr 25 '18 at 23:47
  • @raghav-sood thanks for the correction. Helps a lot to see where I misunderstood or made reckless mistakes! – Kyle Graham Apr 26 '18 at 4:57
3

I believe 0x8000002C is 128 as an integer

... No, it isn't. First of all, it already is an integer, just represented in hexadecimal. In decimal it is 2147483692. How did you get 128?

how does this equate to 44' however?

44' means that hardened keys should be used. The distinguisher for whether a key a given index is hardened is that the index is greater than 2^31, which is 2147483648. In hex, that is 0x80000000. That is what the apostrophe (') means.

The 44 comes from adding it to 2^31 to get the final hardened key index. In hex, 44 is 2C, so 0x80000000 + 0x2C = 0x8000002C.

I also believe that the ' means that it is a "hardened key", is it hardened because 128 is between 0 and 2^32 - 1 ?

No, hardened means that the key index is between 2^31 and 2^32 - 1. Between 0 and 2^31 - 1 are unhardened keys.

Which means that the only key that can derive it, is the private key?

Yes.

  • Hey Andrew! I saw 0x80 in code and made that mistake. Thank you for showing me where I was wrong. Your explanation makes it clear why 0 can be hardened. If I derive the normal key with the xpub on a vulnerable server, how would I know what path to take with the xpriv to get the private key to spend the funds? – Kyle Graham Apr 26 '18 at 4:53
  • You wouldn't know the path of something derived from the xpub unless you recorded the path that you used. – Andrew Chow Apr 26 '18 at 5:01
  • Oh, so if I derive a normal key using the xpub, how would I get the corresponding private key for it? If I knew the path, would it be the same path but hardened? – Kyle Graham Apr 26 '18 at 5:06
  • No, it is the same path but derived from the xpriv. Hardening is something else. – Andrew Chow Apr 26 '18 at 5:19
  • Oh I understand. The xpriv can make normal and hardened keys. If yo make a normal key with the xpub, you can use the same path with the xpriv to produce the normal key, but with the private key to spend from it. Thanks for taking the time to explain, Andrew – Kyle Graham Apr 26 '18 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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