Skip to content

Commit a6364e2

Browse files
committed
docs(rpc): add README and print ext address for FilterIter example
1 parent 8fc03ee commit a6364e2

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Example bitcoind RPC sync
2+
3+
### Simple Signet Test with FilterIter
4+
5+
1. Start local signet bitcoind. (~8 GB space required)
6+
```
7+
mkdir -p /tmp/signet/bitcoind
8+
bitcoind -signet -server -fallbackfee=0.0002 -blockfilterindex -datadir=/tmp/signet/bitcoind -daemon
9+
tail -f /tmp/signet/bitcoind/signet/debug.log
10+
```
11+
Watch debug.log and wait for bitcoind to finish syncing.
12+
13+
2. Set bitcoind env variables.
14+
```
15+
export RPC_URL=127.0.0.1:38332
16+
export RPC_COOKIE=/tmp/signet/bitcoind/signet/.cookie
17+
```
18+
3. Run `filter_iter` example.
19+
```
20+
cargo run -p bdk_bitcoind_rpc --example filter_iter
21+
```

crates/bitcoind_rpc/examples/filter_iter.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use bdk_chain::local_chain::LocalChain;
99
use bdk_chain::miniscript::Descriptor;
1010
use bdk_chain::{BlockId, ConfirmationBlockTime, IndexedTxGraph, SpkIterator};
1111
use bdk_testenv::anyhow;
12+
use bitcoin::Address;
1213

1314
// This example shows how BDK chain and tx-graph structures are updated using compact
1415
// filters syncing. Assumes a connection can be made to a bitcoin node via environment
@@ -102,5 +103,9 @@ fn main() -> anyhow::Result<()> {
102103
}
103104
}
104105

106+
let unused_spk = graph.index.reveal_next_spk("external").unwrap().0 .1;
107+
let unused_address = Address::from_script(&unused_spk, NETWORK)?;
108+
println!("Next external address: {}", unused_address);
109+
105110
Ok(())
106111
}

0 commit comments

Comments
 (0)