☠️⚠️ Work In Progress ⚠️☠️
Be notified when important things happen on the Bitcoin blockchain
Add package to Cargo.toml file
rust [dependencies] bitcoind-watcher= "0.1.1"
```rust use bitcoindwatcher::BitcoindWatcher; use bitcoindwatcher::LogLine;
const PATHTOLOG_FILE: &str = "/Users/joe/Library/Application Support/Bitcoin/debug.log";
type Callback = Box
let ontransactionaddedtomempool: Callback = Box::new(|logline| { println!(".....ontransactionaddedtomempool....."); println!("{:?}", logline) }); let onnewproofofworkvalidblock: Callback = Box::new(|logline| { println!(".....onnewproofofworkvalidblock....."); println!("{:?}", logline) }); let onnewoutboundpeerconnected: Callback = Box::new(|logline| { println!(".....onnewoutboundpeerconnected....."); println!("{:?}", logline) });
BitcoindWatcher::new(PATHTOLOGFILE) .ontransactionaddedtomempool(ontransactionaddedtomempool) .onnewproofofworkvalidblock(onnewproofofworkvalidblock) .onnewoutboundpeerconnected(onnewoutboundpeer_connected) .run();
```
MIT © Joe Gesualdo