
An xpub (extended public key) is a public key plus a “chain code” that lets software derive every public key and address of one wallet account, without the ability to spend. Give your xpub to a watch-only wallet, an accounting tool or a payment server, and it can show your balance and generate new receive addresses while your private keys stay on your device. The trade-off is privacy: whoever has the xpub sees every address, every transaction and the full balance of that account.
Where an xpub comes from
Modern wallets are hierarchical deterministic (HD) wallets defined in BIP32. From the seed phrase they derive a master key, and from it a tree of child keys. Each branch can be exported as an extended key: the extended private key (xprv) allows spending, the extended public key (xpub) only allows deriving public keys and addresses. Wallets typically export the xpub of an account level such as m/84'/0'/0' — see what is a derivation path.
xpub, ypub, zpub: same thing, different address type
The letters at the start encode which kind of Bitcoin addresses the wallet should generate from the key. The key material is the same; the prefix is a convention (SLIP-132) so that importing software picks the right script type.
| Prefix | Address type | Addresses start with | Standard |
|---|---|---|---|
| xpub | Legacy P2PKH (or generic) | 1… | BIP44 |
| ypub | Nested SegWit P2SH-P2WPKH | 3… | BIP49 |
| zpub | Native SegWit P2WPKH | bc1q… | BIP84 |
| Ypub / Zpub | Multisig variants | 3… / bc1q… (long) | SLIP-132 |
| descriptor tr(…) | Taproot | bc1p… | BIP86, BIP380 |
Taproot wallets usually export an output descriptor rather than a new prefix, for example tr([fingerprint/86'/0'/0']xpub…/0/*). Descriptors are becoming the standard way to describe any wallet, including multisig.
What xpubs are used for
- Watch-only wallets on a phone or computer that show balances and create receive addresses while the hardware wallet stays in a drawer.
- Payment servers such as BTCPay Server, which generate a fresh address for each invoice from the merchant’s xpub, without holding any private key.
- Accounting and tax tools that import full history of an account.
- Multisig coordination: every co-signer’s xpub is part of the wallet description — see multisig wallet explained.
Privacy: why not to post your xpub
Every address of the account can be computed from the xpub, so anyone who has it can look up all of them in a block explorer: past payments, current balance and every future receive address. Sharing an xpub with a service is sharing your financial history with that service; if it is breached or sells data, that history leaks. Share it only with software you run yourself or trust as much as your bank statement.
Security: xpub plus one private key
On its own an xpub cannot spend. But BIP32 has a known property: for non-hardened derivation, an xpub combined with any one child private key from below it allows computing the parent extended private key — and therefore every key of the account. Wallets defend against this by using hardened derivation (the apostrophe in 84') for the account level and above, and by never exporting single private keys casually. The practical rule: never share an xpub and a private key of the same account with anyone, and never import a single exported private key into a service that also has your xpub.
xpubs and swaps
A swap service never needs your xpub. For a KOT.CASH payout you paste one receive address; you can take it from a watch-only wallet built from your xpub, which is a good way to receive to a hardware wallet without plugging it in. Before using it for a large amount, confirm the address once on the hardware device itself, because a compromised watch-only app could show a wrong address.
FAQ
Can someone steal bitcoin with my xpub?
Not with the xpub alone. It reveals your addresses and balance. Combined with one non-hardened child private key, it can expose the whole account.
What is the difference between xpub and zpub?
The same kind of key with a different prefix telling software to generate native SegWit (bc1q) addresses instead of legacy ones.
Where do I find my xpub?
In the wallet’s account details or export settings (Sparrow, Electrum, Ledger Live, Trezor Suite all show it).
Is it safe to share my xpub with an accountant?
It is safe for your funds, but it shares your full transaction history for that account. Share only with someone you trust with that information.
Do Ethereum wallets have xpubs?
HD Ethereum wallets use BIP32 internally, but Ethereum users usually work with single addresses; xpub export is mostly a Bitcoin-world practice.