]> Untitled Git - bdk-cli/commitdiff
docs: reformat and simplify README steps for just & bitcoind
authorSteve Myers <steve@notmandatory.org>
Fri, 13 Jun 2025 01:06:42 +0000 (20:06 -0500)
committerSteve Myers <steve@notmandatory.org>
Fri, 13 Jun 2025 01:06:42 +0000 (20:06 -0500)
Justfile
README.md

index c1c462ab11bdfbf58555ddefbb6d86c512724e18..013c4076c724c927cbc8c5bb64fd913f4f77aa93 100644 (file)
--- a/Justfile
+++ b/Justfile
@@ -95,3 +95,8 @@ send n address wallet=default_wallet:
 [group('rpc')]
 descriptors private wallet=default_wallet:
     bitcoin-cli -datadir={{default_datadir}} -regtest -rpcwallet={{wallet}} -rpcuser={{rpc_user}} -rpcpassword={{rpc_password}} listdescriptors {{private}}
+
+# run any bitcoin-cli rpc command
+[group('rpc')]
+rpc command wallet=default_wallet:
+    bitcoin-cli -datadir={{default_datadir}} -regtest -rpcwallet={{wallet}} -rpcuser={{rpc_user}} -rpcpassword={{rpc_password}} {{command}}
\ No newline at end of file
index 20ea115f2879e7f60acb8a39b62caf6b8b039793..e5d877436f46cf2bb07250dc9b1763f7cf10a288 100644 (file)
--- a/README.md
+++ b/README.md
@@ -128,7 +128,7 @@ just build # build the project
 
 ### Using `Justfile` to run `bitcoind` as a Client
 
-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:
+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`:
 
 Note: You can modify the `Justfile` to reflect your nodes' configuration values. These values are the default values used in `bdk-cli`
  > * 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.
 #### Steps
 
 1. Start bitcoind
-
->> `just start`
-
-2. Create or load a wallet
-
- >> `just create` # if you do not have an existing default wallet (regtest_default_wallet)
-
- >> `load wallet` # if you have an existing default wallet
-
-3. Generate an address to mine regtest bitcoins.
-
->> `just address` # if you want to save to use in the next step  `address=$(just address)`
-
-4. Mine bitcoin
-
->> `just generate 101 $address` # or just generate to a new addres `just generate 101 (just address)`
-
-5. Check Balance
-
->> `just balance`
-
-6. Connect your `bdk-cli` wallet to your node and perform a full_scan
-
->> `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`
+   ```shell
+   just start
+   ```
+
+2. Create or load a bitcoind wallet with default wallet name
+
+   ```shell
+   just create
+   ```
+   or
+   ```shell 
+   just load
+   ```
+
+3. Generate a bitcoind wallet address to send regtest bitcoins to.
+
+   ```shell
+   just address
+   ```
+   
+4. Mine 101 blocks on regtest to bitcoind wallet address
+   ```shell
+   just generate 101 $(just address)
+   ```
+
+5. Check the bitcoind wallet balance
+   ```shell
+   just balance
+   ```
+
+6. Setup your `bdk-cli` wallet config and connect it to your regtest node to perform a `sync`
+   ```shell
+   export NETWORK=regtest
+   export EXT_DESCRIPTOR='wpkh(tprv8ZgxMBicQKsPdMzWj9KHvoExKJDqfZFuT5D8o9XVZ3wfyUcnPNPJKncq5df8kpDWnMxoKbGrpS44VawHG17ZSwTkdhEtVRzSYXd14vDYXKw/0/*)'
+   export INT_DESCRIPTOR='wpkh(tprv8ZgxMBicQKsPdMzWj9KHvoExKJDqfZFuT5D8o9XVZ3wfyUcnPNPJKncq5df8kpDWnMxoKbGrpS44VawHG17ZSwTkdhEtVRzSYXd14vDYXKw/1/*)'
+   export DATABASE_TYPE=sqlite
+   cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password sync
+   ```
 
 7. Generate an address from your `bdk-cli` wallet and fund it with 10 bitcoins from your bitcoind node's wallet
-
->> `just send 10 {your-bdk-cli-wallet-address-here}`
-
-8. Mine 6 more blocks 
-
->> `just generate 6 $address`
-
-You can `sync` your `bdk-cli` wallet now and the balance should reflect
+   ```shell
+   export address=$(cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password new_address | jq '.address')
+   just send 10 $address
+   ```
+
+8. Mine 6 more blocks to the bitcoind wallet
+   ```shell
+   just generate 6 $(just address)
+   ```
+
+9. You can `sync` your `bdk-cli` wallet now and the balance should reflect the regtest bitcoin you received
+   ```shell
+   cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password sync
+   cargo run --features rpc -- wallet -u "127.0.0.1:18443" -c rpc -a user:password balance
+   ```
 
 ## Minimum Supported Rust Version (MSRV)