April 14, 2024

ERC- 4337: What Is Account Abstraction In Crypto

ERC- 4337: What Is Account Abstraction In Crypto

Account abstraction is believed by many to be one of the key methods through which crypto and web3 protocols can achieve mass adoption. 

The concept revolves around optimizing and enhancing user experiences on crypto wallets and web3 protocols by ensuring simplicity and seamlessness without compromising security. 

All technical processes should be kept as far removed as possible from end users when they are using wallets, as well as when interacting with protocols. 

Imagine accessing your wallet without needing seed phrases, interacting with a decentralized application (dApp) without your wallet repeatedly prompting you for approval/signature or paying gas fees with ERC-20 tokens and not with Ether.

Let me pose a question to you, the reader: How often have you attempted to log into an account, only to realize you've forgotten the password, leading you to utilize the "forgot password" feature to regain access?

I've experienced this scenario several times myself.

With account abstraction, wallets can implement social recovery mechanisms, mitigating the risk of losing assets due to forgotten/misplaced seed phrases. 

Account abstraction is the concept aimed at realizing these advancements and more, with ERC-4337 serving as one approach to implementing this concept on the Ethereum blockchain.

While account abstraction can be implemented in numerous blockchains this article focuses on account abstraction on the Ethereum blockchain.

Understanding Account Abstraction 

Account abstraction is a proposal to change the architecture of Ethereum wallets making them simpler and more user-friendly allowing users to customize how they interact with the Ethereum blockchain. 

Abstraction in this instance means; to hide technical processes and the complexities of a system from the end users, that way they can use the application without knowledge of the processes running in the background. 

Accounts are users’ representation on the blockchain that can send or receive transactions and interact with other on-chain accounts, protocols and dApps.

On the Ethereum blockchain, there are two types of accounts they are; Externally Owned Accounts (EOAs) and contracts accounts. 

Externally Owned Accounts(EOAs)

These are regular accounts like MetaMask wallets used to receive or send tokens as well as interact with dApps, smart contracts and protocols managed by cryptographic pair of public and private keys. 

The private key is the sole route to gaining control of an EOA, where the private key holder is the owner of the EOA and can sign transactions without limits.

Contract Account 

Contract accounts are Ethereum accounts deployed as smart contracts meaning they are controlled by code. 

Similar to EOAs contract accounts are also represented by addresses although they do not have private keys.  They are usually compared to vending machines running on codes because they perform certain functions as long as predefined requirements are met. 

Contract accounts can only send transactions in response to a transaction from an EOA and cannot pay gas fees. 

However, since they are programmable, they can execute arbitrary logic depending on the code stored at the address. 

Image credit: MetaMask

This entire process of using EOAs involves multiple steps and confirmations that can be tedious to an average new user carrying out their first activities on a dApp. 

Below is a depiction of what interacting with a dApp looks like from the perspective of a first-time user:

Image credit: Cointelegraph 

This is coupled with the fact that if users misplace their private keys, they may lose their funds held in EOA accounts resulting in a fractured and daunting Web3 experience.

With account abstraction, wallet developers can create systems that handle these processes in the background, simplifying the web3 experience.

ERC-4337: Ethereum’s Approach To  Account Abstraction  

Many Ethereum Improvement Proposals were submitted to achieve account abstraction in  Ethereum but none were accepted before EIP-4337 which was proposed in 2021 and was co-authored by Vitalik Buterin, Yoav Weiss, Kristof Gazso, Dror Tirosh, Shahaf Nacson and Tjaden Hess. 

ERC-4337 was accepted in 2023 majorly because it enabled Ethereum to achieve account abstraction without any changes or modifications to the consensus layer of the network(no hard fork). 

Let's break it down further 

When users use wallets to interact with dApps or send/receive digital assets instead of these being “transactions” ERC-4337 introduces a sort of pseudo-transaction called UserOperation objects. 

These UserOperation Objects send transactions on behalf of the user, these UserOperation Objects are sent to an alternative mempool. 

Once there, nodes on the Ethereum network act as “Bundlers” by picking up multiple UserOperations and bundle them into a single transaction. 

These bundled transactions are sent to a global smart contract as the “EntryPoint”. 

