Account Abstraction: From Chaos to Clarity

Contents

A Practical Guide to Better User Experience

Introduction 

Although blockchain technology has been around for a while and the market has grown dramatically over the last decade, resolving the current high-friction onboarding process is the key to the kind of market expansion that will turn native crypto transactions into a mainstream idea. Luckily, new paradigms such as Account Abstraction can encourage crypto mass adoption by streamlining the onboarding and usage processes of blockchain technology for casual users. 

The ERC-4337 account abstraction implementation, targeting EVM developers, allows the creation of non-custodial wallets as smart contracts, unlocking features like easy wallet recovery, signless transactions, and team wallets. The key innovation of this standard is its ability to create smart accounts independently, enabling transactions without the need for a separate Externally Owned Account (EOA) or contract account. Smart accounts use UserOperations, which represent operations to be conducted on behalf of the user. These UserOperations are bundled, verified, and executed through a single entry point, allowing for various customizations in managing accounts and funds.

With innovators such as Safe, NEAR Wallet, Argent and Blocto already leveraging this new smart contract capabilities, the ERC-4337 is a stop towards standardization, but there’s still work to be done. Key players in the space designed variations of account abstraction suited for particular needs and different blockchain ecosystems, contributing to a multitude of SDKs and libraries to select from.

Account Abstraction Use Cases 

Before jumping into the technical aspects, let’s have an overview of the most interesting use cases where account abstraction brings significant  improvements, all contributing to improving the web3 onboarding experience, especially for non-native users.

1. Wallet Recovery

One of the biggest struggles in the crypto industry is security, with users either having to rely on custodians or having to secure their own keys. In the realm of smart accounts, security diverges from traditional models, eschewing reliance on seed phrases or private keys. Smart account owners can designate multiple entities—devices, individuals, or third-party services—as wallet guardians. 

This innovative feature ensures a robust safety net for users facing credential loss, with guardians capable of signing transactions to assign new access credentials. Importantly, this recovery process prioritizes user control and ownership of assets, striking a delicate balance between security and accessibility. This sophisticated framework heralds a new era in digital asset management, where resilience and user control are greatly enhanced.

2. Batching Transactions

In decentralized exchanges, a token swap typically involves two separate transactions, each requiring user approval through private key signatures, while complex Web3 transactions may demand three or more approvals. Smart accounts introduce a groundbreaking solution by allowing users to batch multiple transactions, reducing the costs for the users, and streamlining DeFi transactions in a manner  we’ve come to expect in web2 applications. A great example for this particular use case is Ambire Wallet, which leverages AA to enable transactions batching for its users. Although the cost for executing one operation is higher compared to using an Externally Owned Account (EOA), when having multiple transactions the price per transaction is reduced drastically.

3. Sponsoring User Transactions

Account abstraction also introduces the concept of Paymasters, smart contracts specifically designed to sponsor transactions’ gas fees. This brings a new level of customization for dApps, which now can accept any token from the user’s wallet as a transaction fee, FIAT payments with card, or even subsidize the entire amount thereby creating a seamless experience for their users, improving the user experience and removing unnecessary friction points. A good example is SendIt from Arcana Network, a small protocol that allows sending crypto to anyone via email, even if they don’t have a wallet, and leverages ERC4337 to sponsor the transaction fees and create a new Smart Contract Account for them. Another great usage of this particular use case is Visa’s proposal of enabling users to pay their on-chain gas fees using a FIAT card, as it can be seen in the images below. 

Rethink Digital Transactions with Account Abstraction

Rethink Digital Transactions with Account Abstraction

4. Automating Transactions

Unlike EOAs, where every transaction on a dApp requires manual initiation or signing, smart accounts introduce automation possibilities. With smart accounts, users can set a variety of parameters, including access to specific tokens, spend limits, duration, gas limits, and predefined triggers for specific actions. Let’s say for example, a user wants to allow a DEX to perform a swap on its behalf every 15 minutes for the next hour: sign once and the transactions will happen automatically afterwards. Such an execution can be seen on CowSwap, a decentralized exchange that offers TWAP transactions, spreading a desired user operation into parts that execute over a period of time. The potential for automation in smart accounts is virtually boundless, offering users a level of customization and efficiency beyond the constraints of traditional EOAs.

Technical Components

There are multiple ways of leveraging this technology, either by spinning up your own in-house components (Figure 1) or by using an SDK or library and leveraging existing infrastructure maintained by other players in the space. We’ve put together a list of various options to get started, where we will further explore use cases and advantages of using particular solutions. 

No matter what implementation method you choose when leveraging Account Abstraction, it’s important to understand the key elements of it. UserOperations, which are transaction-like objects, represent a user’s transaction intent for a Smart Contract Account. Unlike conventional transactions, UserOperations introduce additional fields like EntryPoint, Bundler, Paymaster, and Aggregator, and are directed to a separate mempool. Notably, UserOperations are intent-based, allowing users to include metadata for outcome-focused transactions, deviating from the specificity of traditional inputs.

The following key component is called Bundler, a specialized type of Ethereum node, which plays a pivotal role in supporting UserOperations. UserOperations are directed to a network of Bundlers, which actively monitor the alternative mempool. These Bundlers consolidate multiple UserOperations into a single transaction, subsequently packaging and submitting them to the blockchain on behalf of users. In return for this service, they receive compensation. Their significance lies in abstracting the necessity for every participant in web3 to possess their own Externally Owned Account (EOA), a crucial component in realizing the functionality of ERC-4337.

