# brk_cli **Command line interface for running complete BRK instances** `brk_cli` provides the main command-line interface for operating the Bitcoin Research Kit. It orchestrates the complete data pipeline from Bitcoin Core block parsing through analytics computation to HTTP API serving, with automatic configuration management and graceful operation. ## What it provides - **Complete Pipeline Orchestration**: Coordinates parser, indexer, computer, and server components - **Automatic Configuration**: Saves settings to `~/.brk/config.toml` for consistent operation - **Continuous Operation**: Handles blockchain updates and incremental processing - **Web Interface Options**: Configurable website serving (none, default, custom) - **Graceful Shutdown**: Ctrl+C handling with proper cleanup ## Key Features ### Pipeline Management - **Automatic dependency handling**: Ensures Bitcoin Core sync before processing - **Incremental updates**: Only processes new blocks since last run - **Error recovery**: Automatic retry logic and graceful error handling - **Resource management**: Optimized memory usage and disk I/O ### Configuration System - **Auto-save configuration**: All CLI options saved to persistent config - **Flexible paths**: Configurable Bitcoin directory, blocks directory, and output directory - **RPC authentication**: Cookie file or username/password authentication - **Data source options**: Configurable price fetching and exchange APIs ### Operation Modes - **Initial sync**: Full blockchain processing from genesis - **Continuous operation**: Real-time processing of new blocks - **Update mode**: Resume from last processed block - **Server mode**: HTTP API with optional web interface ## Installation ### Binary Release ```bash # Download from GitHub releases # https://github.com/bitcoinresearchkit/brk/releases/latest ``` ### Via Cargo ```bash cargo install brk --locked ``` ### From Source ```bash git clone https://github.com/bitcoinresearchkit/brk.git cd brk && cargo build --release ``` ## Usage ### First Run (Configuration Setup) ```bash # Basic setup with default options brk --brkdir ./my_brk_data # Full configuration brk --bitcoindir ~/.bitcoin \ --brkdir ./brk_data \ --fetch true \ --exchanges true \ --website default ``` ### Subsequent Runs ```bash # Uses saved configuration from ~/.brk/config.toml brk # Override specific options brk --website none --fetch false ``` ### Command Line Options ```bash brk --help ``` ## Configuration Reference All options are automatically saved to `~/.brk/config.toml`: ### Core Paths - `--bitcoindir ` - Bitcoin Core directory (default: `~/.bitcoin`) - `--blocksdir ` - Block files directory (default: `bitcoindir/blocks`) - `--brkdir ` - BRK output directory (default: `~/.brk`) ### Data Sources - `--fetch ` - Enable price data fetching (default: `true`) - `--exchanges ` - Use exchange APIs for prices (default: `true`) ### Web Interface - `--website