{"eip":7582,"title":"Modular Accounts with Delegated Validation","description":"Extends ERC-4337 interface with nonce-based plugins","authors":["Shivanshi Tyagi (@nerderlyne)","Ross Campbell (@z0r0z)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2023-12-25","requires":[4337],"discussionsTo":"https://ethereum-magicians.org/t/erc-7582-modular-accounts-with-delegated-validation/17640","repo":"ERCs","label":"ERC-7582","officialUrl":"https://eips.ethereum.org/EIPS/eip-7582","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7582.md","url":"https://eips.huatuo.xyz/eip-7582/","tldr":{"en":"A draft, minimal way to add plugins to ERC-4337 smart accounts: the high 192-bit key of a UserOperation's nonce names a validator contract, and the account hands validation of that operation to it.","ja":"ERC-4337 スマートアカウントにプラグインを追加する、ドラフトの最小限の方法。UserOperation の nonce の上位 192 ビットのキーが validator コントラクトを指名し、アカウントはその操作の検証をそのコントラクトに委ねる。","ko":"ERC-4337 스마트 계정에 플러그인을 추가하는 초안 수준의 최소한의 방법. UserOperation nonce의 상위 192비트 키가 validator 컨트랙트를 지정하고, 계정은 그 작업의 검증을 해당 컨트랙트에 넘긴다.","zh":"为 ERC-4337 智能账户添加插件的一种草案性的最小化方法：UserOperation 的 nonce 高 192 位的 key 指定一个 validator 合约，账户把该操作的验证交给它。"},"tags":["account-abstraction","erc4337","smart-accounts","plugins","modular"],"explainers":{"en":{"lang":"en","tldr":"A draft, minimal way to add plugins to ERC-4337 smart accounts: the high 192-bit key of a UserOperation's nonce names a validator contract, and the account hands validation of that operation to it.","tags":["account-abstraction","erc4337","smart-accounts","plugins","modular"],"related":[4337,6900,7579],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7582/","markdown":"## What problem does it solve?\n\nSmart contract accounts can in principle do social recovery, spending limits, session keys, scheduled payments and more. In practice each feature needs custom validation logic, and adding it usually means upgrading or migrating the account. Larger modular-account standards exist, but they add many new functions and conventions.\n\nERC-7582 (\"Modular Accounts with Delegated Validation\", MADV) takes the opposite approach. It adds no new functions at all. It shows how an account that already implements the [ERC-4337](/eip-4337/) `IAccount` interface can delegate validation to plugin contracts, using only fields ERC-4337 already has.\n\n## How it works\n\nERC-4337's EntryPoint tracks nonces as a 192-bit **key** plus a 64-bit **sequence**. Each key has its own counter, so operations with different keys do not block each other. MADV reuses that key as a pointer:\n\n1. The user builds a UserOperation whose `nonce` has a non-zero key (so the nonce is greater than `type(uint64).max`).\n2. In `validateUserOp`, the account extracts a validator identifier from the key. It may be the validator's address directly or a pointer to an address in storage; the account decides.\n3. The account forwards the UserOperation (ideally all of it) to that validator.\n4. The validator returns standard ERC-4337 `validationData`, which the account returns to the EntryPoint unchanged.\n5. A nonce with key 0 falls back to the account's normal signature check.\n\nWhy the nonce and not the `signature` field? It costs no extra calldata, `getNonce(sender, key)` already gives each plugin its own replay counter, and `UserOperationEvent` logs the nonce, so plugin use can be tracked from existing events.\n\n## Sample code\n\nA simplified MADV account (the reference implementation also checks the owner's signature first):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport {IAccount} from \"account-abstraction/interfaces/IAccount.sol\";\nimport {PackedUserOperation} from \"account-abstraction/interfaces/PackedUserOperation.sol\";\n\ncontract MADVAccount is IAccount {\n    address public immutable entryPoint;\n\n    constructor(address ep) { entryPoint = ep; }\n\n    function validateUserOp(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash,\n        uint256 missingAccountFunds\n    ) external returns (uint256 validationData) {\n        require(msg.sender == entryPoint, \"not EntryPoint\");\n\n        if (userOp.nonce \u003e type(uint64).max) {\n            uint192 key = uint192(userOp.nonce \u003e\u003e 64);\n            address validator = address(uint160(key));   // key encodes the plugin\n            // (a real account should check `validator` is installed/allowed)\n            validationData = IAccount(validator).validateUserOp(userOp, userOpHash, missingAccountFunds);\n        } else {\n            validationData = _validateOwnerSignature(userOp, userOpHash);\n        }\n\n        if (missingAccountFunds \u003e 0) {\n            (bool ok, ) = payable(msg.sender).call{value: missingAccountFunds}(\"\");\n            (ok);\n        }\n    }\n\n    function _validateOwnerSignature(PackedUserOperation calldata, bytes32)\n        internal view virtual returns (uint256) { /* ECDSA check */ return 0; }\n}\n```\n\nOff-chain, the next nonce for a plugin is `entryPoint.getNonce(account, BigInt(validatorAddress))`.\n\n## Things to know\n\n- Status: **Draft**.\n- The spec leaves both the identifier-to-validator mapping and any allow-list to the account developer. An account that blindly trusts any address in the key lets anyone choose the validator for its operations, so restrict which validators may be used.\n- Validators run inside ERC-4337's validation phase and must follow its rules (storage access and opcode restrictions) or bundlers will drop the operation.\n- For richer module systems with installation, hooks and execution modules, see [ERC-7579](/eip-7579/) and [ERC-6900](/eip-6900/).\n"},"ja":{"lang":"ja","tldr":"ERC-4337 スマートアカウントにプラグインを追加する、ドラフトの最小限の方法。UserOperation の nonce の上位 192 ビットのキーが validator コントラクトを指名し、アカウントはその操作の検証をそのコントラクトに委ねる。","tags":["account-abstraction","erc4337","smart-accounts","plugins","modular"],"related":[4337,6900,7579],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7582/","markdown":"## 何を解決するのか\n\nスマートコントラクトアカウントは、原理的にはソーシャルリカバリー、支出制限、セッションキー、定期支払いなどを実現できます。しかし実際には、各機能に独自の検証ロジックが必要で、追加するにはたいていアカウントのアップグレードや移行が必要です。より大規模なモジュラーアカウント標準もありますが、多くの新しい関数や規約を追加します。\n\nERC-7582（「Modular Accounts with Delegated Validation」、MADV）は逆のアプローチを取ります。新しい関数をまったく追加しません。すでに [ERC-4337](/eip-4337/) の `IAccount` インターフェースを実装しているアカウントが、ERC-4337 にすでにあるフィールドだけを使って、検証をプラグインコントラクトに委譲できることを示します。\n\n## 仕組み\n\nERC-4337 の EntryPoint は nonce を 192 ビットの**キー**と 64 ビットの**シーケンス**として管理します。キーごとに独自のカウンターを持つため、キーが異なる操作は互いをブロックしません。MADV はそのキーをポインターとして再利用します。\n\n1. ユーザーは、`nonce` のキーがゼロでない（つまり nonce が `type(uint64).max` より大きい）UserOperation を作ります。\n2. `validateUserOp` の中で、アカウントはキーから validator の識別子を取り出します。それは validator のアドレスそのものでも、ストレージ内のアドレスへのポインターでもかまいません。どうするかはアカウントが決めます。\n3. アカウントは UserOperation（できれば全体）をその validator に転送します。\n4. validator は標準的な ERC-4337 の `validationData` を返し、アカウントはそれを変更せずに EntryPoint に返します。\n5. キーが 0 の nonce は、アカウント本来の署名チェックにフォールバックします。\n\nなぜ `signature` フィールドではなく nonce なのか。追加の calldata がかからず、`getNonce(sender, key)` がすでに各プラグインに独自のリプレイカウンターを与えており、`UserOperationEvent` が nonce をログに残すため、既存のイベントからプラグインの利用を追跡できるからです。\n\n## サンプルコード\n\n簡略化した MADV アカウント（リファレンス実装は、先にオーナーの署名もチェックします）:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport {IAccount} from \"account-abstraction/interfaces/IAccount.sol\";\nimport {PackedUserOperation} from \"account-abstraction/interfaces/PackedUserOperation.sol\";\n\ncontract MADVAccount is IAccount {\n    address public immutable entryPoint;\n\n    constructor(address ep) { entryPoint = ep; }\n\n    function validateUserOp(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash,\n        uint256 missingAccountFunds\n    ) external returns (uint256 validationData) {\n        require(msg.sender == entryPoint, \"not EntryPoint\");\n\n        if (userOp.nonce \u003e type(uint64).max) {\n            uint192 key = uint192(userOp.nonce \u003e\u003e 64);\n            address validator = address(uint160(key));   // key encodes the plugin\n            // (a real account should check `validator` is installed/allowed)\n            validationData = IAccount(validator).validateUserOp(userOp, userOpHash, missingAccountFunds);\n        } else {\n            validationData = _validateOwnerSignature(userOp, userOpHash);\n        }\n\n        if (missingAccountFunds \u003e 0) {\n            (bool ok, ) = payable(msg.sender).call{value: missingAccountFunds}(\"\");\n            (ok);\n        }\n    }\n\n    function _validateOwnerSignature(PackedUserOperation calldata, bytes32)\n        internal view virtual returns (uint256) { /* ECDSA check */ return 0; }\n}\n```\n\nオフチェーンでは、プラグインの次の nonce は `entryPoint.getNonce(account, BigInt(validatorAddress))` です。\n\n## 知っておくべきこと\n\n- ステータス: **Draft**。\n- 仕様は、識別子から validator へのマッピングも許可リストも、アカウント開発者に委ねています。キーの中のどんなアドレスでも盲目的に信頼するアカウントは、誰でも自分の操作の validator を選べてしまうため、使用できる validator を制限してください。\n- validator は ERC-4337 の検証フェーズ内で動作し、そのルール（ストレージアクセスと opcode の制限）に従わなければなりません。従わないと Bundler が操作を破棄します。\n- インストール、フック、実行モジュールを備えたより豊富なモジュールシステムについては、[ERC-7579](/eip-7579/) と [ERC-6900](/eip-6900/) を参照してください。\n"},"ko":{"lang":"ko","tldr":"ERC-4337 스마트 계정에 플러그인을 추가하는 초안 수준의 최소한의 방법. UserOperation nonce의 상위 192비트 키가 validator 컨트랙트를 지정하고, 계정은 그 작업의 검증을 해당 컨트랙트에 넘긴다.","tags":["account-abstraction","erc4337","smart-accounts","plugins","modular"],"related":[4337,6900,7579],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7582/","markdown":"## 어떤 문제를 해결하나요?\n\n스마트 컨트랙트 계정은 원칙적으로 소셜 복구, 지출 한도, 세션 키, 예약 결제 등을 할 수 있습니다. 하지만 실제로는 기능마다 맞춤 검증 로직이 필요하고, 이를 추가하려면 보통 계정을 업그레이드하거나 마이그레이션해야 합니다. 더 큰 모듈형 계정 표준도 있지만 새 함수와 관례를 많이 추가합니다.\n\nERC-7582(\"Modular Accounts with Delegated Validation\", MADV)는 반대 접근을 취합니다. 새 함수를 전혀 추가하지 않습니다. 이미 [ERC-4337](/eip-4337/) `IAccount` 인터페이스를 구현한 계정이, ERC-4337에 이미 있는 필드만으로 검증을 플러그인 컨트랙트에 위임하는 방법을 보여 줍니다.\n\n## 어떻게 동작하나요?\n\nERC-4337의 EntryPoint는 nonce를 192비트 **키(key)**와 64비트 **시퀀스(sequence)**로 추적합니다. 키마다 자체 카운터가 있어서 키가 다른 작업은 서로를 막지 않습니다. MADV는 그 키를 포인터로 재사용합니다.\n\n1. 사용자는 `nonce`의 키가 0이 아닌(즉 nonce가 `type(uint64).max`보다 큰) UserOperation을 만듭니다.\n2. `validateUserOp`에서 계정은 키에서 validator 식별자를 추출합니다. validator의 주소 자체일 수도 있고 스토리지의 주소를 가리키는 포인터일 수도 있으며, 이는 계정이 정합니다.\n3. 계정은 UserOperation(가능하면 전체)을 그 validator에게 전달합니다.\n4. validator는 표준 ERC-4337 `validationData`를 반환하고, 계정은 이를 그대로 EntryPoint에 반환합니다.\n5. 키가 0인 nonce는 계정의 일반 서명 검사로 되돌아갑니다.\n\n왜 `signature` 필드가 아니라 nonce일까요? 추가 calldata가 들지 않고, `getNonce(sender, key)`가 이미 각 플러그인에 자체 리플레이 카운터를 주며, `UserOperationEvent`가 nonce를 로그로 남기므로 기존 이벤트로 플러그인 사용을 추적할 수 있기 때문입니다.\n\n## 샘플 코드\n\n단순화한 MADV 계정(레퍼런스 구현은 오너의 서명도 먼저 확인합니다):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport {IAccount} from \"account-abstraction/interfaces/IAccount.sol\";\nimport {PackedUserOperation} from \"account-abstraction/interfaces/PackedUserOperation.sol\";\n\ncontract MADVAccount is IAccount {\n    address public immutable entryPoint;\n\n    constructor(address ep) { entryPoint = ep; }\n\n    function validateUserOp(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash,\n        uint256 missingAccountFunds\n    ) external returns (uint256 validationData) {\n        require(msg.sender == entryPoint, \"not EntryPoint\");\n\n        if (userOp.nonce \u003e type(uint64).max) {\n            uint192 key = uint192(userOp.nonce \u003e\u003e 64);\n            address validator = address(uint160(key));   // key encodes the plugin\n            // (a real account should check `validator` is installed/allowed)\n            validationData = IAccount(validator).validateUserOp(userOp, userOpHash, missingAccountFunds);\n        } else {\n            validationData = _validateOwnerSignature(userOp, userOpHash);\n        }\n\n        if (missingAccountFunds \u003e 0) {\n            (bool ok, ) = payable(msg.sender).call{value: missingAccountFunds}(\"\");\n            (ok);\n        }\n    }\n\n    function _validateOwnerSignature(PackedUserOperation calldata, bytes32)\n        internal view virtual returns (uint256) { /* ECDSA check */ return 0; }\n}\n```\n\n오프체인에서 플러그인의 다음 nonce는 `entryPoint.getNonce(account, BigInt(validatorAddress))`입니다.\n\n## 알아둘 점\n\n- 상태: **Draft**.\n- 스펙은 식별자와 validator의 매핑, 그리고 허용 목록을 모두 계정 개발자에게 맡깁니다. 키 안의 어떤 주소든 맹목적으로 신뢰하는 계정은 누구나 자기 작업의 validator를 고를 수 있게 되므로, 사용할 수 있는 validator를 제한하세요.\n- validator는 ERC-4337의 검증 단계 안에서 실행되며 그 규칙(스토리지 접근과 opcode 제한)을 따라야 합니다. 그렇지 않으면 bundler가 작업을 버립니다.\n- 설치, 훅, 실행 모듈을 갖춘 더 풍부한 모듈 시스템은 [ERC-7579](/eip-7579/)와 [ERC-6900](/eip-6900/)을 참고하세요.\n"},"zh":{"lang":"zh","tldr":"为 ERC-4337 智能账户添加插件的一种草案性的最小化方法：UserOperation 的 nonce 高 192 位的 key 指定一个 validator 合约，账户把该操作的验证交给它。","tags":["account-abstraction","erc4337","smart-accounts","plugins","modular"],"related":[4337,6900,7579],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7582/","markdown":"## 它解决什么问题？\n\n智能合约账户原则上可以实现社交恢复、支出限额、会话密钥、定时支付等等。但在实践中，每项功能都需要自定义的验证逻辑，添加它通常意味着升级或迁移账户。虽然存在更大的模块化账户标准，但它们会增加许多新函数和约定。\n\nERC-7582（\"Modular Accounts with Delegated Validation\"，MADV）采取了相反的思路。它完全不添加新函数。它展示了一个已经实现 [ERC-4337](/eip-4337/) `IAccount` 接口的账户，如何只使用 ERC-4337 已有的字段，把验证委托给插件合约。\n\n## 它如何运作\n\nERC-4337 的 EntryPoint 把 nonce 跟踪为 192 位的 **key** 加 64 位的 **sequence**。每个 key 有自己的计数器，因此 key 不同的操作互不阻塞。MADV 把这个 key 复用为指针：\n\n1. 用户构建一个 `nonce` 的 key 非零（即 nonce 大于 `type(uint64).max`）的 UserOperation。\n2. 在 `validateUserOp` 中，账户从 key 中提取一个 validator 标识符。它可以直接就是 validator 的地址，也可以是指向存储中某个地址的指针；由账户决定。\n3. 账户把 UserOperation（最好是整个）转发给该 validator。\n4. validator 返回标准的 ERC-4337 `validationData`，账户原样将其返回给 EntryPoint。\n5. key 为 0 的 nonce 会退回到账户正常的签名检查。\n\n为什么用 nonce 而不是 `signature` 字段？它不需要额外的 calldata，`getNonce(sender, key)` 已经为每个插件提供了独立的重放计数器，而且 `UserOperationEvent` 会记录 nonce，因此可以通过现有事件追踪插件的使用。\n\n## 示例代码\n\n一个简化的 MADV 账户（参考实现还会先检查所有者的签名）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.23;\n\nimport {IAccount} from \"account-abstraction/interfaces/IAccount.sol\";\nimport {PackedUserOperation} from \"account-abstraction/interfaces/PackedUserOperation.sol\";\n\ncontract MADVAccount is IAccount {\n    address public immutable entryPoint;\n\n    constructor(address ep) { entryPoint = ep; }\n\n    function validateUserOp(\n        PackedUserOperation calldata userOp,\n        bytes32 userOpHash,\n        uint256 missingAccountFunds\n    ) external returns (uint256 validationData) {\n        require(msg.sender == entryPoint, \"not EntryPoint\");\n\n        if (userOp.nonce \u003e type(uint64).max) {\n            uint192 key = uint192(userOp.nonce \u003e\u003e 64);\n            address validator = address(uint160(key));   // key encodes the plugin\n            // (a real account should check `validator` is installed/allowed)\n            validationData = IAccount(validator).validateUserOp(userOp, userOpHash, missingAccountFunds);\n        } else {\n            validationData = _validateOwnerSignature(userOp, userOpHash);\n        }\n\n        if (missingAccountFunds \u003e 0) {\n            (bool ok, ) = payable(msg.sender).call{value: missingAccountFunds}(\"\");\n            (ok);\n        }\n    }\n\n    function _validateOwnerSignature(PackedUserOperation calldata, bytes32)\n        internal view virtual returns (uint256) { /* ECDSA check */ return 0; }\n}\n```\n\n在链下，某个插件的下一个 nonce 是 `entryPoint.getNonce(account, BigInt(validatorAddress))`。\n\n## 需要注意\n\n- 状态：**Draft**。\n- 规范把标识符到 validator 的映射以及任何允许列表都留给账户开发者。盲目信任 key 中任何地址的账户，会让任何人都能为其操作选择 validator，因此要限制可使用的 validator。\n- validator 在 ERC-4337 的验证阶段内运行，必须遵守其规则（存储访问和 opcode 限制），否则 bundler 会丢弃该操作。\n- 如需带有安装、钩子和执行模块的更丰富的模块系统，请参见 [ERC-7579](/eip-7579/) 和 [ERC-6900](/eip-6900/)。\n"}}}
