Public key
Also called: pubkey, pub key, bitcoin public key, compressed public key, x-only public key.
A public key is a point on the secp256k1 curve derived from a private key. Others use it to verify your signatures, and addresses are built from it.
A public key is the shareable half of a key pair. It is calculated from a private key, and anyone can use it to check that a signature was made with that private key, without learning the secret.
Formats
Mathematically, a public key is a point on the secp256k1 elliptic curve. Bitcoin encodes it in three ways:
| Format | Size | Starts with | Used by |
|---|---|---|---|
| Uncompressed | 65 bytes | 04 |
Early wallets, legacy scripts only |
| Compressed | 33 bytes | 02 or 03 |
Most keys, and BIP 32 serialization |
| X-only | 32 bytes | (no prefix) | Taproot and BIP 340 signatures |
A compressed key stores only the x coordinate plus one byte saying whether y is even or odd. BIP 340 drops that byte too, by always using the point with an even y.
Public keys and addresses
Most addresses don't show the public key directly. P2PKH and P2WPKH outputs contain a 20-byte hash of it (HASH160: RIPEMD-160 of SHA-256), and the key itself only appears on chain when the coins are spent. P2TR outputs (BIP 341) put a 32-byte tweaked public key straight into the output. Whether a key is visible before it is spent comes up often in discussions of quantum resistance.
Extended public keys
An xpub is a public key plus a chain code. BIP 32 lets a wallet derive many child public keys from it, which is how watch-only wallets and point-of-sale systems create fresh receiving addresses without holding any private key. Signatures are checked against public keys with ECDSA or Schnorr.