How are hardforks made on Ethereum?

I assume it's necessary to update genesis.json file to define blocks at which the hardofrks happen (example Constantinople: 7 080 000). But if when we enter "--datadir yourfolder newgenesis.json init" it creates an issue because the blockchain has already been initialised with another genesis file. In forums it's said to delete folder and restart blockchain from scratch. But this means restarting a blockchain which is very different from upgrading and preparing for a hardfork.

How could Ethereum nodes have updated their blockchains taking into account these limitations? What is the best way to plan hardforks on Ethereum hardforks?

Thank you very much!

1 Answer 1


no, it is not necessary to put hardfork numbers in the genesis file, actually they are not read from the genesis.json file. They are being read from the source code using the hash of the genesis as lookup value. So, it reads your genesis hash, and uses if statements to load the config file that corresponds to your network (MainNet, Rposten, etc).

You can modify geth sources to add your own genesis hash and it will lookup your particular ChainConfig, here:

func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
    switch {
    case g != nil:
        return g.Config
    case ghash == params.MainnetGenesisHash:
        return params.MainnetChainConfig
    case ghash == params.RopstenGenesisHash:
        return params.RopstenChainConfig
    case ghash == params.SepoliaGenesisHash:
        return params.SepoliaChainConfig
    case ghash == params.RinkebyGenesisHash:
        return params.RinkebyChainConfig
    case ghash == params.GoerliGenesisHash:
        return params.GoerliChainConfig
        return params.AllEthashProtocolChanges

for example instead of GoerliGenesisHash you can put the genesis hash or your own private net. (or add another case statement)

this function is located here: https://github.com/ethereum/go-ethereum/blob/31d401ea687066465846ec4a0d2388ef80e4b0cc/core/genesis.go#L420

How could Ethereum nodes have updated their blockchains taking into account these limitations?

make your custom geth sources with updated config and distribute among your private node users. this is the way

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.