Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

ERC-4494 applies the permit mechanism of ERC-2612 to ERC-721 NFTs, improving the user experience of the conventional approve and transferFrom flow.

This article translates, summarizes, and explains the original proposal.

Other EIP proposals are covered here.

Overview

ERC-4494 adapts the permit-based approval flow of ERC-2612 to ERC-721.

For background on ERC-721, see:

https://chaldene.net/erc721

For background on ERC-2612, see:

[ERC-2612] Combining ERC-20 Approval and Transfer in One Transaction

ERC-2612 allows an ERC-20 holder to authorize an allowance without personally submitting an approval transaction.

Normally, to let another address, such as an application's operator, transfer tokens on their behalf, the holder first calls approve. The spender can then call transferFrom within the authorized allowance.

The holder needs ETH to pay for the approval transaction, which creates friction for users unfamiliar with Web3.

With permit, the holder signs an authorization offchain instead. Another party can submit the signature through permit and execute transferFrom, potentially combining both calls in one transaction. Signing does not consume gas, although submitting the transaction does. An operator or relayer may sponsor the cost, including as part of a broader minting or purchase workflow.

For background on ERC-20, see:

https://chaldene.net/erc20

ERC-20 and ERC-721 have different ownership models and require separate interfaces. ERC-2612 authorizes a fungible amount and uses an owner-specific nonce. ERC-4494 identifies an individual NFT by its tokenId and uses a token-specific nonce.

Motivation

ERC-2612 uses signed EIP-712 typed data to authorize approval.

For background on EIP-712, see:

[EIP-712] Hashing and Signing Typed Structured Data

Conventional approval followed by a delegated transfer generally requires two transactions: one calling approve and another calling transferFrom. This adds friction and can confuse users.

A permit replaces the owner's approval transaction with an offchain signature. A suitable calling contract can submit the permit and transfer the token atomically in one transaction.

While ERC-2612 defines this approval architecture for ERC-20, ERC-4494 introduces the corresponding mechanism for ERC-721.

Specification

The ERC-721 implementation exposes three additional functions.

js
pragma solidity 0.8.10;

import "./IERC165.sol";

///
/// @dev Interface for token permits for ERC-721
///
interface IERC4494 is IERC165 {
  /// ERC165 bytes to add to interface array - set in parent contract
  ///
  /// _INTERFACE_ID_ERC4494 = 0x5604e225

  /// @notice Function to approve by way of owner signature
  /// @param spender the address to approve
  /// @param tokenId the index of the NFT to approve the spender on
  /// @param deadline a timestamp expiry for the permit
  /// @param sig a traditional or EIP-2098 signature
  function permit(address spender, uint256 tokenId, uint256 deadline, bytes memory sig) external;
  /// @notice Returns the nonce of an NFT - useful for creating permits
  /// @param tokenId the index of the NFT to get the nonce of
  /// @return the uint256 representation of the nonce
  function nonces(uint256 tokenId) external view returns(uint256);
  /// @notice Returns the domain separator used in the encoding of the signature for permits, as defined by EIP-712
  /// @return the bytes32 domain separator
  function DOMAIN_SEPARATOR() external view returns(bytes32);
}

permit

Authorizes the specified spender to operate on the NFT identified by tokenId using a signature from its owner. The deadline specifies the expiration timestamp, and sig contains the signature bytes, supporting conventional secp256k1 ECDSA signatures and EIP-2098 compact signatures.

For background on EIP-2098, see:

[ERC-2098] Compact Ethereum Signatures

nonces

Returns the current nonce for a particular token ID. The nonce is incorporated into the signed permit and helps prevent replay across changes in ownership.

DOMAIN_SEPARATOR

Returns the domain separator used to construct the EIP-712 signing digest.

Signature validation

Validation succeeds only when the applicable requirements are met.

  • The current block timestamp must not exceed deadline.
  • The NFT must have a valid, nonzero owner.
  • The nonce included in the signed data must match the current nonce for tokenId.
  • The signature must be valid for the permit data and the current token owner under the applicable validation rules.

Computing the signature

The signing digest is computed as follows.

js
keccak256(abi.encodePacked(
  hex"1901",
  DOMAIN_SEPARATOR,
  keccak256(abi.encode(
    keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"),
    spender,
    tokenId,
    nonce,
    deadline))
));

Defining DOMAIN_SEPARATOR

An EIP-712 domain separator can be defined as follows.

js
DOMAIN_SEPARATOR = keccak256(
  abi.encode(
    keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
    keccak256(bytes(name)),
    keccak256(bytes(version)),
    chainid,
    address(this)
));
  • name
    • The contract name.
  • version
    • The contract version.
  • chainId
    • The chain identifier.
  • address(this)
    • The verifying contract address.

These values provide domain separation and help prevent signatures intended for one domain from being used in another.

Signed message

The permit uses the following EIP-712 typed-data structure.

json
{
"types": {
  "EIP712Domain": [
    {
      "name": "name",
      "type": "string"
    },
    {
      "name": "version",
      "type": "string"
    },
    {
      "name": "chainId",
      "type": "uint256"
    },
    {
      "name": "verifyingContract",
      "type": "address"
    }
  ],
  "Permit": [
    {
      "name": "spender",
      "type": "address"
    },
    {
      "name": "tokenId",
      "type": "uint256"
    },
    {
      "name": "nonce",
      "type": "uint256"
    },
    {
      "name": "deadline",
      "type": "uint256"
    }
  ],
  "primaryType": "Permit",
  "domain": {
    "name": erc721name,
    "version": version,
    "chainId": chainid,
    "verifyingContract": tokenAddress
},
"message": {
  "spender": spender,
  "value": value,
  "nonce": nonce,
  "deadline": deadline
}
}}

