Privacy & Analysis
Change addresses, and the information they leak
Protocol referenceSource: BIP 32, Hierarchical Deterministic WalletsNo market data is used on this page; the derivation and ordering behaviour follows the published BIPs.
How change is created
Outputs are spent whole. If a wallet holds an output worth more than the payment it needs to make, the transaction must consume that output entirely and create a new output for the difference. That new output is the change, and it is a genuinely new output with its own identifier, not a modification of the one that was spent. The wallet controls it because the wallet chose the script it pays to.
The change output is not marked as change. On the ledger it is an output like any other, indistinguishable in form from the payment. This is deliberate: the protocol has no field for "this is the sender's remainder", and adding one would make every transaction trivially readable. The consequence is that the analyst's task is to guess which output is which, and the wallet's task is to make that guess as hard as it can without breaking compatibility.
BIP 32 gives wallets a structural tool for this. An HD wallet organises its keys into an external chain, used for addresses given out to receive payments, and an internal chain, used for everything that does not need to be communicated — change addresses among them. The two chains are derived from the same seed but occupy different branches, so a wallet can generate a fresh change address for every transaction without any coordination. The specification notes that clients which do not support separate chains should use the external one for everything, which is exactly the behaviour that makes change easier to spot.
How change is detected
The oldest signal is script type. If a transaction spends P2PKH inputs and creates one P2PKH output and one bech32 output, the analyst assumes the output matching the inputs is the change, because a wallet tends to pay change to an address of the same type it spends from. Wallets that use a distinct change type, or that upgrade everything to the newest type, remove this signal. The address types page covers the families and their prefixes.
The second signal is value. A payment is often a round number and the change is whatever is left, so the non-round output is assumed to be the change. This is a weak signal that fails whenever the payment is not round, and it is defeated entirely by wallets that deliberately randomise the amounts. The third signal is behaviour: if an output is later spent in a transaction with other outputs the analyst already attributes to the sender, the link is confirmed after the fact. This is the strongest of the three and the slowest, because it requires waiting for the next spend.
BIP 69 addresses a related leak. Before it, wallets ordered inputs and outputs however their code happened to, and the resulting patterns were a fingerprint: the BIP's own motivation notes that many wallets placed spending outputs first and change outputs second, leaking information about both parties' finances. The proposal is a deterministic lexicographic ordering of inputs by previous transaction hash and output index, and of outputs by value and script. It is informational rather than consensus, but it removes a class of passive observation at no cost to the transaction's function.
Why derivation order leaks
An HD wallet derives its addresses in sequence from a seed, and the sequence is deterministic. That is what makes restoration possible: given the seed, the wallet can regenerate every address it ever handed out. It also means that the addresses a wallet uses are not independent random values but consecutive points on a known path. An observer who learns one address cannot compute the next — that would require the extended public key — but an observer who obtains an extended public key can derive every non-hardened address beneath it.
BIP 32 is explicit about this asymmetry. Knowing an extended public key allows reconstruction of all descendant non-hardened public keys, and the specification warns that a parent extended public key combined with any non-hardened private key descending from it is equivalent to knowing the parent extended private key. This is why hardened derivation exists and why it is used at the account level. For privacy, the practical consequence is that an extended public key is a much more sensitive object than a single address: it is a map of every address the wallet will use.
There is a smaller leak that does not require any key material. A wallet that hands out addresses in strict sequence publishes the order in which it received payments, because the addresses appear on the ledger in that order. If two addresses from the same wallet are ever linked — by a shared spend, by a common counterparty, by anything — the sequence tells the analyst which payment came first. The address reuse page covers the case where the sequence is not even needed, because the same address was used twice.
Sources
- Pieter Wuille, BIP 32: Hierarchical Deterministic Wallets — the internal and external keychains, and the warning about extended public keys.
- Kristov Atlas, BIP 69: Lexicographical Indexing of Transaction Inputs and Outputs — the fingerprint created by wallet-specific output ordering.
- Bitcoin Developer Guide, Transactions — how inputs are consumed whole and change is created as a new output.
Related reading
- Privacy & AnalysisWhat the public ledger reveals, and the practices that change it.
- Anonymous vs PseudonymousWhy Bitcoin is pseudonymous, and what an address actually identifies.
- How Transactions Are TracedThe heuristics chain analysis applies, and where they break down.
- Address ReuseWhy reusing an address links every payment to it, and what wallets do instead.
- Coin ControlHow choosing which outputs to spend changes what an observer can infer.
- Transaction BatchingHow combining payments lowers the fee per payment, and what it reveals.