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 Answer 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)


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 :)
    Jan 6, 2019 at 17:49
  • Awesome! Happy it was helpful!
    – James C.
    Jan 6, 2019 at 18: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.