Security Guide

xpub Explained: What Is an Extended Public Key?

To use GapFix — or any Bitcoin address scanner — you need your xpub, ypub, or zpub. Here's exactly what those keys are, what information they reveal, and how to find them in every major wallet.

What Is an xpub?

An xpub (extended public key) is a special type of public key defined in BIP-32. It encodes two pieces of information:

  1. A public key at a specific point in a key derivation tree
  2. A chain code that acts as additional entropy, enabling deterministic derivation of child keys

Together, these allow any software to derive all the Bitcoin addresses in your wallet — starting from address index 0, continuing through index 1, 2, 3, and so on — without ever needing your private key or seed phrase.

This is what makes it safe to paste your xpub into tools like GapFix: it contains no spending capability whatsoever.

xpub vs. private key vs. seed phrase

Seed phrase (24 words): Full control. Can derive all private keys. Never share.
xpub (extended public key): Derives addresses only. Cannot spend. Safe for scanning tools.
Private key: Signs transactions for one address. Never share.

xpub, ypub, zpub — What's the Difference?

The prefix tells you which address type the key is associated with:

Key Type BIP Standard Address Type Address Prefix Example
xpub BIP-44 Legacy P2PKH 1... 1A1zP1eP5QGef...
ypub BIP-49 Wrapped SegWit P2SH-P2WPKH 3... 3J98t1WpEZ73C...
zpub BIP-84 Native SegWit P2WPKH bc1q... bc1qxy2kgdygj...
Any of the above BIP-86 Taproot P2TR bc1p... bc1p5d7rjq926...

All three key types use the same underlying BIP-32 derivation mechanism — the prefix is just a convention that signals which derivation path and address format to expect. GapFix automatically detects the prefix and scans all four address formats regardless of which type you paste.

For testnet wallets, the equivalents are tpub (legacy), upub (wrapped segwit), and vpub (native segwit). GapFix supports these too.

The Technical Structure of an xpub

An xpub is a 78-byte serialized structure containing:

  • Version bytes — 4 bytes indicating the network (mainnet/testnet) and key type (xpub vs xprv)
  • Depth — 1 byte showing how deep in the derivation tree this key is
  • Parent fingerprint — 4 bytes from the parent key (allows wallets to verify the key's position)
  • Child index — 4 bytes identifying which child of the parent this key is
  • Chain code — 32 bytes of entropy for deterministic derivation
  • Key data — 33 bytes (the compressed public key)

This is then Base58Check-encoded into the familiar 111-character string starting with xpub.

Example xpub:

xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz

Account-Level vs. Master xpub

There are two types of xpub you might encounter:

Master xpub (root key)

Derived directly from your seed phrase at path m. This can derive every address across every account and every coin type. Sharing this gives maximum visibility. Most wallets don't expose this directly.

Account-level xpub (recommended for scanning)

Derived at a specific account path, e.g. m/84'/0'/0' for a native segwit BTC account. This can only derive addresses within that specific account. This is what you should use with GapFix.

When wallets expose an "xpub" or "extended public key" in their UI, they almost always show the account-level key — which is exactly what you need.

Where to Find Your xpub

Every major Bitcoin wallet exposes the account-level xpub somewhere in its settings. Here's where to look:

Electrum

  1. Open your wallet
  2. Go to Wallet → Information
  3. The "Master Public Key" shown is your account xpub (starts with xpub, ypub, or zpub depending on wallet type)

Ledger Live

  1. Open your Bitcoin account
  2. Click Edit account (pencil icon)
  3. Open Advanced
  4. The "Extended public key" shown is your xpub

Trezor Suite

  1. Select your Bitcoin account
  2. Click Details (three dots)
  3. Click Show public key (XPUB)
  4. Confirm on the device

Sparrow Wallet

  1. Go to Settings → Keystore
  2. The "Master Public Key" field contains your xpub
  3. For multisig wallets, each cosigner has its own xpub

Coldcard

  1. From the main menu, go to Advanced → View Identity
  2. Select Master XPUB
  3. The key is shown on-device (you can also export it via SD card)

BlueWallet

  1. Long-press on the wallet
  2. Select Wallet details
  3. Tap Show XPUB

Wasabi Wallet

  1. Go to Settings
  2. Under the wallet, look for the Extended Account Public Key

What an xpub Can and Cannot Reveal

Capability xpub
Derive all receive addresses ✅ Yes
Derive all change addresses ✅ Yes
View current balances ✅ Yes (via blockchain API)
View transaction history ✅ Yes (via blockchain API)
Sign transactions ❌ No
Spend Bitcoin ❌ No
Reveal private keys ❌ No
Reveal seed phrase ❌ No
Derive sibling or parent keys ❌ No (for hardened derivation)

xpub Privacy Considerations

While your xpub cannot be used to steal Bitcoin, it does have privacy implications:

Full address visibility. Anyone with your xpub can derive every address in your wallet and check them on the blockchain. This reveals your entire transaction history, current holdings, and spending patterns.

Linkability. An adversary with your xpub could track every payment you receive, identify which addresses belong to you, and potentially link your on-chain activity to your real-world identity if any address is connected to KYC data.

Best practices for xpub privacy

  • Only use client-side tools — tools like GapFix process your xpub entirely in the browser without sending it to a server
  • Run GapFix locally — clone the source code and run it offline for maximum privacy
  • Don't share your xpub with custodial services without understanding their data retention policies
  • Use a different account per purpose — separate accounts under the same seed have different xpubs

How GapFix Uses Your xpub

When you paste your xpub into GapFix:

  1. The key is parsed in your browser using the bitcoinjs-lib library
  2. Child public keys are derived locally at indices 0 through 999+ on both chains (m/0/* external, m/1/* internal)
  3. The derived Bitcoin addresses (not the xpub itself) are sent to Blockstream's public API for balance lookups
  4. The xpub never leaves your browser

The only data that leaves your machine is a set of Bitcoin addresses — which are already public information on the blockchain.

Ready to scan your wallet?

Paste your xpub, ypub, or zpub to find Bitcoin hidden beyond the gap limit. Free, open-source, client-side.

Scan My Wallet