babybitcoin.space

How do HD wallets work with a Bitcoin seed phrase

A single seed phrase can control an unlimited number of Bitcoin addresses. This is possible because of hierarchical deterministic (HD) wallets. The structure is a tree: one seed grows into a master key, that master key branches into accounts, accounts branch into chains, and chains branch into individual addresses.

The tree structure

The process starts with a seed phrase - typically 12 or 24 words. That seed generates a master private key using a standard algorithm called BIP32. From the master key, the wallet creates child keys, and those child keys can create their own children. The tree can extend indefinitely.

The practical benefit is straightforward. You back up one seed phrase and that single backup secures every address the wallet will ever generate. Lose a phone? Restore the seed on a new wallet. All addresses, all funds, all history reappear. You never need to back up individual private keys.

Accounts and chains

The next layer is account-level derivation. BIP44 defined the structure. The path looks like m/44'/0'/0'. The m stands for master, the 44' identifies the purpose (BIP44), the 0' means Bitcoin, and the second 0' is the account number. You can have account 0 for personal use, account 1 for business, account 2 for savings. Each account is a separate branch.

Within each account, there are two chains. Chain 0 is the receiving chain; these addresses are for payments others send to you. Chain 1 is the change chain. When you spend Bitcoin, the wallet sends the change to a change address. This separation prevents address reuse and improves privacy.

The final level is the address index. Paths like m/44'/0'/0'/0/0 mean the first receiving address of account 0. The last number counts up: 0, 1, 2, 3. Each number is a unique address with its own private key - but all derived from the same seed.

Derivation paths for different address types

Different address formats use different purpose values. BIP44 uses 44' for legacy addresses (starting with 1). BIP49 uses 49' for nested SegWit addresses (starting with 3). BIP84 uses 84' for native SegWit addresses (starting with bc1). A native SegWit path looks like m/84'/0'/0'/0/0. The wallet software selects the path automatically; the user typically never sees it.

The xpub and the privacy risk

Each account has an extended public key, called an xpub. The xpub can generate all child public keys without the private keys. This is useful. You can give an xpub to a watch-only wallet or a payment processor; they can see incoming transactions but cannot spend.

But the xpub carries a real privacy risk. Anyone with your xpub can link every address in that account. They can see your total balance. They can track your transaction history. They can connect payments that you thought were unrelated. Sharing an xpub is functionally equivalent to sharing your whole transaction graph for that account.

Some wallets allow you to share a single address instead. That is safer. If you use a service that asks for your xpub, understand what you are giving away.

What the tree does not do

The tree structure does not create different currencies. Bitcoin and Bitcoin Cash share the same derivation path prefix. Different coins use different coin type values: Litecoin uses 2'. Ethereum does not use BIP44 derivation at all.

The tree also does not create infinite accounts automatically. The wallet generates addresses on demand, following a gap limit - typically 20 addresses. If the wallet sees 20 unused addresses in a row, it stops looking for more. This prevents scanning the entire tree.

The single-seed trade-off

One seed secures everything. That is the benefit. The trade-off is obvious: lose the seed, lose everything. One compromise of the seed compromises every derived key. Hardware wallets and passphrases mitigate this risk, but the seed itself remains the single point of failure.

HD wallets are standard. Nearly every modern Bitcoin wallet uses them. The tree structure is not visible to the user, but it is the reason one backup works for a lifetime of addresses.

Not financial advice. babybitcoin.space publishes market data and general information about babybitcoin. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to bitcoin