Bitcoin Block Parser
Fast optimized parser for bitcoin blocks
with input and output tracking.
⚠️ The API is still evolving and should not be considered stable until release 1.0.0
Features
- Parses blocks into the Rust bitcoin
Block
format for easier manipulation - Can track if any
TxOut
is spent or unspent for calculations on the UTXO set - Can track the
Amount
of everyTxIn
for calculating metrics such as fee rates - Multithreaded in-memory parsing provides the fastest block parsing performance
Requirements / Benchmarks
- You must be running a non-pruning bitcoin node (this is the default configuration)
- We recommend using fast storage (e.g. NVMe) and a multithreaded CPU for best performance
- See benchmarks below to understand how much RAM you may need:
Function | Time | Memory |
---|---|---|
BlockParser::parse() Parses blocks |
2m 55s | 0.9 GB |
UtxoParser::parse() Tracks input amounts (no filter) |
7m 41s | 25.0 GB |
UtxoParser::create_filter() Creates new filter |
16m 09s | 5.6 GB |
UtxoParser::load_filter().parse() Tracks input & outputs (with filter) |
7m 46s | 11.8 GB |
Our benchmarks were run on NVMe storage with a 32-thread processor on 800,000 blocks.
Quick Usage
See BlockParser
for details on how to parse blocks:
use *;
// Initialize a logger (if you want to monitor parsing progress)
builder.filter_level.init;
// Parse all blocks in the directory and map them to a value
let parser = new.unwrap;
for size in parser.parse
See UtxoParser
for details on how to track inputs and outputs:
use *;
let parser = new.unwrap;
let blocks = parser.load_or_create_filter.unwrap.parse;
for block in blocks