The nonce for the NFT, nonces[tokenId], must be incremented when ownership is transferred.

This prevents a signature associated with an earlier ownership state from becoming valid again if the NFT returns to its previous owner.

The permit function must also reject a zero-address signer.

Authorization does not depend on msg.sender being the owner. Any address can submit a valid permit.

EIP-165

The standard requires EIP-165 interface detection. Applications can use it to check whether an NFT contract advertises ERC-4494 support. Its interface identifier is 0x5604e225.

For background on ERC-165, see:

[ERC-165] Detecting Contract Interface Support

Rationale

Permit submission can be combined with safeTransferFrom without a separate approval transaction from the owner. The signed format limits the scope of the authorization, while the token-specific nonce protects against stale authorizations following ownership changes.

A relayer can submit a permit on the owner's behalf, but can also choose not to submit it. Owners can limit the relayer's discretion with a short deadline. Using the maximum unsigned integer as a deadline makes it effectively nonexpiring. The original article expresses that value as uint(-1); the equivalent expression in Solidity 0.8 and later is type(uint256).max.

The proposal uses EIP-712 because ERC-2612 already uses typed structured data and the format is widely supported by wallet providers.

ERC-2612 authorizes a fungible value, whereas ERC-4494 authorizes an individual NFT identified by its tokenId. Multiple permits can be signed for one token, but standard ERC-721 token-specific approval still identifies one approved address at a time. Granting approval does not transfer the NFT or change its owner.

ERC-2612 passes the signature components v, r, and s separately. ERC-4494 uses a dynamic byte array that accommodates both EIP-2098's 64-byte compact representation and conventional 65-byte signatures. EIP-2098 packs recovery parity into the compact representation of the s component, so decoding differs from simply splitting a 65-byte signature.

Compatibility

Existing ERC-721 implementations, including Uniswap V3's NFT position manager, already implement permit functionality. The original article discusses several differences among earlier permit designs.

  • Owner-based rather than token-based permit accounting.
  • Nonce increments associated with permit execution.
  • Different assumptions about the owner and caller in the authorization flow.
  • Passing r, s, and v separately rather than as a byte array.

These characteristics vary by implementation and should not all be attributed to Uniswap V3 without checking its actual code and interface. ERC-4494 itself allows any caller to submit a permit.

Tests

The reference tests are available here.

Reference implementation

The reference implementation is available here.

Security considerations

Security issues

Applications combining permit and transfer in one operation must handle invalid or unexpected authorizations correctly. This is particularly important for automated NFT platforms handling user assets.

The original proposal adapts several security considerations from ERC-2612.

Even if a signer gives a permit to a particular relayer, another party obtaining the signature may submit it first. The approval authorized by the signature remains the same, but applications must account for transaction ordering rather than assuming their own permit call will always succeed.

The ecrecover precompile can return the zero address when recovery fails. Implementations must check ownerOf(tokenId) != address(0) and reject authorizations for nonexistent or invalid tokens.

A relayer can withhold a signed permit rather than submit it. The deadline bounds its lifetime. An owner who can pay gas may also submit an authorization directly. However, submitting a different permit does not necessarily invalidate all earlier signatures; this depends on nonce changes and revocation semantics. ERC-4494 explicitly requires the nonce to increment on transfer.

The ERC-20 approval race condition is also relevant when reasoning about changes to permit-based authorization.

Consider Alice approving Bob to spend 100 ERC-20 tokens. Bob may then use transferFrom to transfer the tokens from Alice's account.

If Alice changes the allowance from 100 to 50, the outcome depends on transaction ordering.

  • Bob may spend the initial 100 tokens before the new approval takes effect, then spend an additional 50 tokens.
  • If the new 50-token allowance takes effect first, a subsequent attempt to spend 100 tokens may fail.

For an ERC-721 NFT, the analogous risk is that a previously approved spender may transfer the NFT before the new approval takes effect, rather than spending a fungible amount.

Mitigation

One conventional ERC-20 mitigation is to reset the existing allowance to zero and confirm that change before setting the new allowance.

  1. Reset the existing allowance.
js
approve(spender, 0);
  1. Set the new allowance.
solidity
approve(spender, newAmount);

This cannot undo a transfer that has already occurred. The examples above use ERC-20 allowance semantics, not ERC-721 token-specific approval semantics.

If a domain separator containing a chain ID is cached at deployment and not updated when the chain ID changes, a future chain split can introduce cross-chain replay risks.

Citation

Simon Fremaux (@dievardump), William Schwab (@wschwab), "ERC-4494: Permit for ERC-721 NFTs [DRAFT]," Ethereum Improvement Proposals, no. 4494, November 2021. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4494.

Conclusion

ERC-4494 extends signature-based approvals to ERC-721, allowing an NFT owner to authorize a spender without submitting an approval transaction personally. Applications can combine permit submission and transfer while accounting for signature expiration, ownership changes, and approval races.

Questions are welcome through Twitter direct messages.

Twitter @cardene777

I also publish on the following platforms.

https://chaldene.net/