ERC-4337 — A New Approach to Account Abstraction

Tiena Sekharan
Coinmonks

--

Why isn’t crypto as ubiquitous as the internet? Why aren’t there as many people in Web3 as there are on Web2?

One of the bigger blockers of crypto adoption is that it is difficult to use. To engage with crypto one needs to create a wallet, generate and secure a seed phrase, connect to DeFi protocols, pay gas fees, etc. The process is intimidating for most people.

With this daunting user experience, we’re never going to reach the goal of attracting 1 billion users. This is where Account Abstraction comes in.

What is “Abstraction” and why do we need it?

In computer science, “abstraction” essentially means hiding everything except what is relevant to the user, thus reducing complexity.

If we can use the internet without knowing what HTTP is or without ever having heard of TCP-IP, why should it be necessary to understand the nuances of blockchain infrastructure to be able to use it?

With Account Abstraction, it will no longer be necessary for one to have a sophisticated understanding of blockchain technology to be able to access crypto tokens and blockchain-based products. It is hoped that Account Abstraction will do for crypto what the browser did for the internet. It will shield the user from the complexities of the technology by hiding it behind an intuitive interface.

Why is this called “Account” Abstraction?

This is an abstraction exercise where we’re abstracting 2 account types.

Ethereum has 2 types of accounts:

  1. Externally Owned Account (EOA) — EOAs can do only a few things- (a) initiate transactions, (b) send and receive tokens, © interact with smart contracts and, (d) pay gas fees. They are controlled by private keys that are required to sign transactions.
  2. Smart Contract Account (SCA) — SCAs can execute complex logic but they cannot (a) initiate transactions or (b) pay gas fees. Any transaction on a SCA is triggered by a transaction from an EOA. They are controlled by code written on the EVM (Ethereum Virtual Machine) and hence do not need private keys.

An EOA can initiate transactions but has limited functionality. A SCA can execute complex logic but can’t initiate transactions. Having 2 types of accounts is an unnecessary complication.

The ideal solution would be if only 1 account type existed that could (a) initiate transactions and pay gas fees, like an EOA, and (b) execute complex code, like an SCA. The icing on the cake would be if that account didn’t require a difficult-to-remember private key that one couldn’t afford to forget or have stolen.

With ERC-4337, an account type doesn’t cease to exist but instead, the workflow is cleverly redesigned so that the user need not be bothered by the difference.

How does ERC-4337 work?

Let us first do a quick recap on how Ethereum confirms transactions pre-ERC-4337

A user uses her wallet to sign transactions and send them to a Public Mempool. From the Public Mempool, a Builder picks up transactions, and with the help of Searchers, builds a block with the maximum potential for profits (after factoring in transaction fees and MEV). Builders then send ready blocks to Proposers who canonically add blocks to the blockchain.

Now let’s look at how the flow changes post ERC-4337.

When a user knows what transaction she wants to execute, she conveys her “intent” by sending a UserOp to an Alt Mempool. An entity called Bundler picks up UserOps from the Alt Mempool, bundles them, and submits them to the Public Mempool through the Entry Point. The steps post this are the same as in the pre-ERC-4337 world.

New Concepts introduced by ERC-4337

The new flow introduces some new concepts and entities:

1. UserOperations (UserOps)

UserOp is a transaction “intent” that the user sends to an Alt Mempool. A UserOp therefore expresses what a user is trying to do. An example of intent is “I want to swap MATIC for AAVE”. UserOps are different from regular transactions in the following ways:

1. UserOps contain additional fields like Entry Point, Bundler, and Aggregator

2. Traditional transactions originate from an EOA. UserOps originate from an ERC-4337 compatible wallet.

3. Traditional transactions must be signed with private keys. UserOps have the flexibility to use different authorization mechanisms and don’t have to use private keys.

4. UserOps can combine steps. Currently, if you want to swap one token for another, authorizing the swap is one transaction, and executing the swap is another transaction. Both transactions incur separate gas fees. With a UserOp, both steps can be combined and executed as one.

2. Bundler

Bundlers monitor the Alt Mempool for UserOps and bundle them into a single transaction to submit to the Public Mempool through the Entry Point. This way an “intent” is converted to a “transaction”.

Note that since the Bundler has an EOA, as far as the consensus layer of the blockchain is concerned, the transaction is originating from the Bundler’s EOA which is also paying the gas fee. The end user doesn’t need an EOA at all.

Similar to Block Building, Bundling is a technically sophisticated task. Bundlers require computing, networking, and storing capacity, and like Block Builders make money through gas fees and MEV from inclusion/exclusion/ ordering of UserOps.

The below diagram from Vitalik Buterin’s article from 2021 portrays the role of UserOps and Bundler:

Image Source

3. Entry Point

Entry Point is a smart contract that acts as a bridge to the chain. The Bundler sends bundles of UserOps as a single transaction to the Entry Point which it verifies and executes.

