Account Abstraction - Wallets of the Future
Managing wallets is challenging due to complex private key management & security risks, further deterring users from embracing this technology. Account Abstraction via ERC-4337 addresses some of these issues by enabling customisable smart contract wallets, enhancing the UX and security on Ethereum.
Wallet Management
Self-custody management of crypto can be a daunting task for both new and experienced users alike. Private key management often poses a significant challenge, and incidents like FTX mishandling customer funds have made many retail users reluctant to store large sums on shady and unregulated exchanges.
In the realm of web3, the terms "wallets" and "accounts" play crucial roles, but their interchangeable usage often leads to confusion. This issue is further exacerbated by the fact that many leading wallet applications lack user-friendly interfaces that clearly distinguish between the functions of wallets and accounts. Crypto wallets are responsible for storing ERC-20s / ERC-721s / ERC-1155s and to leverage their utility for buying, selling, and interacting with dApps for authentication or identity verification purposes. Each wallet contains a private key essential for its operation - while this key enables wallet access from multiple locations, it does not synchronise the interactions across those access points. Relying exclusively on a private key also introduces a central point of failure, making it a significant security risk.
The absence of user-friendly tools, along with the inherent difficulty in comprehending their safe and secure usage, makes it hard for people to onboard and use blockchain-based dApps. This lack of trust perpetuates a cycle in which users struggle to fully embrace the potential of crypto due to its inherent complexity.
⚡️ This is where Account Abstraction (AA) comes in, promising to solve the dilemma between key management UX and security for self-custodial funds by enabling arbitrary logic to determine if an account can move funds or interact with any Smart Contract (SC).
Account Abstraction (AA)
To understand account abstraction we first need to understand how accounts work on Ethereum today.
There are two types of accounts on Ethereum:
- 👛 Externally Owned Account (EOAs);
- 🤖 Contract Account (CAs).
👛 EOAs have three properties:
- 💰 A balance to represent the amount of ETH available to the account;
- 🔢 A nonce to ensure that every transaction is unique and well-numbered;
- 🔑 An address (public key) to uniquely identify the account on the Ethereum network.
The state of the blockchain can only be modified through transactions. This trigger must come from something external to the blockchain, hence, every transaction must be initiated by an EOA meaning that when a transaction is executed by the Ethereum Virtual Machine (EVM) the first account being touched must be an EOA and the corresponding account must pay a fee to the miner for the execution of the entire transaction. To assert its validity and to prove account ownership, every EOA has an associated with a cryptographic object called a signer, also called keypair, is made of two keys: a private key and a public key. The private key or the secret, can be used to sign digital message whereas the public key can enable anyone to verify that a given signature was signed by its corresponding private key.
As the usage of Ethereum grew, developers grew frustrated at the limitations of EOA wallets and started creating wallets with more advanced access control. Contract Accounts, also commonly known as Smart Contracts(SC), are a tad different from EOAs since code written on the EVM controls their activities. The sometimes immutable code will define the nature of transactions the contract account can complete which means that CAs do not initiate transactions, unlike their EOA counterparts - instead, they can only send transactions in response to a transaction received.
Since User Operations cannot be directly submitted to the blockchain, a relayer or an external wallet is required to initiate the transaction. The constraints, imposed by the consensus layer and legacy dApps, are maintained in the above flow, however, it increases the transaction cost.
But is there a better solution? Thankfully, yes. The new advancements rolled out in ERC-4337, an out-of-protocol meta-transaction standard that enables a form of Account Abstraction, allows any EOA wallet to interact with the network by initiating a transaction containing any User Operation, i.e. it guarantees that the initiator EOA wallet - called Blunder - will be paid back for the transaction fees by the User Operation.
This is achieved by splitting a User Operation into 2 sandboxed steps. A validation step, to check if the User Operation can move funds, and an execution step that performs the dApp interaction.
Bundlers only need to verify if the validation step will succeed, to gain confidence that they will be paid for including this User Operation in their transaction. One challenge with stateful AA is that a UserOp might be valid at one block and invalid at the following block.
To ensure that the Bundler address gets paid and User Operation interacts with the dApp as intended, ERC-4337 orchestrates these operations via an EntryPoint Contract - the smart contract that handles the verification and execution logic for transactions.
In layman terms, Account Abstraction transforms Ethereum's account system from having two distinct account types (Externally Owned Accounts and Contract Accounts) to just one - Contract Accounts where these new CAs can now initiate transactions, cover transaction fees, and be tailored to meet individual user requirements.
ERC-4337 is a standard to supercharge user accounts by programming wallets into a smart contract. Some key Account Abstraction features:
- 🤝 Unified Account Model: ERC-4337 introduces a new transaction format that combines the existing EOA and contract-based transactions. This unified format streamlines the transaction process, reducing complexity for users and developers.
- ⚙️ Customisable Transaction Logic: Users can implement custom transaction logic in their accounts allowing for a wide range of use cases, such as multi-signature wallets, smart contract-based access control, social recovery tools and unique gas payment schemes. This flexibility enables developers to create applications tailored to specific user needs and requirements.
- ⛽️ Gas Sponsorship: ERC-4337 enables transaction sponsors to pay gas fees on behalf of users. This feature allows dApp developers and other third parties to subsidise users' transaction costs, improving the user experience and encouraging adoption.
- ✈️ First-class support for Layer 2: ERC-4337 provides native support for L2 scaling solutions, such as rollups and sidechains. It allows for seamless interactions between L1 and L2, enabling users to access a range of scalability options without sacrificing security or user experience.
The ERC-4337 standard seeks to transfer a significant portion of transaction validation logic on-chain while maintaining efficiency to ensure an enjoyable user experience. By enabling the bundling of multiple User Operations within a single EOA transaction, it can effectively distribute the 21,000 gas overhead associated with the EOA across these operations, thus optimising resource utilisation!
Final Thoughts
For web3 to truly achieve mainstream adoption and success, it is of paramount importance that the industry reaches a consensus on standard practices and protocols. ERC-4337, with its potential to resolve existing wallet and account-related challenges, serves as a catalyst in this process, laying the foundation for a more standardised and accessible future for web3.
By addressing complexities and improving user experience, this new standard can contribute to the seamless integration of blockchain technology into everyday applications. This will empower users and developers alike, fostering innovation and expanding the reach of decentralised platforms across various sectors. As we embrace the potential of web3, the adoption of well-defined standards such as ERC-4337 will prove to be instrumental in shaping a more unified, secure, and user-friendly decentralised ecosystem!