I'm searching for a way to mine 60 blocks without the waiting time (or at least significantly reduce the time) on a testnet. Can it be done or will it affect other operations in the blockchain?
2 Answers
If you're using a local testnet (that is, you don't need to accept blocks from other peers, nor get peers to accept your blocks), then you can hardcode a fixed difficulty in src/cryptonote_basic/difficulty.cpp, returning a small value in next_difficulty. A value equal to your hash rate will get you a block every 2 minutes on average. A value equal to your hash rate divided by 20 will get you a block every 6 second on average, etc.
-
This is unnecessary. Just used the
--fixed-difficulty
flag when using--testnet
.– jtgrassie ♦Aug 22, 2018 at 18:04 -
-
If you're doing testnet stuff you are almost always on master no? If you are cloning the repo and making code changes, you're most likely on master too.– jtgrassie ♦Aug 22, 2018 at 19:14
No code changes needed:
$ monerod --help | grep fixed
--fixed-difficulty arg (=0) Fixed difficulty used for testing.