<p>Bitcoin private keys are 32 bytes, but are often stored in their full OpenSSL-serialized form of 279 bytes. They are serialized as 51 base58 characters, or 64 hex characters.</p>

<p>Bitcoin public keys (traditionally) are 65 bytes (the first of which is 0x04). They are typically encoded as 130 hex characters.</p>

<p>Bitcoin compressed public keys (as of 0.6.0) are 33 bytes (the first of which is 0x02 or 0x03). They are typically encoded as 66 hex characters.</p>

<p>Bitcoin addresses are RIPEMD160(SHA256(pubkey)), 20 bytes. They are typically encoded as 34 base58 characters.</p>

CC BY-SA 3.0
2012-03-03T23:24:56.240Z
So let me test my understanding:  The private key is 32 bytes and the public key has an x and a y component of some magical curve making it 64 bytes.  

I suppose in the early days they used the full public key. It was good, but it needed a checksum and a prefix to prevent against accidental misuse.  

But when they added this it became too long, people complained, so they added some compression and shortened it up.  

What we now call the bitcoin address is 20 bytes now.

Is this roughly correct?
shoeless joe
CC BY-SA 3.0
2012-03-06T15:03:10.183Z
Note that point compression (turning a 65 byte pubkey into a 33 byte one) is not the same as hashing (which is done for addresses).
Pieter Wuille
CC BY-SA 3.0
2012-03-06T15:04:27.090Z
Also, the hashing and adding of a checksum was always done in addresses. It's just that originally addresses weren't intended to be the norm for doing transactions (using "IP Transactions", which negotiated the pubkey directly).
Pieter Wuille
CC BY-SA 3.0
2012-03-03T01:14:18.447Z
2012-03-03T01:14:18.447Z
Pieter Wuille
<p>Your <a href="https://en.bitcoin.it/wiki/ECDSA">public key is 65 bytes of data</a>: A leading 0x04 byte followed by 32 bytes for the X coordinate and 32 bytes for the Y coordinate of the point it represents.  It takes 130 hex characters at 4 bits per character to display the full key.</p>

<p>Your bitcoin address is a hash of your public key.  It's a <a href="https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses#How_to_create_Bitcoin_Address">little more complex than that</a>, involving <a href="https://en.bitcoin.it/w/images/en/9/9b/PubKeyToAddr.png">multiple hashes and a built-in checksum</a>, but that's basically true.</p>

<p>It's not possible to get from your bitcoin address to your public key.  There are many public keys which have the same bitcoin address.  The corresponding private key is able to spend the funds on that address if the funds were sent using the official client.  It's incredibly hard to find a keypair with the same bitcoin address as an existing address.  The check for spendability for funds sent to a bitcoin address is:</p>

<p>The spender of a transaction's output:</p>

<ul>
<li>must supply a public key which hashes to the address specified by the creator of that transaction, and</li>
<li>must be abe to demonstrate that he holds the corresponding private key by signing his new transaction with it</li>
</ul>

<p>At no point is there a check that the spender has the same public key as the intended recipient.  Indeed, the creator of a transaction doesn't know the public key of the intended recipient, only his bitcoin address.</p>

CC BY-SA 3.0
2012-03-02T23:04:25.457Z
Check the (new) first link on the my answer.  I linked it to the wiki's ECDSA page which talks about key sizes.
Chris Moore
CC BY-SA 3.0
2012-03-02T23:17:14.303Z
Compressed public keys, which will be used as of bitcoin 0.6.0, are only 33 bytes.
Pieter Wuille
CC BY-SA 3.0
2012-03-01T06:11:59.320Z
2012-03-02T23:03:33.103Z
2012-03-02T23:03:33.103Z
Chris Moore
<p>I went onto <a href="https://www.bitaddress.org">https://www.bitaddress.org</a> and the last tab there is a place to enter a private key and it shows the various formats of public and private keys.<br>
It is strange to me that the public key can either be 33 Base58 or 130 Base16.  It doesn't seem right, especially since the private key is 51 Base58 or 64 Base16 which makes sense.</p>

<p>So what gives?   Here is a printscreen:</p>

<p>Bitcoin Address (33 or 34 characters, starts with a '1'):
1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm</p>

<p>Public Key (130 characters [0-9A-F]):
0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F8179
8483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8</p>

<p>Private Key Hexadecimal Format (64 characters [0-9A-F]):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</p>

