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.

Background

ERC-7741 proposes using EIP-712 signatures to let someone else submit a transaction and pay its gas on the user's behalf.

This article translates, summarizes, and expands on the proposal below.

I also cover other Ethereum proposals.

Overview

ERC-7741 proposes a set of functions that use EIP-712 signatures to manage operators through meta-transactions and enable atomic interactions with contracts. EIP-712 gives signed data a defined structure and explicit types, making signatures easier to understand and use safely.

Users can grant or change operator permissions without submitting a transaction directly. Another address submits the transaction, pays its gas, and carries out the requested operation.

For background on EIP-712, see the following article.

[EIP-712] Hashing and signing structured typed data

Motivation

ERC-7741 aims to make operator management more flexible, secure, and efficient. An EIP-712 signature lets users authorize and manage operators without paying the transaction fee themselves, simplifying the experience for end users.

The proposal addresses four practical needs.

Meta-transactions

In a meta-transaction, a third party such as a relayer or operator submits a transaction on behalf of the user. With EIP-712, a user can authorize an operator by signing off-chain, and the operator can submit the actual transaction. The user can therefore trigger an on-chain action without holding a native token such as ETH or MATIC. This is especially useful when operators change frequently, as it reduces the user's direct transaction costs and simplifies approval.

Security

An EIP-712 signature describes the fields a user is signing. Simpler signing flows, such as those that use EIP-191 to sign a raw hash, can leave the purpose of the message unclear and increase the risk of phishing. With EIP-712, the data has explicit types and a defined structure, so users can better understand the request and avoid accidental approvals.

For background on EIP-191, see the following article.

[ERC-191] How signed data is used safely

Interoperability

A shared interface gives developers a consistent way to manage operators across contracts and protocols. This is especially useful for vault protocols that delegate asset management to operators. Wallets and other platforms can integrate with multiple vaults through the same interface.

A vault is a smart contract that manages assets on-chain. Vaults are common in decentralized finance (DeFi), where users deposit tokens for activities such as staking, yield optimization, and automated asset management.

Simpler cross-chain operations

Managing operators consistently across several blockchains can be difficult. A standard off-chain signing workflow makes it easier to configure operators and transfer permissions using a consistent process on each chain. This reduces operational work for projects that manage assets across chains.

Specification

ERC-7741 defines an EIP-712 authorization scheme for operators. It works with operator interfaces such as those in EIP-6909 and EIP-7540, giving contracts a consistent way to set up operators and manage their permissions.

For background on EIP-6909, see the following article.

[ERC-6909] A simpler multi-token interface based on ERC-1155

For background on EIP-7540, see the following article.

[ERC-7540] Separating ERC-4626 deposit and redemption requests from execution

Operator-compatible contracts

The authorization scheme applies to contracts that implement the IOperator interface. That interface provides the following event and functions.

OperatorSet

The contract emits this event when an owner grants or revokes approval for a particular operator. Off-chain applications can use it to track changes.

setOperator

This externally callable function configures or removes an operator's permissions by setting approved for the specified operator.

isOperator

This function checks whether a particular operator currently has approval for a specified owner. It returns true when the operator is approved and false otherwise.

EIP-6909 uses names such as spender in place of operator. These naming differences do not change the underlying behavior, so the interfaces can remain compatible.

Functions

authorizeOperator

An owner uses an EIP-712 signature to grant or revoke an operator's permissions. The owner can sign off-chain, and another party can submit the meta-transaction.

The function has the following requirements.

  • Revert after the deadline. An expired signature cannot authorize a transaction, limiting the use of old signatures.
  • Invalidate the signature's nonce. A nonce is a unique value that may be used once. Consuming it prevents replay, where someone reuses an earlier signature to execute another transaction.
  • Validate the EIP-712 signature and revert if it is invalid. The function rejects incorrect or invalid signatures.
  • Set the operator's status to approved. A value of true grants approval and false revokes it.
  • Emit OperatorSet. The event records the change on-chain so external applications can follow it.

The function returns true on success.


invalidateNonce

This function lets the owner (the caller, msg.sender) invalidate a specified nonce.

An unused EIP-712 signature could fall into someone else's hands and be submitted later. An owner can explicitly invalidate a nonce that is no longer needed. Once the transaction succeeds, the specified nonce cannot be used again.


authorizations

This function checks whether a particular controller and nonce combination has already been used.

  • controller
    The account whose authorization is being checked.
  • nonce
    A unique value. The function returns true if the nonce is used and false otherwise.

This lets the owner check whether a nonce is still available and manage the risk of signature reuse.

Specification note: The Japanese article describes the controller as the entity that verifies the signature. The draft checks nonce usage for the controller address, and its example passes that address as the signer to signature verification.


DOMAIN_SEPARATOR

This function returns the domain separator defined by EIP-712. The separator identifies the signing domain so a signature intended for one contract and chain cannot simply be replayed on another.

The domain can include fields such as:

  • The verifying contract address.
  • The chain ID, which identifies a network such as Ethereum or Polygon.
  • Fields selected for the signing domain.

Specification note: The Japanese article lists the message schema alongside the chain ID and contract address. EIP-712 hashes the message type separately from the domain separator, as shown in the reference example below.


ERC-165 support

