bitceptron_regtest_utils

Crates.iobitceptron_regtest_utils
lib.rsbitceptron_regtest_utils
version0.5.0
sourcesrc
created_at2024-04-10 03:37:02.139056
updated_at2024-04-10 09:03:47.965876
descriptionA tiny utility crate for running bitcoin's regtest network.
homepage
repositoryhttps://github.com/bitceptron/bitceptron_regtest_utils
max_upload_size
id1203111
size12,971
(bitceptron)

documentation

https://docs.rs/bitceptron_regtest_utils/latest/bitceptron_regtest_utils/

README

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);
Commit count: 12

cargo fmt