Home › Glossary › Public key

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.

BIPs that define Public key

  • BIP 32 (HD wallets): Hierarchical Deterministic Wallets: Deployed. Defines hierarchical deterministic (HD) wallets, in which a single seed generates a whole tree of keys. Users can back up a wallet once and share watch-only parts, for example with a shop or…
  • BIP 340: Schnorr Signatures for secp256k1: Deployed. Defines a standard for Schnorr signatures, a simpler and more flexible signing method than the ECDSA scheme Bitcoin originally used, on the same elliptic curve. Schnorr signatures are compact (64…
  • BIP 341: Taproot: SegWit version 1 spending rules: Deployed. Taproot introduces a new kind of Bitcoin output that can be spent either with a single signature or by revealing just one of many possible alternative spending conditions, kept hidden in a tree…

Related terms

  • Private key: A private key is a secret 256-bit number that signs Bitcoin transactions. Whoever knows it can spend the coins it controls.
  • xpub (extended public key): An xpub is a BIP 32 extended public key: a public key plus chain code that can derive every address in an account, but can't spend from them.
  • Schnorr signatures: Schnorr signatures are the 64-byte digital signatures standardized in BIP 340 and used by Taproot. They are simpler and more flexible than ECDSA.
  • ECDSA: ECDSA (Elliptic Curve Digital Signature Algorithm) is the signature scheme Bitcoin has used since 2009, over secp256k1, for all pre-Taproot outputs.
  • P2TR: P2TR (Pay to Taproot) is the SegWit version 1 output type from BIP 341: one 32-byte key with optional hidden scripts. Addresses start with bc1p.

Learn more

Guides