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 ERC-7766, which introduces an aggregator contract to validate and authorize multiple UserOperations together.

This article translates, summarizes, and supplements the material linked below.

I have also covered other EIPs.

Overview

ERC-4337 enables account abstraction on Ethereum using a UserOperation mempool separate from conventional transaction processing, allowing flexible transaction execution.

See the following article for ERC-4337.

[ERC-4337] Implementing Account Abstraction Without Protocol Changes

However, validating each UserOperation using its own signature or other validation input limits efficiency and gas optimization when many operations are processed together.

To address this limitation, the proposal introduces an aggregator. This contract participates in validation and verifies multiple UserOperations together. Sharing signatures or validation data can reduce bundle gas costs and enable group-level signature validation. This does not, by itself, guarantee atomic success of every individual operation's execution.

Motivation

Signature aggregation can offer the following benefits.

  • Lower gas costs
    • Shared validation work can eliminate redundant computations.
  • Smaller transaction data
    • Individual UserOperations need not carry separate full signatures in the submitted bundle.
  • Compatibility with rollups
    • Rollups post data to Ethereum mainnet, so reducing data size can provide significant cost benefits.

Aggregators make ERC-4337 more flexible and can improve efficiency when processing large numbers of UserOperations.

Specification

Introducing the Aggregator

An aggregator is a contract responsible for signature aggregation and verification. It supports ERC-4337 UserOperation validation and is trusted by the accounts that select it. Bundlers and clients manage the set of aggregators they support.

Interface

An aggregator exposes the following interface.

js
interface IAggregator {
  function validateUserOpSignature(PackedUserOperation calldata userOp) external view returns (bytes memory sigForUserOp);

  function aggregateSignatures(PackedUserOperation[] calldata userOps) external view returns (bytes memory aggregatesSignature);

  function validateSignatures(PackedUserOperation[] calldata userOps, bytes calldata signature) external view;
}
  • validateUserOpSignature
    • Validates a UserOperation's signature and returns alternative signature data.
  • aggregateSignatures
    • Combines signatures from multiple UserOperations into a single signature.
  • validateSignatures
    • Checks that the aggregated signature is valid for all corresponding UserOperations.

Using an Aggregator from an Account

A smart contract account indicates that it uses signature aggregation by returning the aggregator's address from validateUserOp. This information is included in the aggregatorInfo field of the ValidationResult returned during simulateValidation.

Staking Requirements and the Bundler's Role

All aggregators must stake. Bundlers must ensure that an aggregator is not throttled or banned under ERC-7562.

The bundler first calls validateUserOpSignature to validate the signature. It then calls validateUserOp again using the returned alternative signature and checks that the validation result remains consistent.

See the following article for ERC-7562.

[ERC-7562] Transaction Validation Rules for Account Abstraction

Changes to Bundle Processing

In addition to the standard ERC-4337 workflow, the following steps are required.

  • Group UserOperations by aggregator.
  • Call aggregateSignatures for each group to aggregate its signatures.
  • Update the UserOperations for submission with the aggregated signature.

EntryPoint Contract Functionality

The EntryPoint interface includes the following function for aggregated operations.

js
function handleAggregatedOps(
    UserOpsPerAggregator[] calldata opsPerAggregator,
    address payable beneficiary
);

It processes batches of UserOperations involving multiple aggregators.

js
struct UserOpsPerAggregator {
    PackedUserOperation[] userOps;
    IAggregator aggregator;
    bytes signature;
}

Each group contains an aggregator, its corresponding list of UserOperations, and an aggregated signature.

handleAggregatedOps calls validateSignatures on each applicable aggregator before processing operations. Failed aggregate signature validation prevents successful processing of the bundle.

Errors and Signature Aggregator Selection

If an unsupported signature aggregator is specified, the following error may be returned.

text
code: -32506 - transaction rejected because wallet specified unsupported signature aggregator

The data field should include the aggregator address returned by validateUserOp().

Additional Notes

Why Return an Alternative Signature?

When using an aggregator, the account delegates signature verification to the aggregator instead of verifying the original UserOperation signature itself. The aggregator returns an alternative signature through validateUserOpSignature, which is used in place of the original signature.

The account's validateUserOp function can then perform non-signature checks, such as balance checks or timing restrictions, while delegating signature verification to the aggregator.

Compatibility

ERC-7766 extends functionality without requiring changes to the already deployed ERC-4337 EntryPoint contract described in the proposal. ERC-4337 originally anticipated signature aggregation, and the additional specification fits within that design.

Existing accounts and bundlers can therefore adopt the functionality progressively.

Security

An aggregator is a highly trusted contract that participates in authorizing transactions on behalf of smart contract accounts. A malicious aggregator could invalidate many UserOperations together or approve unauthorized operations.

Account developers and builders handling bundles must carefully consider which aggregators they trust or support. Choosing an unsuitable aggregator can have serious security consequences.

Citation

Vitalik Buterin (@vbuterin), Yoav Weiss (@yoavw), Dror Tirosh (@drortirosh), Shahaf Nacson (@shahafn), Alex Forshtat (@forshtat), "ERC-7766: Signature Aggregation for ERC-4337 [DRAFT]," Ethereum Improvement Proposals, no. 7766, September 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7766.

Conclusion

ERC-7766 specifies aggregator contracts that enable the collective validation and authorization of multiple UserOperations.

If you have questions, feel free to contact me on Twitter.

Twitter @cardene777

I also publish articles on the following platforms.

https://chaldene.net/