---
eip: 7597
label: ERC-7597
title: Signature Validation Extension for Permit
status: Draft
type: Standards Track
category: ERC
created: 2024-01-15
requires: 1271, 2612
official: https://eips.ethereum.org/EIPS/eip-7597
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7597.md
canonical: https://eips.huatuo.xyz/eip-7597/
lang: en
tldr: A draft extension of ERC-2612 permit that takes the signature as raw bytes and checks it with ERC-1271 when the owner is a contract, so smart contract wallets can also make gasless token approvals.
tags: [token, permit, signatures, smart-wallets, erc20]
---

# ERC-7597: Signature Validation Extension for Permit

> An ERC to extend ERC-2612 Permit to support ERC-1271-based signature validation.

**TL;DR:** A draft extension of ERC-2612 permit that takes the signature as raw bytes and checks it with ERC-1271 when the owner is a contract, so smart contract wallets can also make gasless token approvals.

## What problem does it solve?

[ERC-2612](/eip-2612/) `permit` lets a token holder approve a spender by signing an off-chain message instead of sending an `approve` transaction. But its signature is passed as `v, r, s` and checked with `ecrecover`, which only works for externally owned accounts with a secp256k1 key.

Smart contract wallets (multisigs, passkey wallets, ERC-4337 accounts) do not have such a key. They prove signatures through [ERC-1271](/eip-1271/) `isValidSignature`, which may use any scheme. So under plain ERC-2612 they cannot use permit at all. ERC-7597 adds a `permit` variant that works for both.

## How it works

The token adds an overload that takes the signature as `bytes`:

```solidity
function permit(address owner, address spender, uint256 value, uint256 deadline, bytes memory signature) external;
```

`nonces(owner)` and `DOMAIN_SEPARATOR()` stay exactly as in ERC-2612, and so does the signed EIP-712 `Permit` message. The call sets the allowance, increments the owner's nonce and emits `Approval` only if:

- `block.timestamp <= deadline`,
- `owner` is not the zero address,
- the nonce in the signed message equals `nonces[owner]`,
- the signature is valid: for an EOA, a 65-byte `abi.encodePacked(r, s, v)` ECDSA signature; for a contract, `owner.isValidSignature(digest, signature)` returns the ERC-1271 magic value.

Otherwise it reverts. A token can keep the old `v, r, s` overload by packing those values into bytes and calling the same internal function, so existing integrations keep working.

## Sample code

Token side, using OpenZeppelin's `SignatureChecker` (handles EOA and ERC-1271 in one call):

```solidity
function permit(address owner, address spender, uint256 value, uint256 deadline, bytes memory signature) public {
    require(block.timestamp <= deadline, "expired");
    require(owner != address(0), "zero owner");
    bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));
    bytes32 digest = _hashTypedDataV4(structHash);
    require(SignatureChecker.isValidSignatureNow(owner, digest, signature), "bad signature");
    _approve(owner, spender, value);
}
```

Client side with ethers v6. For a contract wallet, the wallet's own signer produces the bytes:

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

const token = new Contract(tokenAddr, [
  "function nonces(address) view returns (uint256)",
  "function name() view returns (string)",
  "function permit(address,address,uint256,uint256,bytes)",
], signer);

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

const sig = await signer.signTypedData(domain, types, msg);  // EOA: 65 bytes r||s||v
await token["permit(address,address,uint256,uint256,bytes)"](owner, spender, value, deadline, sig);
```

## Things to know

- Status: **Draft**.
- The EIP-712 domain `version` differs between tokens; read it from the token (for example via ERC-5267 `eip712Domain()` where supported) instead of assuming `"1"`.
- For contract wallets, security depends entirely on the wallet's `isValidSignature` logic.
- ERC-1271 only works for wallets already deployed. Counterfactual (not yet deployed) wallets need [ERC-6492](/eip-6492/), which this proposal does not cover.
- The spec's reference snippet is illustrative and omits nonce handling; base real code on an audited permit implementation.


---

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