Account Abstraction EIP-4337: The Web3 Game Changer

By Jacob Dmn
Picture of the author
Published on
Ethereum Shanghai sky view

Announcement 🎉

Hola!, What's up Devs! You certainly heard what happened this last March: ETHEREUM COMMUNITY JUST FINALLY LAUNCHED Account Abstraction EIP 4337 🍾

Let's talk about that!


Introduction

The Ethereum Improvement Proposals (EIPs) describe standards such as core protocol specification and contract standards for the Ethereum platform. Ethereum Request for Comment (ERC) is one type of EIP that sets application-level standards such as contract and token standards. An EIP can only become an ERC once the on-chain governance authorizes the change.

ERC-4337 is the latest ERC standard deployed on the Ethereum mainnet to achieve its long-awaited goal of account abstraction. Some still refer to ERC-4337 using its original term, ERC-4337. However, ERC-4337 was initially proposed in 2021 and has been authorized to become ERC-4337 in 2023.


What Is ERC-4337?

EIP-4337 was proposed by Ethereum co-founder Vitalik Buterin and other developers in 2021 to establish account abstraction. It was deployed on the Ethereum mainnet in March 2023 and is expected to herald user-friendly crypto wallet designs.

In Ethereum, account abstraction aims to combine features of the protocol’s two existing account types: Externally owned accounts (EOA) and smart contract accounts. The outcome is a single contract account able to transact with tokens and create contracts at the same time. This change makes creative wallet designs such as social recovery, customization, and upgradeability possible.

Another way to think about EIP-4337 is that it brings smart contract functionality to wallets in a single account. This makes services like multi-factor authentication and automatic payments easier to set up.


Why Is ERC-4337 Needed?

To see why EIP-4337 is needed, it’s important to understand why it was proposed and implemented in the first place. Unlike the Bitcoin network’s Unspent Transaction Output (UTXO) module, the Ethereum protocol uses an account-based model. That means the Ethereum protocol keeps track and updates accounts’ available balances as transactions are confirmed.

The two types of accounts in Ethereum have their own functionalities. EOAs are owned and controlled by users, while smart contract accounts are smart contracts that are deployed on the network. Both accounts can receive, hold, and send ether or tokens.

ERC-4337-EOA-experience
ERC-4337-EOA-experience

Most existing crypto wallets on Ethereum, such as MetaMask, are EOAs, meaning they are limited by the rules set around EOAs. These limitations include solely relying on private keys to access accounts and requiring all transactions to be signed. Because of this, wallet setup procedures and private key security measures are usually complex and not user-friendly. If users lose their seed phrase, it usually means losing access to the wallet.

EIP-4337 removes such limitations. Smart contract wallets such as UniPass and Safe, are wallets managed by smart contract accounts instead of EOAs and can achieve the same goal. However, users must manage their ether in two accounts to pay for gas or rely on a centralized relay system. EIP-4337 removes such limitations because it combines the two account’s functionalities into one, making it easier to deploy desired wallet features.

Solidity Code Example

To give you a better understanding of how Account Abstraction works, here are some Solidity code examples:

// Example of a contract function that uses Account Abstraction 
function transferFrom(address _from, address _to, uint256 _amount) public {
  require(ERC20(_from).transfer(_to, _amount), "Transfer failed");
}

// Example of a contract function that uses an EOA account 
function transfer(address payable _to) public payable {
  _to.transfer(msg.value);
}

In the first example, the transferFrom function can transfer tokens from any contract account, whereas in the second example, the transfer function can only send ether to an EOA account.


How Does ERC-4337 Work?

The Ethereum community has been working on ways to achieve account abstraction for a long time. Before EIP-4337, the community put forward another proposal aimed at achieving account abstraction called EIP-2938. EIP-2938 was similar to EIP-4337 but called for consensus-layer changes. EIP-4337 circumvents this.

It does so by introducing a higher-layer pseudo-transaction object called a UserOperation, which shares similarities to rollups as both involve different versions of the concept of bundling. In EIP-4337, different users send UserOperation objects into a separate mempool.

How does EIP 4337 work
How does EIP 4337 work

Bundlers package these objects into a transaction, which gets included in a block. The bundlers pay gas for the bundled transactions and get paid fees by the individual UserOperation executions. Bundlers work in similar ways to a validator, choosing which objects to include based on fee-prioritization logic.

New functions, including validateUserOp, are also being added to enable a wallet to be a smart contract at the same time. A new contract called the EntryPoint is also being introduced to serve as a security gate for the execution of these new functions.


What Goals Does ERC-4337 Achieve?

The goals EIP-4337 aims to achieve include the following:

Account abstraction: Allow users to enjoy a single account with functionalities of smart contracts and EOAs.

Decentralization: Allow any so-called bundlers to participate in the process.

Avoid consensus changes: Make faster adoption possible as the Ethereum consensus layer focuses on scalability-oriented upgrades.

Enable innovative use cases: These could include aggregated signature, setting daily transaction limit, emergency account freezing, whitelisting, and privacy-preserving applications.

Save time and gas: As bundlers can package UserOperation objects into one transaction, it could save time and gas.


What Does ERC-4337 Mean For Users?

EIP-4337 could spell the end for the complicated crypto wallet user experience and, in doing so, could also increase adoption. Here are some highlights of what EIP-4337 could enable:

Wallet setup: No need to write down seed phrases. Setup can be quick and easy with just a few clicks.

Worry-free account recovery: Users no longer need to sweat over losing their seed phrases, as multi-factor authentication and account recovery are now possible.

User-friendly wallet functions: Users can enjoy a wide range of customized services including auto-pay, pre-approve transactions, and bundled transactions. The sky's the limit.

Better security: Wallets could potentially be more secure as the possibility of human error is reduced — no more hiding seed phrases under your mattress! EIP-4337 should, in theory, lead to a smoother and friendlier user experience for users, therefore removing one major hurdle for mass adoption.

Gas flexibility: Wallets powered by EIP-4337 can now pay gas fees with any ERC-20 tokens and beyond. Developers can build wallets that make paying gas fees in any tokens and even fiat possible.



If you want to dive deeper into Account Abstraction, here are some YouTube videos that I recommend watching:

Ethereum Game Changer!! The ERC-4337 Upgrade Explained!đź’Ą

Why Account Abstraction is a Game-Changer for Dapps | Devcon Bogotá

The Future of Account Abstraction: A roundtable conversation | #web3


Closing Thoughts

The terminologies of crypto wallets – such as seed phrases, private keys, and public keys – can be daunting for new users. The process of using crypto wallets is still challenging for some people. Many agree that the average user’s crypto interface needs to be as simple as possible to accelerate adoption.

EIP-4337 lays down the technical foundation to support creative crypto wallets. What developers can build based on this could change the main touch-point between crypto and users. Regardless, the impact that EIP-4337 will have on user experience and crypto as a whole is something to keep an eye on in the coming years.

#Quiz Time! What is Account Abstractionâť“

  • A new token on the Ethereum network
  • A proposal to enable smart contracts to interact with any account type
  • A security feature to prevent double-spending attacks
  • A protocol for decentralized file storage

Did you enjoy reading?


References


    Follow Me !

    If you enjoyed this article, follow me on social media for more thoughts on full-stack development particularly in the web3 space!

    Hi there! Want to support my work?

    Buy Me A Coffee

    Stay Tuned

    Want to become a Web3 Pro?

    The best articles, links and news related to web development delivered once a week to your inbox.