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-6384, which proposes allowing wallets to retrieve human-readable explanations of EIP-712 messages from the contract responsible for verifying them.

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

I have also covered other EIPs.

Overview

ERC-6384 proposes a function called evalEIP712Buffer.

It receives EIP-712 message data in a buffer and returns corresponding human-readable descriptions.

See the following article for EIP-712.

[EIP-712] Hashing and Signing Typed Structured Data

EIP-712 defines a standard for signing structured data off-chain and is supported by wallets such as MetaMask. Human readability was one of its original goals, but displaying typed fields does not necessarily communicate the practical consequences of a signature.

Users may therefore approve messages they do not understand and become victims of fraud.

Motivation

EIP-712 allows users to sign messages without paying transaction gas for the signing operation itself. It is used in mechanisms such as ERC-2612 and applications such as OpenSea.

However, insufficient readability can make the meaning of an off-chain signature request difficult to understand, exposing users to malicious authorizations.

See the following article for ERC-2612.

[ERC-2612] Combining ERC-20 Approvals and Transfers

For example, deceptive signing requests may authorize an unwanted NFT sale, including a sale with no payment to the owner. Conventional wallet interfaces may not adequately communicate the consequences.

ERC-6384 adds evalEIP712Buffer to the verifying contract identified by verifyingContract, allowing that contract to explain the meaning of the message.

The intended advantages include:

  • The contract can supply interpretation logic based on its understanding of the message format, reusable both on-chain and off-chain.
  • Developers have an incentive to communicate signature consequences clearly and reduce fraud.
  • Descriptions can originate from the verifying contract rather than requiring an independent interpretation service.
  • As a view function, it can be queried off-chain without sending a gas-paying transaction.
  • The approach preserves Web3 composability.

The mechanism aims to improve security and usability while supporting scalable integrations.

Example of a noncompliant signing interface

Example of a warning in an ERC-6384-compatible interface

The original images are retained, including any original labels.

Specification

EIP-712 already provides an optional verifyingContract domain field to bind off-chain signatures to a smart contract.

ERC-6384 requires a conforming verifying contract to implement a view function that returns human-readable explanations of the message.

Function

Contracts conforming to ERC-6384 must implement the following function.

js
/**
 * @dev Returns the expected result of the offchain message.
 */
function evalEIP712Buffer(
    bytes32 domainHash,
    string memory primaryType,
    bytes memory typedDataBuffer
) external view returns (string[] memory);

It receives three inputs related to an EIP-712 message and returns an array of strings explaining the proposed signature.

Input Parameters

  • domainHash
    • The EIP-712 domainSeparator, derived by hashing the domain structure.
  • primaryType
    • The primary type defined by EIP-712.
    • The name of the main structure used to encode the message.
  • typedDataBuffer
    • ABI-encoded bytes representing the message data.

Output

The function returns a string[] containing descriptions intended to explain the signature to the user.

Wallets must display the descriptions to users. They may supplement them with contextual information, such as a human-readable name for a contract address.

Returned strings must not contain formatting information such as HTML. Wallets must render them safely because the returned data may be malicious.

Wallet Behavior

  • Before signing, a wallet can call evalEIP712Buffer to provide an explanatory experience analogous to transaction simulation, although a description is not itself proof of execution effects.
  • Because the function name and argument signature are fixed, the EIP-712 message structure does not need to change.

Unsupported Cases

  • If the EIP-712 domain does not include verifyingContract, the wallet must not use this mechanism to retrieve the description.
  • In such cases, the wallet falls back to its conventional EIP-712 display.

Additional Notes

ABI Encoding of typedDataBuffer

The proposal represents typedDataBuffer as ABI-encoded bytes to provide a generic way to pass message data to contracts.

Passing a particular typedData structure directly would require different function interfaces for different message types.

ABI encoding provides a common byte representation, allowing the same interface to accommodate different typed-data structures.

Why Return an Array of Strings?

The return type is string[] rather than a single string to support messages involving multiple operations.

For example, a message authorizing several token transfers can provide a separate description for each transfer. The wallet can display those descriptions individually, making complex messages easier to review.

Comparison with Other Approaches

Using Third-Party Services

An alternative is to submit signature data to a third-party service for interpretation.

The proposal identifies several drawbacks.

  • Limited scalability.
    • The service must understand DApp-specific message structures.
  • No inherent guarantee of correctness.
    • External interpretation can be incomplete or incorrect.
  • Security and privacy concerns.
    • Depending on an additional trusted service introduces another trust relationship.

Binding Messages to Web Domains

Another approach is to compare a Web2 domain name represented in the EIP-712 domain information with the origin of the signature request.

This also has limitations.

  • It can restrict composability between different DApps.
  • A compromised legitimate domain can still present malicious signing requests.
  • Some connection methods, including the WalletConnect context discussed in the proposal, may not independently verify the authenticity of the Web2 origin.

Compatibility

Wallets and smart contracts that do not implement this extension can continue operating without it.

  • For unsupported contracts, wallets use their existing EIP-712 presentation mechanism.
  • Unsupported wallets do not call evalEIP712Buffer and retain their existing behavior.

The extension is designed to support incremental adoption.

Security

Threat Model

The primary threat addressed by ERC-6384 is a malicious Web2 interface presenting an EIP-712 message that authorizes an action detrimental to the user.

The message data is controlled by the requesting party and cannot be trusted merely because it is structured.

The proposal assumes that the verifying contract identified by verifyingContract is legitimate and trusted within the intended application. A malicious party may later submit the signed message on-chain.

If the user instead sent the transaction directly, conventional transaction simulation could help explain its expected effects.

ERC-6384 addresses the separation between off-chain authorization and later on-chain execution.

Risks from Malicious Contracts

A malicious contract could implement evalEIP712Buffer to return misleading or specially crafted strings.

Wallets must treat these strings as untrusted input and render them safely, including preventing HTML or script execution.

Security Analysis

Under the intended threat model, the description is produced by the trusted verifying contract rather than supplied directly by the requesting interface.

Because the message identifies its verifying contract, the requesting party cannot freely substitute a different description from that same trusted contract without affecting the relevant message or contract behavior.

Embedding a description directly in the message would instead allow the requesting party to control both the authorization data and its purported explanation.

The contract-based mechanism is designed to avoid that particular problem. However, it does not guarantee that every verifying contract is trustworthy or that its description is accurate.

The view modifier allows the function to be queried without changing on-chain state. Wallets should still validate the contract and present the relevant message data and risks independently when appropriate.

Citation

Tal Be'ery tal@zengo.com, RoiV (@DeVaz1), "ERC-6384: Human-readable offline signatures [DRAFT]," Ethereum Improvement Proposals, no. 6384, January 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6384.

Conclusion

ERC-6384 proposes a standardized way for verifying contracts to provide human-readable descriptions of EIP-712 messages before users sign them.

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

Twitter @cardene777

I also publish articles on the following platforms.

https://chaldene.net/