Contracts implementing ERC-7741 must implement ERC-165's supportsInterface function. ERC-165 allows applications and other contracts to discover the interfaces a contract implements.

supportsInterface must return true for 0xa9e50872, which identifies support for this interface.

For background on ERC-165, see the following article.

[ERC-165] Checking whether a contract supports a specific interface

Additional notes

Similarities to ERC-2612

ERC-7741 is deliberately similar to ERC-2612 (Permit), so projects that already support ERC-2612 can adopt it more easily.

ERC-2612 lets a user sign an ERC-20 allowance off-chain using EIP-712. Without Permit, allowing another party, such as a DeFi protocol, to transfer tokens on the user's behalf usually requires the user to submit an approve transaction. With Permit, the user signs off-chain and hands the signature to another party to submit, saving the user a separate approval transaction and its direct gas cost.

ERC-7741 follows the same general design for authorizing operators through EIP-712 signatures.

For background on ERC-2612, see the following article.

[ERC-2612] Combining ERC-20 approval and transferFrom in one transaction

Key differences from ERC-2612

ERC-7741 uses bytes32 nonces. ERC-2612 uses a uint256 nonce that increments automatically in order, from 0 to 1 to 2 to 3 and so on. That makes the scheme straightforward but introduces two limitations.

  • Unused nonces cannot be skipped. An ERC-2612 authorization must use the account's current nonce. If it is 5, a signature using 7 is rejected.
  • Concurrent signatures require coordination. A user preparing several transactions at once must track which nonce will be available when each signature is submitted.

ERC-7741's bytes32 nonces can be used in any order.

  • Nonces need not increase. Different operator authorizations can use independently chosen values, such as 0xabc123 and 0xdef456 as abbreviated illustrations.
  • Parallel handling is simpler. Users can prepare separate authorizations for different operators without coordinating a single sequence. This makes the approach easier to integrate with clients that process requests across multiple threads or distributed systems.

Reference implementation

js
// This code snippet is incomplete pseudocode used for example only and is no way intended to be used in production or guaranteed to be secure

bytes32 public constant AUTHORIZE_OPERATOR_TYPEHASH =
    keccak256("AuthorizeOperator(address controller,address operator,bool approved,bytes32 nonce,uint256 deadline)");

mapping(address owner => mapping(bytes32 nonce => bool used)) authorizations;

function DOMAIN_SEPARATOR() public view returns (bytes32) {
  // EIP-712 implementation 
}

function isValidSignature(address signer, bytes32 digest, bytes memory signature) internal view returns (bool valid) {
  // ERC-1271 implementation 
}

function authorizeOperator(
    address controller,
    address operator,
    bool approved,
    bytes32 nonce,
    uint256 deadline,
    bytes memory signature
) external returns (bool success) {
    require(block.timestamp <= deadline, "ERC7540Vault/expired");
    require(controller != address(0), "ERC7540Vault/invalid-controller");
    require(!authorizations[controller][nonce], "ERC7540Vault/authorization-used");

    authorizations[controller][nonce] = true;

    bytes32 digest = keccak256(
        abi.encodePacked(
            "\x19\x01",
            DOMAIN_SEPARATOR(),
            keccak256(abi.encode(AUTHORIZE_OPERATOR_TYPEHASH, controller, operator, approved, nonce, deadline))
        )
    );

    require(SignatureLib.isValidSignature(controller, digest, signature), "ERC7540Vault/invalid-authorization");

    isOperator[controller][operator] = approved;
    emit OperatorSet(controller, operator, approved);

    success = true;
}

function invalidateNonce(bytes32 nonce) external {
    authorizations[msg.sender][nonce] = true;
}

Security considerations

Operator management and signature risks

Operators have significant authority because they can manage a user's assets or resources. EIP-712 authorizations should be handled carefully once signed, as a leaked message could be submitted by an unintended party.

Poor operator management can let assets move in ways the user did not expect, potentially leaving them outside the user's control.


Why signatures should expire quickly

A signature is created off-chain, and the signed data cannot be edited once the signature is issued. An unused authorization that leaks can be exploited while it is valid. For instance, a leaked operator approval could enable an action the user did not intend. Using the shortest practical expiration limits that window.

Long deadlines create several risks.

  • A leaked signature remains usable for longer. An attacker who obtains it has until the deadline to submit it unless the nonce is invalidated first.
  • An operator can act later than the user expected. If an approved operator delays execution, the authorization may be used under circumstances the user did not anticipate.
  • Cancellation options are limited. The user cannot edit or erase an issued signature on-chain. ERC-7741 does let the owner prevent its use by invalidating the associated nonce. A short deadline also reduces the chance of an unused signature remaining valid longer than intended.

Benefits of short deadlines

Shorter deadlines give leaked signatures less time to be used, narrow the window the user intends to authorize, and let unused authorizations expire automatically if the owner does not invalidate them. This is particularly useful when operating across chains or changing operators frequently.

Citation

Jeroen Offerijns (@hieronx), João Martins (@0xTimepunk), "ERC-7741: Authorize Operator [DRAFT]," Ethereum Improvement Proposals, no. 7741, June 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7741.

Conclusion

ERC-7741 uses EIP-712 signatures to let users authorize operators off-chain and have another party submit the transaction and pay its gas.

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

Twitter @cardene777

Find more of my writing and resources here.

https://chaldene.net/