Bitcoin Core Index Synchronization: getindexinfo and Application Readiness
Bitcoin Core can be ready to validate new blocks while an optional index is still processing historical data. Applications that depend on indexed queries need a readiness check for each required index rather than a single global online flag.
Inspect the chain and indexes separately
````
bitcoin-cli getblockchaininfo
bitcoin-cli getindexinfo
The first command describes the node's active chain, including block height, header height and initial block download status. The second reports enabled indexes and their synchronization information. Typical index entries contain synced and best_block_height fields. An empty result does not mean all possible indexes are ready; it can mean no optional indexes are enabled.
A service that requires txindex should explicitly check that the transaction index exists and is synchronized. A service using compact filters should check the corresponding basic filter index instead. Index names and available fields should be verified against the deployed release.
Readiness is a moving target
A new block can arrive between two RPC calls. A reorganization can also replace a block at an unchanged height. Consequently, comparing heights alone does not establish that two observations refer to the same chain state. For operations that require consistency, capture the active tip hash, perform the required queries, then verify the tip again and retry if it changed.
Even a synchronized index does not guarantee that an arbitrary query will succeed. The requested transaction may not exist, the block may have been pruned, or the arguments may be invalid. Handle RPC errors separately from synchronization state.
Service health design
Distinguish connectivity, chain readiness, index readiness and query success. For example, a service can report that the node is reachable while historical transaction lookup remains warming. Avoid returning a fabricated zero balance or a definitive not-found response when a required data source is still initializing.
Use bounded retries with backoff and preserve diagnostic information. Long-running index construction should not trigger repeated destructive reindex operations. Inspect logs and available disk space before taking recovery action.
Deployment decisions
Choose only indexes that support the application's query requirements. Standard Bitcoin Core txindex requires non-pruned storage, while the basic block filter index and CoinStatsIndex support pruning subject to historical data availability during construction. These distinctions affect provisioning and migration plans.
Readiness checks should be repeated after restarts and chain changes, not only at installation. Indexes are derived data; they do not replace wallet backups or change Bitcoin consensus rules.
Primary references
Bitcoin Core index framework: https://github.com/bitcoin/bitcoin/blob/master/src/index/base.cpp
RPC documentation (29.0): https://bitcoincore.org/en/doc/29.0.0/rpc/util/getindexinfo/
