Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

Commit 91a3d42

Browse files
committed
fund example
1 parent c885ed8 commit 91a3d42

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

romeo/examples/fund.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use std::str::FromStr;
2+
3+
use bdk::{
4+
bitcoin::{Address, BlockHash},
5+
bitcoincore_rpc::{Auth, Client, RpcApi},
6+
};
7+
8+
fn mine_blocks(client: &Client, blocks: u64, address: &str) -> Vec<BlockHash> {
9+
client
10+
.generate_to_address(blocks, &Address::from_str(address).unwrap())
11+
.unwrap()
12+
}
13+
14+
fn main() {
15+
let client = Client::new(
16+
"http://localhost:32790",
17+
Auth::UserPass("devnet".into(), "devnet".into()),
18+
)
19+
.unwrap();
20+
21+
// p2wpkh W0
22+
let address = "bcrt1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxfrjz47";
23+
let block_hashes = mine_blocks(&client, 10, address);
24+
println!("blocks mined: {block_hashes:#?}");
25+
}

0 commit comments

Comments
 (0)