Last active
January 9, 2023 17:01
-
-
Save notmandatory/e427dd478b026f9773fad1369857e768 to your computer and use it in GitHub Desktop.
local regtest bitcoind bdk testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start regtest bitcoind | |
mkdir -p /tmp/regtest1/bitcoind | |
bitcoind -datadir=/tmp/regtest1/bitcoind -regtest -server -fallbackfee=0.0002 -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 -blockfilterindex=1 -peerblockfilters=1 -daemon | |
# generate keys and create test descriptor | |
cargo run --features rpc -- key generate | |
ALICE_KEY=tprv8ZgxMBicQKsPec2RXKZgdJhFsnm2s4xZvYXaaUzcyr3ybx9L2kCTtGAjYjAEuT1aPoLapD6M5Zrk99u4xHZf2NbdPT2X7zsu5qoWmSxoiVC | |
BOB_KEY=tprv8ZgxMBicQKsPfKtuWgVHdn5C1AJvXgSTPJqyCfAa5aCxFutmCnxS8DRT8Cyni4mk4NDes5Cpqb93RLsjy9a7ZXEw4sZDZ6Xpk3vpgYsiH22 | |
DESC="wsh(multi(2,$ALICE_KEY/*,$BOB_KEY/*))" | |
# get test address | |
cargo run --features rpc -- -n regtest wallet --cookie /tmp/regtest1/bitcoind/regtest/.cookie -d $DESC sync | |
cargo run --features rpc -- -n regtest wallet --cookie /tmp/regtest1/bitcoind/regtest/.cookie -d $DESC get_new_address | |
# generate test btc | |
bitcoin-cli -datadir=/tmp/regtest1/bitcoind -regtest generatetoaddress 101 "<TEST ADDRESS>" | |
# view new balance | |
cargo run --features rpc -- -n regtest wallet --cookie /tmp/regtest1/bitcoind/regtest/.cookie -d $DESC sync | |
cargo run --features rpc -- -n regtest wallet --cookie /tmp/regtest1/bitcoind/regtest/.cookie -d $DESC get_balance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment