When you build something on Monero (a payment integration, a wallet feature, a test of how your app handles confirmations) you want a chain you control: blocks on demand, coins for free, no waiting, nothing at stake. Monero offers this through regtest mode, a private test chain run by monerod --regtest. You mine blocks instantly with an RPC call, your wallet receives coinbase rewards, and you can reset the whole thing by deleting a folder.

This guide sets up a private chain on one machine, mines coins into a test wallet, sends transactions, connects the wallet RPC, extends it to several nodes, and explains when the public stagenet is the better choice. Everything here uses the official Monero binaries (current release 0.18.5.4); flags can change between versions, so check monerod --help for yours.

Regtest, testnet and stagenet

NetworkWho runs itCoinsBlocksUse it for
Regtest (private)YouCreated by you, worthlessOn demandDevelopment, automated tests, CI
StagenetThe publicFree from faucets, worthlessEvery ~2 minutes, like mainnetTesting against real-world conditions
TestnetThe publicFree, worthless~2 minutes; often runs upcoming rules earlyTesting future protocol changes
MainnetThe publicReal XMR~2 minutesReal money only

Stagenet guide covers the public networks. Regtest is for when you need control and speed.

Step 1: start a regtest node

Use a separate data directory so nothing touches a real node's data:

monerod --regtest --offline --fixed-difficulty 1 \
  --data-dir ~/monero-regtest \
  --rpc-bind-ip 127.0.0.1 --rpc-bind-port 18081 \
  --no-igd --non-interactive

What the flags do:

  • --regtest: run a private regression-test chain instead of mainnet.
  • --offline: do not connect to any peers. Your chain stays private.
  • --fixed-difficulty 1: every hash is a valid block, so blocks are created instantly.
  • --data-dir: keep this chain's database in its own folder. Delete the folder to start over.
  • --rpc-bind-ip 127.0.0.1: only this machine can talk to the RPC. Keep it that way.

Regtest uses the mainnet address format. That is convenient (mainnet tooling works) and a trap: never reuse addresses or wallets between a regtest chain and mainnet, and never point a regtest setup at a wallet holding real funds. Create dedicated test wallets.

Step 2: create a test wallet

In another terminal:

monero-wallet-cli --generate-new-wallet ~/monero-regtest/wallets/alice \
  --daemon-address 127.0.0.1:18081 --trusted-daemon

No network flag is needed for a regtest daemon. Note the wallet's primary address (address in the CLI). Make a second wallet, bob, the same way, so you have someone to pay.

Step 3: mine blocks with generateblocks

generateblocks is a daemon JSON-RPC method that only works in regtest. It mines a number of blocks paying the coinbase reward to an address:

curl -s http://127.0.0.1:18081/json_rpc -H 'Content-Type: application/json' -d '{
  "jsonrpc":"2.0","id":"0","method":"generateblocks",
  "params":{"amount_of_blocks":100,"wallet_address":"<alice address>"}
}'

The response lists the new block hashes and the new height. Alternatively, start_mining <address> 1 in the daemon console mines with one thread; with difficulty 1 that also produces blocks very quickly.

Coinbase outputs are locked for 60 blocks. A freshly mined reward cannot be spent until 60 more blocks exist on top of it, which is why the example mines 100. If Alice's balance shows as locked, generate more blocks. Ordinary transaction outputs have the usual 10-block lock. Unlock time explained.

Step 4: send a transaction

In Alice's wallet:

refresh
balance
transfer <bob address> 10

The transaction goes into the regtest node's mempool. It confirms only when a block is mined, so generate one or more blocks with generateblocks. Then refresh Bob's wallet and you will see the incoming payment, locked until 10 blocks have been added.

This loop (send, generate N blocks, check) is how you test confirmation handling, unlock logic and payment detection deterministically, without waiting two minutes per block.

Step 5: use the wallet RPC

For an application, run monero-wallet-rpc against the regtest node:

monero-wallet-rpc --daemon-address 127.0.0.1:18081 --trusted-daemon \
  --wallet-dir ~/monero-regtest/wallets \
  --rpc-bind-ip 127.0.0.1 --rpc-bind-port 18083 \
  --rpc-login test:test

Then open_wallet, get_balance, create_address, transfer, get_transfers and the rest work exactly as against mainnet. Wallet RPC guide, accepting Monero payments. The test login is only acceptable because everything is bound to localhost on a throwaway chain; use real credentials anywhere else.

Step 6 (optional): a private network of several nodes

To test relay behaviour, reorgs or multiple wallets on separate nodes, run two or more regtest daemons that talk only to each other. Give each its own data directory and ports, drop --offline, and use --add-exclusive-node to connect them:

monerod --regtest --fixed-difficulty 1 --data-dir ~/rt-a \
  --p2p-bind-port 28080 --rpc-bind-port 28081 --no-igd \
  --add-exclusive-node 127.0.0.1:38080

monerod --regtest --fixed-difficulty 1 --data-dir ~/rt-b \
  --p2p-bind-port 38080 --rpc-bind-port 38081 --no-igd \
  --add-exclusive-node 127.0.0.1:28080

--add-exclusive-node makes each node connect only to the listed peers, so your chain never meets the public network. Mine on one node and watch the other sync. You can simulate a reorganisation by disconnecting the nodes, mining different blocks on each, and reconnecting; the node with less work will switch. Our reorg tracker shows what real reorgs on mainnet look like.

Step 7: reset

Stop the daemons and wallets and delete the data directories and test wallets. Next start is a fresh genesis.

Using Docker for tests and CI

The same commands work in containers, which is convenient for continuous integration: one container for monerod --regtest, one for the wallet RPC, your test suite talking to both over a private network. Run a Monero node in Docker shows how to build and run the official binaries in a container; replace the mainnet flags with the regtest ones above.

Limits of regtest

  • It is not realistic. Instant blocks, fixed difficulty and tiny rings do not behave like mainnet. Decoy selection on a short chain is nothing like the real one; some wallet errors about not enough outputs for a ring are a regtest artefact. Transaction failed errors.
  • Fees and block weights differ from mainnet's live conditions; use the fee calculator and mempool for those.
  • Timing logic that depends on real block intervals should also be tested on stagenet.

A sensible workflow: unit and integration tests on regtest; a final pass on stagenet; then a small real payment on mainnet.

Our recommendation

FAQ

How do I run a private Monero testnet?

Start monerod --regtest --offline --fixed-difficulty 1 with its own --data-dir, then mine blocks to a test wallet with the generateblocks RPC method.

What does generateblocks do in Monero?

It is a daemon RPC method, available only in regtest mode, that mines a given number of blocks and pays the coinbase rewards to an address you specify.

Why is my regtest balance locked?

Coinbase rewards unlock after 60 blocks and ordinary outputs after 10. Generate more blocks.

Do regtest addresses look like mainnet addresses?

Yes, regtest uses the mainnet address format. Keep test wallets separate and never mix them with real funds.

Should I use regtest or stagenet?

Regtest for fast, controlled development and automated tests; stagenet when you need realistic block times, decoys and network conditions.