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 examines ERC7582, which proposes a new account extension mechanism for modularizing validation logic without changing the existing ERC4337 interface.
The following explanation translates, summarizes, and expands on the original specification.
I also cover various EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
ERC4337 proposes a mechanism for implementing accounts (wallets) as smart contracts. ERC7582 enables ERC4337 smart contract accounts to incorporate extension modules called plugins in a safe, standardized way.
For more on ERC4337, see the following article.
[ERC4337] Account abstraction without protocol changes
A plugin is extension logic implemented in a contract separate from the account itself. It contains code that the account invokes with particular privileges. Composable logic refers to the ability to combine multiple plugins or pieces of validation logic.
Rather than introducing additional interfaces, the specification uses mechanisms already defined by ERC4337 to integrate plugins. It specifically builds on the following components.
| Component | Role |
|---|---|
| Entry Point | A routing contract in ERC4337 that receives user operations. |
| NonceManager | Centrally manages nonces (single-use counters) associated with the Entry Point to prevent replay attacks, in which the same operation is executed twice. |
| UserOperationEvent | An event emitted when the Entry Point processes a user operation, recording who performed the operation and what happened. |
| IAccount.validateUserOp | The sole function that an ERC4337 smart contract account must implement, covering tasks such as signature validation and balance checks. |
ERC7582 reorganizes these existing mechanisms so they can also be used with plugins, clarifying how accounts invoke plugins and which execution privileges they grant each plugin.
A particularly important feature is the ability to select the validation logic (in this case, a plugin validator) through validateUserOp. Accounts can therefore do the following.
- Flexibly determine which plugin to invoke for each user operation.
- Grant plugins execution privileges distinct from those of ordinary external contracts.
The ERC4337 interface IAccount is minimal, requiring only validateUserOp, and this proposal preserves that minimal design.
Instead of adding functions to IAccount, it integrates plugins using the existing validateUserOp function and information available around the Entry Point.
This approach is relatively straightforward for developers to adopt and is less likely to conflict with existing account implementations or other account abstraction standards.
Motivation
Unlike conventional wallets controlled by private keys, smart contract accounts let developers customize asset management and transaction execution through code. The ability to program user actions in advance makes these accounts expressive and powerful.
However, many aspects of their design remain unstandardized, which can limit functionality and flexibility when implementing practical features. Without agreement on how to abstract account behavior safely, wallet implementations can diverge, reducing reuse and interoperability across the ecosystem.
ERC4337 addresses part of this problem by standardizing and simplifying core concerns such as the following.
- Abstracting transaction fee payments, allowing users to transact without necessarily holding ETH themselves.
- Unifying account processing through a common path centered on the Entry Point.
To represent user intent more expressively and support everyday use cases, it is useful to have a simple, predictable mechanism for delegating account permissions and validation logic to another contract.
Typical examples include the following.
- Social recovery
- A mechanism for recovering wallet access through approval from multiple trusted people or devices.
- Scheduled payments (recurring payments)
- A mechanism for making payments automatically at predetermined times, as with subscriptions.
- An experience resembling custodial services
- An experience similar to exchanges or specialized services, where an authorized third party or dedicated application executes operations on the user's behalf.
To support these features naturally, accounts need to delegate execution or validation authority to specific plugins in a predictable, standardized manner. This enables more sophisticated combinations of functionality without compromising the user experience.
The IAccount interface in ERC4337 defines only validateUserOp; it does not provide a dedicated API for adding plugins or custom validation logic.
Historically, implementing such extensions could require upgrading the account contract itself or migrating the entire account.
However, the mechanisms surrounding IAccount and the Entry Point already provide the following information and capabilities.
- Unique nonce management through the Entry Point and NonceManager, providing singleton nonce tracking.
- A hook for validating user operations inside
validateUserOp. - Execution logs through UserOperationEvent.
These existing ERC4337 mechanisms can be used to retrofit plugins and other composable validation logic into smart contract accounts without defining an additional interface.
In summary, the ERC4337-based approach has the following goals.
- Build on the existing IAccount, Entry Point, and NonceManager framework.
- Allow accounts to delegate permissions and validation logic to plugins.
- Do so with a minimal design that introduces no new mandatory functions.
The goal is to retain the benefits of account abstraction while making advanced features such as social recovery and recurring payments easier to develop and use.
Specification
The basic idea behind MADV
Under ERC4337, each UserOperation includes a single-use number called a nonce.
ERC7582 introduces a way to use the upper 192 bits of the nonce as a validator identifier rather than treating the nonce as a simple sequential number.
A validator here is a contract responsible for account signature validation or additional logic.
A MADV (Modular Account Delegated Validation) account reads this portion of the nonce and performs the following operations.
- Determine which validator to use.
- Pass the entire UserOperation data (
calldata) to that validator. - Return the
validationDatacomputed by the validator to the EntryPoint.
This creates a plugin architecture in which validation logic can be replaced without embedding complex validation logic in the account itself.
MADV flow

