Brain Account

The BrainAccount contract is the on-chain root of authority for every user. It extends the ERC-4337 standard with policy-aware validation and agent permissions, while remaining fully compatible with standard EntryPoint and bundler infrastructure.

Contract Interface

interface IBrainAccount {
    /// @notice Called by the ERC-4337 EntryPoint during UserOperation validation.
    /// Verifies signature, agent authorization, policy proofs, spend limits,
    /// allowlists, expiry, and replay protection.
    function validateUserOp(bytes calldata userOp) external returns (bool);

    /// @notice Execute a call after successful validation.
    function execute(
        address target,
        uint256 value,
        bytes calldata data
    ) external;

    /// @notice Grant or update agent permissions.
    function authorizeAgent(address agent, bytes32 permissions) external;

    /// @notice Store a hash of the active policy definition on-chain.
    function setPolicy(bytes32 policyHash) external;
}

Responsibilities

  • Enforce global policy for the user and all associated agents

  • Validate all UserOperations via the ERC-4337 validateUserOp hook

  • Authorize agents and manage their permissions and budgets

  • Execute approved calls against external contracts

Validation Checks in validateUserOp

  1. User signature or agent authorization credential

  2. Agent permission scope (is this agent allowed to make this call?)

  3. Policy proof — a signed approval from the Brain policy engine

  4. Spend limits — has the agent exceeded its daily/weekly budget?

  5. Contract allowlist — is the target contract permitted?

  6. Token allowlist — is the asset permitted?

  7. Time window — is the current time within the agent's active hours?

  8. Expiry and replay protection — is the nonce fresh and unused?

Deployment

BrainAccount is deployed per user via a factory contract. The user's EOA becomes the owner. ERC-7902 capability discovery interfaces are exposed so wallets and infrastructure providers can inspect supported methods, account abstraction features, and policy hooks.

circle-info

BrainAccount is compatible with any standard ERC-4337 EntryPoint and ERC-7769-compatible bundler. No custom modifications to existing infrastructure are required.

Interoperability Standards

Standard
Role

ERC-4337

Core account abstraction and UserOperation model

ERC-7902

Wallet capability discovery

ERC-7769

Bundler infrastructure compatibility

Last updated