Table of Contents

Account Abstraction ERC-4337 architecture analysis

The Ethereum blockchain has been at the forefront of innovation in the decentralized finance (DeFi) space, enabling the creation and execution of smart contracts. However, interacting with Ethereum and managing accounts has often been complex and cumbersome for users. This is where account abstraction comes into play. Account abstraction is a new paradigm that aims to revolutionize the user experience and enhance the functionality of Ethereum accounts.

The Significance of Account Abstraction

Account abstraction is a concept that has accumulated significant attention in the Ethereum community. It offers a new way of managing accounts by leveraging the power of smart contracts. Traditionally, Ethereum accounts were classified into externally owned accounts (EOAs) and smart contract accounts (SCAs). EOAs are controlled by private keys and are limited in functionality, while SCAs are programmable and autonomous.

Account abstraction aims to transform EOAs into "smart wallets" by integrating the functionality of SCAs into user accounts. This allows for a more streamlined and user-friendly experience, enhanced security measures and improved transaction fee management. With account abstraction, users can perform multiple actions in a single transaction, enable multi-signature functionality, and even pay transaction fees with ERC-20 tokens. Overall, account abstraction opens new possibilities for users to interact with the Ethereum ecosystem.

ERC-4337: Account Abstraction Using Alt Mempool

Screenshot 2023-12-21 at 12.27.25

Source ERC 4337: account abstraction without Ethereum protocol changes

Account Abstraction ERC-4337 is an Ethereum Improvement Proposal (EIP) that introduces account abstraction to the Ethereum ecosystem. ERC-4337 aims to transform traditional EOAs into "smart wallets" by leveraging the power of smart contracts.

Account abstraction using ERC-4337 introduces a new workflow for interacting with the Ethereum network. Instead of directly initiating transactions from EOAs, users create "UserOperations" that represent their desired transaction intentions. These UserOperations are then processed and executed by smart contract wallets.

ERC-4337 provides several key benefits and features, including:

Multi-Operation Transactions: Users can bundle multiple actions into a single transaction, streamlining the process and reducing the need for various transactions.

Multi-Signature Functionality: ERC-4337 enables the execution of transactions that require multiple signatures, providing enhanced security and enabling collaborative decision-making.

Gas Cost Flexibility: ERC-4337 introduces the concept of "sponsored transactions" where someone else can pay the gas fee, offering more flexibility in transaction fee handling.

Upgradeability: The standard supports using proxy contracts, enabling smart wallets to be "upgradeable" without interrupting interoperability within the Ethereum ecosystem.

ERC-4337 is designed to enhance the user experience, simplify transaction management, and improve security within the Ethereum network. It is an essential step towards achieving a more user-friendly and efficient blockchain ecosystem.

The Components of ERC-4337

ERC-4337 introduces several vital components that work together to enable account abstraction and enhance the functionality of Ethereum accounts. These components include UserOperations, Bundlers, EntryPoint, Account Contracts, Factory Contract, Paymaster, and Aggregators. Let's explore each of these components in detail.

UserOperations:

UserOperations are pseudo-transaction objects that represent the intentions of users. Instead of directly initiating transactions from EOAs, users create UserOperations that encapsulate their desired transaction actions. These UserOperations are similar to unconfirmed transactions and contain essential information such as the sender, recipient, transaction data, and gas fee details.

UserOperations empower users by allowing them to define multiple actions within a single operation. This eliminates the need for users to initiate separate transactions for each action, streamlining the transaction process and reducing gas fees.

With UserOperations, users can perform various actions, including transferring funds, interacting with smart contracts, or executing multiple actions. These UserOperations are then processed and executed by the smart contract wallets, enabling more complex and efficient transactions on the Ethereum network.

Bundlers:

Bundlers play a crucial role in the account abstraction workflow. They are responsible for listening to the UserOperation mempool, bundling multiple UserOperations, and submitting them as a single transaction to the Ethereum network.

When a UserOperation is created, it is initially stored in the UserOperation mempool, a separate mempool dedicated to processing ERC-4337 transactions. Bundlers monitor this mempool and select UserOperations to include in their bundled transactions based on various criteria, such as gas fee prioritization.

Bundlers are validators or actors who take UserOperations from the mempool and bundle them into a single transaction known as a "bundle transaction". These bundle transactions are then submitted to the EntryPoint contract for execution.

