☠️⚠️ Work In Progress ⚠️☠️

Bitcoin Node Query

Request information from a Bitcoin node

This library provides helpful functions to query common information about the bitcoin network.

Install

Add package to Cargo.toml file rust [dependencies] bitcoin-node-query = "0.1.2"

Usage:

```rust use bitcoinnodequery::{ Client, getblockheight, gettimesincelastblockinseconds, getaverageblocktimeforlast2016_blocks }

// Create a Client. let bitcoindpassword: &str = ... let bitcoindusername: &str = ... let bitcoindurl = "127.0.0.1:8332" let client = Client::new( &bitcoindurl, &bitcoindusername, &bitcoindpassword ).expect("failed to create client");

// get block height let blockheight = getblockheight(&client); println!("Block height: {:#?}", blockheight);

// Get how many seconds ago the last block was mined let secondssincelastblock = gettimesincelastblockinseconds(&client); println!( "Seconds since last block:", formatduration(secondssincelast_block) );

// Get the average seconds it took for each of the last 2016 blocks to be mined let averagesecondsperblocklast2016blocks = getaverageblocktimeforlast2016blocks(&client); println!( "Average block time for last 2016 blocks", formatduration(averagesecondsperblocklast2016blocks as i64) );

```

API

Find a list of all the functions available in the documentation

Related

License

MIT © Joe Gesualdo