Gasless Payments with ERC-4337 Account Abstraction
TL;DR: T402's gasless mode wraps payment authorizations in ERC-4337 UserOperations, allowing users to pay with USDT without holding ETH for gas. A paymaster sponsors the transaction, and the bundler submits it on-chain. Available on all supported EVM chains via @t402/wdk-gasless.
The Gas Problem
Traditional EVM payments require users to hold two tokens: the payment token (USDT) and the native gas token (ETH, MATIC, etc.). This creates friction — users who receive USDT can't spend it without first acquiring gas tokens through an exchange or bridge.
For mainstream adoption, users should only need to think about the payment amount. They have USDT, they want to pay — everything else should be invisible.
ERC-4337: Account Abstraction
ERC-4337 introduces a new transaction flow that separates who initiates a transaction from who pays for gas:
Traditional Transaction
- User signs tx with EOA
- User pays gas in ETH
- Submitted directly to mempool
ERC-4337 UserOperation
- User signs a UserOp
- Paymaster pays gas
- Bundler submits to EntryPoint
Key components:
- UserOperation: A pseudo-transaction that describes what the user wants to do
- Bundler: Collects UserOps and submits them as real transactions
- Paymaster: A contract that sponsors gas fees (can be repaid in ERC-20 tokens)
- EntryPoint: The singleton contract that validates and executes UserOps
T402 Gasless Flow
T402 integrates ERC-4337 through the @t402/wdk-gasless package. The flow wraps a standard EIP-3009 TransferWithAuthorization inside a UserOperation:
flowchart TD A["1. Client signs EIP-3009 authorization (off-chain, free)"] B["2. Wrapped in UserOperation"] C["3. Paymaster agrees to sponsor gas"] D["4. Bundler submits UserOp to EntryPoint"] E["5. EntryPoint validates & executes"] F["5a. Paymaster pays gas"] G["5b. Token transfer via transferWithAuthorization"] H["6. USDT moves payer → payee"] I["7. Gas deducted from paymaster (or charged to user in USDT)"] A --> B --> C --> D --> E E --> F & G F --> H G --> H H --> I
The user experience is simple: sign one message, payment complete. No ETH, no gas estimation, no stuck transactions.
Implementation
// Server-side: wrap the facilitator with gasless support
import { withGasless } from '@t402/wdk-gasless';
import { ExactEvmFacilitator } from '@t402/evm/exact/facilitator';
const facilitator = withGasless(
new ExactEvmFacilitator({ rpcUrl, signer }),
{
bundlerUrl: 'https://bundler.example.com',
paymasterUrl: 'https://paymaster.example.com',
entryPoint: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789'
}
);
// Client-side: CLI gasless flag
t402 pay 0xRecipient... 1.00 --gasless
t402 request https://api.example.com/data --gasless
Supported Chains
Gasless payments are available on all EVM chains where ERC-4337 infrastructure is deployed:
Trade-offs
Advantages
- No ETH needed for users
- Better UX for non-crypto users
- Single-token experience
- Bundler handles nonce management
Considerations
- Slightly higher latency (bundler step)
- Requires paymaster infrastructure
- UserOp gas estimation can vary
- EVM-only (other chains use native gasless)
Try Gasless Payments
Enable gasless mode in the CLI or integrate @t402/wdk-gasless into your application.