Updated regtest example
This commit is contained in:
parent
74c95bfdf5
commit
4263977d99
@ -171,52 +171,58 @@ Helpful link: https://gist.github.com/System-Glitch/cb4e87bf1ae3fec9925725bb3ebe
|
|||||||
|
|
||||||
Run bitcoind on regtest:
|
Run bitcoind on regtest:
|
||||||
```
|
```
|
||||||
bitcoind -regtest -rpcport=8332
|
bitcoind -regtest
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a new wallet, if needed:
|
Create a new wallet, if needed:
|
||||||
```
|
```
|
||||||
bitcoin-cli -regtest -rpcport=8332 createwallet test
|
bitcoin-cli -regtest createwallet test
|
||||||
```
|
```
|
||||||
|
|
||||||
Load wallet (this command may take a while if you have lot of UTXOs):
|
Load wallet (this command may take a while if you have lot of UTXOs):
|
||||||
```
|
```
|
||||||
bitcoin-cli -regtest -rpcport=8332 loadwallet test
|
bitcoin-cli -regtest loadwallet test
|
||||||
```
|
```
|
||||||
|
|
||||||
Get a new address:
|
Get a new address:
|
||||||
```
|
```
|
||||||
address=$(./src/bitcoin-cli -regtest -rpcport=8332 getnewaddress)
|
address=$(bitcoin-cli -regtest getnewaddress)
|
||||||
```
|
```
|
||||||
|
|
||||||
Mine blocks to the previously generated address. You need at least 101 blocks before you can spend. This will take some time to execute (~1 min):
|
Mine blocks to the previously generated address. You need at least 101 blocks before you can spend. This will take some time to execute (~1 min):
|
||||||
```
|
```
|
||||||
bitcoin-cli -regtest -rpcport=8332 generatetoaddress 101 $address
|
bitcoin-cli -regtest generatetoaddress 101 $address
|
||||||
```
|
```
|
||||||
|
|
||||||
Send 0.1 BTC at 5 sat/vB to another address:
|
Send 0.1 BTC at 5 sat/vB to another address:
|
||||||
```
|
```
|
||||||
./src/bitcoin-cli -named -regtest -rpcport=8332 sendtoaddress address=$(./src/bitcoin-cli -regtest -rpcport=8332 getnewaddress) amount=0.1 fee_rate=5
|
bitcoin-cli -named -regtest sendtoaddress address=$(bitcoin-cli -regtest getnewaddress) amount=0.1 fee_rate=5
|
||||||
```
|
```
|
||||||
|
|
||||||
See more example of `sendtoaddress`:
|
See more example of `sendtoaddress`:
|
||||||
```
|
```
|
||||||
./src/bitcoin-cli sendtoaddress # will print the help
|
bitcoin-cli sendtoaddress # will print the help
|
||||||
```
|
```
|
||||||
|
|
||||||
Mini script to generate transactions with random TX fee-rate (between 1 to 100 sat/vB). It's slow so don't expect to use this to test mempool spam, except if you let it run for a long time, or maybe with multiple regtest nodes connected to each other.
|
Mini script to generate random network activity (random TX count with random tx fee-rate). It's slow so don't expect to use this to test mempool spam, except if you let it run for a long time, or maybe with multiple regtest nodes connected to each other.
|
||||||
```
|
```
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
address=$(./src/bitcoin-cli -regtest -rpcport=8332 getnewaddress)
|
address=$(bitcoin-cli -regtest getnewaddress)
|
||||||
|
bitcoin-cli -regtest generatetoaddress 101 $address
|
||||||
for i in {1..1000000}
|
for i in {1..1000000}
|
||||||
do
|
do
|
||||||
./src/bitcoin-cli -regtest -rpcport=8332 -named sendtoaddress address=$address amount=0.01 fee_rate=$(jot -r 1 1 100)
|
for y in $(seq 1 "$(jot -r 1 1 1000)")
|
||||||
|
do
|
||||||
|
bitcoin-cli -regtest -named sendtoaddress address=$address amount=0.01 fee_rate=$(jot -r 1 1 100)
|
||||||
|
done
|
||||||
|
bitcoin-cli -regtest generatetoaddress 1 $address
|
||||||
|
sleep 5
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
Generate block at regular interval (every 10 seconds in this example):
|
Generate block at regular interval (every 10 seconds in this example):
|
||||||
```
|
```
|
||||||
watch -n 10 "./src/bitcoin-cli -regtest -rpcport=8332 generatetoaddress 1 $address"
|
watch -n 10 "bitcoin-cli -regtest generatetoaddress 1 $address"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mining pools update
|
### Mining pools update
|
||||||
|
Loading…
x
Reference in New Issue
Block a user