Jannah Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.
Business

How can I efficiently build near-full blocks with regtest?

I would like to build a nearly complete block with regtest.

I wrote a script that does the job (on bitcoin core v24.0rc3), but it’s too slow to be practical for my use case:

#!/usr/bin/env bash

BCLI="./bitcoin-cli -regtest"
DAEMON="./bitcoind -regtest"

# Start from a clean node
$BCLI stop
sleep 2
rm -rf ~/.bitcoin/regtest
$DAEMON
sleep 2

set -eo pipefail

$BCLI -named createwallet wallet_name="miner" load_on_startup=false
mineraddress=$($BCLI getnewaddress)
$BCLI generatetoaddress 1000 $mineraddress
i=0
time while [ $i -lt 100 ]
do
    newaddress=$($BCLI getnewaddress)
    $BCLI sendtoaddress $newaddress 1
    i=$((i+1))
done
$BCLI generatetoaddress 1 "$mineraddress"

This script has some problems.

  • Very slow, creating only 10 transactions per second
  • slows down as more tx are created
  • To avoid hitting the limit of 25 chained mempool transactions, you should generate a large number of blocks (eg 1000 instead of 101). This makes the script even slower.
  • The script above creates 100 tx’s just to measure performance, but I actually want to create ~7000 tx’s.

Can this be improved by more than a certain factor?

How can I efficiently build near-full blocks with regtest?

Source link How can I efficiently build near-full blocks with regtest?

Related Articles

Back to top button