Ch6: Something on Private Key, Public Key & Bitcoin Address

Khor Aik Cheow, PhD
4 min readJun 24, 2020

--

A wallet can contain multiple sets of private & public key pair and bitcoin address. A private key is private, and you do not share it. You can however share your public key and bitcoin address with others. However, the public key is very long. Most people prefer to share bitcoin address, which is a shorter version of the public key. Private key is like a password for the email address where you need to keep it confidential. Bitcoin address is similar to the email address you share with others so you can receive emails.

If you look at any of the bitcoin transactions on the blockchain explorer, you can see the bitcoin address (highlighted in red below) on the input and output part of the transaction.

When you click any of the bitcoin addresses, you will be shown the details of that particular bitcoin address (such as address, format, number of transactions made, amount of bitcoins received/sent, final bitcoins balance, and past transactions record).

Wallet generates the private key, the corresponding public key and the corresponding bitcoin address. The relationship between the private key, the public key and the bitcoin address is shown below. The diagram might look daunting. Don’t worry about it! Just know that the bitcoin address is generated from the public key; The public key is generated from the private key.

A private key is a 32 bytes number that can be expressed in a few formats:

On the other hand, a public key is a 33/65 bytes number of 66 or 130 characters. Public key hash is a 20 bytes number of 40 characters. Bitcoin address is 25 bytes number with 26 to 35 characters, starting with ‘1’, or ‘3’ or ‘bc1’.

Below is a summary table comparing the size of the private key, the public key, the public key hash and the bitcoin address.

Visually, you can see that the public key is the longest string. The bitcoin address is therefore more ‘share-friendly’ than the public key.

When a receiver gives his/her bitcoin address to a sender, the wallet of the sender will decode the receiver’s bitcoin address back to public key hash.

Sender’s wallet can then ‘lock’ receiver’s public key hash in a P2PKH (Pay-To-Public-Key-Hash) payment to receiver. Some articles use ‘bitcoin address’ and ‘public key hash’ interchangeably. This article separates the two terms to avoid confusion.

Beside bitcoin address, receiver’s wallet can also send public key and script hash to sender’s wallet, so that sender can make a P2PK (Pay-To-Public-Key) and P2SH (Pay-To-Script-Hash) payment respectively.

Remember

· A wallet can generate multiple sets of private key, public key & bitcoin address.

· Private key is secret. You can share bitcoin address.

· Bitcoin address is generated from public key; Public key is generated from private key.

--

--