Setup Bitcoin Regtest Locally

The Regression Test Network (regtest) is a parallel blockchain to the Bitcoin blockchain. It works almost identically to the Bitcoin network, but it is used for private development. Regtest is most similar to testnet in that the coins on the regtest network are not monetized. Additionally, regtest is meant solely for private testing; external connections are not enabled and the mining difficulty is set to zero. This allows a regtest user to mine as many blocks as they want, making testing easier.

Many developers consider regtest mode the preferred way to develop new applications.

Setting up your own regtest node can easily be achieved with docker.

version: '3.7'
services:
  bitcoin-core:
    image: ruimarinho/bitcoin-core:latest
    command:
      -printtoconsole
      -regtest=1
      -rest
      -txindex=1
      -listen=1
      -server=1
      -port=18444
      -rpcallowip=0.0.0.0/0
      -rpcbind=0.0.0.0
      -rpcport=18443
      -rpcuser=user
      -rpcpassword=randompass
      -zmqpubrawblock=tcp://0.0.0.0:28332
      -zmqpubrawtx=tcp://0.0.0.0:28332
      -server
    entrypoint: ["bash", "-c", "bitcoind"]
    ports:
      - 18443:18443
      - 18444:18444
      - 28332:28332
    volumes:
      - ./bitcoin-data:/data
      - ./bitcoin-conf/bitcoin.conf:/root/.bitcoin/bitcoin.conf
    networks:
      - bitcoin-network
networks:
  bitcoin-network:

volumes:
  bitcoin-data: