#indexer #bitcoin #stores #vecs #dataset #compute #brk-parser

bin+lib brk_indexer

A Bitcoin Core indexer built on top of brk_parser

7 releases

new 0.0.6 Mar 3, 2025
0.0.5 Mar 3, 2025
0.0.2 Feb 27, 2025

#31 in Magic Beans

Download history

275 downloads per month
Used in 5 crates

MIT license

200KB
5K SLoC

BRK Indexer

A Bitcoin Core node indexer which iterates over the chain (via ../brk_parser) and creates a database of the vecs (../brk_vec) and key/value stores (fjall) that can be used in your Rust code.

The crate only stores the bare minimum to be self sufficient and not have to use an RPC client (except for scripts which are not stored). If you need more data, checkout ../computer which uses the outputs from the indexer to compute a whole range of datasets.

Vecs are used sparingly instead of stores for multiple reasons:

  • Only stores the relevant data since the key is an index
  • Saved as uncompressed bytes and thus can be parsed manually (with any programming language) without relying on a server or library
  • Easy to work with and predictable

Usage

Storage wise, the expected overhead should be around 30% of the chain itself.

Peaks at 5 GB of RAM

Outputs

Vecs: src/storage/vecs/mod.rs

Stores: src/storage/stores/mod.rs

Examples

Rust: src/main.rs

Python: ../python/parse.py

Benchmark

Indexing 0..885_835 took 11 hours 6 min 50 s on a Macbook Pro M3 Pro with 36 GB of RAM

footprint report:

  • Peak memory: 5115 MB
  • Memory while waiting for a new block: 890 MB
  • Reclaimable memory: 6478 MB

Dependencies

~23–35MB
~513K SLoC