brk
Main wrapper crate for the Bitcoin Research Kit (BRK)
The brk crate serves as the primary entry point for the Bitcoin Research Kit, providing a unified interface to all BRK components through feature flags. It enables developers to selectively include only the components they need while maintaining a consistent API.
What it provides
- Unified Access: Single crate providing access to the entire BRK ecosystem
- Feature-based Selection: Choose only the components you need
- Consistent Versioning: All components versioned together for compatibility
- Simplified Dependencies: Single dependency instead of multiple individual crates
Available Components
Core Data Pipeline
parser(brk_parser) - High-performance Bitcoin block parserindexer(brk_indexer) - Blockchain data indexer with dual storagecomputer(brk_computer) - Analytics engine for computed datasetsinterface(brk_interface) - Unified data query and formatting API
Infrastructure
structs(brk_structs) - Bitcoin-aware type system and data structureserror(brk_error) - Centralized error handlingstore(brk_store) - Blockchain-aware key-value storage
External Integration
fetcher(brk_fetcher) - Bitcoin price data fetcher with multi-source fallbackserver(brk_server) - HTTP server with REST APImcp(brk_mcp) - Model Context Protocol for LLM integration
Utilities
cli(brk_cli) - Command line interface (always enabled)logger(brk_logger) - Logging utilitiesbundler(brk_bundler) - Asset bundling for web interfaces
Usage
Full Installation
[]
= { = "0.0.88", = ["full"] }
use *;
// Access all components
let config = load?;
let parser = new;
let indexer = forced_import?;
let computer = forced_import?;
Selective Components
[]
= { = "0.0.88", = ["parser", "indexer", "computer"] }
use ;
// Core data pipeline only
let parser = new;
let mut indexer = forced_import?;
let mut computer = forced_import?;
Minimal Setup
[]
= { = "0.0.88", = ["structs", "parser"] }
use ;
// Just parsing and types
let height = new;
let parser = new;
Feature Flags
| Feature | Description | Dependencies |
|---|---|---|
full |
Enable all components | All crates |
cli |
Command line interface | Always enabled |
structs |
Core type system | Foundation for other crates |
error |
Error handling | Used by most crates |
parser |
Block parsing | structs, error |
store |
Key-value storage | structs, error |
indexer |
Blockchain indexing | parser, store |
computer |
Analytics computation | indexer, fetcher (optional) |
fetcher |
Price data fetching | structs, error |
interface |
Data query API | indexer, computer |
server |
HTTP server | interface, mcp |
mcp |
LLM integration | interface |
logger |
Logging utilities | Standalone |
bundler |
Asset bundling | Standalone |
Common Usage Patterns
Complete BRK Instance
use *;
// Full data pipeline setup
let config = load?;
let rpc = /* Bitcoin Core RPC client */;
let parser = new;
let mut indexer = forced_import?;
let mut computer = forced_import?;
let interface = build;
let server = new;
// Start server
server.serve.await?;
Data Analysis
use ;
// Analysis-focused setup
let indexer = forced_import?;
let computer = forced_import?;
let interface = build;
// Query data
let params = Params ;
let csv_data = interface.search_and_format?;
Custom Integration
use ;
// Custom application with BRK components
Version Compatibility
All BRK crates are released together with synchronized versions. When using the brk wrapper crate, you're guaranteed compatibility between all components.
- Current version: 0.0.88
- Rust MSRV: 1.89+
- Bitcoin Core: v25.0 - v29.0
Performance Characteristics
The brk crate itself adds no runtime overhead - it simply re-exports the underlying crates. Performance characteristics depend on which components you use:
- Full pipeline: ~13-15 hours initial sync, ~40GB storage overhead
- Parser only: ~4 minutes to parse entire blockchain
- Indexer only: ~7-8 hours to index blockchain, ~5-6GB RAM usage
- Server: Low latency API responses with caching and compression
Dependencies
The brk crate's dependencies are determined by enabled features. Core dependencies include:
brk_cli- Always included for configuration and CLI support- Individual
brk_*crates based on enabled features - Transitive dependencies from enabled components
For specific dependency information, see individual crate READMEs.
This README was generated by Claude Code