{"eip":5189,"title":"Account Abstraction via Endorsed Operations","description":"An account abstraction proposal that avoids protocol changes while maintaining compatibility with existing smart contract wallets.","authors":["Agustín Aguilar (@agusx1211)","Philippe Castonguay (@phabc)","Michael Standen (@ScreamingHawk)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2022-06-29","discussionsTo":"https://ethereum-magicians.org/t/erc-account-abstraction-via-endorsed-operations/9799","repo":"ERCs","label":"ERC-5189","officialUrl":"https://eips.ethereum.org/EIPS/eip-5189","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5189.md","url":"https://eips.huatuo.xyz/eip-5189/","tldr":{"en":"Account abstraction without protocol changes: wallets submit Operations to a public mempool, and a per-wallet 'endorser' contract tells bundlers whether each one will pay and which state it depends on.","ja":"プロトコル変更なしのアカウント抽象化: ウォレットが Operation を公開 mempool に送り、ウォレットごとの「endorser」コントラクトが、各 Operation が支払われるかどうか、どの状態に依存するかを Bundler に伝える。","ko":"프로토콜 변경 없는 계정 추상화: 지갑이 Operation을 공개 mempool에 제출하고, 지갑별 \"endorser\" 컨트랙트가 각 Operation이 비용을 지불할지, 어떤 상태에 의존하는지를 bundler에게 알려 준다.","zh":"无需修改协议的账户抽象：钱包向公共 mempool 提交 Operation，每个钱包对应的\"endorser\"合约告诉 bundler 每个 Operation 是否会付费，以及它依赖哪些状态。"},"tags":["account-abstraction","wallets","mempool","bundlers","erc"],"explainers":{"en":{"lang":"en","tldr":"Account abstraction without protocol changes: wallets submit Operations to a public mempool, and a per-wallet 'endorser' contract tells bundlers whether each one will pay and which state it depends on.","tags":["account-abstraction","wallets","mempool","bundlers","erc"],"related":[4337,7702,1559,3074],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5189/","markdown":"## What problem does it solve?\n\nSmart contract wallets need someone, a **bundler**, to send their transactions on-chain and get paid back for gas. The hard part is denial-of-service. How does a bundler know an operation will actually pay, without running the whole thing and re-running it after every state change?\n\n[ERC-4337](/eip-4337/) answers this with a fixed `UserOperation` format, a shared EntryPoint and strict validation rules on opcodes and storage. Existing wallets have to adopt that model. ERC-5189 takes another route. It aims to work with **already-deployed wallets as they are**, with no consensus changes and no restrictions on what wallet code may do. Each wallet developer instead supplies a contract that vouches for their wallet's operations.\n\n## How it works\n\n**Operation.** An off-chain struct sent to a dedicated mempool. Its fields include `entrypoint` + `callData` (what to call, usually the wallet itself), `fixedGas` and `gasLimit`, fee fields similar to [EIP-1559](/eip-1559/) (`maxFeePerGas`, `priorityFeePerGas`), a `feeToken` with scaling factors for paying in ERC-20, `chainId`, and the `endorser` to consult.\n\n**Endorser.** A contract deployed by the wallet developer. Bundlers **simulate** calls to it off-chain and never call it on-chain:\n\n- `simulationSettings(op)` returns code and storage overrides to apply before simulating.\n- `isOperationReady(op)` returns `readiness` plus the operation's **dependencies**. These are global (base fee, timestamp, block number, `maxBlockNumber` and so on) and per-address (balance, code, nonce, specific storage slots, or value ranges called `constraints`).\n\nIf `readiness` is true, the operation must execute and must pay the bundler at least:\n\n```\ngasUnits  = fixedGas + min(gasUsed, gasLimit)\nfeePerGas = min(maxFeePerGas, baseFee + priorityFeePerGas)\nrepayment = gasUnits * feePerGas * feeScalingFactor / feeNormalizationFactor\n```\n\nThe bundler only re-checks an operation when one of its dependencies changes. It runs a final simulation inside the actual block before inclusion. If an endorser said \"ready\" and the operation then fails or underpays, the bundler **bans that endorser** and drops all of its operations. To make endorsers costly to throw away, they can **burn ETH** in an `EndorserRegistry`, and each mempool operator decides how much burn to require.\n\nFor code paths the endorser cannot fully check, it can emit `UntrustedStarted` / `UntrustedEnded`. Inside that section, the bundler records every state access as a dependency automatically.\n\n## Sample code\n\nThe registry contract from the spec, slightly trimmed:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.15;\n\ncontract EndorserRegistry {\n    event Burned(address indexed endorser, address indexed sender, uint256 added, uint256 total);\n    mapping(address =\u003e uint256) public burn;\n\n    function addBurn(address endorser) external payable returns (uint256 total) {\n        total = burn[endorser] + msg.value;   // ETH is locked here forever\n        burn[endorser] = total;\n        emit Burned(endorser, msg.sender, msg.value, total);\n    }\n}\n```\n\nA bundler's admission check, in pseudocode:\n\n```python\nsettings = endorser.simulationSettings(op)                     # eth_call\nready, glob, deps = simulate(endorser.isOperationReady, op, overrides=settings)\nif ready and registry.burn(op.endorser) \u003e= MIN_ENDORSER_BURN:\n    mempool.add(op, watch=deps, valid_until=(glob.maxBlockNumber, glob.maxBlockTimestamp))\n```\n\n## Things to know\n\n- **Status: Draft.** In practice, the ecosystem has mostly gone with [ERC-4337](/eip-4337/) and, for EOAs, [EIP-7702](/eip-7702/).\n- The spec defines no replay protection or wallet-deployment logic. Those stay with each wallet and its entrypoint.\n- Safety rests on bundlers' own policies: minimum burn, dependency limits, re-evaluation limits and endorser bans. The spec suggests constants such as `MAX_ENDORSER_GAS` and `MIN_ENDORSER_BURN` but gives them no values.\n- An operation can be executed more than once. The protocol does not stop this. Replay protection is up to the wallet, for example a nonce that shows up as a dependency.\n"},"ja":{"lang":"ja","tldr":"プロトコル変更なしのアカウント抽象化: ウォレットが Operation を公開 mempool に送り、ウォレットごとの「endorser」コントラクトが、各 Operation が支払われるかどうか、どの状態に依存するかを Bundler に伝える。","tags":["account-abstraction","wallets","mempool","bundlers","erc"],"related":[4337,7702,1559,3074],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5189/","markdown":"## 何を解決するのか\n\nスマートコントラクトウォレットには、トランザクションをオンチェーンに送り、ガス代を払い戻してもらう役割の誰か、つまり **Bundler** が必要です。難しいのはサービス拒否攻撃（DoS）です。Operation 全体を実行したり、状態が変わるたびに再実行したりせずに、Bundler はその Operation が実際に支払われるとどうやって知るのでしょうか。\n\n[ERC-4337](/eip-4337/) は、固定の `UserOperation` 形式、共有の EntryPoint、opcode とストレージに関する厳格な検証ルールでこれに答えます。既存のウォレットはそのモデルを採用しなければなりません。ERC-5189 は別の道を取ります。コンセンサスの変更もウォレットコードへの制限もなしに、**デプロイ済みのウォレットをそのまま**扱えることを目指します。代わりに、各ウォレット開発者が、自分のウォレットの Operation を保証するコントラクトを提供します。\n\n## 仕組み\n\n**Operation。** 専用の mempool に送られるオフチェーンの構造体です。フィールドには、`entrypoint` + `callData`（何を呼ぶか。通常はウォレット自身）、`fixedGas` と `gasLimit`、[EIP-1559](/eip-1559/) に似た手数料フィールド（`maxFeePerGas`、`priorityFeePerGas`）、ERC-20 で支払うためのスケーリング係数付きの `feeToken`、`chainId`、そして参照すべき `endorser` が含まれます。\n\n**Endorser。** ウォレット開発者がデプロイするコントラクトです。Bundler はこれの呼び出しをオフチェーンで**シミュレーション**し、オンチェーンでは呼び出しません。\n\n- `simulationSettings(op)` は、シミュレーション前に適用するコードとストレージのオーバーライドを返します。\n- `isOperationReady(op)` は `readiness` と、その Operation の**依存関係**を返します。依存関係には、グローバルなもの（base fee、タイムスタンプ、ブロック番号、`maxBlockNumber` など）と、アドレスごとのもの（残高、コード、nonce、特定のストレージスロット、`constraints` と呼ばれる値の範囲）があります。\n\n`readiness` が true なら、その Operation は実行されなければならず、少なくとも次の額を Bundler に支払わなければなりません。\n\n```\ngasUnits  = fixedGas + min(gasUsed, gasLimit)\nfeePerGas = min(maxFeePerGas, baseFee + priorityFeePerGas)\nrepayment = gasUnits * feePerGas * feeScalingFactor / feeNormalizationFactor\n```\n\nBundler は、依存関係のいずれかが変化したときにだけ Operation を再チェックします。取り込む前に、実際のブロック内で最終シミュレーションを実行します。endorser が「ready」と言ったのに Operation が失敗したり支払いが不足したりした場合、Bundler は**その endorser を BAN** し、その endorser のすべての Operation を破棄します。endorser を使い捨てるコストを高くするため、`EndorserRegistry` で **ETH をバーン**でき、どれだけのバーンを要求するかは各 mempool オペレーターが決めます。\n\nendorser が完全には検証できないコードパスについては、`UntrustedStarted` / `UntrustedEnded` を emit できます。その区間内では、Bundler がすべての状態アクセスを依存関係として自動的に記録します。\n\n## サンプルコード\n\n仕様のレジストリコントラクト（少し簡略化）:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.15;\n\ncontract EndorserRegistry {\n    event Burned(address indexed endorser, address indexed sender, uint256 added, uint256 total);\n    mapping(address =\u003e uint256) public burn;\n\n    function addBurn(address endorser) external payable returns (uint256 total) {\n        total = burn[endorser] + msg.value;   // ETH is locked here forever\n        burn[endorser] = total;\n        emit Burned(endorser, msg.sender, msg.value, total);\n    }\n}\n```\n\nBundler の受け入れチェック（疑似コード）:\n\n```python\nsettings = endorser.simulationSettings(op)                     # eth_call\nready, glob, deps = simulate(endorser.isOperationReady, op, overrides=settings)\nif ready and registry.burn(op.endorser) \u003e= MIN_ENDORSER_BURN:\n    mempool.add(op, watch=deps, valid_until=(glob.maxBlockNumber, glob.maxBlockTimestamp))\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** 実際には、エコシステムの大半は [ERC-4337](/eip-4337/) を採用し、EOA については [EIP-7702](/eip-7702/) を採用しています。\n- 仕様は、リプレイ防止もウォレットのデプロイロジックも定義していません。それらは各ウォレットとその entrypoint に委ねられます。\n- 安全性は、最小バーン、依存関係の上限、再評価の上限、endorser の BAN といった Bundler 自身のポリシーに依存します。仕様は `MAX_ENDORSER_GAS` や `MIN_ENDORSER_BURN` といった定数を示唆していますが、値は与えていません。\n- Operation は複数回実行される可能性があります。プロトコルはこれを防ぎません。リプレイ防止はウォレットの責任で、たとえば依存関係として現れる nonce を使います。\n"},"ko":{"lang":"ko","tldr":"프로토콜 변경 없는 계정 추상화: 지갑이 Operation을 공개 mempool에 제출하고, 지갑별 \"endorser\" 컨트랙트가 각 Operation이 비용을 지불할지, 어떤 상태에 의존하는지를 bundler에게 알려 준다.","tags":["account-abstraction","wallets","mempool","bundlers","erc"],"related":[4337,7702,1559,3074],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5189/","markdown":"## 어떤 문제를 해결하나요?\n\n스마트 컨트랙트 지갑에는 트랜잭션을 온체인에 보내고 가스비를 돌려받는 누군가, 즉 **bundler**가 필요합니다. 어려운 부분은 서비스 거부 공격입니다. bundler는 Operation 전체를 실행하거나 상태가 바뀔 때마다 다시 실행하지 않고도 그 Operation이 실제로 비용을 지불할지 어떻게 알 수 있을까요?\n\n[ERC-4337](/eip-4337/)은 고정된 `UserOperation` 형식, 공유 EntryPoint, opcode와 스토리지에 대한 엄격한 검증 규칙으로 이에 답합니다. 기존 지갑은 그 모델을 채택해야 합니다. ERC-5189는 다른 길을 택합니다. 합의 변경이나 지갑 코드에 대한 제약 없이, **이미 배포된 지갑을 그대로** 지원하는 것을 목표로 합니다. 대신 각 지갑 개발자가 자기 지갑의 Operation을 보증하는 컨트랙트를 제공합니다.\n\n## 어떻게 동작하나요?\n\n**Operation.** 전용 mempool로 보내는 오프체인 구조체입니다. 필드에는 `entrypoint` + `callData`(무엇을 호출할지, 보통 지갑 자신), `fixedGas`와 `gasLimit`, [EIP-1559](/eip-1559/)와 비슷한 수수료 필드(`maxFeePerGas`, `priorityFeePerGas`), ERC-20으로 지불하기 위한 스케일링 계수가 있는 `feeToken`, `chainId`, 그리고 참조할 `endorser`가 포함됩니다.\n\n**Endorser.** 지갑 개발자가 배포하는 컨트랙트입니다. bundler는 이에 대한 호출을 오프체인에서 **시뮬레이션**하며, 온체인에서는 절대 호출하지 않습니다.\n\n- `simulationSettings(op)`는 시뮬레이션 전에 적용할 코드와 스토리지 오버라이드를 반환합니다.\n- `isOperationReady(op)`는 `readiness`와 그 Operation의 **의존성**을 반환합니다. 의존성에는 전역적인 것(base fee, 타임스탬프, 블록 번호, `maxBlockNumber` 등)과 주소별 의존성(잔액, 코드, nonce, 특정 스토리지 슬롯, 또는 `constraints`라 불리는 값 범위)이 있습니다.\n\n`readiness`가 true이면 그 Operation은 반드시 실행되어야 하고, bundler에게 최소한 다음을 지불해야 합니다.\n\n```\ngasUnits  = fixedGas + min(gasUsed, gasLimit)\nfeePerGas = min(maxFeePerGas, baseFee + priorityFeePerGas)\nrepayment = gasUnits * feePerGas * feeScalingFactor / feeNormalizationFactor\n```\n\nbundler는 의존성 중 하나가 바뀔 때만 Operation을 다시 확인합니다. 포함하기 전에 실제 블록 안에서 최종 시뮬레이션을 실행합니다. endorser가 \"ready\"라고 했는데 Operation이 실패하거나 지불이 부족하면, bundler는 **그 endorser를 차단**하고 해당 endorser의 모든 Operation을 버립니다. endorser를 버리는 데 비용이 들도록, `EndorserRegistry`에서 **ETH를 소각**할 수 있으며, 얼마나 소각해야 하는지는 각 mempool 운영자가 정합니다.\n\nendorser가 완전히 검증할 수 없는 코드 경로에서는 `UntrustedStarted` / `UntrustedEnded`를 emit할 수 있습니다. 그 구간 안에서 bundler는 모든 상태 접근을 자동으로 의존성으로 기록합니다.\n\n## 샘플 코드\n\n사양의 레지스트리 컨트랙트(약간 줄임):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.15;\n\ncontract EndorserRegistry {\n    event Burned(address indexed endorser, address indexed sender, uint256 added, uint256 total);\n    mapping(address =\u003e uint256) public burn;\n\n    function addBurn(address endorser) external payable returns (uint256 total) {\n        total = burn[endorser] + msg.value;   // ETH is locked here forever\n        burn[endorser] = total;\n        emit Burned(endorser, msg.sender, msg.value, total);\n    }\n}\n```\n\nbundler의 수용 검사(의사 코드):\n\n```python\nsettings = endorser.simulationSettings(op)                     # eth_call\nready, glob, deps = simulate(endorser.isOperationReady, op, overrides=settings)\nif ready and registry.burn(op.endorser) \u003e= MIN_ENDORSER_BURN:\n    mempool.add(op, watch=deps, valid_until=(glob.maxBlockNumber, glob.maxBlockTimestamp))\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 실제로는 생태계 대부분이 [ERC-4337](/eip-4337/)을, EOA에 대해서는 [EIP-7702](/eip-7702/)를 택했습니다.\n- 사양은 리플레이 방지나 지갑 배포 로직을 정의하지 않습니다. 이들은 각 지갑과 그 entrypoint에 맡겨집니다.\n- 안전성은 최소 소각량, 의존성 한도, 재평가 한도, endorser 차단 같은 bundler 자체 정책에 달려 있습니다. 사양은 `MAX_ENDORSER_GAS`와 `MIN_ENDORSER_BURN` 같은 상수를 제안하지만 값은 주지 않습니다.\n- Operation은 여러 번 실행될 수 있습니다. 프로토콜은 이를 막지 않습니다. 리플레이 방지는 지갑의 몫이며, 예를 들어 의존성으로 나타나는 nonce를 사용합니다.\n"},"zh":{"lang":"zh","tldr":"无需修改协议的账户抽象：钱包向公共 mempool 提交 Operation，每个钱包对应的\"endorser\"合约告诉 bundler 每个 Operation 是否会付费，以及它依赖哪些状态。","tags":["account-abstraction","wallets","mempool","bundlers","erc"],"related":[4337,7702,1559,3074],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5189/","markdown":"## 它解决什么问题？\n\n智能合约钱包需要有人，也就是 **bundler**，把它们的交易发送上链，并获得 gas 的补偿。难点在于拒绝服务攻击。bundler 如何在不运行整个 Operation、也不必在每次状态变化后重新运行的情况下，知道某个 Operation 真的会付费？\n\n[ERC-4337](/eip-4337/) 用固定的 `UserOperation` 格式、共享的 EntryPoint，以及对 opcode 和存储的严格验证规则来回答这个问题。现有钱包必须采用这种模型。ERC-5189 走了另一条路。它的目标是**原样支持已经部署的钱包**，无需共识层变更，也不限制钱包代码能做什么。取而代之的是，每个钱包开发者提供一个合约，为自己钱包的 Operation 担保。\n\n## 它如何运作\n\n**Operation。** 发送到专用 mempool 的链下结构体。字段包括 `entrypoint` + `callData`（调用什么，通常是钱包本身）、`fixedGas` 和 `gasLimit`、类似 [EIP-1559](/eip-1559/) 的费用字段（`maxFeePerGas`、`priorityFeePerGas`）、带缩放系数以便用 ERC-20 付费的 `feeToken`、`chainId`，以及要咨询的 `endorser`。\n\n**Endorser。** 由钱包开发者部署的合约。bundler 在链下**模拟**对它的调用，从不在链上调用它：\n\n- `simulationSettings(op)` 返回模拟前要应用的代码和存储覆盖。\n- `isOperationReady(op)` 返回 `readiness` 以及该 Operation 的**依赖项**。依赖项包括全局的（base fee、时间戳、区块号、`maxBlockNumber` 等）和按地址的（余额、代码、nonce、特定存储槽，或称为 `constraints` 的取值范围）。\n\n如果 `readiness` 为 true，该 Operation 必须执行，并且至少要向 bundler 支付：\n\n```\ngasUnits  = fixedGas + min(gasUsed, gasLimit)\nfeePerGas = min(maxFeePerGas, baseFee + priorityFeePerGas)\nrepayment = gasUnits * feePerGas * feeScalingFactor / feeNormalizationFactor\n```\n\nbundler 只在某个依赖项变化时才重新检查 Operation。它在纳入之前，会在真实区块内进行最后一次模拟。如果 endorser 说\"ready\"，而 Operation 随后失败或支付不足，bundler 会**封禁该 endorser**，并丢弃它的所有 Operation。为了让丢弃 endorser 变得代价高昂，它们可以在 `EndorserRegistry` 中**销毁 ETH**，每个 mempool 运营者自行决定要求销毁多少。\n\n对于 endorser 无法完全检查的代码路径，它可以触发 `UntrustedStarted` / `UntrustedEnded`。在该区间内，bundler 会自动把每一次状态访问记录为依赖项。\n\n## 示例代码\n\n规范中的注册表合约（略有精简）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.15;\n\ncontract EndorserRegistry {\n    event Burned(address indexed endorser, address indexed sender, uint256 added, uint256 total);\n    mapping(address =\u003e uint256) public burn;\n\n    function addBurn(address endorser) external payable returns (uint256 total) {\n        total = burn[endorser] + msg.value;   // ETH is locked here forever\n        burn[endorser] = total;\n        emit Burned(endorser, msg.sender, msg.value, total);\n    }\n}\n```\n\nbundler 的准入检查（伪代码）：\n\n```python\nsettings = endorser.simulationSettings(op)                     # eth_call\nready, glob, deps = simulate(endorser.isOperationReady, op, overrides=settings)\nif ready and registry.burn(op.endorser) \u003e= MIN_ENDORSER_BURN:\n    mempool.add(op, watch=deps, valid_until=(glob.maxBlockNumber, glob.maxBlockTimestamp))\n```\n\n## 需要注意\n\n- **状态：Draft。** 实际上，生态系统大多选择了 [ERC-4337](/eip-4337/)，而对于 EOA 则选择了 [EIP-7702](/eip-7702/)。\n- 规范没有定义重放保护或钱包部署逻辑。这些仍由各个钱包及其 entrypoint 负责。\n- 安全性取决于 bundler 自己的策略：最低销毁量、依赖项上限、重新评估次数上限和 endorser 封禁。规范建议了 `MAX_ENDORSER_GAS` 和 `MIN_ENDORSER_BURN` 之类的常量，但没有给出具体值。\n- 一个 Operation 可能被执行多次，协议并不阻止这一点。重放保护由钱包负责，例如使用作为依赖项出现的 nonce。\n"}}}
