brk_rpc
Thread-safe Bitcoin Core RPC client with automatic retries.
What It Enables
Query a Bitcoin Core node for blocks, transactions, mempool data, and chain state. Handles connection failures gracefully with configurable retry logic.
Key Features
- Auto-retry: Up to 1M retries with configurable delay on transient failures
- Thread-safe: Clone freely, share across threads
- Full RPC coverage: Blocks, headers, transactions, mempool, UTXO queries
- Mempool transactions: Resolves prevouts for mempool tx fee calculation
- Reorg detection:
get_closest_valid_heightfinds main chain after reorg - Sync waiting:
wait_for_synced_nodeblocks until node catches up
Core API
let client = new?;
let height = client.get_last_height?;
let hash = client.get_block_hash?;
let block = client.get_block?;
// Mempool
let txids = client.get_raw_mempool?;
let entries = client.get_raw_mempool_verbose?;
Key Methods
get_block,get_block_hash,get_block_header_infoget_transaction,get_mempool_transaction,get_tx_outget_raw_mempool,get_raw_mempool_verboseget_blockchain_info,get_last_heightis_in_main_chain,get_closest_valid_height
Built On
brk_errorfor error handlingbrk_loggerfor debug loggingbrk_typesforHeight,BlockHash,Txid,MempoolEntryInfo