While the Bundler is the one on the hook for paying gas fees, he is reimbursed by the User. But what if the User doesn’t have sufficient funds in her wallet? The Entry Point is the smart contract that verifies that either the user wallet has sufficient funds to pay gas fees or a Paymaster will cover the same. If not, it’ll reject the transaction.

The below diagram from the same Vitalik Buterin article portrays the role of Entry Point

Image Source

4. Aggregator

A bundle has multiple UserOps signed by multiple users. Aggregator combines these signatures into a single signature. If this combined signature is found to be valid then it implies that all constituent signatures are also valid. Hence multiple UserOps can be verified in one go.

5. Paymaster

Even after the implementation of EIP-1559, payment of gas fees remains a daunting task. Protocols may want to make life easier for their users by helping out with gas fees. Paymaster is a smart contract that allows Protocols to abstract the concept of gas from end users:

  1. Protocols can pay gas fees on behalf of users.
  2. Pre-ERC-4337, users had to pay gas fees in ETH. Now with the help of Paymasters, users can pay gas fees in ERC20 tokens in case they don’t have ETH or don’t want to spend their ETH
  3. Users may also pay gas fees off-chain with credit cards or even airline miles.

Note that Paymaster is an optional feature. The way it works is that the Paymaster stakes ETH with the Entry Point. The Entry Point can debit the staked ETH once the Paymaster validates the UserOps and confirms that it is willing to pay the associated gas fees. Behind the scenes, either the user or the protocol pays the Paymaster in a pre-agreed token or fiat currency.

Benefits of Account Abstraction

With ERC4337, wallets with richer functionality and higher security can be used, you don’t need to safeguard a seed phrase, and you may not need to pay gas fees.

1. Wallets

Given the decentralized ethos of crypto, self-custody is recommended. “Not your keys. Not your coins” is constantly quoted. However, self-custody is scary, as losing keys means losing your funds forever. With Account Abstraction, instead of EOAs, users can use unhosted smart contract wallets with advanced functionality like multi-sig, social recovery, the ability to change keys without changing wallets, etc. It may even be possible to use your Visa card credentials as your wallet.

2. Gas Fees

  1. Pay gas fees in ERC20 tokens — Currently, gas fees on Ethereum must be paid in ETH. This means that a user who only has MATIC in her wallet and wants to swap those for a different token cannot do so till she buys sufficient ETH to pay gas fees. With Account Abstraction, the user will be able to pay gas fees in MATIC or other ERC20 tokens and won't need to buy ETH just to pay gas.
  2. DApps can sponsor gas fees — Gas fees are among the biggest friction points when executing on blockchain. Protocols can incentivize usage by covering gas fees for their users.

3. Improved User Experience

Engaging with DeFi is currently a clunky experience. With ERC-4337, some of the friction is removed by allowing users to use programmable accounts. For example, when interacting with a lending protocol like Aave, one doesn’t need to send 2 separate instructions, one to deposit funds and the second to withdraw. Both steps can be combined in one UserOp.

4. Security

EOAs use ECDSA (Elliptic Curve Digital Signature Algorithm) for encryption. While safe for now, ECDSA is not quantum-resistant. With ERC-4337, users are not bound to EOAs. They are free to upgrade to quantum-resistant wallets with quantum-safe signature algorithms like Lamport or Winternitz.

Why this attempt at Account Abstraction is more promising than past attempts?

This is not the first attempt at Account Abstraction.

EIP-86 — was the first attempt at account abstraction. Currently, Ethereum has a default nonce scheme and uses ECDSA signature verification. Under EIP86, all accounts would become contract accounts with their own preferred signature/nonce scheme.

EIP-2938 — aimed at allowing SCAs to initiate transactions and pay gas fees.

EIP-3074 — gave control of EOAs to SCAs.

These attempts failed for a variety of reasons but the main one being that they required changes to be made to the core Ethereum protocol itself.

Core Ethereum Developers are focused on “scaling”. Their time and effort are currently devoted to increasing network capacity, speed, and throughput through Proto-Danksharding. Any other proposals for changes to the core protocol find themselves in a long queue waiting to have developer resources allocated.

What makes ERC-4337 different is that it has a clever design that achieves Account Abstraction without making major changes to the underlying blockchain infrastructure itself. It can be used on Ethereum (or any EVM chain) without requiring a hard fork or changes to the consensus. In fact, ERC-4337 has been live on Ethereum since March’23 when the Entry Point was first deployed.

Problems with ERC-4337

As Ethereum matures and supports complex operations, steps are moving to shadowy layers. While this might be a practical requirement to promote efficiency, speed, and ease of use, the core tenets of blockchain, like observability, are likely being compromised.

--

--

Tiena Sekharan
Coinmonks

I’m passionate about Cryptocurrencies and am keen to help those struggling to make sense of this world with all its confusing terms and esoteric concepts.