---
eip: 2612
label: ERC-2612
title: Permit Extension for EIP-20 Signed Approvals
status: Final
type: Standards Track
category: ERC
created: 2020-04-13
requires: 20, 712
official: https://eips.ethereum.org/EIPS/eip-2612
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2612.md
canonical: https://eips.huatuo.xyz/eip-2612/
lang: en
tldr: Adds a permit() function to ERC-20 so a holder can grant an allowance by signing an EIP-712 message off-chain, saving a separate approve transaction.
tags: [token, erc20, signatures, eip712, gasless]
---

# ERC-2612: Permit Extension for EIP-20 Signed Approvals

> EIP-20 approvals via EIP-712 secp256k1 signatures

**TL;DR:** Adds a permit() function to ERC-20 so a holder can grant an allowance by signing an EIP-712 message off-chain, saving a separate approve transaction.

## What problem does it solve?

With plain [ERC-20](/eip-20/), using a token in a contract takes two transactions: `approve` from the holder, then the contract call that runs `transferFrom`. `approve` is tied to `msg.sender`, so the holder must send it themselves and must hold ETH for gas, even if they only want to spend tokens.

ERC-2612 adds one function, `permit`, that sets an allowance from a **signature** instead of `msg.sender`. The holder signs off-chain for free; anyone (the dApp, a relayer, the spender) submits it. Approve and use can then happen in a single transaction.

## How it works

A compliant token adds three functions:

```solidity
function permit(address owner, address spender, uint256 value, uint256 deadline,
                uint8 v, bytes32 r, bytes32 s) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
```

`permit` sets `allowance[owner][spender] = value`, increments `nonces[owner]`, and emits `Approval`, but only if:

- `block.timestamp <= deadline`,
- `owner != address(0)`,
- the signature is a valid secp256k1 signature by `owner` over the [EIP-712](/eip-712/) struct
  `Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)` using the current nonce.

Otherwise it must revert. The domain separator binds the signature to this token contract and chain (commonly `name`, `version`, `chainId`, `verifyingContract`). The nonce stops replay.

## Sample code

Signing a permit off-chain and using it on-chain (ethers v6):

```ts
import { Contract, Wallet, Signature, MaxUint256 } from "ethers";

const token = new Contract(tokenAddress, [
  "function name() view returns (string)",
  "function nonces(address) view returns (uint256)",
], provider);

const owner = new Wallet(process.env.PRIVATE_KEY!, provider);
const { chainId } = await provider.getNetwork();
const deadline = BigInt(Math.floor(Date.now() / 1000) + 3600); // 1 hour

const domain = { name: await token.name(), version: "1", chainId, verifyingContract: tokenAddress };
const types = {
  Permit: [
    { name: "owner", type: "address" },
    { name: "spender", type: "address" },
    { name: "value", type: "uint256" },
    { name: "nonce", type: "uint256" },
    { name: "deadline", type: "uint256" },
  ],
};
const message = { owner: owner.address, spender, value: 1000n, nonce: await token.nonces(owner.address), deadline };

const { v, r, s } = Signature.from(await owner.signTypedData(domain, types, message));
// Send (owner, spender, value, deadline, v, r, s) to the spender contract.
```

Spender side, approving and pulling in one call:

```solidity
function depositWithPermit(uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
    IERC20Permit(token).permit(msg.sender, address(this), value, deadline, v, r, s);
    IERC20(token).transferFrom(msg.sender, address(this), value);
}
```

## Things to know

- The `version` string in the domain varies by token. Read it from the contract (many expose `eip712Domain()` per [ERC-5267](/eip-5267/)) rather than assuming `"1"`.
- **Front-running**: anyone who sees the signature can call `permit` first. The approval still happens, but your `depositWithPermit` would then revert. Robust integrations wrap `permit` in `try/catch` and check the allowance.
- DAI's earlier `permit` uses a different signature (`allowed` bool and `expiry`), so it is not ERC-2612 compatible.
- Permit signatures are a common phishing vector: signing one grants a spending allowance without any transaction. Wallets should display them clearly and users should read before signing.
- If the domain separator is cached at deploy time, signatures could be replayed after a chain split. Recompute it when `block.chainid` changes.
- Standard `permit` only supports EOA signers. Smart-contract wallets need [ERC-1271](/eip-1271/)-aware variants.


---

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