I have implemented private chain in ethereum but its difficulty level increases by time as a result the mining process slows down. Is it possible to make the difficulty static or disable it in testnet.


2 Answers 2


Modify the CalcDifficulty in Geth to return a static number, then rebuild Geth. Example:

func CalcDifficulty(config *ChainConfig, time, parentTime uint64, parentNumber, parentDiff *big.Int) *big.Int {
    return big.NewInt(0x4000)

Source: Answer to Is it possible to change the block target time?

  • 1
    Is this still the only way to decrease the difficulty? Apr 28, 2018 at 18:40
  • 2
    @ThorkilVærge I usually won't answer/reply if I don't know. But I'm doing so here since I'm not ignoring the question, and would encourage if there are new answers.
    – eth
    May 3, 2018 at 7:41

If it is private chain you can define difficulty in genesis block.

Something like this

  "nonce": "0x0000000000000042",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x4000",
    "alloc": {},
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "Custem Ethereum Genesis Block",
    "gasLimit": "0xffffffff"

Here is a good read to How to Set up testnet

  • 1
    I have used this format only. Initially the mining is fast but as the time flows the difficulty increases and mining goes very slow. Jul 18, 2016 at 7:19
  • 1
    The difficulty is adjusted automatically so the average block time is within the hard-coded time in ethereum. The difficulty you specify in the genesis file is just the starting difficulty. To make difficulty static you need to modify the source code.
    – dragosb
    Jul 18, 2016 at 12:42
  • 1
    @dragosb yeah, but OP is not asking for the dynamic settings.
    – niksmac
    Jul 18, 2016 at 12:48
  • 1
    what genesis block has to do with difficulty as it is only to create inital blockchain . difficulty is measured by CalcDifficulty algo. Dec 5, 2016 at 12:18
  • 1
    @Himanshusharma I understand that. OP is asking about creating the initial set up.
    – niksmac
    Dec 5, 2016 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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