Tutorial · Regtest

Give Yourself Coins on Regtest

There is no faucet on regtest: you make the coins by making blocks. This page shows where each coin comes from, when it becomes spendable, what changes after block 100, and how to put exact amounts on the addresses your test needs.

About 15 minutes · Checked 2026-10-21
Start here if you have no node yet

This page assumes a regtest node in ~/divi-regtest exactly as built in start your first regtest node. The commands below were run on a fresh node, so you can follow along from block 0; if your node already has blocks, the heights in the output will differ but the amounts will not.

1The rules of money on regtest

Regtest uses the same code as mainnet with a few numbers changed, so the money rules are the real ones in miniature. Every number in this table comes from the node's source (chainparams.cpp and LegacyBlockSubsidies.cpp in Divi 3.0.0), and the rest of this page shows each of them happening.

RuleRegtestWhat it means for you
Reward per block, blocks 1 to 1001,250 DIVIEach setgenerate 1 pays 1,250 to your wallet.
Maturity20 blocksA reward can be spent once 20 more blocks sit on top of it, that is at 21 confirmations.
Last "proof of work" block100From block 101 every block is a staked block, made from a coin your wallet already holds.
Reward after block 1001,250, then 100 less every 100 blocks, floor 250Blocks 101 to 199 are worth 1,250, blocks 200 to 299 are worth 1,150, and so on.
Split of a staked block's reward50 to the lottery, then 38% staker, 45% masternodes, 16% treasury, 1% charityWith no masternodes on your chain the masternode share goes to the staker, so your wallet sees 996 per block at first.
Lottery blocksevery 10 blocks from 101Block 110, 120, 130, … pay the saved-up lottery money to recent stakers.
Treasury blocksevery 50 blocks from 102Block 150, 200, 250, … pay the saved-up treasury and charity shares to two fixed addresses.

Compare mainnet: the same 1,250 reward and the same 20-block maturity, but lottery and treasury blocks come once a week instead of every few seconds of your time.

2Watch a reward mature

Make one block and look at the transaction it created. The first transaction of every block is the reward, called the coinbase: it has no real input, only a marker, and one output of 1,250 DIVI to an address in your wallet.

divi-cli -datadir=~/divi-regtest setgenerate 1
divi-cli -datadir=~/divi-regtest getblock $(divi-cli -datadir=~/divi-regtest getblockhash 1)
… "tx" : [ "ce0b…" ], …
divi-cli -datadir=~/divi-regtest getrawtransaction <that txid> 1
… "vin" : [ { "coinbase" : "510101", … } ],
    "vout" : [ { "value" : 1250.00000000, … "addresses" : [ "xweFepmNma3CsNUbFDsp74gEPPqgFuA3ds" ] } ] …
divi-cli -datadir=~/divi-regtest listtransactions
… "category" : "immature", "amount" : 1250.00000000, "confirmations" : 1 …
divi-cli -datadir=~/divi-regtest listunspent
[
]

The wallet lists the reward as immature and listunspent, which shows only coins you can spend right now, is empty. Now add blocks and watch the first reward cross the line. Make 19 more (height 20), then one at a time:

divi-cli -datadir=~/divi-regtest setgenerate 19 > /dev/null
divi-cli -datadir=~/divi-regtest getwalletinfo
… "immature_balance" : 25000.00000000, … "spendable_balance" : 0.00000000, …
divi-cli -datadir=~/divi-regtest setgenerate 1 > /dev/null
divi-cli -datadir=~/divi-regtest getwalletinfo
… "immature_balance" : 25000.00000000, … "spendable_balance" : 1250.00000000, …
divi-cli -datadir=~/divi-regtest setgenerate 1 > /dev/null
divi-cli -datadir=~/divi-regtest getwalletinfo
… "immature_balance" : 25000.00000000, … "spendable_balance" : 2500.00000000, …
divi-cli -datadir=~/divi-regtest listunspent
… "amount" : 1250.00000000, "confirmations" : 21 …
… "amount" : 1250.00000000, "confirmations" : 22 …
HeightSpendableImmatureWhy
20025,000Twenty rewards, none with 20 blocks on top yet.
211,25025,000Block 1's reward has 21 confirmations; block 21's reward joined the immature pile.
222,50025,000One reward matures per block from now on, and one new one arrives.
confirmations before a reward is spendable
21
DIVI always maturing once the chain is running
25,000
the output type of a regtest reward
coinbase

3100 blocks, 100,000 DIVI

