Skip to content

bitcoinresearchkit/brk

Repository files navigation

Bitcoin Research Kit

A suite of Rust crates for working with Bitcoin data.

MIT Licensed Crates.io docs.rs Discord

Homepage · API Docs · Charts · Changelog

About

BRK is a toolkit for parsing, indexing, and analyzing Bitcoin blockchain data. It combines functionality similar to Glassnode (on-chain analytics), mempool.space (block explorer), and electrs (address indexing) into a single self-hostable package.

  • Parse blocks directly from Bitcoin Core's data files
  • Index transactions, addresses, and UTXOs
  • Compute derived metrics across multiple time resolutions
  • Monitor mempool with fee estimation and projected block building
  • Serve data via REST API and web interface
  • Query addresses, transactions, blocks, and analytics

The crates can be used together as a complete solution, or independently for specific needs.

Built on rust-bitcoin, vecdb, and fjall.

Crates

Entry Points

Crate Purpose
brk Umbrella crate, re-exports all components via feature flags
brk_cli CLI binary (cargo install --locked brk_cli)

Core

Crate Purpose
brk_reader Read blocks from blk*.dat with parallel parsing and XOR decoding
brk_indexer Index transactions, addresses, and UTXOs
brk_computer Compute derived metrics (realized cap, MVRV, SOPR, cohorts, etc.)
brk_mempool Monitor mempool, estimate fees, project upcoming blocks
brk_query Query interface for indexed and computed data
brk_server REST API with OpenAPI docs

Data & Storage

Crate Purpose
brk_types Domain types: Height, Sats, Txid, addresses, etc.
brk_store Key-value storage (fjall wrapper)
brk_fetcher Fetch price data from exchanges
brk_rpc Bitcoin Core RPC client
brk_iterator Unified block iteration with automatic source selection
brk_grouper UTXO and address cohort filtering
brk_traversable Navigate hierarchical data structures

Clients & Integration

Crate Purpose
brk_mcp Model Context Protocol server for LLM integration
brk_binder Generate typed clients (Rust, JavaScript, Python)
brk_client Generated Rust API client
brk_bundler JavaScript bundling for web interface

Internal

Crate Purpose
brk_error Error types
brk_logger Logging infrastructure
brk_bencher Benchmarking utilities

Architecture

blk*.dat ──▶ Reader ──┐
                      ├──▶ Indexer ──▶ Computer ──┐
         RPC Client ──┤                           ├──▶ Query ──▶ Server
                      └──▶ Mempool ───────────────┘
  • Reader parses blk*.dat files directly
  • RPC Client connects to Bitcoin Core
  • Indexer builds lookup tables from blocks
  • Computer derives metrics from indexed data
  • Mempool tracks unconfirmed transactions
  • Query provides unified access to all data
  • Server exposes Query as REST API

Usage

As a library:

use brk::{reader::Reader, indexer::Indexer, computer::Computer};

let reader = Reader::new(blocks_dir, &rpc);
let indexer = Indexer::forced_import(&brk_dir)?;
let computer = Computer::forced_import(&brk_dir, &indexer, None)?;

As a CLI: See brk_cli

Public API: bitcoinresearchkit.org/api

Documentation

Contributing

Contributions are welcome. See open issues.

Join the discussion on Discord or Nostr.

Acknowledgments

Development supported by OpenSats.

License

MIT

About

A suite of tools designed to extract, compute and display data stored on a Bitcoin node

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •