2

How do I get started with a monero Regtest node? I am running monerod with --regtest, but when I mine, the difficulty quickly increases to a point where I need to wait an hour to generate a fair amount of blocks.

3

Start the monero daemon with the following flags:

./monerod --regtest --offline --fixed-difficulty 1

--fixed-difficulty keeps the difficulty constant, allowing users to quickly generate a large number of blocks

--offline ensures that the node does not connect to the main network and learn of its latest chaintip

New blocks can be generated with the following RPC call, mining the new block directly to a specific address:

curl http://127.0.0.1:18081/json_rpc -d \
'{"jsonrpc":"2.0","id":"0","method":"generateblocks","params":{
"amount_of_blocks":1,
"wallet_address":"42eTJxqsYwsSpFCRUp19vPAXNruqAUqnFMY2XN198643Ukrera958dY4qbRdoaoCVffhbC7ro4nzVBMw1E8ip7LAKG3SrsU",
"starting_nonce": 0}' \
-H 'Content-Type: application/json'

The generateblocks RPC call is badly documented, probably because it is only useful for nodes running in --regtest mode. Observe the amount_of_blocks field, allowing the user to generate an exact number of blocks quickly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.