143 / 691GAP

Gap Limit

Limit of consecutive unused addresses

Gap Limit determines when a wallet stops looking for more addresses during recovery. A payment beyond a long sequence of unused addresses may remain invisible to the default scan.

Gap Limit bounds the number of consecutive unused addresses encountered while searching a deterministic branch. It limits history discovery, not the number of derivable keys; exceeding it does not itself mean cryptographic loss of funds.

A used address interrupts the unused sequence and resets the gap counter. With a limit of 20, suppose index 0 has history but indices 1–20 do not: the scan stops before index 21 and may miss a payment there. This is not a maximum of twenty addresses in the whole wallet. [BIP 44 — Account discovery and address gap limit]

BIP 44 specifies an Address gap limit of 20 for discovery on the external receiving branch. Software should warn when generating an address beyond this boundary. This is a particular recovery convention, not a consensus rule or a mandatory setting for every wallet; other systems may use different ranges. [BIP 44 — Account discovery and address gap limit]

BIP 44 searches transaction history, not a positive balance. An address that received funds and later spent everything is still used. Treating an empty balance as an unused address could stop the scan prematurely and miss subsequent payments. [BIP 44 — Account discovery and address gap limit]

BIP 44 starts with account 0 and checks its external branch; it continues to the next account if history is found. Branch change=0 receives payments, while change=1 returns one's own change. The first account without history stops account discovery, so the standard restricts creating skipped empty accounts. One branch's limit is not a shared counter for all accounts. [BIP 44 — Account discovery and address gap limit]

The Electrum FAQ explicitly warns that addresses generated beyond Gap Limit may not be found automatically during ordinary seed recovery. Its documented remedies are a larger limit or deriving more addresses until the used position is reached. The FAQ's default of 20 refers to Electrum 2.0; it is not presented here as every current wallet's setting. [Electrum FAQ — Gap limit and generated addresses]

Bitcoin Core 29.0's importdescriptors RPC distinguishes range, next_index and timestamp. A range of derived indices is not the same as a stopping rule for unused addresses; next_index sets the next generated index. timestamp sets the scan start. The value now does not replace full historical recovery; the documentation also includes blocks up to two hours before the earliest timestamp and the Mempool. A correct range without appropriate scan history is therefore insufficient. [Bitcoin Core 29.0 — importdescriptors RPC]

BIP 32 derives keys deterministically, but the search must start with the correct wallet, account, derivation path and script type. A larger Gap Limit cannot fix a different seed or passphrase. An xpub alone also cannot derive hardened descendants; expanding a scan cannot replace missing derivation capability. [BIP 32 — Hierarchical Deterministic Wallets] [BIP 39 — From mnemonic to seed]

A wider search means more derived addresses and queries; it can reveal additional wallet relationships to a remote server. Recovery is checked against known addresses and transactions, including receipts already spent. An expanded scan neither changes the blockchain nor moves coins; its success also depends on correct starting information and available history. [BIP 44 — Account discovery and address gap limit] [Electrum FAQ — Gap limit and generated addresses] [BIP 32 — Hierarchical Deterministic Wallets]

For the clearest picture, read this entry together with HD Wallet, Derivation Path, Extended Public Key (xpub), Output Descriptor, Change output. The reverse links also lead from HD Wallet, Derivation Path.

DOC · 001BIP 44 — Account discovery and address gap limitSpecificationDOC · 002Electrum FAQ — Gap limit and generated addressesDocumentationDOC · 003Bitcoin Core 29.0 — importdescriptors RPCDocumentationDOC · 004BIP 32 — Hierarchical Deterministic WalletsSpecificationDOC · 005BIP 39 — From mnemonic to seedSpecification
Source-first · No investment advice