divi-cli -datadir=~/divi-regtest setgenerate 78 > /dev/null
divi-cli -datadir=~/divi-regtest getblockcount
100
divi-cli -datadir=~/divi-regtest getwalletinfo
… "immature_balance" : 25000.00000000, … "spendable_balance" : 100000.00000000, …
divi-cli -datadir=~/divi-regtest getinfo
… "moneysupply" : 125000.00000000, …

At height 100 the chain has made 100 × 1,250 = 125,000 DIVI, all of it in your wallet: 80 rewards spendable (blocks 1 to 80) and the last 20 still maturing. moneysupply is the node's own count of every coin that exists; on regtest it matches your wallet until you pay someone else.

Reading listtransactions

The first 100 rewards show up with "category" : "generate" once they mature. From block 101 you will see stake_reward instead, and later lottery. On the chain used for this page the final counts were 100 generate, 1,012 stake_reward and 72 lottery entries.

4After block 100 the chain stakes

setgenerate keeps working after block 100, but the blocks it makes are different: they are staked blocks, like every block on mainnet today. Look at block 101.

divi-cli -datadir=~/divi-regtest setgenerate 1 > /dev/null
divi-cli -datadir=~/divi-regtest getblock $(divi-cli -datadir=~/divi-regtest getblockhash 101)
… "tx" : [ "251c3cb2…", "f77409a4…" ], … "moneysupply" : 125996.00000000 …
divi-cli -datadir=~/divi-regtest getrawtransaction f77409a4… 1
… "vin" : [ { "txid" : "…", "vout" : 0, … } ],      ← spends one of your 1,250 rewards
    "vout" : [ { "value" : 0.00000000, … "type" : "nonstandard" },   ← the stake marker
              { "value" : 2246.00000000, … "addresses" : [ "y1WosQEJkqUx…" ] } ] …
divi-cli -datadir=~/divi-regtest getwalletinfo
… "immature_balance" : 25996.00000000, … "spendable_balance" : 100000.00000000, …

Two transactions now. The coinbase is empty. The second one, the coinstake, takes a mature 1,250 coin out of your wallet and gives back 2,246: the 1,250 plus a reward of 996. The whole output is immature again for 20 blocks, which is why spendable stays at 100,000 rather than rising by 1,250: one coin matured, one was staked. Money supply rose by 996, the part of the block reward paid to the staker.

Where did 996 come from? The block is worth 1,250. First 50 DIVI is set aside for the lottery, leaving 1,200. Of that the staker gets 38% (456) and masternodes 45% (540); with no masternode on your chain the staker gets both, 996. The treasury's 16% (192) and charity's 1% (12) are not paid in this block: they are saved up for the next treasury block (step 5).

BlocksBlock valueAfter lottery's 50Staker gets (38% + 45%)Saved for treasury (16%)Saved for charity (1%)
101 to 1991,2501,20099619212
200 to 2991,1501,10091317611
300 to 3991,0501,00083016010
…100 less each 100 blocks
1,100 onwards250 (the floor)200166322

You can check the second row yourself: block 201 on our chain paid its staker 2,163, which is a 1,250 coin plus 913, and moneysupply went from 244,917 at block 200 to 245,830 at block 201, up by 913.

You do not need staking switched on

staking=0 stays in divi.conf. setgenerate builds the staked block itself from a mature coin in your wallet, so blocks still appear only when you ask. That is what makes regtest predictable.

5Treasury and lottery blocks

Make blocks up to 150 and look at the coinstake of block 150. It has two extra outputs.

divi-cli -datadir=~/divi-regtest setgenerate 49 > /dev/null
divi-cli -datadir=~/divi-regtest getblock $(divi-cli -datadir=~/divi-regtest getblockhash 150)
… "tx" : [ "…", "…coinstake…" ], … "moneysupply" : 185000.00000000 …
divi-cli -datadir=~/divi-regtest getrawtransaction <coinstake txid> 1
… 4238.00000000  → y9S94NDz6FbX…   (your stake plus reward)
    9600.00000000  → xw7G6toCcLr2…   (treasury: 50 blocks × 192)
     600.00000000  → y8zytdJziDeX…   (charity: 50 blocks × 12) …

Blocks 200, 250, 300 and so on do the same, with the amounts following the table above: at block 250 the treasury output was 8,800 (50 × 176) and charity 550 (50 × 11). The two addresses are fixed in the regtest code and are not in your wallet, so from block 150 on moneysupply and your balance drift apart.

