What is EIP-4337 and “account abstraction”?
Account abstraction creates a new account type which exists as a smart contract. By having the account exist as a smart contract, transaction validation and transaction execution are split.
EIP-4337 is a proposal authored by Vitalik Buterin, Yoav Weiss, Kristof Gazso, Namra Patel, Dror Tirosh, Shahaf Nacson and Tjaden Hess which lays out the specifications of the account abstraction proposal without making consensus-level changes (i.e., no hard-fork needed).
For a quick refresher on what an EIP (and an ERC) is, have a quick look at the ”From EIP to ERC” section of our Master Web3 Fundamentals: From Node to Network piece.
Accounts in Ethereum
In Ethereum there are currently two account types:
- Externally-owned account (EOA)
- Contract accounts (CA)
EOAs are accounts that belong to normal users: they are owned by people external to the Ethereum network. CAs belong to smart contracts, and creating a CA is only possible from within the network by using an EOA or another CA. Account abstraction matters most to normal users that would normally own an EOA.
Transactions are authorized by an EOA by signing the transaction details with the private key of that account. The transaction details as well as the signature are sent to the Ethereum Virtual Machine (EVM) for verification that the signature is valid and that the nonce in the transaction matches the nonce in the account. Once the validation is complete, the EVM executes the transaction and deducts gas fees (transaction fees) from the EOA’s account balance.
Definition of Abstraction
In computer science, abstraction refers to the extraction of relevant pieces from a larger piece, or phrased differently, splitting something into smaller pieces. In Ethereum, account abstraction refers to the splitting of transaction validation and transaction execution from being a single monolithic process (above), to modular components that can be adjusted as per users’ individual requirements.
Account Abstraction in EIP-4337
In EIP-4337 the validation and transaction processes are separated into two smart contracts: the Entry Point Contract and Wallet Contract. The Entry Point Contract acts as a coordinator that communicates with the Wallet Contract. The Wallet Contract handles the validation of a user’s transaction based on custom logic implemented by the Wallet Contract. If the Wallet Contract successfully validates a transaction, the Entry Point Contract executes the transaction, which is then submitted to be included in the next block.
This abstraction is what gives developers and users the freedom to codify whatever they want as requirements for a transaction to be valid in custom Wallet Contracts. For example, a Wallet Contract could use multi-sig, social recovery features or even quantum resistant signature schemes, instead of being limited to only using the ECDSA encryption scheme like EOAs are.
EIP-4337 introduces abstracted accounts without making consensus-level protocol changes, as it was previously proposed in EIP-2938. This is possible, because the functionality needed for abstracted accounts can be achieved with smart contracts in the current EVM.
Additional Architectural Requirements of EIP-4337
Apart from account abstraction through smart contracts, EIP-4337 also introduces a new transaction type specifically for abstracted accounts called UserOperations, a mempool exclusively for UserOperations and a Bundler that passes UserOperations to the Entry Point smart contract, which is to exist alongside the EOA mempool and normal transactions.
After a UserOperation is created and signed, the wallet app submits that UserOperation to the UserOperation mempool. A mempool is essentially a memory module on Ethereum nodes where transactions are stored before they are validated and included in a block. UserOperations are structurally different to transactions, which means they cannot be included in the existing mempool. To include them, consensus-level changes would be necessary which would require a hard-fork of the network. To avoid this, the proposal is to add a new mempool which would only require updating Ethereum node clients.
A Bundler is an actor that listens to the transactions in the UserOperation mempool, and bundles them into batches which are submitted to the Entry Point Contract on the EVM.
This design also enables additional benefits:
- Multiple operations that would usually require multiple transactions can be bundled together. For example, approving the spending of a token and initiating a trade of the token could be executed as a single transaction.
- Standardization of a Smart Contract Wallet Interface. Universality and standardization improve interoperability and security. Just look at what ERC-20 (token standard) or ERC-721 (non-fungible token standard) did for tokenization.
Finally, EIP-4337 also proposes paymaster functionality, which would allow a third party to cover transaction costs of a user for certain UserOperations. This could be used to subsidize the usage of a protocol by paying the gas fees for users.
In the Verification Loop, the Entry Point Contract checks that the paymaster account has sufficient funds to cover the UserOperations, before passing the UserOperation to the Wallet Contract for validation. If everything succeeds, the account balances for the user and the paymaster are calculated and updated in the execution loop, before being passed on to be included in a block.
The paymaster functionality combined with the multiple operations mechanism enables another exciting use-case:
- Use ERC-20 tokens to pay for transaction fees. By allowing multiple operations to be submitted in a single transaction, ERC-20 tokens can be transferred to a paymaster and the paymaster can handle paying gas using Ether, all in a single transaction.
In Summary, an abstracted account essentially provides users with the power of smart contracts for their everyday accounts. Abstracted accounts make the programmability of smart contracts available to average users and developers. Average users can harness that power to better control their Ethereum accounts, while developers can improve user experience through added convenience.
If you were previously not yet excited about EIP-4337, now is the time to be excited. When implemented, we can expect the developer community to come up with exciting new ways to leverage this technology.
To experience some of EIP-4337 features, you can test the Stackup Wallet, which to my knowledge is the first wallet that has implemented EIP-4337 features. I highly recommend their Discord as well, where they act
SHARE THIS PIECE
In this piece @lingchenjaneliu explores the staking market landscape, including key actors and top players, as well as latest developments in Proof-of-Stake. Special thanks to @0xPhillan for ...
The year of 2022 was a year of great highs and new lows for the Web3 industry. Read more about the defining events of 2022!
Metaverse Concept and History The term "metaverse" was invented by American author Neal Stephenson in his science fiction novel titled Snow Crash, published in 1992. ...
Wintermute, a crypto asset manager and liquidity provider, was recently hacked for US$160m. The hack occurred on their DeFi operations and did not affect other ...