There are 2 ways to do this:
Change the value of difficulty parameter in genesis.json
file to a small number(preferably set it to 0). You can refer to this example genesis file
{
"config": {
"chainId": 1994,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0
},
"difficulty": "0x0", //difficulty set to zero in hexadecimal format
"gasLimit": "0x8000000",
"alloc": {
"9a963d0eefeb62678d8efb48561c81e51c552797": {
"balance": "9606938044258990275541962092341162602522202993782792835301376"
},
"30f28686aef33adbfbc13797b1d9f5a2f2759f56": {
"balance": "9606938044258990275541962092341162602522202993782792835301376"
}
}
}
Problem with this method is that when the block number increases, the difficulty also starts increasing at a high rate. So, to tackle that problem refer to the below part.
- You can reduce the rate of block difficulty increament by making some changes in the consensus code of go-ethereum.
Open
consensus.go
which resides at consensus/ethash/consensus.go
and search for the below line.
return CalcDifficulty(chain.Config(), time, parent)
Now replace the above line with the below one.
return big.NewInt(1)
.
Now build the go-ethereum using make geth
command.
I strongly recommend you to go through this article for much detailed implementation of the above process.