---
eip: 5478
label: EIP-5478
title: CREATE2COPY Opcode
status: Stagnant
type: Standards Track
category: Core
created: 2022-08-17
requires: 1014, 2929
official: https://eips.ethereum.org/EIPS/eip-5478
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-5478.md
canonical: https://eips.huatuo.xyz/eip-5478/
lang: en
tldr: Proposed a CREATE2COPY opcode that deploys a contract whose code matches an existing one and charges an account access (2,600 or 100 gas) instead of the per-byte code deposit fee.
tags: [evm, opcodes, deployment, account-abstraction, gas]
---

# EIP-5478: CREATE2COPY Opcode

> Reducing the gas cost of contract creation with existing code

**TL;DR:** Proposed a CREATE2COPY opcode that deploys a contract whose code matches an existing one and charges an account access (2,600 or 100 gas) instead of the per-byte code deposit fee.

## What problem does it solve?

With account abstraction, every user gets their own smart-contract wallet, and most of them run *identical* code. Deploying a contract still charges the code deposit cost of 200 gas per byte of runtime code. The spec's example: a 10,000-byte wallet costs 2,000,000 gas in code deposit alone, every time, even though nodes already store that exact code.

EIP-5478 proposes paying only for looking up the existing code instead of re-paying for storing it.

## How it works

A new opcode `CREATE2COPY` (proposed at `0xf6`) behaves like `CREATE2` ([EIP-1014](/eip-1014/)) with one extra stack argument:

```text
CREATE2COPY(endowment, memory_start, memory_length, salt, existing_contract_address)
```

- Initcode runs exactly as with `CREATE2`, and the address is derived the same way.
- The runtime code returned by the initcode MUST have the same code hash as `existing_contract_address`. If it does not, creation fails ("mismatched contract creation code with existing code") and all gas for the creation is burned.
- Gas is the same as `CREATE2`, except the code-deposit term `200 * code_size` is replaced by the cost of an `EXTCODEHASH` on the existing contract: **2,600** if cold, **100** if warm ([EIP-2929](/eip-2929/)).

| Constant | Value |
| --- | --- |
| `CREATE_DATA_GAS_PER_BYTE` | 200 |
| `COLD_ACCOUNT_ACCESS_COST` | 2600 |
| `WARM_ACCOUNT_ACCESS_COST` | 100 |

## Sample code

How a wallet factory might use it (hypothetical; no compiler or chain supports this opcode):

```python
# Pseudocode: CREATE2COPY does not exist on mainnet.
def deploy_wallet(factory, initcode: bytes, salt: bytes, template: str) -> str:
    # Same as CREATE2(endowment=0, initcode, salt) ...
    # ... but the runtime code must hash-match `template`, and the
    # 200 gas/byte code deposit is replaced by an EXTCODEHASH-priced access.
    wallet = factory.CREATE2COPY(0, initcode, salt, template)
    assert wallet != ZERO_ADDRESS, "deploy failed"
    return wallet

# Gas for a 10,000-byte wallet code deposit:
#   CREATE2:      200 * 10_000 = 2_000_000
#   CREATE2COPY:  2_600 (template cold) or 100 (template warm)
```

## Things to know

- Status: **Stagnant**. The fork block is "TBD", and the Rationale and Security Considerations sections were never completed.
- It only discounts the code deposit. Initcode execution, the base `CREATE2` cost and hashing still apply.
- Today the usual way to make cheap per-user deployments is a proxy such as [ERC-1167](/eip-1167/), which deploys a few dozen bytes that `DELEGATECALL` into shared logic. That is the pattern [ERC-4337](/eip-4337/) wallet factories commonly use.
- Unlike a proxy, `CREATE2COPY` would give each account a full, independent copy of the code with no delegatecall overhead.


---

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