lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Use 'eth_chainID` instead of `net_version`

Open MariusVanDerWijden opened this issue 4 years ago • 2 comments

💎 Issue

Lighthouse currently uses net_version to query for the chain id. While this works in most cases, it might make it possible to connect to an ETC node by mistake as discussed here: https://eips.ethereum.org/EIPS/eip-695

Generally the eth_chainID should always be preferred to net_version Additionally geth currently has a bug which impacts net_version and makes it impossible to run Lighthouse with the current geth master, see: https://github.com/ethereum/go-ethereum/issues/22034

While we are going to restore the net_version RPC call, it would be better to move to eth_chainId.

See also: https://github.com/prysmaticlabs/prysm/issues/8170

MariusVanDerWijden avatar Dec 22 '20 11:12 MariusVanDerWijden

We use both the eth_chainId and net_version to decide the eth1 chain as the eth2 config defines both https://github.com/ethereum/eth2.0-specs/blob/dev/configs/mainnet/phase0.yaml#L54-L55.

Agree that we don't really need the eth1 networkId for eth2. I'm not really sure why we have it in the config. Maybe we could make a PR to remove the eth1 network_id requirement from the eth2 mainnet config? cc @paulhauner

pawanjay176 avatar Dec 22 '20 11:12 pawanjay176

Yes, please use eth_chainId rather than net_version. Per the spec EL should only expose engine_ and eth_ methods on the Engine API port. Erigon doesn't expose net_ methods by default.

yperbasis avatar Jun 16 '22 15:06 yperbasis

Resolved by #3214

paulhauner avatar Sep 12 '22 08:09 paulhauner