bitcoind-watcher

Crates.iobitcoind-watcher
lib.rsbitcoind-watcher
version0.1.2
sourcesrc
created_at2022-08-17 00:22:05.246727
updated_at2022-08-17 00:30:37.554599
descriptionBe notified when important things happen on the Bitcoin blockchain
homepage
repository
max_upload_size
id647069
size13,938
Joe Gesualdo (joegesualdo)

documentation

README

☠️⚠️ Work In Progress ⚠️☠️

Bitcoind Watcher

Be notified when important things happen on the Bitcoin blockchain

Install

Add package to Cargo.toml file

[dependencies]
bitcoind-watcher= "0.1.2"

Usage:

use bitcoind_watcher::BitcoindWatcher;
use bitcoind_watcher::LogLine;

const PATH_TO_LOG_FILE: &str = "/Users/joe/Library/Application Support/Bitcoin/debug.log";

type Callback = Box<dyn Fn(LogLine) + 'static>;

let on_transaction_added_to_mempool: Callback = Box::new(|log_line| {
    println!(".....on_transaction_added_to_mempool.....");
    println!("{:?}", log_line)
});
let on_new_proof_of_work_valid_block: Callback = Box::new(|log_line| {
    println!(".....on_new_proof_of_work_valid_block.....");
    println!("{:?}", log_line)
});
let on_new_outbound_peer_connected: Callback = Box::new(|log_line| {
    println!(".....on_new_outbound_peer_connected.....");
    println!("{:?}", log_line)
});

BitcoindWatcher::new(PATH_TO_LOG_FILE)
    .on_transaction_added_to_mempool(on_transaction_added_to_mempool)
    .on_new_proof_of_work_valid_block(on_new_proof_of_work_valid_block)
    .on_new_outbound_peer_connected(on_new_outbound_peer_connected)
    .run();

Related

License

MIT © Joe Gesualdo

Commit count: 0

cargo fmt