Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article covers ERC-5189, a proposal for account abstraction that avoids protocol changes while remaining compatible with existing contract wallets.
The following explanation translates, summarizes, and expands on the original proposal.
As of December 9, 2023, ERC-5189 is in Draft status.
I have also written about other ERC standards.
Overview
This EIP aims to advance the design of smart contract wallets on Ethereum. In particular, it uses account abstraction (AA) to make wallets more functional and flexible.
For an introduction to AA, see the following article.
[ERC-4337] Understanding Account Abstraction without Protocol Changes
At the heart of the proposal is a new type of smart contract called an endorser contract. These contracts are responsible for assessing the validity of AA transactions (a special kind of transaction) on Ethereum. This helps bundlers, the entities that group transactions and decide whether to include them in the network, determine more safely which transactions to retain in the mempool.
To use this mechanism, smart contract wallet developers must create endorser contracts appropriate for their wallets and deploy them to Ethereum. They may also use existing compatible endorser contracts. This makes wallets more flexible and functional, improving the Ethereum user experience.
The proposal addresses the same problem as ERC-4337, but offers a framework with fewer restrictions. See the following reference for details.
Motivation
This account abstraction (AA) proposal introduces a new transaction processing system for Ethereum. The system has the following characteristics.
Primary goal of account abstraction
Users can use a smart contract wallet as their primary account, with freely configurable validation and execution logic, rather than a conventional externally owned account (EOA).
Decentralization
The system allows any bundler to participate in AA transaction inclusion, operating in a public mempool without relying on centralized relayers. It also protects the mempool from invalid or malicious payloads and avoids trust assumptions between bundlers, developers, and wallets.
Support for existing smart contract wallets
The system works with existing smart contract wallets and maintains compatibility without requiring manual upgrades to every wallet instance.
An unrestricted framework
Smart contract wallets have different designs, limitations, and features, and the proposal is designed to accommodate these variations.
Support without additional overhead
Smart contract wallets cost more to use than EOAs, but the proposal does not increase their existing costs.
Support for other use cases
The proposal supports privacy-preserving applications, atomic multi-operation execution (similar to EIP-3074), transaction fee payments in ERC-20 tokens, scheduled smart contract execution without user input, and other applications requiring general-purpose relayers.
For an introduction to ERC-20, see the following article.
Specification
This Ethereum account abstraction (AA) proposal describes how to process AA transactions efficiently without changing Ethereum's underlying consensus mechanism. Rather than introducing a new transaction type, the system manages AA transactions with a struct called Operation.
An Operation is a struct containing the following information.
| Field | Type | Description |
|---|---|---|
| entrypoint | address | Address of the contract called with callData to execute the operation. |
| callData | bytes | Data passed to the entry point call to execute the operation. |
| gasLimit | uint64 | Minimum gas limit required to execute the operation. |
| feeToken | address | Contract address of the ERC-20 token used to reimburse the bundler (address(0) for the native token). |
| endorser | address | Address of the endorser contract used to validate the operation. |
| endorserCallData | bytes | Additional data passed to the endorser when calling isOperationReady(). |
| endorserGasLimit | uint64 | Amount of gas provided to the endorser when validating the operation. |
| maxFeePerGas | uint256 | Maximum expected base fee for executing the operation (similar to max_fee_per_gas in EIP-1559). |
| priorityFeePerGas | uint256 | Expected fixed fee paid to the bundler for executing the operation (similar to max_priority_fee_per_gas in EIP-1559). |
These fields provide the information necessary to execute an operation (transaction) correctly.
These Operation objects are submitted to a dedicated mempool. Bundlers, entities running specialized block-building code or relaying transactions to block producers, monitor this pool and execute transactions.
A transaction is executed by calling the entry point with the supplied call data. The entry point is generally either the wallet contract itself or an intermediary utility contract that deploys the wallet and executes the transaction.
End-user functionality
In this proposal, endorsers distinguish good operations from bad operations in the mempool. A good operation pays the bundler the appropriate fee, whereas a bad operation pays too little or does not work at all.
interface Endorser {
struct BlockDependency {
uint256 maxNumber;
uint256 maxTimestamp;
}
struct Dependency {
address addr;
bool balance;
bool code;
bool nonce;
bool allSlots;
bytes32[] slots;
}
function isOperationReady(
address _entrypoint,
bytes calldata _data,
bytes calldata _endorserCallData,
uint256 _gasLimit,
uint256 _maxFeePerGas,
uint256 _maxPriorityFeePerGas
) external view returns (
bool readiness,
BlockDependency memory blockDependency,
Dependency[] memory dependencies
);
}Structs
BlockDependency
struct BlockDependency {
uint256 maxNumber;
uint256 maxTimestamp;
}Overview
A struct representing block dependencies.
Details
This struct stores the maximum block number and maximum timestamp for a particular block dependency.
Parameters
maxNumber- Maximum block number on which the operation depends.
maxTimestamp- Maximum block timestamp on which the operation depends.
Dependency
struct Dependency {
address addr;
bool balance;
bool code;
bool nonce;
bool allSlots;
bytes32[] slots;
}Overview
A struct representing contract dependencies.
Details
This struct stores dependency information such as a contract's address, balance, code, nonce, and storage slots.
Parameters
addr- Address of the contract on which the operation depends.
balance- Flag indicating whether the operation depends on the contract's balance.
code- Flag indicating whether the operation depends on the contract's code.
nonce- Flag indicating whether the operation depends on the contract's nonce.
allSlots- Flag indicating whether the operation depends on all storage slots.
slots- List of storage slots on which the operation depends.
Functions
isOperationReady
function isOperationReady(
address _entrypoint,
bytes calldata _data,
bytes calldata _endorserCallData,
uint256 _gasLimit,
uint256 _maxFeePerGas,
uint256 _maxPriorityFeePerGas
) external view returns (
bool readiness,
BlockDependency memory blockDependency,
Dependency[] memory dependencies
);Overview
A function that checks whether an operation is ready to execute.
Details
This function determines whether a particular operation can be executed. Readiness is determined from the supplied arguments and dependencies. The function returns a boolean indicating whether the operation is ready, along with information about block dependencies and dependent contracts necessary for execution.
Arguments
_entrypoint- Address of the entry point contract.
_data- Operation data.
_endorserCallData- Endorser call data.
_gasLimit- Gas limit.
_maxFeePerGas- Maximum fee per gas.
_maxPriorityFeePerGas- Maximum priority fee per gas.
Return values
readinesstrueif the operation is ready to execute;falseotherwise.
blockDependency- Block dependency information required to execute the operation.
dependencies- List of dependencies required to execute the operation.
An endorser must be deployed as a smart contract implementing the specified interface above.
The interface includes the isOperationReady function, which determines whether a transaction is ready.
It returns the operation's readiness (readiness), block dependency (blockDependency), and list of dependencies (dependencies).
This information helps mempool operators maintain a pool of valid AA transactions.
Endorsers should also register with the EndorserRegistry, which requires burning a minimum amount of ETH. This measure reduces the risk of denial-of-service attacks. Mempool operators may nevertheless accept operations from endorsers that have not burned ETH, at increased risk.
An endorser assesses an operation's readiness through isOperationReady, helping mempool operators manage operations appropriately based on the result.
For greater efficiency, additional information can be supplied to the endorser through _endorserCallData.
In that case, the endorser must verify that the supplied _endorserCallData is valid and relates to the other supplied values.
Block dependencies
The endorser uses these fields to specify the period during which an operation's readiness remains valid. Specifically, there are two fields.
| Field | Description |
|---|---|
| maxNumber | Maximum value of block.number for which readiness applies.Useful when an operation is valid only within a particular period. |
| maxTimestamp | Maximum value of block.timestamp for which readiness applies.Also used when an operation is valid only during a particular time window. |
The endorser sets these values to limit the period during which an operation is considered valid.
If the endorser determines that the operation is valid indefinitely, these fields are set to type(uint256).max (the maximum value).
This makes it possible to limit the validity of an operation's readiness to a specific block number or timestamp.
Dependencies
Dependencies are particular contract properties or state that an endorser must consider to ensure an operation executes correctly. They matter because they can affect whether the operation remains executable. The following table describes each field.
| Field | Description |
|---|---|
| Address (addr) | Address of the contract on which the operation depends.Multiple entries for the same address are not permitted. |
| Balance (balance) | Set to true if the balance of addr affects execution of the operation. |
| Code (code) | Set to true if the code at addr affects the operation. |
| Nonce (nonce) | Set to true if the nonce of addr affects execution of the operation. |
| All storage slots (allSlots) | Set to true if all storage slots of addr are dependencies of the operation. |
| Storage slot list (slots) | List of particular storage slots of addr that may affect execution of the operation. |
The endorser should include only storage slots that may affect the operation's readiness in the dependency list.
allSlots and slots are mutually exclusive. If allSlots is true, slots should be an empty array.
Endorsers are encouraged to use slots rather than allSlots whenever possible.
For example, if a wallet pays fees in WETH, the endorser contract calls the WETH contract's balanceOf method when executing isValidOperation() to check whether the wallet has a sufficient WETH balance.
Although the ETH balance and code of the WETH contract are also accessed in this case, the endorser may consider only the user's WETH balance relevant and omit the other elements from its dependencies.
Detecting misbehavior
An endorser contract may behave unexpectedly or maliciously. Possible problems include the following.
1. Insufficient fees
Even when an endorser contract declares an operation ready, its execution may transfer less to the bundler than the promised fee.
2. Execution failure
Even when an operation has been declared ready, its top-level call may fail during execution.
3. Readiness changes without changes to dependencies
An endorser contract may change an operation's status from ready to not ready even though none of its dependencies have changed.
Whenever an operation's dependencies change, the bundler must invalidate its readiness and reevaluate it. This ensures that only ready operations are candidates for building the next block.
When a bundler simulates final inclusion of an operation, it should ban the endorser if the simulation shows that the proper payment will not be made (either because the transaction fails or because the amount transferred is below the required fee).
Reasons include isOperationReady() returning true for an operation that should not be included in a block, or readiness changing from true to false without any dependency changes.
Once an endorser is banned, mempool operators should remove all operations associated with it.
Notice: The mempool operator could call one last time isOperationReady to determine if the endorser should be banned because (1) or (2), but this step is not strictly necessary since both scenarios lead to the endoser being banned.
Mempool operators can optionally call isOperationReady one last time before banning the endorser to determine whether the cause was (1) or (2), or (3).
This is not required because either case leads to a ban.
Bundler behavior on receiving an operation
The following describes the basic steps bundlers should take to process AA transactions effectively and receive compensation for relaying them. The procedure is as follows.
-
Basic bundler checks
- Verify that the gas limit specified by the endorser contract (
endorserGasLimit) does not exceedMAX_ENDORSER_GAS. - Verify that the endorser contract is properly registered, has burned the required minimum amount of ETH (
MIN_ENDORSER_BURN), and is not banned. - Verify that the operation's gas limit is sufficient for a CALL with a nonzero value.
- Verify that the fee token is
address(0)or an ERC-20 token accepted by the bundler. - Verify that the operation's
maxFeePerGasandpriorityFeePerGasmeet the minimums configured by the bundler.
- Verify that the gas limit specified by the endorser contract (
-
Comparison with other operations in the mempool
- If another operation with the same dependencies and endorser address exists in the mempool, the incoming operation's
maxFeePerGasandpriorityFeePerGasmust be12%higher than those of the existing operation.
- If another operation with the same dependencies and endorser address exists in the mempool, the incoming operation's
The requirement to set maxFeePerGas and priorityFeePerGas 12% above those of the existing operation primarily concerns competition and prioritization in the mempool.
The rule serves the following purposes.
Managing competition in the transaction mempool
- In a blockchain mempool, many transactions compete for inclusion in blocks with limited capacity.
- Bundlers (entities that include transactions in blocks) tend to prioritize transactions offering higher fees.
Setting transaction priorities
The 12% threshold establishes a clear difference in priority between existing and incoming transactions.
This gives the incoming transaction priority in the mempool and increases its chances of being processed quickly.
Preventing spam transactions
- Rules of this kind also help prevent low-fee spam transactions from indiscriminately filling the mempool.
- To remain in the mempool, a transaction must offer a clear fee advantage over competing transactions.
Maintaining network health
- These mechanisms help prevent network overload and maintain a healthy mempool.
- Transactions are priced appropriately, which helps avoid wasting resources.
The specific 12% figure is a threshold intended to provide a meaningful difference without being excessively high.
The value may vary depending on network characteristics and bundler strategies.
-
Calling
isOperationReady()and processing the operation- If the checks above pass, the bundler calls the endorser contract's
isOperationReady()function. - The operation is added to the mempool only if the method determines that it is ready (
readiness == true). - Otherwise, the operation is discarded.
- If the checks above pass, the bundler calls the endorser contract's
-
Reevaluation when dependencies change
- When a dependency changes, the operation's readiness is reevaluated.
- If readiness changes to
false, the operation is discarded.
-
Final simulation before block inclusion
- Before including the operation in a block, the bundler performs a final simulation without calling the endorser contract.
- If the simulation encounters a problem, the endorser contract may be banned.
-
Banning endorser contracts when simulation fails
- If operation simulation fails, the endorser contract is banned for reporting incorrect readiness or changing readiness independently of its dependencies.
-
Invalidating readiness
- If a transaction or operation queued ahead of the specified operation changes a storage slot listed as a dependency, the operation's readiness is invalidated.
These steps help bundlers process AA transactions efficiently and safely and ensure they receive compensation for relaying them.
Operation rules
Mempool clients can implement additional rules to protect themselves against malicious transactions. These rules aim to improve the safety and efficiency of the mempool.
Limiting dependency size
Mempool clients can limit the size of accepted dependencies to a configured value called MAX_OPERATION_DEPENDENCIES.
Operations exceeding this limit are discarded.
Limiting the number of reevaluations
Clients can also set a limit called MAX_OPERATION_REEVALS on the number of times an operation requires reevaluation.
Operations exceeding this limit are considered to require too many reevaluations and are discarded.
Limiting the number of operations in the mempool
Clients can also limit the number of operations that depend on the same dependency slot. This prevents excessive accumulation of operations concentrated on a particular dependency.
If these rules are widely adopted, wallet developers will be encouraged to minimize the use of dependencies. The goal is to avoid unnecessary load and risk so that the mempool can be managed more efficiently and safely.
Evaluation
The following describes the evaluation process a bundler should follow to process AA transactions properly. It is an important procedure for determining whether an operation is ready to be included in a block. The process is as follows.
-
Calling
isOperationReady()- The bundler calls the endorser contract's
isOperationReady()method to evaluate the operation. - The gas limit for this call must be at least the
endorserGasLimitspecified by the endorser.
- The bundler calls the endorser contract's
-
Handling the operation according to the result
- If the
isOperationReady()call fails or the endorser reports that the operation is not ready (readiness == false), the operation should be removed from the mempool. - Conversely, if the call succeeds and reports readiness (
readiness == true), the operation can be retained in the mempool and used to build a block.
- If the
This process helps bundlers determine whether operations are suitable for inclusion in a block.
The result of the endorser contract's isOperationReady() evaluation is an important indicator of whether the operation can execute and directly affects how the bundler handles it.
After operation inclusion
The following describes what bundlers should do after including an operation in a block. The key points are as follows.
No restriction on repeated execution
The proposed rules do not require an operation to be executed only once. An operation may therefore be executed multiple times.
Keeping the operation in the mempool
After including an operation in a block, the bundler must not remove it from the mempool.
The operation should remain in the mempool while the bundler calls the endorser contract's isOperationReady() one final time.
Checking the endorser's readiness result
If the endorser contract still reports readiness (readiness == true) after block inclusion, the operation may be treated like any other valid operation and retained in the mempool.
By following these guidelines, bundlers can manage operations efficiently and prepare them for inclusion in another block when necessary.
The result of isOperationReady() is an important indicator of whether an operation remains suitable for execution.
Endorser registry
The registry records ETH burned to demonstrate the trustworthiness of an endorser contract. The main features and objectives are as follows.
Recording burns
The endorser registry records the amount of ETH burned for each endorser contract. This serves as an indicator of the endorser contract's credibility and commitment.
Using the addBurn() function
Anyone can use addBurn() to increase the amount burned for any endorser contract.
This allows third parties to increase confidence in the endorser contract.
Permanently locking burned ETH
ETH burned in the registry is effectively locked forever and cannot be recovered. This is because reliably proving on-chain slashing (a penalty) is difficult under the current protocol.
Slashing as a virtual event
Slashing is treated as a virtual event that does not actually occur. Mempool operators instead disregard the committed ETH.
The endorser registry is a tool for increasing accountability and trust in endorser contracts. Because the burned ETH cannot be recovered, its primary role is to establish credibility.
Reference implementation
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.15;
contract EndorserRegistry {
event Burned(
address indexed _endorser,
address indexed _sender,
uint256 _new,
uint256 _total
);
mapping(address => uint256) public burn;
function addBurn(address _endorser) external payable returns (uint256) {
uint256 total = burn[_endorser] + msg.value;
burn[_endorser] = total;
emit Burned(_endorser, msg.sender, msg.value, total);
return total;
}
}Additional notes
Griefing protection
This section discusses defenses against denial-of-service (DoS) attacks in an account abstraction system based on smart contract wallets.
Denial-of-service (DoS) attacks in account abstraction systems
Account abstraction is a mechanism for handling user accounts more flexibly on blockchains such as Ethereum. Blockchains typically have two types of accounts: externally owned accounts (EOAs) and smart contracts. EOAs are owned by individual users and controlled with private keys. Smart contracts, on the other hand, are controlled by code and can perform more complex logic and operations.
Account abstraction removes this distinction, allowing all accounts to be treated like smart contracts. Users can therefore add custom logic and security features to their accounts.
However, these systems carry a risk of DoS attacks. A DoS attack disrupts the normal functioning of a system through excessive use or abuse of a service. In the context of account abstraction, the following risks are particularly relevant.
-
Resource consumption
- An attacker may create large numbers of smart contracts containing complex operations and consume excessive network resources, delaying or disrupting legitimate transaction processing.
-
Mempool congestion
- As the number of smart contract operations increases, transactions for processing them accumulate in the mempool.
- Excessive unnecessary or malicious transactions may congest the mempool and interfere with legitimate transaction processing.
-
Impact on bundlers
- Bundlers that include transactions in blocks must evaluate and process each transaction appropriately.
- Abuse of complex smart contracts can increase the burden on bundlers and reduce network efficiency.
To address these risks, account abstraction systems generally need carefully designed transaction validation and processing mechanisms. Examples include endorser contracts and transaction prioritization. The goal is to reduce DoS risk while making accounts more flexible and functional.
The system's main challenges and solutions are as follows.
Guaranteeing operation execution and compensation
Bundlers need assurance that they can receive compensation from an operation without executing the operation itself. However, executing an entire operation to confirm its validity is problematic in terms of cost and complexity.
Difficulty of execution
Fully executing an operation is difficult for the following reasons. - Bundlers cannot simulate using a reduced amount of gas and must use the full gas limit, increasing the risk of griefing. - Bundlers have no way of knowing whether a state change affects an operation, so they must reevaluate operations after every change. - They also cannot tell whether a state change will invalidate a large portion of the mempool.
Introducing endorser contracts
This proposal introduces endorser contracts so that bundlers can validate arbitrary operations in a controlled manner. Bundlers therefore do not need to know the internal behavior of each operation.
Shifting responsibility to wallet developers
Wallet developers must write and deploy endorser contracts and burn ETH. This is desirable because developers understand their own wallet operations and can build tools to evaluate them efficiently.
Simplifying the specification
The specification remains simple and does not impose highly structured behavior on smart contract wallet transactions, allowing adoption of new wallet types and shared standards to continue.
This system allows bundlers to validate operations safely and efficiently while minimizing the risk of griefing attacks.
Griefing attacks
In online games and digital communities, griefing means deliberately causing trouble for other players or users. Such behavior aims to disrupt other people's enjoyment or interfere with their in-game activities. Griefing often brings no particular benefit to the attacker and is done simply to inconvenience others or ruin their gaming experience.
Examples of griefing in online games include the following.
- Deliberately interfering with teammates
- Attacking allies or acting against the objectives of the game.
- Destroying or stealing resources
- Destroying structures built by other players or stealing their items.
- Disruptive behavior in chat
- Using offensive language or sending spam messages.
Many online games prohibit griefing because it damages community interactions and undermines the gaming experience.
In the context of blockchains and smart contracts, a griefing attack involves abusing the system to interfere with other users or processes. Examples include transactions that deliberately congest the network or consume excessive resources. These actions aim to reduce network efficiency and disrupt other users' operations.
Burned ETH
This section discusses important aspects of endorser contracts. The key points are as follows.
Deploying endorser contracts
Anyone can deploy an endorser contract. The wallet client decides which endorser contract to use for a particular transaction.
Using the endorser registry
Rather than relying on separate off-chain registries, bundlers can use the endorser registry to verify that the requested endorser contract exists and how much ETH has been burned for it.
Setting the threshold for burned ETH
Bundlers can set their own minimum amount of burned ETH required to accept an endorser contract.
Supporting endorser contracts outside the registry
Bundlers are free to support endorser contracts that are not registered or that are registered but have no associated burned ETH.
This allows bundlers to manage transactions more efficiently and use endorser contracts they consider trustworthy. The amount of burned ETH serves as an indicator of an endorser contract's credibility and provides a criterion for bundlers assessing it.
Minimal overhead
This section explains how account abstraction (AA) transactions are processed efficiently. The system has the following characteristics.
Off-chain AA transaction validation
AA transactions are validated off-chain in advance rather than at execution time. Bundlers perform this validation. Bundlers are responsible for including transactions in blockchain blocks.
No additional gas overhead
This process introduces no additional gas overhead when executing AA transactions. Transactions normally require gas fees for execution, but this system does not add that extra cost.
Bundlers bear the risk
The risks associated with transaction validation are borne by bundlers rather than all users. Users therefore do not need to pay additional fees for security.
Consequently, the additional cost of AA transactions does not affect users, and bundlers' efficient risk management allows transactions to be processed more economically. This system reduces the burden on the network as a whole and enables users to execute transactions at a lower cost.
Differences from alternatives
This proposal differs from alternatives in the following respects.
No restrictions required
Wallets do not need to restrict the functionality of the EVM under this proposal. Other proposals may impose such restrictions.
No prescribed replay protection logic
The proposal does not prescribe replay protection logic.
Instead, it can be controlled using a nonce (nonce).
No prescribed counterfactual deployment logic
The proposal does not require predefined deployment logic. This can be handled at the entry point.
No requirement to accept a trusted entry point contract
Under this proposal, wallets do not need to accept transactions from a trusted entry point contract.
No distinction between execution and signature payloads
The distinction between execution and signature payloads depends on the implementation.
These differences give the proposal flexibility while maintaining compatibility with existing wallets and improving security and efficiency.
Backward compatibility
This EIP neither modifies the consensus layer nor requires changes to existing smart contract wallets, so there are no backward compatibility issues.
Security considerations
This EIP (Ethereum Improvement Proposal) does not change on-chain interactions. Endorsers are explicitly intended for off-chain validation.
Bundlers are responsible for their own security and for ensuring they are paid for transactions included in blocks.
References
Agustín Aguilar (@agusx1211), Philippe Castonguay (@phabc), Michael Standen (@ScreamingHawk), "ERC-5189: Account Abstraction via Endorsed Operations [DRAFT]," Ethereum Improvement Proposals, no. 5189, June 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5189.
Conclusion
This article covered ERC-5189, a proposal for account abstraction that avoids protocol changes while maintaining compatibility with existing contract wallets. I hope the explanation was helpful.
If you have questions, feel free to contact me via Twitter DM.
I also publish content on the following platforms.



