mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-27 10:48:11 -07:00
global: init readmes
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
# biter
|
||||
# BRK Parser
|
||||
|
||||
Biter (Bitcoin Block Iterator) is a very fast and simple Rust library which reads raw block files (*blkXXXXX.dat*) from Bitcoin Core Node and creates an iterator over all the requested blocks in sequential order (0, 1, 2, ...).
|
||||
A very fast and simple Rust library which reads raw block files (*blkXXXXX.dat*) from Bitcoin Core node and creates an iterator over all the requested blocks in sequential order (0, 1, 2, ...).
|
||||
|
||||
The element returned by the iterator is a tuple which includes the:
|
||||
- Height: `usize`
|
||||
- Height: `Height`
|
||||
- Block: `Block` (from `bitcoin-rust`)
|
||||
- Block's Hash: `BlockHash` (also from `bitcoin-rust`)
|
||||
|
||||
|
||||
@@ -54,6 +54,10 @@ impl Parser {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self, height: Height) -> Block {
|
||||
self.parse(Some(height), Some(height)).iter().next().unwrap().1
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns a crossbeam channel receiver that receives `(Height, Block, BlockHash)` tuples from an **inclusive** range (`start` and `end`)
|
||||
///
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::path::Path;
|
||||
|
||||
use bitcoincore_rpc::{Auth, Client};
|
||||
use brk_core::Height;
|
||||
use brk_parser::Parser;
|
||||
|
||||
fn main() {
|
||||
@@ -24,5 +25,8 @@ fn main() {
|
||||
println!("{height}: {hash}");
|
||||
});
|
||||
|
||||
parser.get(Height::new(0));
|
||||
parser.get(Height::new(840_000));
|
||||
|
||||
dbg!(i.elapsed());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user