exact payment scheme. This uses EIP-3009 (Transfer with Authorization) for gasless USDC transfers.
Source: GitHub › scripts/evm-example/base-sepolia-payment.ts
What is EIP-3009?
EIP-3009 enables gasless payments by allowing you to:- Sign an authorization message off-chain (EIP-712)
- A facilitator submits the transaction and pays gas
- The USDC contract verifies your signature and executes the transfer
Full Example
Step-by-Step Breakdown
1. Load Private Key
- 64-character hex string
- Prefixed with
0x - Example:
0x1234567890abcdef...
2. Create Wallet
- Uses your private key for signing
- Connects to Base Sepolia RPC
- Implements EIP-712 typed data signing (required for EIP-3009)
3. Create Payment Handler
- Defaults to USDC on the wallet’s chain
- Signs EIP-3009 authorization messages
- Uses EIP-712 typed data for secure signing
4. Make Payment
- The handler creates an EIP-3009 authorization
- Signs it using EIP-712 typed data
- Returns the authorization + signature
- The facilitator submits the transaction
Payment Flow
Custom Asset Selection
By default, the handler uses USDC. To specify a different asset:@faremeter/info/evm. You can also provide custom contract information.
Command Line Arguments
- First argument: Server port (default:
4021) - Second argument: Endpoint path (default:
weather)
EIP-712 Signing Details
The authorization is signed using EIP-712 typed data: Domain:Environment Variables
EVM_PRIVATE_KEY: Your EVM private key (0x-prefixed hex string)
Funding Your Wallet
Make sure your wallet has:- USDC: Sufficient USDC for payments (Base Sepolia USDC from faucet)
- ETH: For initial setup (optional if using facilitator for gas)
Related Resources
- SKALE Europa Payment - Forwarder example
- Base Ledger Payment - Hardware wallet example
- Package Reference - EVM payment handler docs
- EIP-3009 Specification - Transfer with authorization