0

I followed this post and created a private key for bitcoin wallet. The post says after finding the random 256 bit(32 bytes) integer the version number should be prepended and the checksum should be appended to it. This produces a 37 bytes hex. Now I am trying to find the public key associated with this private key.I learnt that the PUBLIC key is calculated by applying ECDSA secp256k1 curve on the private key. But only 32 bytes is accepted as input by the ECDSA algorithm.
So what am I doing wrong?
Thanks in advance.

1

The private key is just the 32B entropy you generated. Between wallets this private key can be encoded in a format, which provides further information such as the network(main/test/alt) and whether a compressed or uncompressed public key was used. This encoding is called the Wallet Import Format.

  • version (1B) (0x80 mainnet/0xEF testnet)
  • privatekey (32B)
  • 0x01 compressionmarker (1B)
  • checksum (4B)

https://teachbitcoin.io/wallets.html#/2

Checksum is of everything which precedes it. The data is finally encoded in base58.

To take this WIF data and produce the public key, the wallet just needs to extract the private key 32B) and compute the public key point

  • private_key * Generator_point = public_key(x,y)

The resulting x, y public key point is your public key. If the compression market is on, take the x-coordinate and prepend a 0x02 or 0x03 depending on whether it is even or odd.

  • compressed public key: 0x02/0x03 + x_coordinate(32B)
  • uncompressed public key: 0x04 + x_coordinate(32B) + y_coordinate(32B)
  • Thank you so much..it was very helpful!!. Im just beginning to learn about blockchain. Thanks again :) – ABHISHEK Jan 6 at 17:49
  • Awesome! Happy it was helpful! – James C. Jan 6 at 18:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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