---
eip: 7582
label: ERC-7582
title: Modular Accounts with Delegated Validation
status: Draft
type: Standards Track
category: ERC
created: 2023-12-25
requires: 4337
official: https://eips.ethereum.org/EIPS/eip-7582
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7582.md
canonical: https://eips.huatuo.xyz/eip-7582/
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]
---

# ERC-7582: Modular Accounts with Delegated Validation

> Extends ERC-4337 interface with nonce-based plugins

**TL;DR:** 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.

## What problem does it solve?

Smart 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.

ERC-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.

## How it works

ERC-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:

1. The user builds a UserOperation whose `nonce` has a non-zero key (so the nonce is greater than `type(uint64).max`).
2. 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.
3. The account forwards the UserOperation (ideally all of it) to that validator.
4. The validator returns standard ERC-4337 `validationData`, which the account returns to the EntryPoint unchanged.
5. A nonce with key 0 falls back to the account's normal signature check.

Why 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.

## Sample code

A simplified MADV account (the reference implementation also checks the owner's signature first):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {IAccount} from "account-abstraction/interfaces/IAccount.sol";
import {PackedUserOperation} from "account-abstraction/interfaces/PackedUserOperation.sol";

contract MADVAccount is IAccount {
    address public immutable entryPoint;

    constructor(address ep) { entryPoint = ep; }

    function validateUserOp(
        PackedUserOperation calldata userOp,
        bytes32 userOpHash,
        uint256 missingAccountFunds
    ) external returns (uint256 validationData) {
        require(msg.sender == entryPoint, "not EntryPoint");

        if (userOp.nonce > type(uint64).max) {
            uint192 key = uint192(userOp.nonce >> 64);
            address validator = address(uint160(key));   // key encodes the plugin
            // (a real account should check `validator` is installed/allowed)
            validationData = IAccount(validator).validateUserOp(userOp, userOpHash, missingAccountFunds);
        } else {
            validationData = _validateOwnerSignature(userOp, userOpHash);
        }

        if (missingAccountFunds > 0) {
            (bool ok, ) = payable(msg.sender).call{value: missingAccountFunds}("");
            (ok);
        }
    }

    function _validateOwnerSignature(PackedUserOperation calldata, bytes32)
        internal view virtual returns (uint256) { /* ECDSA check */ return 0; }
}
```

Off-chain, the next nonce for a plugin is `entryPoint.getNonce(account, BigInt(validatorAddress))`.

## Things to know

- Status: **Draft**.
- 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.
- Validators run inside ERC-4337's validation phase and must follow its rules (storage access and opcode restrictions) or bundlers will drop the operation.
- For richer module systems with installation, hooks and execution modules, see [ERC-7579](/eip-7579/) and [ERC-6900](/eip-6900/).


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7582
