Skip to main content

Overview

AnySpend x402 uses cryptographic signatures instead of traditional token approvals, enabling gasless payments for users. The facilitator pays all gas fees while users simply sign authorization messages. There are two main signature standards supported, each optimized for different token types:
  • EIP-3009 (transferWithAuthorization) - Used by USDC, one-step direct transfers
  • EIP-2612 (permit) - Used by most modern ERC-20 tokens, two-step approval + transfer

Quick comparison

EIP-3009: transferWithAuthorization (USDC)

Overview

Direct transfer authorization - the signature authorizes an immediate transfer from sender to recipient without a separate approval step. Used by: USDC on all networks (Base, Ethereum, Arbitrum, Optimism, Polygon, etc.)

Key advantages

  • One-step execution - direct transfer, no approval needed
  • Random nonce - no sequential dependency, parallel transactions possible
  • Immediate settlement - executes in single transaction
  • Gasless for payer - facilitator pays gas
  • No front-running - random nonce prevents MEV attacks

Message structure

Usage example

How it works

1

User Signs Authorization

User signs an EIP-712 message authorizing the transfer with a random nonce
2

Facilitator Executes Transfer

Facilitator calls receiveWithAuthorization() with the signature
3

USDC Transferred

USDC is transferred directly from user to facilitator in one atomic transaction
4

Nonce Invalidated

The random nonce is marked as used, preventing replay attacks

EIP-712 typed data structure


EIP-2612: Permit (Standard ERC-20)

Overview

Signature-based approval that sets an allowance, followed by a separate transferFrom() call. This is the standard method for most modern ERC-20 tokens. Used by: Most modern ERC-20 tokens with permit support

Key advantages

  • Widely adopted - standard across many tokens
  • Time-limited approvals - deadline-based expiration
  • ERC-20 compatible - works with existing infrastructure
  • Gasless for payer - facilitator pays gas
  • Supported by major wallets and dapps

Message structure

Usage example

How it works

1

User Signs Permit

User signs an EIP-712 permit message with current sequential nonce
2

Facilitator Calls Permit

Facilitator calls permit() to set the allowance on-chain
3

Nonce Auto-Increments

The token contract automatically increments the user’s nonce
4

Facilitator Transfers Tokens

Facilitator calls transferFrom() to transfer tokens using the approval

EIP-712 typed data structure


Which method does my token use?

Checking token support

Common tokens by method

EIP-3009 (transferWithAuthorization):
  • USDC (all chains)
  • USDC.e (bridged versions)
EIP-2612 (permit):
  • Most modern ERC-20s
  • USDT (on some chains - Base, Arbitrum, Optimism)
  • Many DeFi tokens
  • Check compatibility: anyspend.com/x402-tokens
No Gasless Support:
  • USDT on Ethereum mainnet (no permit)
  • USDT on Polygon (no permit)
  • Legacy ERC-20 tokens
The AnySpend x402 client automatically detects which signature method to use based on the token contract. You don’t need to specify this manually.

Nonce management

Random nonce (EIP-3009)

Advantages:
  • No ordering dependency - multiple signatures can be used in any order
  • Parallel transactions possible
  • No blocked state if one transaction fails
Implementation:
Nonce Tracking:

Sequential nonce (EIP-2612)

Advantages:
  • Simple and predictable
  • Gas efficient (single storage slot)
  • Standard across all permit implementations
Implementation:
Nonce Auto-Increment:

Security considerations

Replay protection

EIP-3009:
  • Random nonce prevents replay across chains and contracts
  • Each nonce can only be used once per address
  • Nonce state stored on-chain in mapping
EIP-2612:
  • Sequential nonce prevents replay
  • Must use current nonce (auto-increments)
  • Failed transactions block subsequent signatures until re-signed

Deadline enforcement

Both methods enforce deadlines to prevent stale signatures:
Best Practices:
  • Use short deadlines (5-10 minutes) for security
  • Longer deadlines (30-60 minutes) for better UX if needed
  • Never use type(uint256).max for infinite approvals

Signature validation

Both methods validate signatures using EIP-712:

Client SDK integration

The AnySpend x402 client handles all signature complexity automatically:

Gas cost comparison

All gas costs are paid by the facilitator and included in the 0.25% AnySpend fee. Users never pay gas directly.

Further reading

EIP-2612 Specification

Official EIP-2612 permit specification

EIP-3009 Specification

Official EIP-3009 transferWithAuthorization specification

EIP-712 Typed Data

EIP-712 typed structured data hashing and signing

Network Support

See which tokens support which methods on each network