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 DAI and most modern ERC-20 tokens, two-step approval + transfer
Quick Comparison
| Feature | EIP-2612 (Permit) | EIP-3009 (transferWithAuthorization) | 
|---|---|---|
| Used by | DAI, most modern ERC-20s | USDC (all networks) | 
| Execution | Two-step: approve + transfer | One-step: direct transfer | 
| Nonce Type | Sequential (auto-increments) | Random bytes32 | 
| Dependency | Must wait for previous nonce | No ordering required | 
| Ideal for | General ERC-20 tokens | Stablecoin payments | 
| Replay Protection | Sequential nonce | Random nonce tracking | 
| Gas Efficiency | 2 transactions (permit + transferFrom) | 1 transaction (direct transfer) | 
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 signature3
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 separatetransferFrom() call. This is the standard method for most modern ERC-20 tokens.
Used by: DAI, and 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
- ✅ Ecosystem support - 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-chain3
Nonce Auto-Increments
The token contract automatically increments the user’s nonce
4
Facilitator Transfers Tokens
Facilitator calls 
transferFrom() to transfer tokens using the approvalEIP-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)
- DAI (all chains)
- Most modern ERC-20s
- USDT (on some chains - Base, Arbitrum, Optimism)
- Many DeFi tokens
- 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
Sequential Nonce (EIP-2612)
Advantages:- Simple and predictable
- Gas efficient (single storage slot)
- Standard across all permit implementations
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
- 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:- Use short deadlines (5-10 minutes) for security
- Longer deadlines (30-60 minutes) for better UX if needed
- Never use type(uint256).maxfor 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
| Method | User Gas | Facilitator Gas | Total Transactions | 
|---|---|---|---|
| EIP-3009 | 0 | ~45,000 | 1 | 
| EIP-2612 | 0 | ~70,000 (permit) + ~45,000 (transfer) | 2 | 
All gas costs are paid by the facilitator and included in the 0.25% AnySpend fee. Users never pay gas directly.
 HypeDuel
HypeDuel