Every one is talking about Account Abstraction proposed by ERC-4337 and developers trying to find a way to adopt it. Some concepts you might have heard about are Smart Contract Wallets, EntryPoint contract, UserOperation, Paymasters, Bundlers etc. but few understand these concepts in detail.
The target audience for this article is developers who are familiar with the concept of account abstraction and have basic knowledge of concepts mentioned above but they don’t understand the detailed working of smart contracts related to it.
In this article we’ll try to understand EntryPoint contract line by line and try to visualise the transaction flow via EntryPoint contract and we’ll also learn how to initialise values in a UserOperation on the client side.
<aside> 💡 If you have no knowledge of account abstraction but have some knowledge of smart contracts, I would recommend to read this article to understand it.
Before going deep into transaction flow, let’s first understand the basic definitions of terms we’ll use in this article.
Data structure that describes a transaction to be sent on behalf of a user. It is not an actual Blockchain transaction but is similar to it as it contains fields like “sender”, “to”, “calldata”, “nonce”, “signature”,”maxFeePerGas”, “maxPriorityFeePerGas” and more. We’ll go through them one by one.
It is a singleton contract that’s used as an entry point to execute bundles of UserOperations. It has two entry point methods
handleAggregatedOps . We’ll go through only the handleOps method and its flow in this article. We’ll cover
handleAggregatedOps in the next article.
It is a smart contract that acts as a user wallet where all user assets are stored. You can program how to validate transactions sent via SCW before executing them. That’s why these are sometimes referred to as programmable accounts.
It is a smart contract that acts as gas tank and is used to sponsor transactions where a third party pays the transaction fee on behalf of the user. Sponsor stores the gas beforehand using Paymaster which then can be used during the transaction flow via EntryPoint.