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.
EIP-684 defines a rule that prevents contract creation from overwriting a contract at an existing address.
This article translates, summarizes, and expands on the following specification.
More proposal explainers:
Overview
EIP-684 requires contract creation to fail if the destination account already has a nonzero nonce or nonempty code.
The purpose is to prevent creation at an address occupied by an existing contract from replacing that contract's code. Without a collision rule, the immutability of deployed contract code would be undermined.
Ethereum associates deployed contract code with an account address. The collision rule prevents a subsequent contract creation operation from overwriting code at an occupied address.
The proposal formalizes this protection. It should not be interpreted as evidence that overwriting deployed contracts was routinely possible on historical Ethereum mainnet.
Contract creation at an occupied address is distinct from upgrading a contract through an explicitly designed upgrade mechanism.
For example, an upgradeable proxy may change the implementation to which it delegates execution while leaving the proxy's deployed bytecode unchanged.
For further details, see the following articles.
Understanding Smart Contract Upgrades
https://chaldene.net/upgradable-contracts
Specification
Whenever a contract creation is attempted, whether through a creation transaction, the CREATE or CREATE2 opcode, or another creation mechanism, the operation must fail if the destination address has a nonzero nonce or a nonzero code length.
Destination account nonce and code length
A contract is deployed at a specific Ethereum address. The protocol checks the state of that destination account before allowing creation.
The nonce is an account counter, not a unique account identifier. A nonzero nonce or the presence of executable code is sufficient to trigger the collision rule.
A nonzero ETH balance alone is not one of the two collision conditions specified by EIP-684. An address can therefore be funded before contract deployment, provided the other conditions permit creation.
Creation failure
If CREATE or CREATE2 computes an address that meets either collision condition, the attempted creation fails.
This prevents the creation mechanism from installing new contract code over existing code at an occupied address.
CREATE and CREATE2 are EVM opcodes for creating contracts. They differ primarily in how they derive the destination address.
CREATE
CREATE has existed since Ethereum's early versions. It derives the destination address from the creator's address and nonce, executes initialization code, and installs the resulting runtime bytecode if creation succeeds.
CREATE address calculation
The inputs are:
- Creator address
- The address initiating contract creation.
- Nonce
- The creator account's applicable nonce.
The original article illustrates the relationship using the following simplified expression:
address = keccak256(作成者アドレス + ノンス)For example, if the creator address is represented as 0x1234... and its nonce is 3:
address = keccak256(0x1234... + 3)These two expressions are conceptual illustrations, not the actual address derivation formula. The correct CREATE address is the last 20 bytes of the Keccak-256 hash of the RLP encoding of the creator address and nonce. For contract accounts, the nonce is related to contract creation operations, rather than a count of ordinary externally submitted transactions.
CREATE2
CREATE2 was introduced later and derives the destination address from the creator address, a salt, and the hash of the initialization code.
It allows the destination address to be computed independently of the creator's nonce, enabling deterministic deployment patterns.
CREATE2 address calculation
The inputs are:
- Creator address
- Salt
- A 32-byte value supplied to the creation operation.
- Initialization-code hash
- The Keccak-256 hash of the initialization code.
The original article expresses the calculation as follows:
address = keccak256(0xff + 作成者アドレス + ソルト + keccak256(初期化コード)) の最後の20バイトFor illustration, the original article uses abbreviated values:
address = keccak256(0xff + 0x1234... + 0xabcd... + keccak256(0x5678...)) の最後の20バイトThe actual formula takes the last 20 bytes of the Keccak-256 hash of the concatenation of the single byte 0xff, the 20-byte creator address, the 32-byte salt, and the 32-byte initialization-code hash.
The last example above contains an ambiguity in the original text: if 0x5678... already represents the initialization-code hash, it must not be hashed again. The abbreviated expressions and Japanese labels are preserved as source material.
Summary
- CREATE and CREATE2 both deploy contracts but use different address derivation rules.
- CREATE uses the creator's nonce.
- CREATE2 uses a salt and the initialization-code hash to support deterministic deployment independent of the creator's nonce.
- Both remain subject to the contract creation collision rule.
Specifically, creation must fail as though the first byte of the initialization code were an invalid opcode.
EIP-684 states that the rule applies retroactively to all historical blocks.
If the destination account has a nonzero nonce or nonempty code, contract creation must fail rather than overwrite the occupied account's code. A failed internal creation does not necessarily revert every enclosing call: the caller may handle the failure according to the EVM's execution semantics.
Rationale
One important property of smart contracts is that their deployed runtime code is ordinarily immutable. This allows users and applications to reason about the code associated with an address.
If a creation operation were permitted to overwrite existing code, an attacker with sufficient computational resources to find a colliding creation address could potentially replace the original contract. That would undermine assumptions about contract behavior and could put assets at risk.
The collision rule protects deployed code from being replaced through another contract creation operation. It is not a general guarantee that contract behavior can never change: proxy upgrades and other explicitly implemented mechanisms remain separate considerations.
Backward compatibility
The original article describes this as an execution-layer change requiring a hard fork. However, EIP-684 explicitly specifies retroactive application, so its historical context and activation semantics should not be confused with those of a newly scheduled forward-only protocol upgrade.
Tests
The example starts with the following genesis allocation.
Address : 0xd0bBEc6D2c628b7e2E6D5556daA14a5181b604C5,
Balance : 1000000000000000000, // 1 ether
Nonce : 0,
code : "",
Address : 0x7658771dc6Af74a3d2F8499D349FF9c1a0DF8826,
Balance : 0,
Nonce : 1,
Code : "0xB0B0FACE",An externally owned account (EOA) at address 0xd0bBEc6... submits a contract creation transaction with the hash 227bcc6959669226360814723ed739f1214201584b6a27409dfb8228b8be5f59.
No CREATE2 salt is used in this example.
The attempted creation must fail because the computed destination account at 0x7658771dc6Af74a3d2F8499D349FF9c1a0DF8826 has a nonce of 1 and existing code.
Either condition alone would be sufficient to prevent creation under EIP-684.
The existing code must remain unchanged. A failed creation transaction can still consume gas and advance the sender's transaction nonce; failure does not mean that every transaction-level effect is undone.
Security considerations
EIP-684 enforces the immutability of existing deployed code against contract creation collisions.
The rule prohibits replacing code at an occupied address through a new creation operation. This protection supports the security assumptions of contracts and applications that depend on stable deployed code.
It does not prohibit intentionally upgradeable application architectures or define all possible changes to account code under other protocol rules.
Citation
Vitalik Buterin (@vbuterin), Renan Rodrigues de Souza (@RenanSouza2), "EIP-684: Revert creation in case of collision," Ethereum Improvement Proposals, no. 684, March 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-684.
Conclusion
EIP-684 requires contract creation to fail whenever the destination account has a nonzero nonce or nonempty code. This protects existing contracts against code replacement through address collisions.
Questions are welcome via Twitter @cardene777.
Other publications:


