Skip to content

Commit 2524da3

Browse files
committed
docs: reformat and simplify README steps for just & bitcoind
1 parent b289a61 commit 2524da3

File tree

2 files changed

+59
-33
lines changed

2 files changed

+59
-33
lines changed

Justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,8 @@ send n address wallet=default_wallet:
9595
[group('rpc')]
9696
descriptors private wallet=default_wallet:
9797
bitcoin-cli -datadir={{default_datadir}} -regtest -rpcwallet={{wallet}} -rpcuser={{rpc_user}} -rpcpassword={{rpc_password}} listdescriptors {{private}}
98+
99+
# run any bitcoin-cli rpc command
100+
[group('rpc')]
101+
rpc command wallet=default_wallet:
102+
bitcoin-cli -datadir={{default_datadir}} -regtest -rpcwallet={{wallet}} -rpcuser={{rpc_user}} -rpcpassword={{rpc_password}} {{command}}

README.md

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ just build # build the project
128128

129129
### Using `Justfile` to run `bitcoind` as a Client
130130

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:
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 use your `bitcoind` node in *regtest* mode with `bdk-cli`:
132132

133133
Note: You can modify the `Justfile` to reflect your nodes' configuration values. These values are the default values used in `bdk-cli`
134134
> * default wallet: The set default wallet name is `regtest_default_wallet`
@@ -139,40 +139,61 @@ Note: You can modify the `Justfile` to reflect your nodes' configuration values.
139139
#### Steps
140140

141141
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`
142+
```shell
143+
just start
144+
```
145+
146+
2. Create or load a bitcoind wallet with default wallet name
147+
148+
```shell
149+
just create
150+
```
151+
or
152+
```shell
153+
just load
154+
```
155+
156+
3. Generate a bitcoind wallet address to send regtest bitcoins to.
157+
158+
```shell
159+
just address
160+
```
161+
162+
4. Mine 101 blocks on regtest to bitcoind wallet address
163+
```shell
164+
just generate 101 $(just address)
165+
```
166+
167+
5. Check the bitcoind wallet balance
168+
```shell
169+
just balance
170+
```
171+
172+
6. Setup your `bdk-cli` wallet config and connect it to your regtest node to perform a `sync`
173+
```shell
174+
export NETWORK=regtest
175+
export EXT_DESCRIPTOR='wpkh(tprv8ZgxMBicQKsPdMzWj9KHvoExKJDqfZFuT5D8o9XVZ3wfyUcnPNPJKncq5df8kpDWnMxoKbGrpS44VawHG17ZSwTkdhEtVRzSYXd14vDYXKw/0/*)'
176+
export INT_DESCRIPTOR='wpkh(tprv8ZgxMBicQKsPdMzWj9KHvoExKJDqfZFuT5D8o9XVZ3wfyUcnPNPJKncq5df8kpDWnMxoKbGrpS44VawHG17ZSwTkdhEtVRzSYXd14vDYXKw/1/*)'
177+
export DATABASE_TYPE=sqlite
178+
cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password sync
179+
```
166180

167181
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
182+
```shell
183+
export address=$(cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password new_address | jq '.address')
184+
just send 10 $address
185+
```
186+
187+
8. Mine 6 more blocks to the bitcoind wallet
188+
```shell
189+
just generate 6 $(just address)
190+
```
191+
192+
9. You can `sync` your `bdk-cli` wallet now and the balance should reflect the regtest bitcoin you received
193+
```shell
194+
cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password sync
195+
cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password balance
196+
```
176197

177198
## Minimum Supported Rust Version (MSRV)
178199

0 commit comments

Comments
 (0)