Bundlers initiate a function at the EntryPoint known as “handleOps” With this function, the bundled transaction is received.

Another function called “validateUserOp”, is invoked for each account. This function authenticates the signature of the operation and, if the operation aligns with the account’s evaluation and the corresponding gas fee payment before they are added to blocks on the Ethereum network.

 Image credit: Cointelegraph

Of course, all this happens in the background, and users are not aware of this underlying process. The whole function is programmatic, thus removing private key dependencies and tedious processes for users, essentially turning EOAs into smart accounts.

Benefits of Account Abstraction 

Account abstraction eliminates most of the friction associated with using web3 wallets and interacting with dApps. Some of the benefits are: 

Signature abstraction 

Transactions from Externally Owned Accounts (EOAs) are validated by signatures generated using the Elliptic Curve Digital Signature Algorithm (ECDSA). 

EOAs have a straightforward security model: funds remain safe as long as owners possess their private keys. 

However, emerging threats such as wallet draining, phishing, malware injection, and spoofing have made EOAs challenging to secure. Bad actors continually devise new methods to compromise private keys, additionally, users face the stark reality that losing their private keys results in the loss of everything.

Signature abstraction solves these problems by removing ECDSA signatures as the default authorization mechanism for non-custodial accounts 

Users can customise their accounts and set rules for authorizing wallets to initiate transactions. This opens up the possibility of the following: 

  • Transaction Limits:  Users can set transaction limits for wallets linked to their smart accounts, their wallet can either reject or ask for additional authorisation if the value of a transaction exceeds the predefined limit set by the owner. 
  • Multi-Party Approval:  Users can delegate partial control of their accounts to guardians, these guardians can be close family, friends, associates or even another device that they own. They can then enable web2 style authentication by requiring the approval of a guardian before assets can be withdrawn from their accounts. 
  •  Key Rotation and Revocation: With smart accounts users can generate new signing keys if they were stolen or misplaced While they are recovering their keys a guardian can freeze their account until they regain full control.  This can be likened to how users can freeze their bank accounts when they misplace their credit/debit cards. 
  • Trusted Sessions and Automatic payments:   if a user dislikes wallet-pops asking for approval every now and then when they are interacting with a dApp or playing a web3 game. The user can create special keys using their smart account for dApps to automatically sign transactions for a specific period. 

Users can also grant permission to service providers or dApps to pull funds from their accounts subject to predetermined rules. This makes subscription and recurring payments seamless. 

Fee abstraction 

Gas fees on the Ethereum blockchain are paid for in ether (ETH) this means users cannot send transactions without having ether which is necessary before a transaction can be executed. 

This might be tedious, especially for new users who would need to get ether to proceed with a transaction. 

Although account abstraction does not eliminate the payment of gas fees it however makes it more flexible as it supports “sponsored transactions” where another account can cover the gas fee for a user. Some of the benefits include: 

  • Non-ETH Gas Fee Payments: Users who want to perform transactions on Ethereum but don't have Ether can use erc-20 tokens in their wallets all thanks to sponsored transactions, users can get a “relayer” with ETH to front the cost for the transactions and pay them back in another erc-20 token like DAI, USDC etc. 
  • Gasless transactions: Protocols and dApps developers can choose to sponsor transactions by paying the gas fees in other to onboard new Ethereum users to their platform without friction. This way users can be using web3 protocols without knowing anything about gas fees enjoying a one-click experience. 

Closing Thoughts 

ERC-4337 and account abstraction bring web3 closer to the ideals, simplicity and functionality of web2 applications.  

It shifts Ethereum accounts away from the current simple EOA account model, which poses the risk of total loss from minor errors and enables users to enjoy flexibility and ease of use. 

It is important to note that account abstraction is still new to  Ethereum and for now, it is hard to know the security risks and vulnerabilities that come with it. 

Although ERC-4337 wallets are starting to pop up this article should not be taken as advice but simply as an educational insight into ERC-4337 and account abstraction. 

[Author’s Note: This article does not represent financial advice, everything written here is strictly for educational and informational purposes. Please do your own research before investing.]

Author: Godwin Okhaifo