CC BY-SA 3.0
2012-03-01T06:38:27.717Z
What makes you think the public key can be 33 base 58? It most certainly cannot be.
David Schwartz
CC BY-SA 3.0
2012-03-01T18:38:37.977Z
He was thinking his bitcoin address was the same thing as his public key, just in a different format, as opposed to just being a hash of his public key, containing much less information.
Chris Moore
<encoding><private-key>
What is a 130 hex character public key?
shoeless joe
# What is a 130 hex character public key?

(Asked by: username_0 on 2012-03-01)

I went onto <https://www.bitaddress.org> and the last tab there is a place to enter a private key and it shows the various formats of public and private keys.  
It is strange to me that the public key can either be 33 Base58 or 130 Base16. It doesn't seem right, especially since the private key is 51 Base58 or 64 Base16 which makes sense.

So what gives? Here is a printscreen:

Bitcoin Address (33 or 34 characters, starts with a '1'):
1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm

Public Key (130 characters [0-9A-F]):
0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F8179
8483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

Private Key Hexadecimal Format (64 characters [0-9A-F]):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

**Tags:** encoding, private-key

> **Comments:**
> **username_1**: What makes you think the public key can be 33 base 58? It most certainly cannot be.  
> **username_2**: He was thinking his bitcoin address was the same thing as his public key, just in a different format, as opposed to just being a hash of his public key, containing much less information.  

---

## 2 answers

### Answer by username_3 on 2012-03-03. Score: 17

Bitcoin private keys are 32 bytes, but are often stored in their full OpenSSL-serialized form of 279 bytes. They are serialized as 51 base58 characters, or 64 hex characters.

Bitcoin public keys (traditionally) are 65 bytes (the first of which is 0x04). They are typically encoded as 130 hex characters.

Bitcoin compressed public keys (as of 0.6.0) are 33 bytes (the first of which is 0x02 or 0x03). They are typically encoded as 66 hex characters.

Bitcoin addresses are RIPEMD160(SHA256(pubkey)), 20 bytes. They are typically encoded as 34 base58 characters.

> **Comments:**
> **username_0**: So let me test my understanding:  The private key is 32 bytes and the public key has an x and a y component of some magical curve making it 64 bytes.    I suppose in the early days they used the full public key. It was good, but it needed a checksum and a prefix to prevent against accidental misuse.    But when they added this it became too long, people complained, so they added some compression and shortened it up.    What we now call the bitcoin address is 20 bytes now.  Is this roughly correct?  
> **username_3**: Note that point compression (turning a 65 byte pubkey into a 33 byte one) is not the same as hashing (which is done for addresses).  
> **username_3**: Also, the hashing and adding of a checksum was always done in addresses. It's just that originally addresses weren't intended to be the norm for doing transactions (using "IP Transactions", which negotiated the pubkey directly).  

---

### Answer by username_2 on 2012-03-01. Score: 9

Your [public key is 65 bytes of data](https://en.bitcoin.it/wiki/ECDSA): A leading 0x04 byte followed by 32 bytes for the X coordinate and 32 bytes for the Y coordinate of the point it represents. It takes 130 hex characters at 4 bits per character to display the full key.

Your bitcoin address is a hash of your public key. It's a [little more complex than that](https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses#How_to_create_Bitcoin_Address), involving [multiple hashes and a built-in checksum](https://en.bitcoin.it/w/images/en/9/9b/PubKeyToAddr.png), but that's basically true.

It's not possible to get from your bitcoin address to your public key. There are many public keys which have the same bitcoin address. The corresponding private key is able to spend the funds on that address if the funds were sent using the official client. It's incredibly hard to find a keypair with the same bitcoin address as an existing address. The check for spendability for funds sent to a bitcoin address is:

The spender of a transaction's output:

* must supply a public key which hashes to the address specified by the creator of that transaction, and
* must be abe to demonstrate that he holds the corresponding private key by signing his new transaction with it

At no point is there a check that the spender has the same public key as the intended recipient. Indeed, the creator of a transaction doesn't know the public key of the intended recipient, only his bitcoin address.

> **Comments:**
> **username_2**: Check the (new) first link on the my answer.  I linked it to the wiki's ECDSA page which talks about key sizes.  
> **username_3**: Compressed public keys, which will be used as of bitcoin 0.6.0, are only 33 bytes.  

---

