I am trying to add the constantinople fork to my private net with is running on geth. I have updated to latest geth, geth 1.8.23.
I have stopped my current geth node running and have chnged the genesis file by adding constantinople block as below in config file
"config": {
"chainId": 56312,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0, "constantinopleBlock": 16275, "byzantiumBlock": 0
}
However, when I try to init the geth with new config, O am getting below error
Fatal: Failed to write genesis block: mismatching Constantinople fork block in database (have <nil>, want 16275, rewindto 16274)
Could someone help me to add constantinople fork to my private net.
Best Answer
I tried this and worked (but I recommend to create a backup):
=>
xxxxxx
is the future block number you want to do hardfork your private ethereum chain.1- Alter the .json file by adding
"constantinopleBlock": xxxxxx, "petersburgBlock": xxxxxx
.PetersburgBlock
is theConstantinople
fix due to a security hole ofConstantinople
.2- Run the command:
geth --datadir <your datadir> init <genesis>.json
3- Restart running your
geth
, and you should see something like follows:and the chain data remains but the
admin.nodeinfo
, node'senode
is updated.