mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
25 lines
646 B
Rust
25 lines
646 B
Rust
use brk_error::Result;
|
|
use brk_reader::Reader;
|
|
use brk_rpc::{Auth, Client};
|
|
|
|
fn main() -> Result<()> {
|
|
let bitcoin_dir = Client::default_bitcoin_path();
|
|
|
|
let client = Client::new(
|
|
Client::default_url(),
|
|
Auth::CookieFile(bitcoin_dir.join(".cookie")),
|
|
)?;
|
|
|
|
let reader = Reader::new(bitcoin_dir.join("blocks"), &client);
|
|
|
|
// Stream all blocks from genesis to the current tip.
|
|
let i = std::time::Instant::now();
|
|
for block in reader.after(None)?.iter() {
|
|
let block = block?;
|
|
println!("{}: {}", block.height(), block.hash());
|
|
}
|
|
println!("Full read: {:?}", i.elapsed());
|
|
|
|
Ok(())
|
|
}
|