Electrs Query

Request information from an Electrs Server

This library provides helpful functions to query common information about an Electrs server.


⚠️ This is experimental. Please use at your own risk.⚠️


Install

Add package to Cargo.toml file rust [dependencies] electrs-query = "0.1.1"

Usage:

```rust use electrsquery::{getbalanceforaddress, getrelayfee, getutxosfor_address, Client};

// setup let address = "127.0.0.1:50001"; let client = Client::new(address);

// get realy fee let relayfee = getrelayfee(&client); println!("relay fee result: {}", relayfee);

let p2pkhaddress = "mv7RvNNQ7HpQf2diQai5hgpeuzkFoAQP9G".tostring(); // get balance for p2pkh address let addressbalance = getbalanceforaddress(&p2pkhaddress, &client); println!("balance: {:#?}", addressbalance); // get utxo for p2pkh address let addressutxos = getutxosforaddress(&p2pkhaddress, &client); println!("utxos: {:#?}", addressutxos); // get historical transactions for p2pkh address let historicaltransactions = gethistoricaltransactionsforaddress(&p2pkhaddress, &client); println!("historical transactions: {:#?}", historical_transactions);

let p2shaddress = "2MzBNKyJjx44BDJfwEevVzS3Q9Z5kSEYUZB".tostring(); // get balance for p2sh address let addressbalance = getbalanceforaddress(&p2shaddress, &client); println!("balance: {:#?}", addressbalance); // get utxos for p2sh address let addressutxos = getutxosforaddress(&p2pkhaddress, &client); println!("utxos: {:#?}", addressutxos); // get historical transactions for p2sh address let historicaltransactions = gethistoricaltransactionsforaddress(&p2shaddress, &client); println!("historical transactions: {:#?}", historical_transactions);

let p2wpkhaddress = "tb1qphdqqxupe6dzkz3z58twy5l4s0v24mle5gkp99".tostring(); // get balance for p2wpkh address let addressbalance = getbalanceforaddress(&p2wpkhaddress, &client); println!("balance: {:#?}", addressbalance); // get utxos for p2wpkh address let addressutxos = getutxosforaddress(&p2pkhaddress, &client); println!("utxos: {:#?}", addressutxos); // get historical transactions for p2wpkh address let historicaltransactions = gethistoricaltransactionsforaddress(&p2wpkhaddress, &client); println!("historical transactions: {:#?}", historical_transactions); ```

API

Find a list of all the functions available in the documentation

Related

License

MIT © Joe Gesualdo