---
eip: 689
label: EIP-689
title: Address Collision of Contract Address Causes Exceptional Halt
status: Stagnant
type: Standards Track
category: Core
created: 2017-08-15
official: https://eips.ethereum.org/EIPS/eip-689
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-689.md
canonical: https://eips.huatuo.xyz/eip-689/
lang: en
tldr: A stagnant proposal to make contract creation fail outright when the target address already has code or a non-zero nonce; the same rule was adopted through EIP-684.
tags: [evm, create, core, consensus, stagnant]
---

# EIP-689: Address Collision of Contract Address Causes Exceptional Halt

> This EIP proposes to make contract creation fail on an account with nonempty code or non-zero nonce.

**TL;DR:** A stagnant proposal to make contract creation fail outright when the target address already has code or a non-zero nonce; the same rule was adopted through EIP-684.

## What problem does it solve?

A contract's address is derived from a hash. In theory, a new contract could be deployed at an address that already holds code. The Yellow Paper said creation would then start from empty code and the initial nonce, which means it would **overwrite** the existing contract.

On mainnet this practically never happens, because it needs a keccak256 collision. But the consensus test suite included such cases, and clients disagreed on how to handle them. Supporting "overwrite, and undo the overwrite if creation reverts" just to pass tests made clients more complex for no real benefit.

EIP-689 proposed a simple rule: **if the address is already in use, creation fails.**

## How it works

From genesis (`block.number >= 0`):

- If a contract creation targets an account with a **non-zero nonce** or **non-empty code**, creation fails **as if the init code hit an exceptional halt**.
- This applies both to contract-creation transactions and to the `CREATE` opcode.

The spec gives two benefits:

- **Simpler testing.** Clients no longer need to revert a code overwrite.
- **Simpler reasoning.** It creates an invariant: once an account has code, that code is never modified by another creation.

Because applying the rule from genesis changes nothing in mainnet history, the spec says it is backwards compatible.

## Sample code

Pseudocode for the check at the start of contract creation:

```python
def create_contract(state, sender, address, init_code, value, gas):
    target = state.get(address)
    if target is not None and (target.nonce != 0 or len(target.code) > 0):
        # Collision: behave like an exceptional halt in init code
        return Failure(gas_used=gas)     # all supplied gas consumed
    state.increment_nonce(address)       # EIP-161: new contracts start at nonce 1
    return run_init_code(state, sender, address, init_code, value, gas)
```

From Solidity, a collided `CREATE2` deployment simply returns the zero address:

```solidity
address a;
assembly { a := create2(0, add(code, 0x20), mload(code), salt) }
require(a != address(0), "create2 failed (e.g. address already in use)");
```

## Things to know

- **This proposal is Stagnant and was never adopted as written.** The same collision rule is part of Final [EIP-684](/eip-684/) (Revert creation in case of collision), which clients apply retroactively. [EIP-7610](/eip-7610/) extends the check to accounts with non-empty storage.
- The spec says the rule was already covered by [EIP-86](/eip-86/) for the planned Constantinople fork. EIP-86 itself is now Stagnant.
- The rule matters more once addresses are predictable. With `CREATE2` ([EIP-1014](/eip-1014/)), deploying the same init code with the same salt twice from one factory fails the second time.
- The spec names the BlockchainTest `createJS_ExampleContract_d0g0v0_EIP158` as a test that tells implementing clients apart from others.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-689
