EIP-3788 Strict chain ID enforcement (Strict enforcement of chainId)
No call decision · Security & privacy · EIP status Stagnant · created 2021-09-02
A proposal to invalidate transactions whose chainId differs from the node's configuration, especially chainId=0, to prevent users from losing funds to replay attacks.
Why it is needed
EIP-155 treated transactions with chainId=0 as valid. This was an intentional feature allowing developers to create transactions replayable across multiple chains. However, as EVM-compatible chains that fork Ethereum clients or reuse their code have proliferated, wallet interfaces often fail to show the chainId to users, so users sign without knowing which chain they are signing for. If a malicious actor (or simple mistake) gets a user to sign a chainId=0 transaction on a non-mainnet network, that transaction can be replayed as is on Ethereum mainnet or another network, opening the door to griefing attacks or more sophisticated attacks that put user funds at risk.
What changes
Today
- Transactions with chainId=0 are treated as valid under EIP-155
- Wallet UIs often do not show the chainId to users
- A malicious actor can get a user to sign a chainId=0 transaction on a non-mainnet network and replay it on mainnet or elsewhere
After EIP-3788
- After fork block N, transactions with a chainId different from node.cfg.chainId (especially 0) are rejected as invalid
- Filtered at both the JSON-RPC level (e.g. eth_sendTransaction) and EVM transaction validation
- Users no longer hold transactions in pending state that would fail anyway
- Applications and tooling that submitted transactions with chainId=0 will break
Who is affected
- Users: The risk of losing funds to replay attacks using chainId=0 transactions is reduced.
- Wallet & app developers: Logic that used chainId=0 to create transactions replayable across multiple chains will no longer work and will need to be fixed.
- Client teams: A check comparing node.cfg.chainId and tx.chainId must be added to both the JSON-RPC filter and the EVM validation logic.
In depth
Verification logic
From fork block N onward, transactions where node.cfg.chainId != tx.chainId are rejected. In other words, the transaction's chainId must exactly match the node's configuration, and even chainId=0 transactions previously treated as valid under EIP-155 fail this comparison and become invalid.
Where validation occurs
This check must exist in two places. One is a JSON-RPC level filter (e.g. eth_sendTransaction), which filters transactions before they enter pending state. The other is strictly enforced at the EVM's transaction validation stage, preventing such transactions from being included in a block.
Background: EIP-155 and chainId=0
EIP-155 treated transactions with chainId=0 as valid. This was intended to let developers submit transactions replayable across multiple chains.
Problem: proliferation of EVM-compatible chains
As EVM-compatible chains that fork Ethereum clients or reuse their code have proliferated, wallet interfaces often fail to show the chainId to users, so users do not know which chainId they are signing for. If a malicious actor (or a mistake) gets a user to sign a chainId=0 transaction on a non-mainnet network, that transaction could be replayed as is on Ethereum mainnet or another network to carry out griefing attacks or more sophisticated attacks.
Rationale
The chainId configured by the node should serve as the source of truth, and it should be used explicitly when filtering transactions. This way, users no longer hold transactions in pending state that would fail anyway, and such transactions are also prevented from being included in a block.
Backward compatibility
From fork block N onward, any application or tooling that submitted transactions with chainId == 0 will break.
Security considerations and limitations
This EIP explicitly states that it does not prevent a malicious actor from deploying a new network that simply copies the chainId of chainId=1 (mainnet) or another network. In other words, forging or duplicating the chainId itself is outside the scope of what this proposal solves.
Current status
This EIP's status is Stagnant, and the Test Cases section is also left as TBD. It is an early-stage proposal that has not yet been finalized or decided for inclusion in a fork.