There are several main components to ERC-4337:
Account Factory Contract and
UserOperationsare 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
UserOperationsso dapps' frontends don't need to change anything to support ERC-4337
Bundlersare actors that package UserOperations from a mempool and send them to the EntryPoint contract on the blockchain. For more detailed documentation on bundlers head on to this part of the documentation.
EntryPointis a smart contract that handles the verification and execution logic for transactions. Account Contracts are smart contract accounts owned by a user.
Account Contractis the smart contract wallet of a user. Wallet developers are required to implement at least two custom functions - one to verify signatures, and another to process transactions.
Factory Contract- When using a wallet for the first time, the
initCodefield of the
UserOperationis used to specify creation of the smart contract wallet. This is used concurrently with the first actual operation of the wallet (in the same
UserOperation). Therefore, wallet developers also need to implement the account factory contract (for example:
BLSAccountFactory.sol(opens in a new tab)). Creating new wallets should use the CREATE2 method to ensure the determinacy of generated addresses.
Paymaster Contractsare 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. For more detailed documentation on paymasters head on to this part of the documentation.
In practice the process is complex. The typical lifecycle of a transaction looks like this: