1

Can anyone please tell me how to create a million blocks in regtest or testnet mode? Is there a way other than to start mining with the smallest difficulty?

4

Creating a private testnet and setting the difficulty very low is an easy way. You can start your testnet nodes passing the flag --fixed-difficulty N (where N is a very low number), so your mining node mines blocks near instantly.

There is also a new RPC command generateblocks, that can generate a bunch of blocks in regtest mode. It's currently not documented, but see the commit message. To use it, you would start monerod with the --regtest flag and the --fixed-difficulty flag (as detailed above). Then you can call the RPC interface passing the parameters: amount_of_blocks and wallet_address. For example:

curl -X POST http://127.0.0.1:18081/json_rpc -d
  '{"jsonrpc":"2.0","id":"0","method":"generateblocks","params":{
  "wallet_address":"44GBHzv...","amount_of_blocks":1000000}}' 
  -H 'Content-Type: application/json'

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.