---
eip: 7598
label: ERC-7598
title: Use contract signature for signed transfer
status: Draft
type: Standards Track
category: ERC
created: 2024-01-15
requires: 1271, 3009
official: https://eips.ethereum.org/EIPS/eip-7598
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7598.md
canonical: https://eips.huatuo.xyz/eip-7598/
lang: en
tldr: Extends ERC-3009 signed transfers to accept a single bytes signature, so smart contract wallets (via ERC-1271) can authorize gasless token transfers just like EOAs.
tags: [token, signatures, smart-wallet, gasless, erc3009]
---

# ERC-7598: Use contract signature for signed transfer

> An ERC to extend ERC-3009 Transfer with Authorization to support ERC-1271 signature validation.

**TL;DR:** Extends ERC-3009 signed transfers to accept a single bytes signature, so smart contract wallets (via ERC-1271) can authorize gasless token transfers just like EOAs.

## What problem does it solve?

[ERC-3009](/eip-3009/) "Transfer With Authorization" lets a token holder sign a transfer off-chain and have anyone submit it, so the holder never needs ETH for gas. But its functions take an ECDSA signature split into `v, r, s`. Only an externally owned account (EOA) can produce that. Smart contract wallets, such as multisigs and account-abstraction wallets, cannot use it at all.

ERC-7598 adds overloads that take an opaque `bytes signature`. The token checks it with ECDSA if `from` is an EOA, or by calling `isValidSignature` on the wallet ([ERC-1271](/eip-1271/)) if `from` is a contract.

## How it works

A compliant token keeps everything from ERC-3009: the `AuthorizationUsed` event, the `TRANSFER_WITH_AUTHORIZATION_TYPEHASH` and `RECEIVE_WITH_AUTHORIZATION_TYPEHASH` constants, and `authorizationState(authorizer, nonce)`. It adds:

```solidity
function transferWithAuthorization(
    address from, address to, uint256 value,
    uint256 validAfter, uint256 validBefore, bytes32 nonce,
    bytes memory signature
) external;

function receiveWithAuthorization(
    address from, address to, uint256 value,
    uint256 validAfter, uint256 validBefore, bytes32 nonce,
    bytes memory signature
) external;   // also requires msg.sender == to, to stop front-running
```

Optionally, `cancelAuthorization(authorizer, nonce, bytes signature)` is added as well.

The signed payload is still the [EIP-712](/eip-712/) typed data from ERC-3009: `from, to, value, validAfter, validBefore, nonce` under the token's domain. Each authorization uses a random 32-byte nonce, and the token marks it used so it can only run once. For EOAs, the bytes are `r ‖ s ‖ v` (65 bytes), so the old `v, r, s` functions can simply forward to the new ones.

## Sample code

Verification inside the token, using OpenZeppelin's `SignatureChecker`, which handles both EOAs and ERC-1271 wallets:

```solidity
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";

function transferWithAuthorization(
    address from, address to, uint256 value,
    uint256 validAfter, uint256 validBefore, bytes32 nonce,
    bytes memory signature
) external {
    require(block.timestamp > validAfter, "not yet valid");
    require(block.timestamp < validBefore, "expired");
    require(!_authorizationStates[from][nonce], "used or canceled");

    bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
        TRANSFER_WITH_AUTHORIZATION_TYPEHASH, from, to, value, validAfter, validBefore, nonce
    )));
    require(SignatureChecker.isValidSignatureNow(from, digest, signature), "invalid signature");

    _authorizationStates[from][nonce] = true;
    emit AuthorizationUsed(from, nonce);
    _transfer(from, to, value);
}
```

## Things to know

- Status: **Draft**. [ERC-3009](/eip-3009/) itself is also still Draft.
- The reference code in the spec has inconsistent variable names (`owner`, `authorizer`, `typedDataHash`); treat it as illustrative and use a clean implementation like the one above.
- For contract wallets, security depends entirely on the wallet's `isValidSignature`. A sloppy implementation can approve transfers its owners never intended.
- [ERC-7597](/eip-7597/) applies the same idea to [ERC-2612](/eip-2612/) `permit`.


---

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