Crates.io | bitceptron_regtest_utils |
lib.rs | bitceptron_regtest_utils |
version | 0.5.0 |
source | src |
created_at | 2024-04-10 03:37:02.139056 |
updated_at | 2024-04-10 09:03:47.965876 |
description | A tiny utility crate for running bitcoin's regtest network. |
homepage | |
repository | https://github.com/bitceptron/bitceptron_regtest_utils |
max_upload_size | |
id | 1203111 |
size | 12,971 |
This is a tiny Bitcoin Regtest utility crate.
Usage:
const BITCOIND_PATH: &str = "/Users/x/Desktop/bitcoin-26.0/bin/bitcoind";
const BITCOIN_CONF_PATH: &str = "/Users/x/Desktop/bitcoin-26.0/bitcoin.conf";
const TEMP_PATH: &str = "/Users/x/Desktop/regtemp";
const NETWORK: Network = Network::Regtest;
let mut clients = spawn_regtest(
BITCOIND_PATH,
BITCOIN_CONF_PATH,
TEMP_PATH,
vec![
RegtestConf::new(18447, 18448).unwrap(),
RegtestConf::new(18449, 18450).unwrap(),
],
500,
2,
)
.unwrap();
let mining_client = clients.remove(0);
let rusty_client = clients.remove(0);
let mining_address = mining_client
.get_new_address(Some("mining"), Some(AddressType::Bech32))
.unwrap()
.require_network(NETWORK)
.unwrap();
let _ = mining_client
.generate_to_address(150, &mining_address)
.unwrap();
unwind_regtest(vec![rusty_client, mining_client], TEMP_PATH, 200);