EIPs Explained

EIP-7997 · Last Call · Core · 2025-08-03

EIP-7997: Deterministic Factory Contract

Makes the widely used keyless CREATE2 factory at 0x4e59b448...4956C a formal requirement on EVM chains, so contracts and smart accounts can be deployed at the same address on every chain.

What problem does it solve?

Developers want a contract (and users want their smart account) to live at the same address on every chain. CREATE2 (EIP-1014) makes addresses deterministic, but the result depends on the deployer's address, so you first need a factory that already sits at the same address everywhere.

The usual trick is a keyless "Nick's method" transaction that anyone can replay on a new chain. It has a fixed gas price and gas limit, so it fails on chains whose gas rules differ, and the spec notes this has started to affect Ethereum's own devnets as the gas schedule changes. Without a guaranteed factory, smart accounts end up at different addresses on different chains, which confuses users and has caused loss of funds.

How it works

  • FACTORY_ADDRESS = 0x4e59b44847b379578588920cA78FbF26c0B4956C.
  • A chain's state MUST contain this account with a nonzero nonce and the exact runtime bytecode given in the spec.
  • A chain can satisfy this by deploying it with an ordinary transaction (such as the existing keyless one) where gas rules allow, or by including it in genesis with nonce 1. Clients must not check for it at the fork boundary.

Factory behavior:

  • Calldata = salt (32 bytes) ++ initcode. msg.value is forwarded to CREATE2.
  • On success it returns the new address as exactly 20 bytes, not ABI-padded.
  • On failure it reverts with empty data. Calldata shorter than 32 bytes should also revert.

The resulting address is the standard CREATE2 formula with the factory as deployer:

address = keccak256(0xff ++ FACTORY_ADDRESS ++ salt ++ keccak256(initcode))[12:]

Sample code

Deploying through the factory and predicting the address (ethers v6):

import { Wallet, JsonRpcProvider, concat, zeroPadValue, getCreate2Address, keccak256 } from "ethers";

const FACTORY = "0x4e59b44847b379578588920cA78FbF26c0B4956C";
const wallet = new Wallet(process.env.PRIVATE_KEY!, new JsonRpcProvider(process.env.RPC_URL));

const salt = zeroPadValue("0x01", 32);
const initcode = "0x..."; // your creation code + encoded constructor args

const predicted = getCreate2Address(FACTORY, salt, keccak256(initcode));
const tx = await wallet.sendTransaction({ to: FACTORY, data: concat([salt, initcode]) });
await tx.wait();
console.log("deployed at", predicted); // same on every chain with the factory

Things to know

  • Status: Last Call. The spec says Ethereum Mainnet and most chains already have the factory, so for them it is a no-op.
  • The return value is 20 raw bytes; do not abi.decode it as an address.
  • Revert reasons from your initcode are not propagated; use a trace to debug failed deployments.
  • Deployments of contracts that read the environment (ORIGIN, NUMBER, …) can be front-run with attacker-chosen parameters. Use the factory only for fully deterministic initcode.
  • An earlier attempt at a standard singleton factory was ERC-2470 (Stagnant).

#create2 #factory #deterministic-deployment #multichain #core

Details

Authors
Francisco Giordano (@frangio), Toni Wahrstätter (@nerolation), Nick Johnson (@Arachnid), Jochem Brouwer (@jochem-brouwer)
Status
Last Call
Type
Standards Track / Core
Created
2025-08-03
Requires
Required by

Machine-readable: Markdown · JSON