Learning objectives
- Understand the purpose and power of Bitcoin Core’s regtest mode
- Set up a private, fully controlled Bitcoin network
- Mine blocks and confirm transactions instantly
- Use regtest for API testing, integration flows, and simulations
Why Regtest matters
regtest stands for Regression Test mode. It is a fully offline, developer-first Bitcoin network that:- Has no network peers (your node is the entire network)
- Lets you mine blocks instantly
- Offers free test coins and instant transaction confirmation
- Works perfectly with automated testing, CI flows, and local wallets
Setting up a fully isolated Bitcoin environment
Start your node in regtest mode:- ~/.bitcoin/regtest/ as your data directory
- A zero-block chain, ready to mine
- No connections to testnet, mainnet, or the internet
Mining blocks instantly
Regtest allows manual block generation. First, create a wallet and get a new address:Sending transactions instantly
With freshly mined coins, you can now send BTC. Regtest has no fee history, so make surefallbackfee=0.0001 is set in bitcoin.conf (see module 1):
GUI alternative: Polar
Polar is a desktop app that sets up a regtest Bitcoin + Lightning network for you using Docker. Why use it? No terminal needed Visual interface for nodes, wallets, payments Supports Bitcoin Core + LND + Core Lightning 🖥️ If you prefer a GUI for testing, Polar is highly recommended. It is especially useful for team demos, education, and debugging. Install it via:- macOS: brew install —cask polar
- Linux: .AppImage from GitHub
- Windows: .exe installer
Activity
Set up a regtest sandbox from scratch:- Start bitcoind in regtest mode.
- Create a wallet named activity_wallet, generate 101 blocks (replace <your_address> with an address from the new wallet).
- Send 2 test transactions (replace <destination_1>, <destination_2> with valid addresses).
- Mine 1 block to confirm (use the same <your_address> as before or another address in activity_wallet).
- Use listtransactions to view history.