VelvetShark

ERC-4337 - It's all about Account Abstraction

Abstraction
Camaraderie (Abstract painting) by Nikolaos Schizas

This article is part of a "30 Days with Ethereum Standards" series. To see the first article in the series and to understand why the standards matter, check the initial article: 30 Days with Ethereum Standards.

ERC-4337: Account Abstraction Using Alt Mempool

An account abstraction proposal which completely avoids consensus-layer protocol changes, instead relying on higher-layer infrastructure.

Abstract: An account abstraction proposal which completely avoids the need for consensus-layer protocol changes. Instead of adding new protocol features and changing the bottom-layer transaction type, this proposal instead introduces a higher-layer pseudo-transaction object called a UserOperation. Users send UserOperation objects into a separate mempool. A special class of actor called bundlers package up a set of these objects into a transaction making a handleOps call to a special contract, and that transaction then gets included in a block.


What ERC-4337 is about

ERC-4337 doesn't change the consensus layer of Ethereum. Instead, it creates a new mempool for something called userOperations. userOperations are objects that package up the user's intent along with signatures and other data for verification. Bundlers can then package up multiple userOperations into a single transaction, which then gets included in an Ethereum block.

ERC-4337 flow

The key components of ERC-4337 are:

  • UserOperations: Pseudo-transaction objects created by users that contain the sender account, calldata, signatures, and other metadata. UserOperations are sent to a new dedicated mempool.
  • Bundlers: Special actors that listen to the UserOperations mempool, package up multiple operations into a single transaction calling a handleOps function on the entry point contract, and get that transaction included in a block.
  • EntryPoint contract: A singleton contract that verifies UserOperations and dispatches them to the destination account contracts for execution. It acts as the "entry point" for all account abstracted transactions.
  • Account contracts: Smart contract based accounts owned by users that implement verification logic in a validateUserOp function. Account contracts have complete freedom in defining their own authentication schemes.
  • Paymaster contracts (optional): Contracts that can pay the gas fees on behalf of the user, enabling users to pay fees in ERC20 tokens or have fees subsidized by a 3rd party.

This architecture replicates much of the functionality of the normal transaction mempool at a higher level while keeping the core consensus layer of Ethereum unchanged.

Why it is important

ERC-4337 is a major step forward for account abstraction on Ethereum. Some of the key benefits:

  • Improved user experience: Contract-based accounts with smart verification logic can provide significantly better UX with support for social recovery, multisig, spending limits, etc. Gas abstraction via paymasters also reduces onboarding friction.
  • Decentralization: ERC-4337 achieves account abstraction without centralized control. Any bundler or block-builder can participate in the process of including UserOperations on-chain. The system assumes work happens over public mempools.
  • Flexible authentication: Accounts have complete freedom in defining their own authentication logic, enabling cheaper signature schemes, hardware-based signing, quantum-safe schemes, etc.
  • No consensus changes: By working within the existing protocol and relying solely on smart contracts, ERC-4337 can be adopted much more quickly and doesn't add complexity to Ethereum clients.
  • Developer ecosystem: An account abstraction standard provides a unified interface for wallets and dapps to build user-friendly smart contract based accounts, kickstarting a vibrant developer ecosystem.

Overall, ERC-4337 maintains the security and decentralization aspect of Ethereum while drastically improving the user experience and capabilities of user accounts. It's a critical building block for mainstream adoption. Multiple new standards are already being introduced to take advantage of these capabilities and build new user experiences. EIP-7022 is one of the examples. It will introduce a new transaction type to enhance the security and functionality of EOAs.

Use cases

Some of the key use cases enabled by ERC-4337 include:

  • Smart contract wallets / Smart Accounts: Contract accounts with sophisticated verification logic. What can you do with a Smart Account?
    • Automated transactions - Recurring payments, conditional transfers
    • Multi-signature authorization - Require multiple approvals for a transaction to increase security
    • Delegated transactions - Allow a third party to execute transactions on your behalf under specific conditions
    • Enhanced security - Implement complex security mechanisms such as time-locked transactions and withdrawal limits
    • Interoperability - Interact seamlessly with decentralized applications (dApps) and decentralized finance (DeFi) protocols
    • Custom logic - Create custom transaction rules and workflows that align with personal or business requirements.
  • Sponsored transactions: Service providers can pay transaction fees on behalf of their users, similar to how web2 apps subsidize infrastructure costs. This greatly reduces onboarding friction.
  • Paying fees in ERC20 tokens: Users can pay fees in stablecoins or other ERC20s instead of having to acquire ether. Apps can better optimize flows around their native token.
  • Atomic multi-operations: Multiple transactions can be bundled together and executed atomically. Simplifies complex user flows.
  • Trusted hardware support: Hardware wallets can directly sign and authenticate EVM operations. Allows more secure self-custody options for mainstream users.
  • Privacy: Users can execute transactions without revealing their identity by relying on a paymaster or deploying a fresh smart contract account funded by privacy solutions.

By introducing these capabilities, ERC-4337 enables a new wave of user-friendly wallets and onboarding flows that will be critical for taking Ethereum mainstream. It preserves decentralization while making Ethereum much more accessible to end users.

Resources