Skip to main content

ERC-4337 Overview

Introduction

The proposal suggests a different approach to achieve account abstraction in Ethereum. It intends to enable users to use smart contract wallets with arbitrary verification logic instead of externally owned accounts (EOAs) as their primary accounts, without the need for any Ethereum consensus changes. To obtain a complete understanding of the specification, it is suggested to refer to the original source.

Components of ERC-4337

ERC-4337 consists of four primary components, namely UserOperation, Bundler, EntryPoint, and Contract Account. Additionally, Paymasters and Aggregators can also be used to complement these components.

alt_text

UserOperation

In the context of the ERC-4337 account abstraction proposal, user operations refer to the actions taken by users on their accounts. A structure that describes a transaction to be sent on behalf of a user. To avoid confusion, it is not named “transaction”.

  • Like a transaction, it contains sender, to, calldata, max fee per gas, max priority fee, signature, nonce
  • Unlike a transaction, it contains several other fields, described below
  • Also, the nonce and signature fields usage is not defined by the protocol, but by each account implementation
FieldTypeDescription
senderaddressThe account making the operation
nonceuint256Anti-replay parameter; also used as the salt for first-time account creation
initCodebytesThe initCode of the account (needed if and only if the account is not yet on-chain and needs to be created)
callDatabytesThe data to pass to the sender during the main execution call
callGasLimituint256The amount of gas to allocate the main execution call
verificationGasLimituint256The amount of gas to allocate for the verification step
preVerificationGasuint256The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata
maxFeePerGasuint256Maximum fee per gas (similar to EIP-1559 max_fee_per_gas)
maxPriorityFeePerGasuint256Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)
paymasterAndDatabytesAddress of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction)
signaturebytesData passed into the account along with the nonce during the verification step

Overall, user operations in ERC-4337 provide a more user-friendly and extensible interface for interacting with decentralized applications on the Ethereum network.

Bundler

A node (block builder) that bundles multiple UserOperations and creates an EntryPoint.Handleops() transaction. Note that not all block-builders on the network are required to be bundlers.

EntryPoint

A singleton contract to execute bundles of useroperations. Bundlers/clients whitelist the supported entrypoint.

Contract Account

The account contract sends a user operation. In the context of the ERC-4337 account abstraction proposal, a Contract Account is a special type of account that is associated with a smart contract on the Ethereum network.

Unlike traditional externally-owned accounts, Contract Accounts are not controlled by individual users, but instead operate autonomously based on the rules and logic defined by the associated smart contract.

Contract Accounts are created and managed using proxy contracts, which act as intermediaries between the user and the smart contract, abstracting away the details of the contract's implementation and providing a more user-friendly and efficient interface for interacting with decentralized applications on the EVM compatible network.

Supplementary Components

Aggregator

A helper contract trusted by accounts to validate an aggregated signature. Bundlers/clients whitelist the supported aggregators.

Paymaster

The Paymaster is a contract that is designated to pay for gas fees on behalf of a user or a group of users. The purpose of the Paymaster is to simplify the transaction process and improve user experience by eliminating the need for users to hold and manage their own native tokens (like ETH) for transaction fees.

This can be particularly useful for dApps and other blockchain services that involve frequent and complex transactions, as it allows for a more streamlined and efficient transaction process.

How Components Work Together

Simulation Phase

alt_text

Execution Phase

alt_text

Benefits of Using ERC-4337

Erc-4337 brings a lot of advantages for users:

Summary

In simple terms, with ERC-4337, anyone can start trading in NFTs, get crypto newsletter memberships, play web3 games easily, and create new smart account wallets. All without having to become a technical guru. Things are about to get much easier and more fun for the average user and more accessible for the crypto beginner. Check out W3Smart Wallet!