UserOperations are then sent to an EntryPoint Contract, which is a singleton smart contract that performs verification and execution of UserOperations. The verification process involves assessing whether the wallet possesses sufficient funds to cover the potential maximum gas usage, determined by the gas field in the UserOp. Transactions lacking adequate funds are rejected. For execution, the smart contract carries out the transaction, deducting funds from the Smart Contract Account (SCA) to reimburse the Bundler with the appropriate native token amount for gas expenses.

In some cases, the developers want to sponsor gas fees on behalf of the users or allow them to pay for these in various tokens besides the native ones. For this, they can leverage a contract called Paymaster, designed to manage gas payment policies. This effectively eliminates the requirement for users to possess native blockchain tokens for interacting with the blockchain.

Walkthrough of different AA tools

1. No SDK Solution

As mentioned above, there are some key elements required to leverage the capabilities of account abstraction, while some others remain optional. If you don’t want to rely on third party solutions for AA, there’s the possibility of running your own setup and having full control and custody over the smart contracts and processes involved. For Ethereum, there’s a variety of proposed solutions, with eth-infinitism having the most popular solution out there in terms of Smart Account Contract, Entry Point Contract and Paymasters. Besides these contracts deployed and correctly funded, one would also require a Bundler running, which will receive the user operations and redirect them to the entry point contract. To help developers, community members developed solutions that allow setting up account abstraction locally in a Hardhat environment just by leveraging a simple npm package

Because of the heavy lift required to set up all the infrastructure by yourself, most people choose to rely on various libraries and companies that offer ready-to-implement solutions and abstract all the complexity from the developers.

2. Pimlico & permissionless.js

The most efficient solution if you are looking to leverage a JavaScript library for adding account abstraction features to your application is permissionless.js. It is built on top of viem and allows developers to build highly customisable and modular applications, leveraging the AA kit Pimlico has to offer, a Bundler and a Paymaster API, all supporting more than 20 EVM-compatible chains. Assuming the smart account and transaction data are already created, here is how you can send a transaction using permissionless.js and Pimlico’s Account Abstraction SDK: 

const txHash = await smartAccountClient.sendTransaction({

to: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",

value: parseEther("0.1"),

maxFeePerGas: gasPrices.fast.maxFeePerGas, 

maxPriorityFeePerGas: gasPrices.fast.maxPriorityFeePerGas, 

});

3. Alchemy Account Kit 

One of the most developer-friendly tools for account abstraction is Alchemy’s Account kit. Similar to other solutions, besides their aa-sdk, Alchemy offers a Light Account solution, which is a simple smart account interface, a Bundler API, a Gas Manager solution that leverages their own Paymaster smart contract, allowing developers to sponsor user operations or allow the users to leverage ERC-20 tokens when paying for gas. Assuming the smart account and transaction data are already created, here is how you can send a transaction using Achemy’s Account Kit and retrieve the transaction hash: 

const userOperation = await smartAccountClient.sendUserOperation({

  uo: {

    target: "0xTARGET_ADDRESS",

    data: uoCallData,

  },

});

const txHash = await smartAccountClient.waitForUserOperationTransaction(uo);

4. Biconomy SDK

Biconomy SDK offers the largest number of features when it comes to building with Account Abstraction. They allow developers to customize various functionalities, setup multi-sig configurations for the Smart Contract Accounts, together with offering a Bundler and Paymaster service. Its functionality is highly modular and brings unique features compared to its competitors. It allows developers to create gateways powered by a set of constraints, which enables particular SCA transactions to take place without the Signer having to sign each one of them. This particular capability enhances the user experience and lays the foundation for applications where the blockchain operations take place in the back, while users are going through a fully web2 journey. Biconomy’s solution for AA is one of the most popular in the space, with 25 million meta-transactions processed by their SDK, which helped onboarding 2.8 million users in the web3 space. Assuming the smart account and transaction data are already created, here is how you can send a transaction using Biconomy SDK and retrieve the transaction hash: 

const userOpResponse = await smartWallet.sendTransaction({

  to: toAddress,

  data: transactionData,

});

const { transactionHash } = await userOpResponse.waitForTxHash();

Conclusion

To wrap up, although the idea of Account Abstraction has been around for a while, there’s still limited documentation and tools to help with its mass adoption among developers. Nevertheless, it’s still one of the biggest milestones in Web3 development and provides the foundation for new and exciting use cases. 

Despite needing to mostly rely on third parties to make use of the account abstraction features for now, the modularity of the paradigm and the decentralization of the ecosystem encourages more and more developers to integrate some of these tools into their applications and even build their own in-house smart contracts and off-chain utilities to leverage this new exciting technology. There’s still a huge need for streamlining user onboarding and contributing towards crypto’s mass adoption, and account abstraction is the best tool for this necessity at the moment, allowing project leverage blockchain technology without the users ever finding out. 

If you already explored account abstraction utilities, are building leveraging the standard or just came up with some interesting use cases, don’t hesitate to reach out to me on X and further explore the numerous  capabilities of this new innovative standard.

Related to this content

Discover more categories

The Atlas Report

Regular web3 insights, analysis, and reports to stay ahead of the game. Sign up to our newsletter.

Sign up to our newsletter