Skip to content

Commit e171990

Browse files
committed
docs: update README steps for just & bitcoind
Update README to show how to use `just` to spine up bitcoind in regtest mode, connect your bdk-cli wallet and fund your bdk-cli wallet. [issue: #199]
1 parent 595f104 commit e171990

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,57 @@ The below are some of the commands included:
122122

123123
``` shell
124124
just # list all available recipes
125-
just start # start regtest bitcoind in default dir
126125
just test # test the project
127126
just build # build the project
128127
```
129128

129+
### Using `Justfile` to run `bitcoind` as a Client
130+
131+
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 `start`, `connect` and `run` your `bitcoind` node:
132+
133+
Note: You can modify the `Justfile` to reflect your nodes' configuration values. These values are the default values used in `bdk-cli`
134+
> * default wallet: The set default wallet name is `regtest_default_wallet`
135+
> * default data directory: The set default data directory is `~/.bdk-bitcoin`
136+
> * RPC username: The set RPC username is `user`
137+
> * RPC password: The set RPC password is `password`
138+
139+
#### Steps
140+
141+
1. Start bitcoind
142+
143+
>> `just start`
144+
145+
2. Create or load a wallet
146+
147+
>> `just create` # if you do not have an existing default wallet (regtest_default_wallet)
148+
149+
>> `load wallet` # if you have an existing default wallet
150+
151+
3. Generate an address to mine regtest bitcoins.
152+
153+
>> `just address` # if you want to save to use in the next step `address=$(just address)`
154+
155+
4. Mine bitcoin
156+
157+
>> `just generate 101 $address` # or just generate to a new addres `just generate 101 (just address)`
158+
159+
5. Check Balance
160+
161+
>> `just balance`
162+
163+
6. Connect your `bdk-cli` wallet to your node and perform a full_scan
164+
165+
>> `cargo run --features rpc -- -n regtest wallet -w {your-bdk-cli-wallet-name} -u "127.0.0.1:18443" -c rpc -a user:password -d sqlite full_scan`
166+
167+
7. Generate an address from your `bdk-cli` wallet and fund it with 10 bitcoins from your bitcoind node's wallet
168+
169+
>> `just send 10 {your-bdk-cli-wallet-address-here}`
170+
171+
8. Mine 6 more blocks
172+
173+
>> `just generate 6 $address`
174+
175+
You can `sync` your `bdk-cli` wallet now and the balance should reflect
130176

131177
## Minimum Supported Rust Version (MSRV)
132178

0 commit comments

Comments
 (0)