---
eip: 1167
label: ERC-1167
title: Minimal Proxy Contract
status: Final
type: Standards Track
category: ERC
created: 2018-06-22
requires: 211
official: https://eips.ethereum.org/EIPS/eip-1167
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1167.md
canonical: https://eips.huatuo.xyz/eip-1167/
lang: en
tldr: A tiny, fixed 45-byte bytecode that forwards every call to one implementation contract, letting you deploy cheap, immutable clones that tools can recognize at a glance.
tags: [proxy, clone, factory, delegatecall, gas]
---

# ERC-1167: Minimal Proxy Contract

> To simply and cheaply clone contract functionality in an immutable way, this standard specifies a minimal bytecode implementation that delegates all calls to a known, fixed address.

**TL;DR:** A tiny, fixed 45-byte bytecode that forwards every call to one implementation contract, letting you deploy cheap, immutable clones that tools can recognize at a glance.

## What problem does it solve?

Many applications deploy the same contract over and over: one wallet per user, one vault per pool, one escrow per deal. Deploying the full bytecode each time is expensive. A proxy that `DELEGATECALL`s to a shared implementation is much cheaper, but if every project writes its own proxy, explorers and auditors cannot tell what a given address will actually run.

ERC-1167 standardizes one exact proxy bytecode. Because the bytes are fixed (apart from the embedded target address), a tool such as a block explorer can read the code at an address, recognize it as a minimal proxy, and know that its behavior is exactly that of the implementation it points to, including any verified source or audit of that implementation.

## How it works

The runtime code is:

```
363d3d373d3d3d363d73 <20-byte implementation address> 5af43d82803e903d91602b57fd5bf3
```

In plain terms it:

1. Copies the full calldata into memory.
2. `DELEGATECALL`s the implementation with all remaining gas.
3. Copies the return data back.
4. Returns it on success, or reverts with the same data on failure, so revert messages bubble up.

Because it uses `DELEGATECALL`, the clone keeps its **own storage and balance** while running the implementation's code. The bytecode relies on [EIP-211](/eip-211/): `RETURNDATASIZE` returns 0 before any call, and it is used as a cheaper way to push zero.

The standard deliberately covers only the deployed (runtime) code; how the clone is deployed is left to the factory.

## Sample code

A minimal factory using the widely used 55-byte creation code (10-byte constructor + 45-byte runtime):

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

contract CloneFactory {
    event Cloned(address instance);

    function clone(address implementation) external returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "create failed");
        emit Cloned(instance);
    }
}
```

In practice, OpenZeppelin's `Clones` library wraps this, including a `CREATE2` variant ([EIP-1014](/eip-1014/)) for predictable addresses:

```solidity
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";

address wallet = Clones.cloneDeterministic(walletImpl, keccak256(abi.encode(user)));
IWallet(wallet).initialize(user);
```

## Things to know

- **Constructors do not run for clones.** Put setup logic in an `initialize` function and make sure it can be called only once, ideally in the same transaction as the clone is created, or someone else can initialize it first.
- Clones are **not upgradeable**: the implementation address is baked into the bytecode. That is by design, so users can trust that the code never changes.
- Every call pays a small extra cost for the `DELEGATECALL` hop. Clones save on deployment, not on per-call gas.
- If the implementation can `SELFDESTRUCT` or be otherwise disabled, every clone that points to it is affected. Lock down the implementation contract itself.
- [ERC-3448](/eip-3448/) (MetaProxy) extends this idea by appending immutable metadata to the clone's bytecode.


---

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