0

I install go ethereum for practice I use my blockchain.

My question is what does it mean "ChainId" in genesis.json?

For example if I write ChainId:1, what does it mean?

Dont forget that I'm in private blockchain.

1 Answer 1

1

ChainID (chain identifier), was introduced in EIP-155 to prevent replay attacks between the main ETH and ETC chains, which both have a networkID of 1. ChainID is an additional way to tell chains apart. Subsequent to EIP-155, ETH had a chainID of 1, while ETC had a chainID of 61. networkID and chainID are required for the chain to operate in general - e.g. it’s required when signing transactions. Default value is equal to networkID.

Here you can find a list of EVM networks and their ChainID.

Source


Simpler Explanation:

Ethereum makes it possible to send the same transaction across different chains, hence the term “replay attack”. For instance, it is possible to issue a fund transfer on a testchain and then perform the same transfer over the MainNet (with real funds). This vulnerability is due to the fact that the same accounts can exist in any Ethereum chain, protected by the same privateKey.

To counteract this issue, an Ethereum fix was implemented (the improvement name is EIP-155) allowing the insertion of the ChainID data in signed transactions. Thanks to this improvement it is now possible to force a transaction to only run on a specific chain by including its ID when signed.

Source


This is how to get your node's chainid using web3:

web3.eth.chain_id

Useful links for a deeper understanding of the concept:

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.