ERC-4337 / Account Abstraction

Meet JainMeet Jain
4 min read

Pre-requisite

Basic understanding of

-Ethereum

-Smart Contracts

What is ERC-4337?

Account Abstraction, aka ERC-4337, is a new approach to solving the wallet user experience on Ethereum today. Account Abstraction acts as a "smart contracts wallet" where users can engage with the Ethereum network without possessing their private keys or having to maintain Ether for transaction costs. It uses an alternative Mempool (aka Alt Mempool) design to accept and interpret messages to facilitate these transactions.

ERC-4337 is a draft EIP (Ethereum Improvement Protocol ) that aims to solve design flexibility that involves multiple transactions or complex interactions between accounts, especially if these operations involve different types of accounts. EOA (Externally Owned Account) also must pay gas fees in the native token of the blockchain (e.g., Ether).

Problem ERC-4337 solves

  • Multi-Operations: Certain interactions with smart contracts involve multiple steps and require multiple transactions. For example, when interacting with a DeFi protocol, a user might need to approve a token transfer, then deposit that token, and then perform some other action. Each step needs to be initiated separately by an EOA, which is a cumbersome and potentially costly process. ERC-4337 proposes to solve this issue by introducing a new transaction type called "UserOperation." (Think of UserOperations as a "to-do list" that you provide to your Ethereum account. This "to-do list" can include things like transferring funds, interacting with a smart contract, or even a combination of multiple actions.)

  • Multi-Signature: ERC-4337 allows for multiple signature-like functionality, opening the door to different use cases like social recovery (e.g., account recovery via your trusted peers), governance security (e.g., unauthorized transactions), and more.

  • Custom Signature Schemes: The ability for alternative signature schemes. Ethereum today uses ECDSA for transaction signatures, and although it is secure and widely used, additional signature schemes open up the door to different use cases, potentially improving interoperability and user experience.

  • Gas costs flexibility: ERC-4337 enables "sponsored transactions" where someone else can pay for the gas fee, allowing more flexibility in transaction fee handling.

  • Upgradability: The ERC-4337 standard uses a proxy contract, making it possible to be "upgradeable". This can allow for new features and bug fixes without interrupting the interoperability within the ecosystem.

We have a high-level understanding of ERC-4337, let's dive into the nitty-gritty details.

Key components of ERC-4337

  • User Operations: UserOperations allow users to define a series of steps that should be executed as part of a single operation. These steps are then executed by the EntryPoint contract, which acts as a proxy for the user.

  • Bundlers - Now, after creating your UserOperation, you need someone to take this and put it into the Ethereum network for you. This is where Bundlers come in. Bundlers can be thought of as facilitators. They are validators or MEV (Maximal Extractable Value) searchers who take your UserOperation, bundle it with others, and submit them all together to the Ethereum network.

  • EntryPoint - The EntryPoint is a smart contract that acts as a gatekeeper for the Ethereum network. Once the Bundlers submit the UserOperations, the EntryPoint is responsible for unpacking the bundle and executing all the operations. If it encounters any operation that fails, it can roll back (or undo) all the actions of that operation, ensuring the integrity and reliability of the transactions.

  • Contract Account - A Contract Account is like your automated assistant on the Ethereum network. Unlike the regular accounts (EOAs) that need to manually initiate every action, Contract Accounts can automatically perform actions based on the instructions they receive (such as those from a UserOperation). They can interact with other contracts, hold and manage assets, and even make decisions based on their programmed logic. This makes them a powerful tool for automating and simplifying complex transactions on Ethereum.

  • Paymaster - This is an optional entity (i.e., smart contract) that can pay (sponsor) transaction fees on behalf of your transaction. It agrees to reimburse the Bundler (i.e., the entity that submits the transaction to the network) for the gas costs. The specifics of when and how the Paymaster pays the fees can be defined in the smart contract.

  • Aggregators - This is an optional smart contract that interacts with the Contract Account, helping it validate signatures from multiple UserOperations together.

How ERC-4337 works?

To visualize this check here:

If you are a developer and want to set up this locally then:

https://github.com/stackup-wallet/erc-4337-examples

Conclusion:

Throughout this article, We now understand ERC-4337, an Ethereum Improvement Proposal (EIP) aimed at enhancing the wallet user experience.

References: https://learn.polygon.technology/courses/14/content/92

0
Subscribe to my newsletter

Read articles from Meet Jain directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Meet Jain
Meet Jain

Working with blockchain technology and an open-source enthusiast.