---
eip: 6900
label: ERC-6900
title: Modular Smart Contract Accounts
status: Draft
type: Standards Track
category: ERC
created: 2023-04-18
requires: 165, 1271, 4337
official: https://eips.ethereum.org/EIPS/eip-6900
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6900.md
canonical: https://eips.huatuo.xyz/eip-6900/
lang: en
tldr: "A draft standard for modular smart accounts: validation logic, execution functions and hooks live in installable modules, so one module can work on any compliant ERC-4337 account."
tags: [account-abstraction, smart-account, modules, erc4337, wallet]
---

# ERC-6900: Modular Smart Contract Accounts

> Interfaces for smart contract accounts and modules, optionally supporting upgradability and introspection

**TL;DR:** A draft standard for modular smart accounts: validation logic, execution functions and hooks live in installable modules, so one module can work on any compliant ERC-4337 account.

## What problem does it solve?

[ERC-4337](/eip-4337/) lets smart contract accounts define their own validation and execution logic. Features like session keys, spending limits, subscriptions or role-based access are then built either into a specific account implementation or as proprietary plugins for one wallet platform. Users get locked into the account that has the features they want, and module developers have to pick which platforms to support.

ERC-6900 defines how an account and its modules talk to each other, so any compliant module can be installed on any compliant account, with clear rules about what each module is allowed to do.

## How it works

A modular account splits its logic into three kinds of **modular functions**, all hosted in external module contracts:

- **Validation functions** decide whether an action is authorised. There are three flows: user operation validation (`validateUserOp` via the EntryPoint), runtime validation (direct calls through `executeWithRuntimeValidation`), and signature validation ([ERC-1271](/eip-1271/) `isValidSignature`).
- **Execution functions** add new callable functions (selectors) to the account.
- **Hooks**: *validation hooks* run before a validation function (e.g. to enforce limits), and *execution hooks* run before and/or after an execution (a pre-hook can pass data to its post-hook).

The account must implement ERC-4337's `IAccount` and `IAccountExecute`, ERC-1271, and `IERC6900Account`:

- `execute`, `executeBatch`, `executeWithRuntimeValidation`
- `installExecution` / `uninstallExecution`, which take the module's **execution manifest** (its selectors, hooks and interface IDs)
- `installValidation` / `uninstallValidation`, which take a `ValidationConfig` with flags `isGlobal`, `isSignatureValidation` and `isUserOpValidation`, plus the selectors it may validate and its hooks
- `accountId()`

Modules implement `IERC6900Module` (`onInstall`, `onUninstall`, `moduleId()` returning `"vendor.module.semver"`) and any of the validation, validation-hook, execution or execution-hook module interfaces.

Key rule: a validation function may only authorise selectors it was installed for, unless it is marked global. Calls from `execute` back into the account itself get extra checks, so a narrow module cannot escalate its own permissions.

## Sample code

Shape of a minimal module (based on the spec's interfaces):

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

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface IERC6900Module is IERC165 {
    function onInstall(bytes calldata data) external;
    function onUninstall(bytes calldata data) external;
    function moduleId() external view returns (string memory);
}

contract DailyLimitModule is IERC6900Module {
    mapping(address account => uint256) public limit;

    function onInstall(bytes calldata data) external {
        limit[msg.sender] = abi.decode(data, (uint256)); // msg.sender is the account
    }

    function onUninstall(bytes calldata) external {
        delete limit[msg.sender]; // clean up, or stale state may be reused on reinstall
    }

    function moduleId() external pure returns (string memory) {
        return "example.daily-limit.1.0.0";
    }

    function supportsInterface(bytes4 id) external pure returns (bool) {
        return id == type(IERC6900Module).interfaceId || id == type(IERC165).interfaceId;
    }
    // A real module would also implement a validation-hook or execution-hook interface.
}
```

## Things to know

- Status: **Draft**. The interfaces have gone through major revisions; check the spec version your account and modules target.
- Modules are trusted code. A malicious module can add reverting hooks that brick the account or execution functions that drain it. Install only audited modules.
- Be careful with global validation: a globally enabled validation function can authorise any native function exposed to it, which is effectively root access.
- The spec allows `onUninstall` failures to be ignored, so modules can leave stale state behind. Clean up fully, especially before reinstalling with the same entity ID.
- [ERC-7579](/eip-7579/) (Draft) is an alternative, more minimal modular account standard. The two are not interchangeable.


---

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