Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines EIP-3607, a proposal addressing collisions between contract accounts and externally owned accounts (EOAs). The original proposal discusses a possible future transition from 160-bit to 256-bit addresses, but EIP-3607 itself introduces a transaction validity rule rather than changing address length.

This explanation translates, summarizes, and expands on the original proposal.

I have also written about other EIPs.

Abstract

Ethereum addresses are only 160 bits long. A contract account (the address of a smart contract) and an externally owned account (an account controlled directly by a user, or EOA) could therefore have the same address. The proposal estimates that finding such a collision would require approximately 2 to the power of 80 computational operations. At the time, it estimated a budget of around USD 10 billion.

In the worst-case scenario described by the proposal, a seemingly safe smart contract, such as a token wrapper or an automated market maker (AMM), could receive user deposits. A private key corresponding to the same address could then undermine the contract's intended restrictions on those funds.

The proposed fix is to reject transactions whose sender already has deployed code. Once a contract has been deployed at an address, that address cannot originate an ordinary EOA transaction under this rule. This prevents the attack described above.

For the difference between EOAs and contract accounts, see the following article.

https://mirror.xyz/0xcE77b9fCd390847627c84359fC1Bc02fC78f0e58/-qoixMc413uT4FFM61uhXYUiL05Hw-wahq9hV_JtjJs

Motivation

The proposal explains Ethereum's address collision problem and a protocol-level mitigation.

Finding address collisions

With 160-bit Ethereum addresses, generating 2 to the power of 80 EOAs and the same number of contract addresses would theoretically be expected to yield at least one collision. Storing 2 to the power of 80 addresses, however, would require around 24 yottabytes of memory, a substantial practical barrier.

Collision-search algorithms need not store every candidate. The original proposal estimated that spending around USD 10 billion on hardware and electricity could make finding a collision within about one year feasible. These are historical estimates, not a current cost assessment.

Background

The proposal discusses the possibility of Ethereum eventually moving to 256-bit addresses, raising collision resistance to a complexity of 2 to the power of 128, which is considered computationally infeasible for the foreseeable future. The existing 160-bit addresses make the collision scenario more plausible in comparison.

Practical likelihood of attacks

Attacks based on address collisions are considered impractical and rare. Some scenarios involve users sending funds to an address before its contract is deployed. Waiting until the intended contract is safely deployed and sufficiently confirmed can mitigate those scenarios.

At the time of the proposal, Ethereum's Yellow Paper did not explicitly specify how clients should handle a transaction originating from an address with deployed contract code.

Purpose of the EIP

The EIP clarifies that transactions originating from accounts with deployed contract code must be rejected under its original rule. This prevents the most practical and serious attacks based on collisions between EOAs and contract accounts.

The proposed solution addresses Ethereum address collisions by restricting transactions originating from addresses where contract code is already present.

Specification

The specification defines how the Ethereum network should treat certain transactions:

  • If the CODEHASH of tx.sender is not EMPTYCODEHASH, the transaction must be considered invalid.

    • tx.sender is the account originating the transaction. CODEHASH is the hash of the code associated with that account.
    • If the sender has empty code, its code hash equals EMPTYCODEHASH.
  • EMPTYCODEHASH is defined as 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, the Keccak-256 hash of empty code.

  • If the sender's CODEHASH differs from EMPTYCODEHASH, clients must reject the transaction.

    • A block containing such an invalid transaction must also be considered invalid.

This rule restricts transaction origination from accounts with deployed code, preventing them from behaving as ordinary EOAs merely because a corresponding private key exists. It mitigates potential address-collision attacks.

This article describes the original EIP-3607 rule. Subsequent protocol changes, notably EIP-7702, introduce an exception for valid delegation designations; the original restriction should not be read as a complete description of current Ethereum transaction validation.

Rationale

The EIP is based on the expectation that a contract account's behavior should be governed by its code. Funds held by a contract should not suddenly become spendable through a private key corresponding to its address. Although 160-bit addresses were implicitly assumed to provide sufficient collision resistance, the proposal recognizes the theoretical possibility of collisions and makes the intended protocol behavior explicit.

Main points

Clarifying protocol behavior

The EIP specifies behavior for a previously undefined case. It formalizes existing expectations rather than introducing a new intended use of contract accounts.

Limiting attack vectors

The EIP removes the most serious attack vector involving collisions between contract accounts and EOAs. It does not eliminate every possible collision-related risk.

Additional attack vectors

Transfers before deployment

A user may be persuaded to send funds to an address before the contract is deployed. Some applications, including state channels, require this behavior.

Chain reorganizations

If a chain reorganization removes a contract's deployment transaction, the address could lose its deployed code. The collision risk would then reappear until the contract is redeployed.

