← Bitcoin Encyclopedia

xpub (Extended Public Key)

🌿 Intermediate

💡 The Plain-English Definition

An xpub — extended public key — is the master public key for a Bitcoin wallet. Anyone who has your xpub can derive every Bitcoin address your wallet has ever generated or ever will, and can see your complete transaction history, past and future — but they can’t spend your bitcoin.

Your seed produces two matching master keys. The private one (xprv) can watch and spend, so it must stay secret. The public one (xpub) can only watch — it can generate all your addresses and see your whole history, but never move a coin. That makes it handy for a watch-only wallet on an everyday phone; the trade-off is that anyone with your xpub can see every payment you've ever received or will receive.Diagram by Bit By Bitcoin.

🤔 But Why Though?

HD wallets — hierarchical deterministic wallets, the standard design where a single seed phrase generates unlimited addresses through a mathematical tree — produce more than private keys. At every level of the tree, they also produce a matching public key. The xpub sits at the account level of that tree: it’s the master public key that all your receiving addresses are derived from. With just the xpub, software can generate every address you’ll ever use, without ever touching your private key or seed phrase.

This is why sharing an xpub is a real privacy decision. When you connect a watch-only wallet — one that can monitor but not spend — to a third-party service, or connect a hardware wallet to software like Electrum or Sparrow, that software usually receives your xpub so it can generate your addresses and watch the blockchain for payments to them. From that point on, the service has permanent, complete visibility into your financial history: every payment you’ve ever received to any address from that xpub, and every payment you’ll receive in future. Sharing a single address reveals only that one address’s history; sharing your xpub reveals everything derived from it — potentially dozens or hundreds of addresses and years of transactions.

Xpubs get shared in a handful of common situations: setting up a watch-only wallet to monitor cold storage, connecting a hardware wallet to desktop wallet software, using a public blockchain explorer that derives addresses from your xpub, or using a custodial Lightning wallet that needs to watch your payment channels. The privacy-preserving alternative is to run your own Bitcoin full node — a computer that keeps its own full copy of the ledger and checks every rule — and point your wallet software at it. Then the xpub stays on your own machine and never reaches a third-party server.

🌍 The Real-World Analogy

Sharing your xpub is like giving someone a key to your filing cabinet that can read — but not remove — every document, including every document you’ll ever file in future. They can see everything you’ve received, everything you’ve spent, everyone you’ve dealt with, and they’ll automatically see everything you do from now on. The key lets them steal nothing, but the surveillance is total. Showing someone a single Bitcoin address is showing them one folder. Showing them your xpub is showing them the whole filing system.

⚡ So What?

Be deliberate about where your xpub goes. Connecting your hardware wallet to trusted, open-source wallet software on your own computer is generally fine — the xpub stays local. But entering it into a web-based blockchain explorer or a third-party portfolio tracker means that service can monitor your entire wallet history, permanently. For the best privacy, use your own Bitcoin node as the data source for your wallet software. For watch-only monitoring of cold storage, a local wallet app connected to your own node keeps the xpub off third-party servers entirely.

📩 The Daily Bit · free

Get one plain-English Bitcoin email each morning.

The Daily Bit — free, two minutes, unsubscribe anytime.

The Bitcoin EncyclopediaPrefer a book? The Bitcoin Encyclopedia