xpub (extended public key)
Also called: extended public key, xpub key, ypub, zpub, tpub, vpub, upub, xprv, extended 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.
An xpub, or extended public key, is a public key bundled with a 32-byte chain code. Together they let software derive all the non-hardened child public keys below that point in an HD wallet, so it can generate and watch addresses but can't sign. Its secret counterpart is the xprv.
Format
BIP 32 serializes an extended key as 78 bytes: 4 version bytes, 1 depth byte, a 4-byte parent fingerprint, a 4-byte child number, the 32-byte chain code and the 33-byte key. Adding a Base58Check checksum gives a 111-character string. The version bytes set the first letters:
| Prefix (mainnet / testnet) | Defined in | Typical use |
|---|---|---|
xpub / tpub |
BIP 32 | Any script type |
ypub / upub |
BIP 49 | P2SH-wrapped SegWit |
zpub / vpub |
BIP 84 | Native SegWit (P2WPKH) |
The key inside a zpub and an xpub can be identical; only the label differs. Output descriptors (BIP 380) state the script type explicitly instead, which is why newer standards, including Taproot wallets under BIP 86, simply use xpub.
Privacy and safety
An xpub can't move funds, but it reveals every address and the full balance and history of the account. Share it only with software you trust, such as your own watch-only wallet or a multisig coordinator. An xprv, like a seed phrase, gives full spending power and should never be shared.
Account-level xpubs sit at a derivation path like m/84'/0'/0'. Below that point hardened derivation isn't used, which is what makes address generation from the xpub possible.