Navigation Menu

Skip to content

rajarshimaitra/bdk-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bdk-cli lib and example bin tool

CI Code Coverage

About

This project provides a command line interface (cli) Bitcoin wallet library and REPL wallet tool based on the bdk library.

Install bdk-cli

From source

To install dev version of bdk-cli from local git repo with the electrum blockchain client enabled:

cd <bdk-cli git repo directory>
cargo install --path . --features electrum
bdk-cli help # to verify it worked

If no blockchain client feature is enabled online wallet commands sync and broadcast will be disabled. To enable these commands a blockchain client features such as electrum or another blockchain backend feature must be enabled. Below is an example of how run the bdk-cli bin with the esplora-ureq blockchain client feature.

RUST_LOG=debug cargo run --features esplora-ureq -- wallet --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync

At most one blockchain feature can be enabled, available blockchain client features are: electrum, esplora-ureq (blocking), esplora-reqwest (async), compact_filters and rpc.

From crates.io

You can the install the binaries for the latest tag of bdk-cli with online wallet features directly from crates.io with a command as below:

cargo install bdk-cli --features electrum

bdk-cli bin usage examples

To get usage information for the bdk-cli bin use the below command which returns a list of available wallet options and commands:

cargo run

To sync a wallet to the default electrum server:

cargo run --features electrum -- wallet --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync

To sync a wallet to Bitcoin Core node (assuming a regtest node at 127.0.0.1:18443) using the core rpc:

cargo run --features rpc -- --network regtest wallet --node 127.0.0.1:18443 --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync

To sync a wallet to Bitcoin Core node (assuming a regtest node at 127.0.0.1:18444) serving compact filters: Note:

  • This will increase build time by few minutes for the binaries because of librocksdb.
  • Bitcoin Core v0.21.0 or higher is required to serve compact filters.
cargo run --features compact_filters -- --network regtest wallet --node 127.0.0.1:18444 --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync

To get a wallet balance with customized logging:

RUST_LOG=debug,sled=info,rustls=info cargo run -- wallet --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" get_balance

To generate a new extended master key, suitable for using in a descriptor:

cargo run -- key generate

About

A CLI wallet library and REPL tool to demo and test the BDK library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%