---
eip: 7666
label: EIP-7666
title: EVM-ify the identity precompile
status: Draft
type: Standards Track
category: Core
created: 2024-03-31
requires: 3855
official: https://eips.ethereum.org/EIPS/eip-7666
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7666.md
canonical: https://eips.huatuo.xyz/eip-7666/
lang: en
tldr: A Draft proposal to retire the identity precompile at 0x04 and replace it with seven bytes of ordinary EVM code that does the same thing, as a first step toward removing rarely used precompiles.
tags: [evm, precompiles, core, simplification]
---

# EIP-7666: EVM-ify the identity precompile

> Remove the identity precompile, and put into place a piece of EVM code that has equivalent functionality

**TL;DR:** A Draft proposal to retire the identity precompile at 0x04 and replace it with seven bytes of ordinary EVM code that does the same thing, as a first step toward removing rarely used precompiles.

## What problem does it solve?

Ethereum has many precompiles: special addresses whose behaviour is hard-coded into every client rather than written in EVM bytecode. Nearly half see little use, yet each adds maintenance burden, consensus-bug risk and work for every new client, especially ZK-EVMs and formally verified implementations.

The identity precompile (`0x04`) simply returns its input. It existed because early on there was no cheap way to copy memory. Since [EIP-5656](/eip-5656/) added `MCOPY`, that reason is gone. EIP-7666 proposes removing it and replacing it with plain EVM code, as a template for later retiring more complex precompiles (such as little-used hash functions and MODEXP).

## How it works

At the start of the fork block:

- The code of address `0x0000000000000000000000000000000000000004` is set to `0x365f5f37365ff3`.
- From that block on, `0x04` is no longer treated as a precompile; calls to it run this bytecode like any other contract.

The bytecode disassembles to:

```
36  CALLDATASIZE      ; size
5f  PUSH0             ; offset in calldata = 0
5f  PUSH0             ; destination in memory = 0
37  CALLDATACOPY      ; memory[0:size] = calldata
36  CALLDATASIZE      ; size
5f  PUSH0             ; offset = 0
f3  RETURN            ; return memory[0:size]
```

It relies on `PUSH0` from [EIP-3855](/eip-3855/), hence the dependency.

## Sample code

Callers do not need to change anything; this still returns a copy of `data` before and after the fork:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract CopyViaIdentity {
    function copy(bytes memory data) external view returns (bytes memory out) {
        (bool ok, bytes memory ret) = address(0x04).staticcall(data);
        require(ok, "identity call failed");
        out = ret;
    }
}
```

New code that just needs a memory copy should use `MCOPY` instead:

```solidity
function copyMem(uint256 dst, uint256 src, uint256 len) internal pure {
    assembly { mcopy(dst, src, len) }
}
```

## Things to know

- **Status: Draft.** It has not been scheduled for any network upgrade.
- Functionality is identical, but gas costs change slightly because the call now executes normal opcodes instead of the precompile's fixed pricing. Contracts that pass a tightly calculated gas stipend to `0x04` should be checked.
- No new functionality is added or made cheaper, so the spec sees no new security risk.
- If adopted, the same "replace with EVM code" pattern could be applied to other precompiles in future proposals.


---

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