Self-destructing contracts

The original proposal also considers contracts intended to burn ERC-20 or other tokens through self-destruction. If their code is removed, a corresponding private key could compromise this assumption.

These scenarios were considered more difficult and less profitable, making economically viable attacks less likely. The self-destruction example describes the historical execution model; subsequent changes to SELFDESTRUCT affect when code is actually removed.

Backward compatibility

The proposal considers the effect of the change on existing Ethereum behavior.

Likelihood of previous attacks

The proposal considers it unlikely that an attack of this kind has already occurred on Ethereum Mainnet, since such an incident would probably have become widely known. Intentionally using the same address as both a contract account and an EOA is not a likely feature: adding methods to a contract would be much easier than investing enormous sums in finding a collision.

Private networks

Private networks may have allocated contracts at genesis that also function as EOAs. Operators should check whether the stricter rule interferes with their existing workflows.

Client flexibility

Clients may choose not to apply the rule to simulated RPC calls such as eth_call and eth_estimateGas. Some multisignature contracts use these calls to simulate execution as though it originated from the multisignature contract itself. Allowing this behavior in simulation can preserve existing workflows without changing on-chain transaction validity.

The proposal was not expected to cause major backward-compatibility problems on Ethereum Mainnet. Private networks and specific client implementations may nevertheless need to account for their existing workflows.

Test cases

The test case illustrates how Ethereum transactions should be treated under a particular genesis configuration.

Genesis allocation

  • Address: 0x71562b71999873DB5b286dF957af199Ec94617F7
  • Balance: 1 ether (1,000,000,000,000,000,000 wei)
  • Nonce: 0
  • Code: 0xB0B0FACE

At genesis (the blockchain's initial state), this address receives a balance of 1 ether and the code 0xB0B0FACE. It is consequently an account with deployed code.

Transaction rejection

All transactions signed using the corresponding public test-fixture private key (b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291) must be rejected. This is a published test key, not a key for holding real funds. The Japanese original abbreviates the associated address as 0x715656...; the full genesis address is shown above.

The address already has deployed code and must not originate ordinary EOA transactions under the original rule.

Exclusion from blocks

Clients must reject these transactions rather than include them in blocks. Contract-account behavior should be governed by contract execution, not by a private key that happens to correspond to the address.

The test checks whether an EIP-3607 implementation correctly distinguishes the intended behavior of contract accounts and EOAs.

Implementation

The proposal adds a check to transaction validation to determine whether the sender is eligible to originate a transaction.

  • After checking the sender's nonce, add a new check to state-transition validation.

    • A nonce is a counter associated with an account; for an EOA, it tracks transactions sent from that account.
  • Check the sender's code

    • Retrieve the code hash (ch) of the address recovered from the transaction signature.
    • The code hash represents the code associated with that address.
  • Validate the code hash

    • If ch differs from EmptyCodeHash, the original implementation returns ErrSenderNoEOA.
    • The presence of deployed code makes the transaction invalid under the rule.

This prevents direct transaction origination from contract accounts and mitigates address-collision risks. The following implementation diff demonstrates how EIP-3607 was introduced in go-ethereum, the Go implementation of Ethereum. It provides a concrete example of the necessary client-side changes.

https://eips.ethereum.org/assets/eip-3607/geth.diff

Security considerations

The EIP is a restrictive security upgrade to Ethereum's validity rules.

Security upgrade

Certain previously valid transactions become invalid. The proposal argues that these transactions have no legitimate intended purpose, so rejecting them does not introduce a security disadvantage.

Implementation as a soft fork

The change can be implemented as a soft fork. It tightens the validity rules: blocks and transactions accepted under the new rules form a subset of those accepted under the old rules. Nodes applying the old rules can therefore still recognize blocks that satisfy the new rules. This allows the security restriction to be introduced without requiring old nodes to accept previously invalid blocks.

EIP-3607 strengthens Ethereum security by rejecting certain transactions that previously could have been accepted. The stricter validity rules are compatible with a soft-fork approach.

Citation

Dankrad Feist (@dankrad), Dmitry Khovratovich (@khovratovich), Marius van der Wijden (@MariusVanDerWijden), "EIP-3607: Reject transactions from senders with deployed code," Ethereum Improvement Proposals, no. 3607, June 2021. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-3607.

Conclusion

EIP-3607 addresses the possibility of a collision between an EOA and a contract account by restricting transaction origination from addresses with deployed code. The original discussion also considers a possible future increase in address length from 160 to 256 bits.

If you have questions, feel free to contact me via Twitter.

Twitter @cardene777

I also share technical content on the following platforms.

https://chaldene.net/