Lottery blocks are every tenth block from 110. The lottery pays its pot to stakers of recent blocks, and on a one-wallet chain those are all you, so the money comes straight back: it appears in listtransactions as "category" : "lottery". Early lottery blocks on our chain had no winner yet (getlotteryblockwinners 110 listed no candidates); the first payout we saw was 250 DIVI in block 340, and block 500 paid 250 + 25 + 25 to three of our addresses. After block 500 the schedule shifts slightly: lottery blocks are 500, 510, 520 … and the treasury pays in the block after each one (501, 511, …). How winners are chosen is explained in who won the lottery.

So the balance after N blocks is not simply N × 1,250

Up to block 100 it is. After that your wallet gains 996 per block (later 913, 830, …), the treasury and charity addresses take theirs every 50 blocks, and the lottery hands its share back in lumps. If a test needs an exact balance, do not count blocks: pay the exact amount to a fresh address, as in the next step.

6Put exact amounts on addresses

Most tests want "an address with 1,000 DIVI", not "a wallet with whatever the chain paid". Make labelled addresses, pay them all in one transaction with sendmany, and make one block to confirm it.

A1=$(divi-cli -datadir=~/divi-regtest getnewaddress alice)
A2=$(divi-cli -datadir=~/divi-regtest getnewaddress bob)
A3=$(divi-cli -datadir=~/divi-regtest getnewaddress carol)
divi-cli -datadir=~/divi-regtest sendmany "" "{\"$A1\":1000,\"$A2\":2500,\"$A3\":0.5}"
ae0f188bf58db305e39d17a4d2b00d0841b77b60290e49881aae7639056cf724
divi-cli -datadir=~/divi-regtest setgenerate 1 > /dev/null
divi-cli -datadir=~/divi-regtest listunspent 1 9999 "[\"$A1\",\"$A2\",\"$A3\"]"
… "address" : "yAAaC9GUx3x8SwFxzKr45f165Do8kUH4hh", "amount" : 1000.00000000, "confirmations" : 1 …
… "address" : "y25MCD9yfHReia4bHXyL92MMBwePRJ6R7V", "amount" : 2500.00000000, "confirmations" : 1 …
… "address" : "xyxxWjSK2zP2PjcLEnxMtvTFtxLmgywm8y", "amount" : 0.50000000, "confirmations" : 1 …
divi-cli -datadir=~/divi-regtest getreceivedbyaddress $A2
2500.00000000

The first argument of sendmany is the account to pay from; the empty string means the wallet's default account, where all the rewards are. The label you gave getnewaddress is only a name for your own bookkeeping. listunspent takes a minimum and maximum number of confirmations and an optional list of addresses, which is the quickest way to see exactly what one address holds.

Ask for more than you have and the node tells you, in satoshis (hundred-millionths of a DIVI):

divi-cli -datadir=~/divi-regtest sendtoaddress $A1 999999999
error: {"code":-6,"message":"Insufficient funds: 99999999900000000(total requested) is greater than 62932749997060(total available)"}

That is 999,999,999 DIVI requested against 629,327.49997060 available: the spendable balance at that moment on our chain, 1,112 blocks in.

7Coins for other wallets and tests

For reference, the chain behind this page reached 1,112 blocks with a spendable balance of 628,677 DIVI and used 23 MB of disk. Regtest coins are cheap: when a test has made a mess of your balances, stop the node, delete ~/divi-regtest/regtest and start again.

If something goes wrong

You seeWhat it meansDo this
getbalance is 0 although you made blocksThe rewards are there but immature.Check immature_balance in getwalletinfo; make 20 more blocks.
Spendable balance stops growing by 1,250 after block 100Each staked block spends one mature coin and returns it, plus 996, as a new immature coin.Nothing is wrong. Wait 20 blocks and the staked coins mature with their rewards.
moneysupply is larger than your balanceTreasury and charity blocks pay two addresses that are not yours.Expected from block 150 on.
A payment you sent is not in listunspent at the receiving addressIt is still in the mempool; nobody makes blocks unless you do.setgenerate 1.
error code: -25 … failed to generate a valid blockStaked blocks need a mature coin and a usable block time; this hit us once, 109 blocks into a setgenerate 1000 at height 1,111.Wait a minute and run setgenerate again; a single block worked for us straight after. Make big batches in a few hundred at a time.
Insufficient funds: …(total requested) is greater than …(total available)The amounts are in satoshis; divide by 100,000,000.Make more blocks, or send less.
Invalid DIVI addressRegtest addresses start with x or y; a mainnet address starting with D will be refused.Use an address made by a regtest wallet.

Still stuck? Ask the Divi chatbot, or see all tutorials.