- The user creates a UserOperation and embeds a validator identifier in the upper 192 bits of its
nonce. - The EntryPoint calls
validateUserOpon the MADV account. - The MADV account reads the upper 192 bits of the nonce and derives the validator contract address.
- The account delegates validation to the corresponding validator, passing the entire UserOperation as an argument.
- The validator returns ERC4337-standard
validationData. - The MADV account returns that value to the EntryPoint.
- The EntryPoint uses
validationDatato determine whether execution can proceed.
The flow has the following characteristics.
| Feature | Description |
|---|---|
Reusing the nonce as a plugin identifier |
No additional data field or extension to the signature field is required. |
Using the EntryPoint's existing getNonce |
Preserves the benefits of standard ERC4337 nonce management. |
Including the nonce in UserOperationEvent |
Makes it easier to analyze which plugin was used. |
Why use the nonce as an identifier?
A similar result could be achieved by encoding the plugin identifier in the signature field.
MADV instead uses the nonce for the following reasons.
| Reason | Description |
|---|---|
| Reduced calldata cost | The nonce is mandatory, so no additional field is needed. |
| Reuse of automatic NonceManager tracking | Sequential nonces are managed per key, so execution can be tracked independently for each plugin. |
UserOperationEvent exposes the nonce |
The signature field is not exposed in the event, making it harder to track. |
The lower 64 bits of the nonce continue to serve as a sequential counter, preserving compatibility with ERC4337.
Rules for MADV accounts
Mandatory behavior for MADV accounts (sender contracts)
| Operation | Description |
|---|---|
| Extract the validator identifier | Extract the upper 192 bits of the nonce to identify the validator. |
| Forward data to the validator | Forward the userOp calldata to the validator without modification. |
| Return the validator's result | Return the validator's validationData to the EntryPoint. |
Mandatory behavior for validator contracts
| Operation | Description |
|---|---|
| Follow ERC4337 conventions | In particular, conform to the validationData format. |
Support delegated validateUserOp |
Validate the operation based on the entire userOp received from MADV. |
Relevant ERC4337 code
PackedUserOperation
The data structure containing a UserOperation. The important detail is that the upper 192 bits of the nonce are used as a validator key.
IAccount.validateUserOp
The sole validation hook that the EntryPoint invokes on the account. MADV extracts the validator identifier here and delegates validation to the corresponding validator.
NonceManager.getNonce
Returns the sequential nonce associated with each key (the upper 192 bits of the nonce). This is well suited to MADV's plugin identifiers.
UserOperationEvent
An event that records the result of processing a UserOperation. Exposing the nonce makes plugin behavior easier to analyze.
Interface
PackedUserOperation interface
/**
* User Operation struct
* @param sender - The sender account of this request.
* @param nonce - Unique value the sender uses to verify it is not a replay. In MADV, the validator identifier is encoded in the high 192 bit (`key`) of the nonce value
* @param initCode - If set, the account contract will be created by this constructor/
* @param callData - The method call to execute on this account.
* @param accountGasLimits - Packed gas limits for validateUserOp and gas limit passed to the callData method call.
* @param preVerificationGas - Gas not calculated by the handleOps method, but added to the gas paid.
* Covers batch overhead.
* @param gasFees - packed gas fields maxPriorityFeePerGas and maxFeePerGas - Same as EIP-1559 gas parameters.
* @param paymasterAndData - If set, this field holds the paymaster address, verification gas limit, postOp gas limit and paymaster-specific extra data
* The paymaster will pay for the transaction instead of the sender.
* @param signature - Sender-verified signature over the entire request, the EntryPoint address and the chain ID.
*/
struct PackedUserOperation {
address sender;
uint256 nonce;
bytes initCode;
bytes callData;
bytes32 accountGasLimits;
uint256 preVerificationGas;
bytes32 gasFees;
bytes paymasterAndData;
bytes signature;
}IAccount interface
interface IAccount {
/**
* Validate user's signature and nonce
* the entryPoint will make the call to the recipient only if this validation call returns successfully.
* signature failure should be reported by returning SIG_VALIDATION_FAILED (1).
* This allows making a "simulation call" without a valid signature
* Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.
*
* @dev Must validate caller is the entryPoint.
* Must validate the signature and nonce
* @param userOp - The operation that is about to be executed.
* @param userOpHash - Hash of the user's request data. can be used as the basis for signature.
* @param missingAccountFunds - Missing funds on the account's deposit in the entrypoint.
* This is the minimum amount to transfer to the sender(entryPoint) to be
* able to make the call. The excess is left as a deposit in the entrypoint
* for future calls. Can be withdrawn anytime using "entryPoint.withdrawTo()".
* In case there is a paymaster in the request (or the current deposit is high
* enough), this value will be zero.
* @return validationData - Packaged ValidationData structure. use `_packValidationData` and
* `_unpackValidationData` to encode and decode.
* <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,
* otherwise, an address of an "authorizer" contract.
* <6-byte> validUntil - Last timestamp this operation is valid. 0 for "indefinite"
* <6-byte> validAfter - First timestamp this operation is valid
* If an account doesn't use time-range, it is enough to
* return SIG_VALIDATION_FAILED value (1) for signature failure.
* Note that the validation code cannot use block.timestamp (or block.number) directly.
*/
function validateUserOp(
PackedUserOperation calldata userOp,
bytes32 userOpHash,
uint256 missingAccountFunds
) external returns (uint256 validationData);
}NonceManager interface
/**
* Return the next nonce for this sender.
* Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)
* But UserOp with different keys can come with arbitrary order.
*
* @param sender the account address
* @param key the high 192 bit of the nonce, in MADV the validator identifier is encoded here
* @return nonce a full nonce to pass for next UserOp with this sender.
*/
function getNonce(address sender, uint192 key)
external view returns (uint256 nonce);UserOperationEvent
/***
* An event emitted after each successful request
* @param userOpHash - unique identifier for the request (hash its entire content, except signature).
* @param sender - the account that generates this request.
* @param paymaster - if non-null, the paymaster that pays for this request.
* @param nonce - the nonce value from the request.
* @param success - true if the sender transaction succeeded, false if reverted.
* @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.
* @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).
*/
event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);Structs
PackedUserOperation
struct PackedUserOperation {
address sender;
uint256 nonce;
bytes initCode;
bytes callData;
bytes32 accountGasLimits;
uint256 preVerificationGas;
bytes32 gasFees;
bytes paymasterAndData;
bytes signature;
}A struct containing the data for a UserOperation. It packages the user operation that the ERC4337 EntryPoint processes into a single data structure. It includes all the values needed for the operation: the sender address, nonce, contract creation code, method call data for the account, gas-related settings, paymaster information for payment, and the signature. The nonce field is particularly important because MADV uses its upper 192 bits as the validator identifier.
- Parameters
| Field | Description |
|---|---|
sender |
Address of the account sending the UserOperation. |
nonce |
Number used to prevent replay attacks. In MADV, the upper 192 bits contain the validator identifier. |
initCode |
Code used to create the account if it has not been deployed. |
callData |
Data specifying the method to execute on the account. |
accountGasLimits |
Packed gas limits for validateUserOp and callData execution. |
preVerificationGas |
Additional gas required for processing the overall handleOps call. |
gasFees |
Packed values for maxPriorityFeePerGas and maxFeePerGas. |
paymasterAndData |
Packed Paymaster address and additional data. |
signature |
Signature covering the UserOperation, EntryPoint address, and chain ID. |
Events
UserOperationEvent
event UserOperationEvent(
bytes32 indexed userOpHash,
address indexed sender,
address indexed paymaster,
uint256 nonce,
bool success,
uint256 actualGasCost,
uint256 actualGasUsed
);An event emitted when a UserOperation has been processed. The EntryPoint emits this event after executing the UserOperation. It includes the operation hash, sender, paymaster used, nonce, success status, and actual gas consumption. Because MADV includes the validator identifier in the nonce, external observers can use this event to identify which plugin was used.
- Parameters
| Parameter | Description |
|---|---|
userOpHash |
Identifying hash derived from the UserOperation, excluding its signature. |
sender |
Account that executed the UserOperation. |
paymaster |
Address of the Paymaster that paid the fee. |
nonce |
Nonce included in the UserOperation. In MADV, it contains the validator identifier. |
success |
Whether execution succeeded. |
actualGasCost |
Final gas cost paid. |
actualGasUsed |
Total gas consumed by the UserOperation, including validation and execution. |
Functions
validateUserOp (IAccount)
function validateUserOp(
PackedUserOperation calldata userOp,
bytes32 userOpHash,
uint256 missingAccountFunds
) external returns (uint256 validationData);A function through which the EntryPoint requests signature and nonce validation from the account.
All ERC4337 accounts must implement this function.
Only the EntryPoint may invoke it. It handles tasks such as checking the user operation signature and nonce and transferring missing funds to the EntryPoint if needed.
In MADV, the account extracts the validator identifier, delegates validation to the validator contract, and forwards the resulting validationData to the EntryPoint without modification.
The validation data is a specially formatted value containing information such as signature validity and expiration times.
- Arguments
| Argument | Description |
|---|---|
userOp |
UserOperation to execute. |
userOpHash |
Hash of the UserOperation, used for signature validation. |
missingAccountFunds |
Missing funds that must be paid to the EntryPoint. |
- Return value
| Return value | Description |
|---|---|
validationData |
Validation result containing information such as signature validity and validity periods. |
getNonce (NonceManager)
function getNonce(address sender, uint192 key)
external view returns (uint256 nonce);Returns the next nonce for the specified combination of sender and key.
Provided by the ERC4337 NonceManager, this function tracks nonces per account and per key.
MADV treats the key (the upper 192 bits of the nonce) as the validator identifier, automatically assigning each plugin a separate nonce sequence.
UserOperations using different validators can therefore have independent nonce tracking, improving safety.
- Arguments
| Argument | Description |
|---|---|
sender |
Account address. |
key |
Value representing the upper 192 bits of the nonce. In MADV, this identifies the validator. |
- Return value
| Return value | Description |
|---|---|
nonce |
The next nonce to use. |
Additional considerations
Objectives and design rationale
ERC4337 provides a framework for account abstraction but defines only the minimal validateUserOp interface for accounts.
MADV aims to support flexible extensions without disrupting this minimal design.
In particular, it does not require adding functions to existing interfaces, making it relatively straightforward for both account and validator developers to adopt.
MADV also repurposes the existing nonce field as a validator identifier. Reusing this field eliminates the need for a dedicated field to identify validation plugins and provides the following benefits.
| Aspect | Description |
|---|---|
| Reduced calldata cost | Because the nonce is mandatory, it can carry the identifier without adding extra bytes. |
Reuse of getNonce |
The NonceManager's existing per-key tracking can be used for plugin identification. |
Use of UserOperationEvent |
Because the event exposes the nonce, plugin invocations can be tracked without additional events. |
Compared with embedding the identifier in the signature field, this approach is more transparent and avoids conflicting with other signature schemes.
Flexible validator address derivation
MADV lets an account define how it derives a validator address from the upper 192 bits of the nonce.
This flexibility supports different approaches.
| Derivation method | Description |
|---|---|
| Interpret the identifier directly as an address | Treat the upper nonce bits as the validator address. This is straightforward to implement. |
| Interpret the identifier as a storage reference | Use a mapping, array, or other structure for more organized plugin management. |
The mechanism therefore supports both of the following.
- On-demand plugins loaded only when needed.
- Frequently used plugins whose information is retained in storage.
Minimum requirements for MADV
MADV's mandatory requirements are simple.
| Requirement | Description |
|---|---|
| Encode an identifier in the nonce | Include the validator identifier in the upper 192 bits of the nonce. |
Return validationData |
Return the validation data computed by the selected validator to the EntryPoint. |
In other words, MADV boils down to two points.
- Use the nonce as a plugin identifier.
- Return the validation result produced by the plugin (validator).
The ability to provide a plugin mechanism with this minimal design is a major advantage of MADV.
Security
MADV is a small extension that does not require additional functions or changes to the EntryPoint specification. It intentionally keeps the attack surface small. However, validator selection and authorization logic differ across account implementations, so developers should pay attention to the following considerations.
Properties of MADV itself
MADV adds a hook that encodes an identifier in the nonce and delegates processing to a validator selected using that identifier. The specification itself does not introduce new attack paths. Depending on the validator implementation, however, the following risks can arise.
| Risk area | Description |
|---|---|
| Validator signature verification | Custom schemes may increase the risk of signature forgery. |
| Validator storage management | Incorrect mapping management may cause an unintended plugin to be selected. |
| Delegation of authority to validators | Avoid designs that allow plugins to execute unauthorized logic. |
MADV is a delegation mechanism, and its safety depends heavily on the quality of the validator implementations to which authority is delegated.
Consistency with the ERC4337 validation flow
All validators must follow ERC4337 validation rules. The following points are particularly important.
| Item | Description |
|---|---|
validationData format |
Correctly return the prescribed structure containing authorizer, validUntil, and validAfter. |
Restrictions on directly using block.timestamp and block.number |
Violating the rules may undermine validation assumptions and lead to unintended rejection or approval. |
| Ensuring that only the EntryPoint can properly invoke validation | Validators may also require safeguards such as caller checks. |
Incorrect implementation of these requirements can compromise validator security and affect users' assets.
Reference implementation
https://eips.ethereum.org/assets/eip-7582/MADVAccount.sol
Citation
Shivanshi Tyagi (@nerderlyne), Ross Campbell (@z0r0z), "ERC-7582: Modular Accounts with Delegated Validation [DRAFT]," Ethereum Improvement Proposals, no. 7582, December 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7582.
Conclusion
This article covered ERC7582, a proposal for extending accounts with modular validation logic without changing the existing ERC4337 interface. I hope you found it useful.
If you have questions, feel free to contact me via Twitter.
I also publish articles on other platforms.