Bundlers are critical in optimizing transaction processing by combining multiple UserOperations into a single transaction. This reduces the number of transactions on the Ethereum network and enhances efficiency while ensuring the integrity and reliability of the bundled operations.

EntryPoint:

The EntryPoint contract is a smart contract that handles the verification and execution logic for transactions. Once the Bundlers submit bundled transactions, the EntryPoint contract unpacks the bundle and executes all its operations.

The EntryPoint contract validates the UserOperations within the bundle, ensuring that each operation meets the required criteria and can be executed successfully. It verifies the signatures, checks the available gas fees, and performs any additional validation required for the specific transaction.

If an operation within the bundle fails during execution, the EntryPoint contract can roll back or undo all the actions performed by that operation. This ensures the integrity and reliability of the transactions and helps maintain the consistency of the Ethereum network.

The EntryPoint contract acts as a reference point for the bundled transactions and coordinates the execution of UserOperations. It plays a crucial role in the account abstraction workflow, ensuring that transactions are processed accurately and securely.

Account Contract:

Account Contracts are smart contract wallets that users interact with instead of traditional EOAs. Account Contracts are owned and controlled by users, offering more flexibility and customization compared to EOAs. These accounts can contain arbitrary verification logic, allowing users to define their transaction verification processes.

Account Contracts can execute complex operations, interact with other smart contracts, and hold assets. They eliminate the need for users to manage their private keys and ether balances, making the Ethereum user experience more user-friendly and accessible. This makes Account Contract a powerful tool for automating and simplifying complex transactions on the Ethereum network.

With ERC-4337, Account Contract become an integral part of the account abstraction workflow. They execute the operations defined within UserOperations, interact with other contracts as required, and facilitate seamless transaction processing on behalf of users.

Factory Contract:

When a user initiates interaction with a wallet for the first time, the initCode field within the UserOperation takes a leading role. This field set up the formation of the smart contract wallet, synchronously aligning with the wallet's initial operation within the same UserOperation. 

To guarantee the predictable generation of addresses, wallet developers are entrusted with implementing the Account Factory Contract. Utilizing the CREATE2 method becomes indispensable, ensuring the reliability and correctness of newly generated addresses. It works in conjunction with the initial operation of the wallet, allowing users to establish their wallets securely and efficiently.

Paymaster:

The Paymaster component in ERC-4337 is an optional smart contract that can sponsor gas fees for Account Contracts. It allows users to pay transaction fees with ERC-20 tokens instead of Ether. 

A Paymaster can be any entity willing to cover the gas fees for a specific transaction. It can be a dApp, a wallet provider, or any other party capable of reimbursing the Bundler for the gas costs incurred during transaction execution. The Paymaster's role is to ensure that the gas fees are paid, allowing users to benefit from sponsored transactions and reducing the burden of transaction costs.

The Paymaster feature in ERC-4337 adds flexibility and affordability to transaction processing, enabling users to perform transactions without the need to pay gas fees directly. It opens possibilities for innovative fee models and sponsorship arrangements within the Ethereum ecosystem.

Aggregators:

Aggregators are optional smart contracts that work in conjunction with Account Contracts to validate aggregated signatures from multiple UserOperations. They provide an additional layer of security and efficiency by consolidating multiple signatures into a single value. Aggregators help Account Contracts validate the signatures of UserOperations, ensuring the authenticity and integrity of the transactions.

Aggregators receive the UserOperations containing the required signatures and perform the necessary verification steps. They ensure that the signatures are valid and correspond to the intended operations within the bundle.

By validating multiple signatures, Aggregators enhance the security and trustworthiness of transactions. They enable collaborative decision-making and provide an additional layer of verification for complex transactions involving multiple parties.

Aggregators are a valuable component of ERC-4337, particularly in scenarios where multi-signature functionality is required. They ensure the integrity and authenticity of transactions, contributing to the overall security of the Ethereum network.

The Transaction Lifecycle Under ERC-4337

Screenshot 2023-12-21 at 12.33.34

Source ERC-4337 Documentation

The introduction of account abstraction through ERC-4337 brings about a new transaction lifecycle that differs from traditional Ethereum transactions. Let's explore the transaction lifecycle under ERC-4337.

UserOperation Creation

