Practical overview
When it fits
Use it when a Rust program or command-line pipeline needs to process block data already stored by Bitcoin Core, especially when ordered iteration or previous-output context matters.
Who it is for
- Rust developers building tools that ingest locally stored Bitcoin block data.
- Analysts who need transaction fee or previous-output context from decoded blocks.
- Developers writing block-processing consumers, including transaction-checking examples.
Documented uses
- Read Bitcoin Core block files and process decoded blocks in height order.
- Calculate transaction fees using previous-output data.
- Feed block data to a consumer through Unix pipes.
- Build analysis consumers for transaction weight, outputs, witness data, or transaction verification.
Requirements & limits
The repository is public and identifies the project as MIT-licensed. No account requirement or price is documented in the cited project materials.
- Bitcoin Core’s block directory must be usable by the tool; block-file XOR is unsupported while enabled.
- Previous-output data supports fee calculations and script checks, but the README’s benchmark table shows substantially different memory and timing figures depending on whether previous outputs are skipped and on the sele
- The maximum reorganization setting affects how the iterator handles reorganizations.
- The library supports Rust integration as well as serialized pipe workflows; the README notes serialization and deserialization when using pipes.
- The project says its 1.0 designation is not a claim of battle-tested production readiness.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Iterate over Bitcoin blocks in a Rust program
Read blocks from a Bitcoin Core blocks directory in height order and sum transaction fees.
Before you start
- A local Bitcoin Core blocks directory containing the blocks to process.
- A Rust project with the blocks_iterator and bitcoin libraries available.
Steps
Create a blocks_iterator::Config with the blocks-directory path and the matching bitcoin::Network, as in the README’s Testnet example.
Pass the configuration to blocks_iterator::iter and iterate over the returned blocks.
For each block, call fee() and add the available fee to a running total; the example expects prevouts to be retained for fee calculation.
Expected outcome
The program iterates blocks and accumulates fees; the documented example asserts a total of 450,000 satoshis for its first 400 Testnet blocks.
Guide limitations
- The example’s total applies only to its stated Testnet data and block range.
- Bitcoin Core 28.0 block-file xoring is not supported. The README says xoring can be disabled with -blocksxor=0.
- Version 1.0 is explicitly not described as battle-tested production-ready.
- Keeping previous outputs can require substantial memory; README benchmarks vary by network and configuration and are described as older-version results.
Build and connect the Unix-pipe example
Build the release CLI and examples, then pipe ordered Testnet blocks to the with_pipe consumer.
Before you start
- Rust and Cargo, as the README build commands use Cargo.
- A local Testnet Bitcoin Core blocks directory at the path used in the documented example.
- Unix pipes.
Steps
Build the release binaries with the command below.
cargo build --releaseBuild the release examples with the command below.
cargo build --release --examplesRun
blocks_iterator_cliwith the documented blocks directory, Testnet network, maximum reorganization of 40, and stop height of 200000, piping its output totarget/release/examples/with_pipe.
Expected outcome
The documented pipeline sends serialized ordered block data with previous outputs to the with_pipe consumer, which reports block and transaction statistics.
Guide limitations
- When using pipes, block data is serialized and deserialized.
- The documented command uses a Testnet directory and fixed example settings; other paths or settings are not specified here.
- Bitcoin Core 28.0 xored block files are unsupported unless xoring is disabled with -blocksxor=0.
- Version 1.0 is not characterized as battle-tested production-ready.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- RCasatta/blocks_iterator · Official homepage title · retained in its source language
Related options
bitcoin-iterate — The README identifies it as an inspiration and contrasts its C implementation and shell-piping focus with Blocks Iterator’s Rust-library option and previous-output data.
rust-bitcoin-indexer — The README contrasts this project’s block-file iteration with an indexer that requires a PostgreSQL database and a longer indexing setup before relational queries.
electrs — The README describes electrs as specifically intended for the Electrum protocol.
brk_parser — The README describes it as a Rust-only parser that uses channels and parallelization, and refers to its own benchmark comparison.

