Skip to main content
added 929 characters in body
Source Link
Richard Horrocks
  • 38k
  • 13
  • 87
  • 144

How is it different than networkID?

ChainID was introduced in EIP-155 to prevent replay attacks between the main ETH and ETC chains, which both have a networkID of 1.

It's basically just an additional way to tell chains apart. Subsequent to EIP-155, ETH has a chainID of 1, while ETC has a chainID of 61 (even though they still have the same networkID of 1).

Is chainID and networkID needed in every block or just the genesis block?

It's required for the chain to operate in general - e.g. it's required when signing transactions, meaning transactions signed on the ETH network end up with a different hash than those signed on ETC. Before EIP-155, signed transactions on each network would look the same, and could be replayed.

Edit:

A specific example of how chainId is used.

As per the EIP-155 page, the v value of a transaction's signature is dependent on the value of chainID.

If block.number >= FORK_BLKNUM and v = CHAIN_ID * 2 + 35 or v = CHAIN_ID * 2 + 36, then when computing the hash of a transaction for purposes of signing or recovering, instead of hashing only the first six elements (i.e. nonce, gasprice, startgas, to, value, data), hash nine elements, with v replaced by CHAIN_ID, r = 0 and s = 0. The currently existing signature scheme using v = 27 and v = 28 remains valid and continues to operate under the same rules as it does now.

There is a detailed example of how this is applied on the EIP-155 page.

How is it different than networkID?

ChainID was introduced in EIP-155 to prevent replay attacks between the main ETH and ETC chains, which both have a networkID of 1.

It's basically just an additional way to tell chains apart. Subsequent to EIP-155, ETH has a chainID of 1, while ETC has a chainID of 61 (even though they still have the same networkID of 1).

Is chainID and networkID needed in every block or just the genesis block?

It's required for the chain to operate in general - e.g. it's required when signing transactions, meaning transactions signed on the ETH network end up with a different hash than those signed on ETC. Before EIP-155, signed transactions on each network would look the same, and could be replayed.

How is it different than networkID?

ChainID was introduced in EIP-155 to prevent replay attacks between the main ETH and ETC chains, which both have a networkID of 1.

It's basically just an additional way to tell chains apart. Subsequent to EIP-155, ETH has a chainID of 1, while ETC has a chainID of 61 (even though they still have the same networkID of 1).

Is chainID and networkID needed in every block or just the genesis block?

It's required for the chain to operate in general - e.g. it's required when signing transactions, meaning transactions signed on the ETH network end up with a different hash than those signed on ETC. Before EIP-155, signed transactions on each network would look the same, and could be replayed.

Edit:

A specific example of how chainId is used.

As per the EIP-155 page, the v value of a transaction's signature is dependent on the value of chainID.

If block.number >= FORK_BLKNUM and v = CHAIN_ID * 2 + 35 or v = CHAIN_ID * 2 + 36, then when computing the hash of a transaction for purposes of signing or recovering, instead of hashing only the first six elements (i.e. nonce, gasprice, startgas, to, value, data), hash nine elements, with v replaced by CHAIN_ID, r = 0 and s = 0. The currently existing signature scheme using v = 27 and v = 28 remains valid and continues to operate under the same rules as it does now.

There is a detailed example of how this is applied on the EIP-155 page.

Source Link
Richard Horrocks
  • 38k
  • 13
  • 87
  • 144

How is it different than networkID?

ChainID was introduced in EIP-155 to prevent replay attacks between the main ETH and ETC chains, which both have a networkID of 1.

It's basically just an additional way to tell chains apart. Subsequent to EIP-155, ETH has a chainID of 1, while ETC has a chainID of 61 (even though they still have the same networkID of 1).

Is chainID and networkID needed in every block or just the genesis block?

It's required for the chain to operate in general - e.g. it's required when signing transactions, meaning transactions signed on the ETH network end up with a different hash than those signed on ETC. Before EIP-155, signed transactions on each network would look the same, and could be replayed.