The transaction process begins with the creation of a UserOperation by the user. The UserOperation encapsulates the user's desired transaction intentions, including the sender, recipient, transaction data, and gas fee details.

Users can define multiple actions within a single UserOperation, streamlining the transaction process and reducing the need for multiple transactions. Each action within the UserOperation is associated with a specific contract account and can involve various interactions with other contracts.

The UserOperation is created off-chain and does not require immediate submission to the Ethereum network. It serves as a pseudo-transaction object representing the user's intent and will be processed and executed by smart contract wallets.

UserOperation Validation and Bundling

Once the UserOperation is created, it is stored in the UserOperation mempool, a dedicated mempool specifically designed for ERC-4337 transactions. The UserOperation mempool operates separately from the main Ethereum network's mempool, ensuring efficient processing of UserOperations.

Acting as validators, Bundlers monitor the UserOperation mempool and select UserOperations to include in their bundled transactions. Bundlers consider various factors, such as gas fee prioritization and transaction efficiency, when bundling UserOperations.

Bundlers simulate the execution of UserOperations to ensure their validity and ability to pay for their execution. They verify the signatures, check the available gas fees, and perform any additional validation required for the specific transactions.

Once the Bundlers have selected and bundled the UserOperations, they create a bundle transaction that includes the bundled UserOperations. This bundle transaction represents a single transaction on the Ethereum network and is ready for submission to the EntryPoint contract.

Sending the Bundle to the EntryPoint Contract

The bundle transaction containing the bundled UserOperations is submitted to the EntryPoint contract for execution. The EntryPoint contract manages the Ethereum network, processing the bundled transactions and coordinating their execution.

The EntryPoint contract verifies the bundled UserOperations, ensuring that each operation meets the required criteria and can be executed successfully. It validates the signatures, checks the available gas fees, and performs any additional validation required for the specific transaction.

If any operation within the bundle fails during execution, the EntryPoint contract can roll back or undo all the actions performed by that operation. This ensures the integrity and reliability of the transactions and helps maintain the consistency of the Ethereum network.

Once the bundled UserOperations are validated by the EntryPoint contract, they are executed by the Account Contract associated with the operations. The Account Contract performs the necessary actions, interacts with other contracts if required, and ensures the successful execution of the bundled transactions.

After execution, the UserOperations becomes a transaction and is sent to the blockchain to be bundled in a block.

Completion of the User Operation

Once the bundled transaction is successfully mined and executed on the blockchain, all the UserOperations it contained are completed. The intended state changes, such as token transfers or contract interactions, occur as specified in the UserOperations. Users are notified that their requested actions have finished successfully.

Conclusion

Account abstraction fosters a more seamless user experience, enabling users to interact with the Ethereum network intuitively. It opens possibilities for innovative fee models, sponsorship arrangements, and subscription-based services.

With ERC-4337, users can create UserOperations to represent their transaction intentions and bundle multiple actions into a single transaction. This simplifies the transaction process, enhances security through multi-signature functionality, and provides flexibility in managing transaction fees.
While account abstraction brings significant benefits, it is essential to consider the potential risks and challenges associated with its implementation. Robust security measures and thorough testing are crucial to mitigate risks and identify and address any potential vulnerabilities.

For further reading on account abstraction and ERC-4337, please refer to the following resources:

About Encora

Fast-growing tech companies partner with Encora to outsource product development and drive growth. Contact us to learn more about our software engineering capabilities.




Learn More about Encora

We are the software development company fiercely committed and uniquely equipped to enable companies to do what they can’t do now.

Learn More

Global Delivery

READ MORE

Careers

READ MORE

Industries

READ MORE

Related Insights

Making Dynamic Pricing Truly Dynamic – Win-win Approach for Customers and Retailers

Dynamic Pricing has become a go-to strategy to compete and improve the bottom line.

Read More

Generative AI: Transforming the Insurance Industry

Learn how generative AI transforms insurance via underwriting, claims processing, and customer ...

Read More

Adopting a Cloud Cost Management Culture: 4 Best Practices to Consider

What is cloud cost management? Learn best practices and get tips to navigate the complexities ...

Read More
Previous Previous
Next

Accelerate Your Path
to Market Leadership 

Encora logo

+1 (480) 991 3635

letstalk@encora.com

Innovation Acceleration

Encora logo

+1 (480) 991 3635

letstalk@encora.com

Innovation Acceleration