Simulating Block Discovery

We can simulate the block discovery function of a bitcoin mining node in Regression Test Mode. Doing so also implicitly rewards a local test wallet with the block rewards.

Note that the Bitcoin network consensus rules require that Transaction Processors (mining nodes) can’t spend their block reward until at least 100 subsequent blocks have been discovered. This means that when we first start our bitcoind in regression test mode, we need to generate at least 101 blocks to get the reward of 1 block spendable from our local wallet.

Let’s generate our first coins

bitcoin-cli -datadir=$BITCOIN_HOME/data generate 101

You will see something like this in the end of your $BITCOIN_HOME/bitcoind.log file :

2020-06-02 16:01:16 AddToWallet abd8743a82a7fe4cf24766de165ad398b2992fbb6140b11479095495d253c226  new

You will now have some spendable coins in your local bitcoin wallet. This wallet is managed directly by the bitcoin client node.