diff --git a/README.md b/README.md index ec2f606..1cfff6f 100644 --- a/README.md +++ b/README.md @@ -38,35 +38,46 @@ This crate can be used for the following purposes: If you are considering using BDK in your own wallet project bdk-cli is a nice playground to get started with. It allows easy testnet and regtest wallet operations, to try out what's possible with descriptors, miniscript, and BDK APIs. For more information on BDK refer to the [website](https://bitcoindevkit.org/) and the [rust docs](https://docs.rs/bdk/latest/bdk/index.html) -`bdk-cli` can be compiled with different features to suit your experimental needs. +###`bdk-cli` can be [compiled from source](#from-source) or [installed from crates.io](#from-crates) with different features to suit your experimental needs. -- Database Options +### Features: + +- Database - `key-value-db` : Sets the wallet database to a `sled` db. - `sqlite-db` : Sets the wallet database to a `sqlite3` db. -- Blockchain Options +- Blockchain - `rpc` : Connects the wallet to bitcoin core via RPC. - `electrum` : Connects the wallet to an electrum server. - `esplora-ureq` or `esplora-reqwest` : Connects the wallet to an esplora server synchronously or asynchronously. -- Extra Utility Tools - - `repl` : use `bdk-cli` as a [REPL](https://codewith.mu/en/tutorials/1.0/repl) shell (useful for quick manual testing of wallet operations). - - `compiler` : opens up `bdk-cli` policy compiler commands. - - `verify` : uses `bitcoinconsensus` to verify transactions at every `sync` call of the wallet. - - `reserves` : opens up `bdk-cli` **Proof of Reserves** operation commands using the [bdk-reserves plugin](https://github.com/bitcoindevkit/bdk-reserves). (requires the `electrum` feature) +### Additional Features: + +- `repl` : use `bdk-cli` as a [REPL](https://codewith.mu/en/tutorials/1.0/repl) shell (useful for quick manual testing of wallet operations). + +- `compiler` : opens up `bdk-cli` policy compiler commands. + +- `verify` : uses `bitcoinconsensus` to verify transactions at every `sync` call of the wallet. + +- `reserves` : opens up `bdk-cli` **Proof of Reserves** operation commands using the [bdk-reserves plugin](https://github.com/bitcoindevkit/bdk-reserves). (requires the `electrum` feature) - Automated Node Backend - `regtest-bitcoin` : Auto deploys a regtest `bitcoind` node, connects the wallet, and exposes core rpc commands via `bdk-cli node` subcommands. - `regtest-electrum` : Auto deploys `electrsd` and connected `bitcoind` nodes, exposes core rpc commands via `bdk-cli node` and provides a wallet connected to the local `electrsd`. -The `default` feature set is `repl` and `sqlite-db`. With the `default` features, `bdk-cli` can be used as an **air-gapped** wallet, and can do everything that doesn't require a network connection. +--- + +##### The `default` feature set is `repl` and `sqlite-db` and enables `bdk-cli` to be used as an **air-gapped** wallet, and doesn't require a network connection. +--- ## Install bdk-cli -### From source + +### From source + To install a dev version of `bdk-cli` from a local git repo with the `electrum` blockchain client enabled: -```shell +```sh cd cargo install --path . --features electrum bdk-cli help # to verify it worked @@ -77,50 +88,56 @@ disabled. To enable these commands a blockchain client feature such as `electrum blockchain client feature must be enabled. Below is an example of how to run the `bdk-cli` binary with the `esplora-ureq` blockchain client feature. -```shell +```sh 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) and `rpc`. -### From crates.io +### From crates.io + You can install the binary for the latest tag of `bdk-cli` with online wallet features directly from [crates.io](https://crates.io/crates/bdk-cli) with a command as below: + ```sh cargo install bdk-cli --features electrum ``` +```sh +cargo install bdk-cli --features electrum,compiler,... +``` + ### bdk-cli bin usage examples To get usage information for the `bdk-cli` binary use the below command which returns a list of available wallet options and commands: -```shell +```sh cargo run ``` To sync a wallet to the default electrum server: -```shell +```sh cargo run --features electrum -- wallet --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync ``` To sync a wallet to a Bitcoin Core node (assuming a regtest node at 127.0.0.1:18443) using the core rpc: -```shell +```sh cargo run --features rpc -- --network regtest wallet --node 127.0.0.1:18443 --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync ``` To get a wallet balance with customized logging: -```shell +```sh RUST_LOG=debug,sled=info,rustls=info cargo run -- wallet --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" get_balance ``` To generate a new extended master key, suitable for use in a descriptor: -```shell +```sh cargo run -- key generate ``` @@ -130,7 +147,7 @@ This library should always compile with any valid combination of features on Rus To build with the MSRV you will need to pin the below dependency versions: -```shell +```sh # log 0.4.19 has MSRV 1.60.0 cargo update -p log --precise 0.4.18 # required for sqlite, hashlink 0.8.2 has MSRV 1.61.0 @@ -148,5 +165,13 @@ cargo update -p flate2 --precise 1.0.26 ## Resources Docs: [bitcoindevkit.org CLI Section](https://bitcoindevkit.org/bdk-cli/installation/) + Episode on the _Bitcoin Developers Show_: [Youtube](https://www.youtube.com/watch?v=-Q8OD8NCEe4) + + + + Video Tutorials: [Youtube Playlist](https://www.youtube.com/playlist?list=PLmyfVqsSelG3jSobvpY3GoNKDtAumsrg3) + + +