The crypto world has witnessed significant growth in the past few years, gaining millions of users. However, the continued widespread adoption of Web3 faces a crucial challenge – improving subpar user experience (UX). If Web3 doesn’t become more user-friendly, people will remain hesitant to transition from their familiar Web2 applications. So, how can we overcome this challenge? One solution is to enhance the UX of blockchain networks like Ethereum through a concept known as account abstraction. But what is account abstraction? And why should you care about it? If you’re looking for the answers to these queries, join us in this article as we explore the ins and outs of account abstraction!
Overview
In today’s article, we’ll kick things off by diving straight into account abstraction. In doing so, we’ll explore what it is and why it is needed. From there, we’ll look into what account abstraction entails in an Ethereum context, where we’ll cover EIP-4337 and how it works in practice. Next, we’re also going to explore other Ethereum Improvement Proposals (EIPs) to give you a more nuanced view of the concept. Lastly, to top things off, we’ll cover some prominent use cases that account abstraction unlocks!
Also, if you’re interested in developing Web3 projects, you must check out Moralis. Moralis offers industry-leading APIs, including the Streams API, our Crypto Price API, etc., making your life as a blockchain developer significantly easier!
For instance, with our free NFT API, you can seamlessly get all NFTs owned by a user address, get ERC-721 on-chain metadata, and much more with a single line of code. As such, with this tool, you can build sophisticated NFT-based projects in a heartbeat.
What’s more, did you know that you can access these premier tools free of charge? All you have to do is sign up with Moralis, and you’ll gain immediate access to our full suite of industry-leading Web3 APIs.
So, without any further ado, let’s jump straight into account abstraction!
What is Account Abstraction?
Blockchain networks generally have two types of accounts: externally owned accounts (EOAs) controlled by users and contract accounts managed by smart contract code. To interact with a blockchain network, you need an EOA, as they are the only way to initiate transactions and execute smart contracts.
However, EOAs are limited to these basic operations, which can be problematic, as this restricts your options for interacting with a blockchain network. For example, it makes it challenging to batch transactions and requires you to always have a sufficient balance of the network’s native token to cover fees.
So, how can we deal with these issues?
One solution currently on everyone’s minds is account abstraction!
Account abstraction increases flexibility in the behavior and management of blockchain user accounts, making it significantly easier to create smart contract wallets. Smart contract wallets are special-purpose smart contracts defining and managing user accounts. They have many benefits, such as opening up the possibility of outlining flexible security rules, doing batch transactions, recovering an account without a seedphrase, etc.
However, from a conventional perspective, it has been difficult to program smart contract wallets because their logic needs to be translated into a set of EOA transactions before the network can process them. So, to solve this, account abstraction enables smart contracts to initiate transactions. This means that any logic you want to implement can be coded into the smart contract wallet itself and executed on the blockchain network in question.
All in all, account abstraction improves support for smart contract wallets and shifts crypto from the current approach of simple EOAs to a future where accounts can be tailored to the users’ needs through smart contracts. This shift paves the way for a series of improvements to wallet design and reduces complexity for end users!
Account Abstraction Ethereum
Ethereum is currently leading the charge when it comes to account abstraction. As such, to further explain what it is and how it works, we’ll be using the Ethereum network as an example!
Account abstraction on Ethereum can take many shapes and forms, and several EIPs suggest various approaches for streamlining the creation of smart contract wallets. However, among the top proposals, EIP-4337 is currently active and outlines the approach favored by the community.
EIP-4337 implements account abstraction using an alternative mempool and gives smart contracts EOA features. What’s more, one of the reasons why this proposal stands out and is liked by the community is that it doesn’t require any changes to the Ethereum protocol.
So, how does this work?
To answer the question above, let’s dive into five fundamental concepts of account abstraction based on EIP-4337!
UserOperation
Instead of sending a regular transaction as an EOA would do, the higher-level system of EIP-4337 is built using a new object type called UserOperations. A UserOperation is a pseudo-transaction object representing operations that will be conducted on a user’s behalf.
UserOperation objects can have data and multiple instructions to execute smart contract calls initiated by the smart contract account. These objects are broadcasted into a dedicated mempool where validators – referred to as “bundlers” – can collect them into a ”bundled transaction”.
Bundler
A bundler is responsible for monitoring the alternative mempool specially built for UserOperation objects. The bundler “bundles” UserOperations into one single transaction, submitting it to the EntryPoint contract. Bundlers are compensated with a portion of the gas fees in return for this work.
Bundlers are essential for this account abstraction workflow, as EAOs must still initiate all Ethereum transactions. Furthermore, all bundlers have EOAs, and in this account abstraction ecosystem, they are the only participants who need them. This is how this implementation can abstract away the need for everyone in Web3 to have their own EOA!
EntryPoint
EntryPoint is a smart contract receiving the transactions from the bundlers. This smart contract is responsible for verifying and executing UserOperations. During the verification process, the EntryPoint smart contract ensures the wallet has enough funds. If it doesn’t, it rejects the transaction.
During the execution process, the EntryPoint smart contracts execute UserOperations by calling the smart contract wallets using the operations’ call data. The EntryPoint also takes money from the account to reimburse the bundlers.
Paymaster
There is also a smart contract called Paymaster, which is responsible for handling the implementation of gas payment policies. These policies provide flexibility in who pays the gas and how. Consequently, it removes the requirement for users to hold the native ETH token to interact with the network.
Aggregator
The Aggregator smart contract implements a signature scheme supporting aggregation. If several messages are signed with multiple keys, it’s possible to generate a single combined signature verifying all aggregate signatures simultaneously. In doing so, an Aggregator contract helps save on call data costs, as multiple bundled UserOperations are being validated in a single step.
Now, that gives you an overview of how account abstraction works based on EIP-4337. However, as we previously mentioned, this isn’t the only proposal for account abstraction. As such, let’s look at some additional EIPs in the next section!
Account Abstraction EIP Proposals
As we previously mentioned, there are multiple EIPs in addition to EIP-4337. In this section, we’ll dive a bit deeper into the others, starting with EIP-2771!
- EIP-2771: EIP-2771 introduces meta-transactions – allowing third-party actors to pay for users’ gas costs – without making any changes to the Ethereum protocol. The idea is that signed transactions get sent to a Forwarder contract. The Forwarder contract then verifies the transaction and sends it to a gas relay. The gas relay then passes the transaction to a Recipient contract, paying the gas to make the transaction executable.
- EIP-2938: Unlike the previous proposals, EIP-2938 aims to update the Ethereum protocol by adding a new type of transaction called AA_TX_TYPE. This transaction type includes three fields: nonce, target, and data. Nonce is a transaction counter, target is the entry point address, and data is EVM bytecode.
To execute these transactions, we need to add two additional instructions to EVM: NONCE and PAYGAS. These features allow Ethereum to support smart contract wallets natively.
- EIP-3074: EIP-3074 aims to update Ethereum’s EOAs so they can delegate control to smart contracts. This would allow smart contracts to approve transactions originating from user accounts. However, we would need to add two EVM “opcodes” for this to work: AUTH and AUTHCALL.
With this implementation, smart contract wallets would be made available without requiring a contract. Instead, a trustless, stateless, non-upgradable contract called ”Invoker” would handle transactions.
Nevertheless, among the four proposals – EIP-4337, EIP-2771, EIP-2938, and EIP-3074 – the community currently favors EIP-4337. This mostly has to do with the fact that EIP-4337 doesn’t require any changes to the Ethereum protocol!
Use Cases for Account Abstraction
Account abstraction is a relatively new concept, and developers are still exploring the many possibilities that it brings to Web3. But to give you some examples, we’ll explore some prominent use cases account abstraction unlocks in the following four sections!
Wallet Recovery
Unlike conventional EOAs, a smart contract wallet’s security doesn’t depend on a private key or seedphrase. Smart contract wallets are more dynamic, allowing you to assign multiple people, devices, and even third-party services as wallet guardians. And in case you lose your credentials, a guardian can sign a transaction to give you access to the wallet once again.
Batch Transactions
To make simple swaps from one token to another on a decentralized exchange (DEX) using an EOA, you need two separate transactions. One to approve the dapp to use the token you want to swap. And another to sign and execute the swap.
With a smart contract account, it’s possible to batch several transactions together and approve them simultaneously. This can enable things such as one-click transactions, making DeFi as seamless and simple as conventional finance.
Automated Transactions
With EOAs, you always have to manually initiate and sign every transaction. There’s no way to automate this process for the transactions that you trust. However, with a smart contract account, you can define a range of parameters to seamlessly automate transactions. This will allow you to, for instance, set up monthly payments for subscription services.
Shared Accounts
You can access conventional EOAs with a single seedphrase, so you can either share complete access to your wallet or not share it at all. There’s no in-between.
Account abstraction, on the other hand, lets you share various levels of access to your wallet with as many users as you would like. For instance, you can set up a multi-signature system where two or more users need to sign a transaction for it to pass. Or add users for a limited time to your account.
All in all, account abstraction opens up many opportunities, allowing users to be creative in how they use Ethereum accounts!
Summary: What is Account Abstraction?
In today’s article, we explored the concept of account abstraction. In doing so, we learned that account abstraction aims to move crypto from the approach of simple EOAs to a future where accounts can be tailored to the needs of the users via smart contracts. This paves the way for many improvements in wallet design and can significantly reduce complexity for end users by providing a more seamless UX!
There are many use cases for account abstraction, and some examples include shared accounts, automated transactions, batch transactions, etc. All in all, account abstraction opens up a range of opportunities, allowing users and developers to be creative and innovative in how they use blockchain accounts.
If you liked this account abstraction guide, consider checking out more content here on the Moralis blog. For instance, learn how to write a smart contract in Solidity or explore the industry’s #1 NFT image API.
Also, if you want to build projects yourself, you can leverage the tools Moralis offers to save time and resources. For instance, no matter your development endeavor, you’ll likely need faucets to get testnet tokens. As such, check out Moralis’ testnet faucets page to get a list of trusted faucets for ten-plus networks. On this page, you can, for instance, find a Goerli faucet and a Linea Goerli faucet.
Nevertheless, if you want access to the tools of Moralis, don’t forget to sign up. You can create an account free of charge and can immediately start leveraging the true power of blockchain technology!