Starting up a node in regtest

The regtest mode (regression testing mode) can be used to create a local blockchain for testing purposes.

The following commands can be used to start up a node in the regtest mode:

$ bitcoind -regtest -daemon
Bitcoin server starting  

Blocks can be generated using the following command:

$ bitcoin-cli -regtest generate 200  

Relevant log messages can be viewed in the .bitcoin/regtest directory on a Linux system under debug.log:

Messages in Bitcoin debug log

After block generation, the balance can be viewed as follows:

$ bitcoin-cli -regtest getbalance
8750.00000000  

The node can be stopped using this:

$ bitcoin-cli ...

Get Mastering Blockchain - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.