Account Abstraction 101: Core Concepts of ERC-4337 and What it Means for Rollups
Account abstraction is the key to better UX on blockchains.
In this article, we’ll discuss:
How ERC-4337 powers account abstraction
Smart wallets and transaction programmability
UserOperations and their role in account abstraction
Account abstraction process and supporting infrastructure
Bundlers make UserOperations happen
Paymasters and gas sponsorship
Conclusion: Account abstraction is the next step for crypto adoption
Account abstraction refers to a set of development practices and tools that make onchain apps more user-friendly by automating complex blockchain processes that users previously had to actively manage. Those processes can include signing transactions, completing gas payments, reconnecting to an onchain app, and more. Account abstraction became possible on Ethereum and other EVM chains in March 2023 with the implementation of ERC-4337, which allowed for the creation of smart wallets that can carry out complex transactions on users’ behalf.
We’ll explain more below and examine the core concepts and tools behind account abstraction, as well as the benefits it delivers to apps and rollups built on Ethereum and other EVM chains.
Account abstraction benefits: The better UX we need to onboard the next billion users
Every builder in crypto wants to bring blockchains to the masses. But many elements of the default user experience on blockchains, such as gas fee management and private key dependence, make this difficult. Account abstraction fixes this for the EVM ecosystem by simplifying user experience and making onchain apps behave more like the web2 apps most people are familiar with.
Some of the user experience gains account abstraction enables include:
- Conditional transaction execution. Account abstraction allows users to program their wallets to automatically carry out transactions under specific circumstances.
- Gas sponsorship. Onchain apps can pay for gas on users’ behalf or support gas payment in tokens other than ETH thanks to account abstraction.
- Session keys. Account abstraction allows users to continuously transact via an onchain app for a given period of time without needing to sign each transaction. This is especially valuable for onchain games and other apps that require sessions of sustained usage.
- Social recovery. Users can recover access to their wallets using trusted contacts or predefined recovery methods, rather than relying solely on a private key.
- Custom wallet logic. Users can implement custom rules for how their wallets interact with onchain apps, such as setting spending limits, time locks, and access restrictions.
All these features and many more are unlocked for onchain builders with account abstraction. And it’s all thanks to a recent change to Ethereum: ERC-4337.
ERC-4337 powers account abstraction with smart wallets and user operations
ERC-4337 introduced two key onchain components that work together to make Ethereum wallets and onchain apps easier to use:
- Smart contract accounts, also known as smart wallets
- UserOperations
Let’s look at both in more detail.
Smart wallets bring programmable transactions
The default Ethereum account is the externally owned account (EOA). Most crypto users are familiar with EOAs: The account is identified by its public key, and anyone in possession of its private key has full control of the account and can execute transactions with it. While EOAs make it possible to transact and use onchain apps, they have limited functionality — users can only execute simple transactions like sending tokens or interacting with smart contracts, and users must sign each individual transaction in real time. This makes them clunky to use, especially for complex onchain operations like paying for gas or executing multi-signature transactions.
Smart wallets solve this by introducing programmability. Smart wallets are actually smart contracts that can hold users’ funds and transact on their behalf, but only at the direction of an EOA tied to the user. Because smart wallets are governed by code rather than by private keys, they can automatically execute transactions when specific conditions are met, making them especially useful in the context of onchain apps. Users can control their own smart wallet that then interfaces with various onchain apps, but many onchain apps choose to embed their own smart wallet solutions that users can control via their EOA, which remains the more widely used account type for individuals.
Embedded smart wallets are a core offering of any account abstraction solution for rollups or onchain apps. Builders should evaluate smart wallets based on their ease of use, security, and compatibility with the most widely used onchain infrastructure and rollup development frameworks. Account abstraction provider ZeroDev discusses smart wallet capabilities here, noting that for now, three features have proven most important to users: gas sponsorship, transaction batching, and session keys. It’s crucial that your smart wallet provider is able to provide those seamlessly. However, as smart wallet APIs become more standardized, other features may become easier to implement and more widely used.
UserOperations: The onchain mechanism of account abstraction
UserOperations are a new type of pseudo transaction enabled by ERC-4337. You can think of them as the mechanism by which users send complex transaction instructions to the smart wallets that execute them.
Each UserOperation represents a specific action a user wants to take onchain, and is made up of all of the smaller transactions that action requires. The UserOperation communicates those smaller transactions to smart wallets that execute them, but from the user’s perspective, they only need to sign one transaction from their EOA. For example, imagine a user wants to swap one ERC-20 token for another on a DEX. Ordinarily, this would require the user to sign a transaction approving the DEX to swap their token, and then another approving the swap itself. Account abstraction would allow a DEX with an embedded smart wallet to batch those two transactions together as a UserOperation so that the user only has to sign one transaction.
However, UserOperations don’t just go directly from EOAs to smart wallets. There are several steps and other pieces of onchain infrastructure involved, many of which can be customized by rollup and app builders.
Account abstraction supporting infrastructure and process: How UserOperations become transactions under ERC-4337
While smart wallets and UserOperations are the core components enabling account abstraction, there are several other pieces of supporting infrastructure that work together to make account abstraction possible. We’ll summarize those here by looking at the lifecycle of a UserOperation, then go deeper on the key pieces of infrastructure that come into play.
The process for executing UserOperations unfolds like this:
- Users submit a UserOperation transaction from their EOA via a smart wallet embedded in an onchain app, or directly from their own smart wallet.
- UserOperation enters the UserOperation mempool, an alternate mempool on Ethereum reserved just for UserOperations.
- A bundler monitoring the UserOperation mempool bundles together several UserOperation transactions and combines them into one transaction for better cost-efficiency. As we’ll explore below, bundlers are nodes with the capability to handle UserOperations, and it’s important for onchain apps and rollups to consider carefully which bundlers they choose to partner with.
- The bundler sends the bundled transaction EntryPoint, a dedicated smart contract on Ethereum that validates each UserOperation in the bundled transaction and executes it on behalf of the smart wallet in question.
- The paymaster is another type of smart contract that is sometimes called during the execution of a UserOperation, specifically when an onchain app wants to pay the gas fee for the transaction on a user’s behalf, or allow them to pay a gas fee in a token other than ETH (or instead of whatever custom gas token another chain may use). Similar to bundlers, apps can choose to utilize paymasters from different providers.
Let’s look more closely at a few of these components and how builders can get the most out of them.
Bundlers make UserOperations happen
Bundlers are the nodes that group together multiple UserOperations and pass them to the EntryPoint contract to be executed in one bundled transaction. The bundler does this by calling the EntryPoint contract’s handleOps function, and in turn the EntryPoint validates each UserOperation with the validateUserOp function. Through this process, the bundler works in tandem with smart wallets to execute complex transactions programmatically, making them as seamless as possible for the end user. Bundlers are responsible for initially paying the gas fee on the bundled transaction, and are later compensated by the end user or by the app via a paymaster.
Any EVM blockchain node can act as a bundler by running the appropriate code. However, rollup and app builders need to carefully evaluate the bundler providers with whom they partner. For instance, reliability and high uptime are crucial for a bundler, as any downtime will disrupt transaction processing and hurt user experience.
Another factor to consider is the bundler’s accuracy in estimating gas fees. Bundlers pay for gas on each bundled transaction by estimating the amount necessary to ensure the transaction included by a block builder. If the bundler estimates too low, the bundle won’t be included, and users face reverted transactions. If the bundler estimates too high, the user may be dissuaded from carrying out the transaction (though ultimately if they do transact, they’ll be reimbursed for the bundler’s overestimate). Bundlers must aim to pay the closest amount to the actual gas fee without undershooting and causing transactions to fail.
Finally, apps and rollups must evaluate the price the bundler charges for executing UserOperations via its API. The onchain fees for bundler transactions are relatively standardized, but there can be a wide range in off-chain costs like integration fees and ongoing SaaS subscription fees. We’re still in the early days of account abstraction, but we predict that as more rollups and apps implement it and users embrace it, bundler pricing will fall as the service becomes commoditized.
Paymasters enable gas sponsorship
By default, crypto users transacting with EOAs alone must pay for gas on every transaction, using the gas token of the chain in question (usually ETH for EVM chains). This creates a clunky user experience, and means holders need to constantly monitor their supply of the gas token, even if it’s a token they otherwise wouldn’t want to hold. Paymasters solve this by enabling apps to abstract away the complexities of gas management. For instance, with gas sponsorship, apps can automatically cover users’ gas fees on any given transaction. Paymasters also enable app users to pay for gas fees in any token they hold — under the hood, this requires a complex set of swaps, but to the user, it happens automatically as part of the transaction.
Rollup and app builders should seek paymasters with high levels of customizability. For instance, an app may want to only enable gas sponsorship under certain conditions, such as during a wallet’s first ten transactions after onboarding to incentivize new users. A good paymaster provider will make those parameters easy to set. Similarly, good paymasters will cover a wide range of ERC-20 tokens for alternate gas token payments. This is no easy feat, as it requires the paymaster to maintain liquidity across a number of tokens. Finally, builders should also take into account the gas efficiency paymasters can provide on gas sponsorship transactions and swaps to enable alternate gas token payments.
Account abstraction is the next step to growing the pie in crypto
Rollups have enabled huge strides in increasing blockchain scalability and lowering transaction costs, priming the pump for new users to onboard into the Ethereum ecosystem. Account abstraction is the next step to getting more users onchain — to spread the benefits of self-custody and permissionless development, we need to make the blockchain a more inviting place. At Conduit, we’re doing our part by enabling rollup builders to integrate with the best account abstraction builders in the space quickly and easily. Contact us here to learn more!