| Crates.io | brk_iterator |
| lib.rs | brk_iterator |
| version | 0.1.0-beta.0 |
| created_at | 2025-12-18 22:58:30.534518+00 |
| updated_at | 2026-01-25 13:21:48.802457+00 |
| description | A Bitcoin block iterator |
| homepage | https://bitcoinresearchkit.org |
| repository | https://github.com/bitcoinresearchkit/brk |
| max_upload_size | |
| id | 1993751 |
| size | 40,603 |
Unified block iteration with automatic source selection.
Iterate over Bitcoin blocks with a simple API that automatically chooses between RPC (for small ranges) and direct blk file reading (for large scans). Handles reorgs gracefully.
let blocks = Blocks::new(&rpc_client, &reader);
// Various range specifications
for block in blocks.range(Height::new(800_000), Height::new(800_100))? { ... }
for block in blocks.start(Height::new(840_000))? { ... }
for block in blocks.last(10)? { ... }
for block in blocks.after(Some(last_known_hash))? { ... }
// Auto-select (default)
let blocks = Blocks::new(&client, &reader);
// Force RPC only
let blocks = Blocks::new_rpc(&client);
// Force Reader only
let blocks = Blocks::new_reader(&reader);
| Method | Description |
|---|---|
range(start, end) |
Inclusive height range |
start(height) |
From height to chain tip |
end(height) |
From genesis to height |
last(n) |
Last n blocks from tip |
after(hash) |
All blocks after given hash |
brk_error for error handlingbrk_reader for direct blk file accessbrk_rpc for RPC queriesbrk_types for Height, BlockHash