ERC-4337 vs ERC-7702: Which Account Abstraction Standard Should You Use?
In-depth comparison of ERC-4337 and ERC-7702 account abstraction standards. Learn the differences, use cases, and which one is right for your dApp's gasless transaction needs.
ERC-4337 vs ERC-7702: Which Account Abstraction Standard Should You Use?
Account abstraction is revolutionizing how users interact with Ethereum. But with two major standards—ERC-4337 and ERC-7702—choosing the right one for your project can be confusing. This guide breaks down both standards to help you make the right choice.
TL;DR Comparison
| Feature | ERC-4337 | ERC-7702 |
|---|---|---|
| Status | Production Ready | Pectra Fork (2024) |
| Protocol Change | None Required | Hard Fork |
| Gas Overhead | ~42,000 gas | Minimal |
| EOA Compatible | Requires Migration | Native Support |
| Bundler Required | Yes | No |
| Best For | New dApps | Existing Users |
What is Account Abstraction?
Account abstraction separates the concept of an "account" from the cryptographic keys that control it. This enables:
- Gasless transactions: Users don't need ETH
- Social recovery: Recover accounts without seed phrases
- Batch transactions: Multiple operations in one click
- Custom validation: Biometrics, multisig, session keys
ERC-4337: The Smart Account Standard
How It Works
ERC-4337 introduces a parallel transaction system without changing the Ethereum protocol:
User → UserOperation → Bundler → EntryPoint Contract → Smart Account → Target Contract
Key Components:
- UserOperation: A new transaction type for smart accounts
- Bundler: Aggregates UserOps and submits to chain
- EntryPoint: Singleton contract that validates and executes
- Paymaster: Sponsors gas for UserOps
- Smart Account: Programmable wallet contract
Code Example
import { createSmartAccountClient } from 'permissionless';
import { privateKeyToSimpleSmartAccount } from 'permissionless/accounts';
// Create a smart account
const smartAccount = await privateKeyToSimpleSmartAccount(publicClient, {
privateKey: '0x...',
entryPoint: ENTRY_POINT_ADDRESS,
factoryAddress: SIMPLE_ACCOUNT_FACTORY,
});
// Create client with paymaster for gasless tx
const smartAccountClient = createSmartAccountClient({
account: smartAccount,
chain: arbitrum,
bundlerTransport: http(BUNDLER_URL),
middleware: {
sponsorUserOperation: paymasterClient.sponsorUserOperation,
},
});
// Send gasless transaction
const hash = await smartAccountClient.sendTransaction({
to: '0x...',
data: '0x...',
});
Pros
- Production Ready: Battle-tested since 2023
- No Protocol Changes: Works on any EVM chain
- Flexible Paymasters: Multiple sponsorship models
- Rich Ecosystem: Many providers (Pimlico, Alchemy, Biconomy)
- Upgradeable: Smart accounts can be upgraded
Cons
- Gas Overhead: ~42,000 extra gas per transaction
- Complexity: New infrastructure (bundlers, paymasters)
- Migration Required: Users need new smart accounts
- Bundle Delays: Transactions wait for bundler
Best Use Cases
- New dApps: Building from scratch with UX focus
- Games: Session keys for seamless gameplay
- Enterprise: Multi-sig and spending policies
- Onboarding: Bringing Web2 users to Web3
ERC-7702: Native EOA Enhancement
How It Works
ERC-7702 (part of the Pectra hard fork) adds a new transaction type that temporarily gives EOAs smart contract capabilities:
EOA + Authorization → Temporary Code → Execute → Revert to EOA
Key Innovation: Your existing wallet becomes a smart wallet for one transaction, then returns to normal.
Code Example
// ERC-7702 authorization
const authorization = {
chainId: 1,
address: DELEGATION_CONTRACT, // The smart contract logic
nonce: await client.getTransactionCount({ address: EOA }),
};
// Sign the authorization
const signature = await wallet.signAuthorization(authorization);
// Send transaction with temporary smart wallet powers
const hash = await client.sendTransaction({
authorizationList: [{ ...authorization, ...signature }],
to: TARGET_CONTRACT,
data: encodeFunctionData({...}),
});
Pros
- Minimal Overhead: Near-zero extra gas cost
- EOA Compatible: Works with existing wallets
- No Migration: Users keep their addresses
- Simple: No bundlers or complex infrastructure
- Atomic: Authorization and execution in one tx
Cons
- Requires Hard Fork: Only available post-Pectra
- Limited Chain Support: Initially Ethereum mainnet only
- Less Flexible: Temporary delegation only
- New Standard: Less tooling and documentation
- Security Surface: New attack vectors possible
Best Use Cases
- Existing dApps: Upgrading UX for current users
- Simple Gas Sponsorship: Just covering fees
- L1 Priority: Ethereum mainnet focus
- Minimal Changes: Don't want new infrastructure
Head-to-Head Comparison
Gas Costs
ERC-4337:
Base transaction: ~21,000 gas
+ UserOp validation: ~20,000 gas
+ Paymaster validation: ~15,000 gas
+ Account deployment (first): ~200,000 gas
─────────────────────────────
Total (first tx): ~256,000 gas
Total (subsequent): ~56,000 gas
ERC-7702:
Base transaction: ~21,000 gas
+ Authorization: ~3,000 gas
+ Code execution: Variable
─────────────────────────────
Total: ~24,000 gas + execution
Winner: ERC-7702 for gas efficiency
Developer Experience
ERC-4337:
- Mature SDKs (permissionless, @account-abstraction/sdk)
- Multiple bundler options
- Extensive documentation
- Active community
ERC-7702:
- Emerging tooling
- Limited documentation
- Fewer examples
- Rapidly evolving
Winner: ERC-4337 for current DX
User Experience
ERC-4337:
- Requires new smart account
- Address changes (unless using CREATE2)
- Can batch multiple operations
- Session keys for gaming
ERC-7702:
- Keep existing address
- Familiar wallet experience
- Single transaction focus
- Simpler mental model
Winner: ERC-7702 for existing users, ERC-4337 for new users
Security
ERC-4337:
- Well-audited EntryPoint contract
- Known attack vectors documented
- Signature replay protection built-in
- Account recovery possible
ERC-7702:
- Newer, less battle-tested
- Authorization replay risks
- Delegation contract must be secure
- No built-in recovery
Winner: ERC-4337 (for now)
When to Use Each
Choose ERC-4337 When:
- Building a new dApp from scratch
- You need session keys for gaming
- Multi-chain support is required
- You want programmable spending policies
- Social recovery is a priority
- You're targeting non-technical users
Choose ERC-7702 When:
- Upgrading an existing dApp
- Users want to keep their addresses
- Minimal overhead is critical
- Targeting Ethereum mainnet primarily
- Simple gas sponsorship is the main goal
- You want the simplest integration
Use Both When:
- Supporting new and existing users
- Building a wallet or infrastructure
- Future-proofing your application
- Targeting multiple chains with different support
How GasX Supports Both
GasX provides unified gas sponsorship across both standards:
ERC-4337 Integration
// Using GasX Paymaster with ERC-4337
const paymasterClient = createPimlicoPaymasterClient({
transport: http(GASX_PAYMASTER_URL),
entryPoint: ENTRY_POINT_ADDRESS,
});
// Sponsor any UserOperation
const sponsoredUserOp = await paymasterClient.sponsorUserOperation({
userOperation,
});
ERC-7702 Integration
// Using GasX with ERC-7702
const sponsoredTx = await gasxClient.sponsorTransaction({
authorization: signedAuthorization,
target: CONTRACT_ADDRESS,
data: callData,
});
Unified API
Whether you're using ERC-4337 or ERC-7702, GasX provides:
- Single dashboard for all campaigns
- Unified analytics across standards
- One API key for both
- Automatic routing based on chain support
Migration Strategies
From EOA to ERC-4337
- Deploy smart account with same owner
- Use CREATE2 for predictable address
- Migrate assets gradually
- Update dApp to support both
From ERC-4337 to ERC-7702
- Wait for Pectra fork on target chain
- Test authorization flows
- Keep ERC-4337 as fallback
- Migrate based on gas savings
Supporting Both Simultaneously
async function sponsorTransaction(user: Address, tx: Transaction) {
// Check if chain supports ERC-7702
const supportsERC7702 = await checkERC7702Support(tx.chainId);
// Check if user has smart account
const hasSmartAccount = await checkSmartAccount(user);
if (supportsERC7702 && !hasSmartAccount) {
// Use ERC-7702 for EOAs on supported chains
return sponsorWithERC7702(user, tx);
} else {
// Fall back to ERC-4337
return sponsorWithERC4337(user, tx);
}
}
Future Outlook
ERC-4337 Roadmap
- Native account abstraction (RIP-7560)
- More efficient bundling
- Cross-chain UserOps
- Better MEV protection
ERC-7702 Roadmap
- L2 support
- Enhanced tooling
- Wallet integration
- Standard delegation contracts
Conclusion
Both standards serve important roles in the account abstraction ecosystem:
- ERC-4337 is the mature, flexible choice for new applications
- ERC-7702 is the lightweight, backwards-compatible option for existing users
For most projects launching today, we recommend:
- Start with ERC-4337 for comprehensive features
- Plan for ERC-7702 integration post-Pectra
- Use GasX to abstract away the complexity
Ready to implement gasless transactions? Create your GasX campaign and we'll handle the infrastructure for both standards.
Further Reading
Ready to eliminate gas friction?
Create your first gas sponsorship campaign in under 5 minutes. No coding required.
Create Campaign