<p>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.</p>

<ul>
<li><code>version</code> (1B) (0x80 mainnet/0xEF testnet)</li>
<li><code>privatekey</code> (32B)</li>
<li><code>0x01</code> compressionmarker (1B)</li>
<li><code>checksum</code> (4B)</li>
</ul>

<p><a href="https://teachbitcoin.io/wallets.html#/2" rel="nofollow noreferrer">https://teachbitcoin.io/wallets.html#/2</a></p>

<p>Checksum is of everything which precedes it. The data is finally encoded in base58.</p>

<p>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</p>

<ul>
<li><code>private_key * Generator_point = public_key(x,y)</code></li>
</ul>

<p>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.</p>

<ul>
<li>compressed public key: <code>0x02/0x03 + x_coordinate(32B)</code></li>
<li>uncompressed public key: <code>0x04 + x_coordinate(32B) + y_coordinate(32B)</code></li>
</ul>

CC BY-SA 4.0
2019-01-06T17:49:31.967Z
Thank you so much..it was very helpful!!. Im just beginning to learn about blockchain. Thanks again :)
ABHISHEK
CC BY-SA 4.0
2019-01-06T18:09:15.983Z
Awesome! Happy it was helpful!
James C.
CC BY-SA 4.0
2019-01-05T15:06:12.297Z
2019-01-05T15:06:12.297Z
James C.
<p>I followed <a href="https://medium.com/@hlopez_/how-are-public-and-private-keys-created-in-bitcoin-f90b2b88f40a" rel="nofollow noreferrer">this</a> 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.
<br>So what am I doing wrong?
<br>Thanks in advance.</p>

<private-key><public-key><ecdsa><secp256k1>
How public key is calculated from a base58 encoded private key?
ABHISHEK
# How public key is calculated from a base58 encoded private key?

(Asked by: username_0 on 2019-01-05)

I followed [this](https://medium.com/@hlopez_/how-are-public-and-private-keys-created-in-bitcoin-f90b2b88f40a) 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.

**Tags:** private-key, public-key, ecdsa, secp256k1


---

## 1 answers

### Answer by username_1 on 2019-01-05. Score: 1 | Accepted answer

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

> **Comments:**
> **username_0**: Thank you so much..it was very helpful!!. Im just beginning to learn about blockchain. Thanks again :)  
> **username_1**: Awesome! Happy it was helpful!  

---

