THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin Core rescanblockchain: Wallet History Recovery and Scan Boundaries

permalink THAMER
#bitcoin#bitcoin-core#rpc#wallet-rescan

A Bitcoin Core wallet rescan examines available historical blocks for transactions relevant to the wallet's known scripts. It does not search for private keys, guess seed phrases, or discover arbitrary derivation paths. The wallet must already know the scripts it is intended to recognize.

Preparing the wallet

Import the appropriate descriptors into the intended wallet before scanning. Include the correct network, external and internal branches, derivation ranges and key origins where applicable. A receive-only descriptor may miss change outputs. A descriptor containing public keys can discover relevant transactions without granting spending authority.

Descriptor import timestamps influence the historical interval searched during import. Choosing a timestamp later than the first relevant transaction risks omitting earlier history. A timestamp of zero requests a scan from the beginning, subject to available block data. Importing descriptors and explicitly rescanning are distinct operations; check import results before initiating another scan.

Selecting a scan interval

For a wallet named recovery, an illustrative command is:

bitcoin-cli -rpcwallet=recovery rescanblockchain 800000 810000

The arguments are start and stop block heights, not timestamps. Omit the stop height to scan toward the current chain tip. The example interval is arbitrary: use a range appropriate to the actual wallet, network and available blocks. A successful scan over this interval does not establish that earlier wallet activity was absent.

Monitoring and cancellation

The wallet RPC getwalletinfo reports scanning state and, while scanning, progress information. abortrescan requests cancellation. An interrupted scan is not an atomic rollback of everything discovered so far. Applications should record the intended scan interval, inspect the final RPC result and avoid treating partial results as complete history.

Pruning and reconciliation

A pruned node may lack historical blocks required for the requested interval. A block filter index can help identify candidate blocks, but a filter is not the transaction data itself. Historical recovery may require access to an archival node or another validated source of missing blocks.

After scanning, reconcile the wallet with the active chain and current mempool. A reorganization can change confirmation status. Check the wallet's known outputs and balances before marking recovery complete. A successful rescan is evidence of a completed search within its scope, not proof that the imported descriptors cover every address the original wallet ever generated.

Primary references

https://bitcoincore.org/en/doc/28.0.0/rpc/wallet/rescanblockchain/

https://bitcoincore.org/en/doc/28.0.0/rpc/wallet/importdescriptors/

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects