Operations

There are several main components to ERC-4337: UserOperations, Bundler, EntryPoint Contract, Account Contract, Account Factory Contract and Paymaster Contract.

  • UserOperation: are pseudo-transaction objects that are used to execute transactions with contract accounts. These are created by the dapp. Wallets should be able to translate regular transactions into UserOperation so dapps' frontends don't need to change anything to support ERC-4337 .

  • Bundlers : are actors that package UserOperations from a mempool and send them to the EntryPoint contract on the blockchain.

  • EntryPoint: is a smart contract that handles the verification and execution logic for transactions. Account Contracts are smart contract accounts owned by a user.

  • Account Contract: is the smart contract wallet of a user.

  • Factory Contract: When using a wallet for the first time, the initCode field of the UserOperation is used to specify creation of the smart contract wallet.

  • Paymaster Contracts: are optional smart contract accounts that can sponsor gas fees for Account Contracts, or allow their owners to pay for those fees with ERC-20 tokens instead of ETH.


The lifecycle of transition looks like this:

UserOperation

UserOperation are pseudo-transaction objects that are used to execute transactions with contract accounts. These are created by the dapp. Wallets should be able to translate regular transactions into UserOperation so dapps' frontends don't need to change anything to support ERC-4337.

FieldTypeDescription

sender

address

The address of the smart contract account

nonce

uint256

Anti-replay protection; also used as the salt for first-time account creation

initCode

bytes

Code used to deploy the account if not yet on-chain

callData

bytes

Data that's passed to the sender for execution

callGasLimit

uint256

Gas limit for execution phase

verificationGasLimit

uint256

Gas limit for verification phase

preVerificationGas

uint256

Gas to compensate the bundler

maxFeePerGas

uint256

Maximum fee per gas (similar to EIP-1559(opens in a new tab) max_fee_per_gas)

maxPriorityFeePerGas

uint256

Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)

paymasterAndData

bytes

Paymaster Contract address and any extra data required for verification and execution (empty for self-sponsored transaction)

signature

bytes

Used to validate a UserOperation along with the nonce during verification

Last updated