I am creating a private Ethereum blockchain for the sake of transactions management and storage. I don't care about the consensus part, so I changed the difficulty in the genesis file to 0x1.

I also edited the consensus.go file located under the consensus/ethash/ directory, and built a custom geth binary to limit the growth of difficulty but with no luck. Here's what I changed exactly, I changed the CalcDifficulty() method implementation with the following:

func (ethash *Ethash) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int {
  return big.NewInt(1)

The problem is that with every block, the difficulty is increased by one. I tried to change the return value to return big.NewInt(0) but I got an error saying panic: division by zero

I just want to limit the difficulty to 0x1 regardless of how many blocks the chain has.

1 Answer 1


I had this problem a year ago. The easiest solution is to only mine, when there are transaction in the pool. This would only increase the difficulty a little bit and so you have a fast test-network. As far as i know, ganache does exactly this.

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.