You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-30Lines changed: 48 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,36 +23,36 @@
23
23
</h4>
24
24
</div>
25
25
26
-
27
26
## About
28
27
29
28
**EXPERIMENTAL**
30
-
This crate has been updated to use `bdk_wallet` 1.x. Only use for testing on test networks.
29
+
This crate has been updated to use `bdk_wallet` 1.x. Only use for testing on test networks.
31
30
32
31
This project provides a command-line Bitcoin wallet application using the latest [BDK Wallet APIs](https://docs.rs/bdk_wallet/1.0.0/bdk_wallet/index.html) and chain sources ([RPC](https://docs.rs/bdk_bitcoind_rpc/0.18.0/bdk_bitcoind_rpc/index.html), [Electrum](https://docs.rs/bdk_electrum/0.21.0/bdk_electrum/index.html), [Esplora](https://docs.rs/bdk_esplora/0.21.0/bdk_esplora/), [Kyoto](https://docs.rs/bdk_kyoto/0.9.0/bdk_kyoto/)). This might look tiny and innocent, but by harnessing the power of BDK it provides a powerful generic descriptor based command line wallet tool.
33
32
And yes, it can do Taproot!!
34
33
35
34
This crate can be used for the following purposes:
36
-
- Instantly create a miniscript based wallet and connect to your backend of choice (Electrum, Esplora, Core RPC, Kyoto etc) and quickly play around with your own complex bitcoin scripting workflow. With one or many wallets, connected with one or many backends.
37
-
- The `tests/integration.rs` module is used to document high level complex workflows between BDK and different Bitcoin infrastructure systems, like Core, Electrum and Lightning(soon TM).
38
-
- (Planned) Expose the basic command handler via `wasm` to integrate `bdk-cli` functionality natively into the web platform. See also the [playground](https://bitcoindevkit.org/bdk-cli/playground/) page.
35
+
36
+
- Instantly create a miniscript based wallet and connect to your backend of choice (Electrum, Esplora, Core RPC, Kyoto etc) and quickly play around with your own complex bitcoin scripting workflow. With one or many wallets, connected with one or many backends.
37
+
- The `tests/integration.rs` module is used to document high level complex workflows between BDK and different Bitcoin infrastructure systems, like Core, Electrum and Lightning(soon TM).
38
+
- (Planned) Expose the basic command handler via `wasm` to integrate `bdk-cli` functionality natively into the web platform. See also the [playground](https://bitcoindevkit.org/bdk-cli/playground/) page.
39
39
40
40
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_wallet/1.0.0/bdk_wallet/index.html)
41
41
42
42
bdk-cli can be compiled with different features to suit your experimental needs.
43
-
- Database Options
44
-
-`sqlite` : Sets the wallet database to a `sqlite3` db.
45
-
- Blockchain Client Options
46
-
-`esplora` : Connects the wallet to an esplora server.
47
-
-`electrum` : Connects the wallet to an electrum server.
48
-
-`kyoto`: Connects the wallet to a kyoto client and server.
49
-
-`rpc`: Connects the wallet to Bitcoind server.
50
-
- Extra Utility Tools
51
-
-`repl` : use bdk-cli as a [REPL](https://codewith.mu/en/tutorials/1.0/repl) shell (useful for quick manual testing of wallet operations).
52
-
-`compiler` : opens up bdk-cli policy compiler commands.
53
-
54
-
The `default` feature set is `repl` and `sqlite`. 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.
55
43
44
+
- Database Options
45
+
-`sqlite` : Sets the wallet database to a `sqlite3` db.
46
+
- Blockchain Client Options
47
+
-`esplora` : Connects the wallet to an esplora server.
48
+
-`electrum` : Connects the wallet to an electrum server.
49
+
-`kyoto`: Connects the wallet to a kyoto client and server.
50
+
-`rpc`: Connects the wallet to Bitcoind server.
51
+
- Extra Utility Tools
52
+
-`repl` : use bdk-cli as a [REPL](https://codewith.mu/en/tutorials/1.0/repl) shell (useful for quick manual testing of wallet operations).
53
+
-`compiler` : opens up bdk-cli policy compiler commands.
54
+
55
+
The `default` feature set is `repl` and `sqlite`. 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.
If no blockchain client feature is enabled online wallet commands `sync` and `broadcast` will be
70
-
disabled. To enable these commands a blockchain client feature such as `electrum` or another
69
+
If no blockchain client feature is enabled online wallet commands `sync` and `broadcast` will be
70
+
disabled. To enable these commands a blockchain client feature such as `electrum` or another
71
71
blockchain client feature must be enabled. Below is an example of how to run the `bdk-cli` binary with
72
72
the `electrum` blockchain client feature.
73
73
@@ -79,8 +79,10 @@ Available blockchain client features are:
79
79
`electrum`, `esplora`, `kyoto`, `rpc`.
80
80
81
81
### From crates.io
82
-
You can install the binary for the latest tag of `bdk-cli` with online wallet features
82
+
83
+
You can install the binary for the latest tag of `bdk-cli` with online wallet features
83
84
directly from [crates.io](https://crates.io/crates/bdk-cli) with a command as below:
85
+
84
86
```sh
85
87
cargo install bdk-cli --features electrum
86
88
```
@@ -114,30 +116,32 @@ cargo run -- key generate
114
116
115
117
## Justfile
116
118
117
-
We have added the `just` command runner to help you with common commands (during development) and running regtest `bitcoind` if you are using the `rpc` feature.
119
+
We have added the `just` command runner to help you with common commands (during development) and running regtest `bitcoind` if you are using the `rpc` feature.
118
120
Visit the [just](https://just.systems/man/en/packages.html) page for setup instructions.
119
121
120
122
The below are some of the commands included:
121
123
122
-
```shell
124
+
```shell
123
125
just # list all available recipes
124
126
just test# test the project
125
127
just build # build the project
126
128
```
127
129
128
130
### Using `Justfile` to run `bitcoind` as a Client
129
131
130
-
If you are testing `bdk-cli` in regtest mode and wants to use your `bitcoind` node as a blockchain client, the `Justfile` can help you to quickly do so. Below are the steps to use your `bitcoind` node in *regtest* mode with `bdk-cli`:
132
+
If you are testing `bdk-cli` in regtest mode and wants to use your `bitcoind` node as a blockchain client, the `Justfile` can help you to quickly do so. Below are the steps to use your `bitcoind` node in _regtest_ mode with `bdk-cli`:
131
133
132
134
Note: You can modify the `Justfile` to reflect your nodes' configuration values. These values are the default values used in `bdk-cli`
133
-
> * default wallet: The set default wallet name is `regtest_default_wallet`
134
-
> * default data directory: The set default data directory is `~/.bdk-bitcoin`
135
-
> * RPC username: The set RPC username is `user`
136
-
> * RPC password: The set RPC password is `password`
135
+
136
+
> - default wallet: The set default wallet name is `regtest_default_wallet`
137
+
> - default data directory: The set default data directory is `~/.bdk-bitcoin`
138
+
> - RPC username: The set RPC username is `user`
139
+
> - RPC password: The set RPC password is `password`
137
140
138
141
#### Steps
139
142
140
143
1. Start bitcoind
144
+
141
145
```shell
142
146
just start
143
147
```
@@ -147,8 +151,10 @@ Note: You can modify the `Justfile` to reflect your nodes' configuration values.
147
151
```shell
148
152
just create
149
153
```
154
+
150
155
or
151
-
```shell
156
+
157
+
```shell
152
158
just load
153
159
```
154
160
@@ -157,18 +163,21 @@ Note: You can modify the `Justfile` to reflect your nodes' configuration values.
157
163
```shell
158
164
just address
159
165
```
160
-
166
+
161
167
4. Mine 101 blocks on regtest to bitcoind wallet address
168
+
162
169
```shell
163
170
just generate 101 $(just address)
164
171
```
165
172
166
173
5. Check the bitcoind wallet balance
174
+
167
175
```shell
168
176
just balance
169
177
```
170
178
171
179
6. Setup your `bdk-cli` wallet config and connect it to your regtest node to perform a `sync`
@@ -178,12 +187,14 @@ Note: You can modify the `Justfile` to reflect your nodes' configuration values.
178
187
```
179
188
180
189
7. Generate an address from your `bdk-cli` wallet and fund it with 10 bitcoins from your bitcoind node's wallet
190
+
181
191
```shell
182
192
export address=$(cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password new_address | jq '.address')
183
193
just send 10 $address
184
194
```
185
195
186
196
8. Mine 6 more blocks to the bitcoind wallet
197
+
187
198
```shell
188
199
just generate 6 $(just address)
189
200
```
@@ -196,9 +207,16 @@ Note: You can modify the `Justfile` to reflect your nodes' configuration values.
196
207
197
208
## Formatting Responses using `--pretty` flag
198
209
199
-
You can optionally return outputs of commands in human-readable, tabular format instead of `JSON`. To enable this option, simply add the `--pretty` flag as a top level flag. For instance, you wallet's balance in a pretty format, you can run:
210
+
You can optionally return outputs of commands in human-readable, tabular format instead of `JSON`. To enable this option, simply add the `--pretty` flag as a top level flag. For instance, you wallet's balance in a pretty format, you can run:
0 commit comments