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.
ERC-6865 proposes a way to interpret EIP-712 data onchain and show users how signing it could affect their assets. The goal is to make transactions safer and easier to understand.
This article translates, summarizes, and expands on the following proposal.
I also cover a range of EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.
Overview
Many protocols and decentralized applications (dApps) use EIP-712, a standard for signing structured data, with their own schemas (definitions of field names and types). Because these schemas vary between protocols, the ecosystem lacks a uniform way to present messages, resulting in inconsistent and difficult-to-understand signing prompts.
For more on EIP-712, see the following article.
[EIP-712] Understanding Typed Structured Data Hashing and Signing
ERC-6865 proposes that dApps implement a common read-only contract function called visualizeEIP712Message.
The function has two responsibilities:
- Accept an ABI-encoded EIP-712 message (structured EIP-712 data converted into binary using Ethereum's standard encoding).
- Interpret and parse the message according to the dApp or protocol's own logic, then return standardized structured data focused on how the user's assets could be affected.
Wallets can consume this structured data and present it through a clear user interface. Instead of each wallet displaying EIP-712 messages differently, users can have a consistent experience across dApps and understand what will happen using a common format.
Motivation
The growth of Web3 and risks to users
The rapid growth of Web3 has created new opportunities and services. At the same time, security risks such as phishing have increased.
A particular problem is that users often do not fully understand what they are about to sign. When users understand what a signature means, they can avoid suspicious transactions and substantially reduce their exposure to risk.
The offchain SDK approach and its limitations
An initial approach to this problem was an offchain SDK that wallets could use to interpret and display EIP-712 messages. The SDK was open source and designed to make messages from different protocols easier to understand visually.
However, the offchain approach faced several significant limitations.
| Aspect | Limitation |
|---|---|
| Scalability | Identifying every protocol that uses EIP-712 and understanding its business logic is nearly impossible. As new protocols and updates appear, covering them all with an offchain SDK alone is impractical. |
| Reliability | External developers may not fully understand each protocol's business logic or may misinterpret its implementation. The resulting visualization may differ from actual behavior, which can be more dangerous than showing nothing at all. |
| Maintainability | The Web3 ecosystem changes rapidly. Protocols are frequently upgraded to add features or fix bugs, and the offchain SDK must keep up with each change, increasing maintenance costs. |
An offchain wallet SDK therefore has limitations as a way to visualize every EIP-712 message correctly and continuously.
Onchain standardization as a solution
To address these limitations, ERC-6865 proposes an onchain standard. Specifically, it shifts responsibility for interpreting and visualizing EIP-712 messages from wallets to protocols.
Each protocol implements visualizeEIP712Message, interprets its own EIP-712 messages, and returns structured data in a common format.
This has several advantages.
- Scalability
A new protocol can implement
visualizeEIP712Messageitself, without requiring each wallet or SDK to add separate support. - Reliability Protocol developers know their own business logic best. Returning visualization data directly makes discrepancies between the implementation and the visualization less likely.
- Maintainability
When a protocol is upgraded, it can update
visualizeEIP712Messagewithin its contracts instead of requiring wallets to change their code each time.
Standardizing visualization onchain improves scalability, reliability, and maintainability, making the approach more adaptable to the rapidly changing Web3 ecosystem.
Effects on the wallet ecosystem
Widespread adoption of ERC-6865 could bring the following benefits to wallet developers.
- Less need to track custom implementations for individual protocols.
- Faster support for new protocols and broader coverage.
- A substantially reduced maintenance burden.
These benefits also improve the user experience. Regardless of the wallet or protocol, users can interpret EIP-712 messages in a consistent format and better understand how their assets may move. The expected result is improved security and usability across the ecosystem.
Current wallet displays compared with visualized messages
Many wallets currently display EIP-712 messages in a relatively mechanical format. Types, field names, and values are often shown as-is, making it difficult for users to understand intuitively what will happen.
With ERC-6865, a wallet can consume structured data from visualizeEIP712Message and present meaningful information instead.
| Aspect | Current display | Example display with ERC-6865 |
|---|---|---|
| Information granularity | Raw field names and values | Information organized around effects on user assets, such as which token moves, from whom to whom, and in what amount, or which position is opened |
| Ease of understanding | Difficult for nontechnical users | More intuitive wording for ordinary users |
| Consistency | Display varies from protocol to protocol | Wallets can provide a consistent UI based on the common format, even across different protocols |


The original figures are retained; any Japanese labels in them remain untranslated.
Specification
ERC-6865 defines a way for wallets to retrieve visualization data onchain to help users understand the EIP-712 messages they are being asked to sign.
Handling verifyingContract and chainId
An EIP-712 message has identifying domain information, described in the original article in terms of its domain separator, including the following two fields.
| Field | Description |
|---|---|
| verifyingContract | The address of the contract that verifies the message. |
| chainId | Identifies the network on which the message is valid. |
Under ERC-6865, when a wallet receives a signing request, it can call the contract to obtain visualization data if both of the following conditions are met.
verifyingContractis specified.chainIdis specified.
If these fields are missing, the wallet should skip visualization.
The role of visualizeEIP712Message
visualizeEIP712Message is the central function of ERC-6865.
By implementing it, a protocol allows wallets to obtain visualization information onchain without performing complex offchain interpretation.
The function accepts an ABI-encoded EIP-712 message and returns three kinds of information.
- Assets the user would receive (assetsIn).
- Assets the user would provide (assetsOut).
- The message's validity period (liveness).
By presenting these values in the UI, a wallet can help users understand which assets increase, which decrease, and how long the message remains valid.
Parameters
encodedMessage
An ABI-encoded EIP-712 message.
It can be decoded back into the original structured data using abi.decode.
domainHash
The hash of the domain separator as defined by EIP-712. The wallet uses it to identify the relevant contract context.
Return values
struct Liveness {
uint256 from;
uint256 to;
}
struct UserAssetMovement {
address assetTokenAddress;
uint256 id;
uint256[] amounts;
}
struct Result {
UserAssetMovement[] assetsIn;
UserAssetMovement[] assetsOut;
Liveness liveness;
}The function returns a Result.
Result consists of the following three components.
Liveness
Timestamps indicating when the message is valid.
| Field | Description |
|---|---|
from |
Start of the message's validity period. |
to |
End of the message's validity period. |
from < to must hold.
Signed messages with validity periods are common in DeFi. Displaying this period helps users understand expiration risk.
UserAssetMovement
A structure representing the type and quantity of an asset, including how its amount changes over time.
| Field | Description |
|---|---|
assetTokenAddress |
Token address. The zero address represents the native coin. |
id |
NFT token ID. Ignored for non-NFT assets. |
amounts |
Asset amounts over the validity period. The first value corresponds to from and the last to to. In most cases, there is only one element. |
The interpretation depends on whether the asset is an NFT.
assetsIn
Represents the minimum assets the user should receive. The important distinction is that these are minimum quantities from the user's perspective, rather than the results expected by the protocol.
assetsOut
Represents the maximum assets the user may have to pay.
Wallets can highlight assetsOut to help users avoid signing inadvertently.
Interface
/**
* @notice This function processes an EIP-712 payload message and returns a structured data format emphasizing the potential impact on users' assets.
* @dev The function returns assetsOut (assets the user is offering), assetsIn (assets the user would receive), and liveness (validity duration of the EIP-712 message).
* @param encodedMessage The ABI-encoded EIP-712 message (abi.encode(types, params)).
* @param domainHash The hash of the EIP-712 domain separator as defined in the EIP-712 proposal; see https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator.
* @return Result struct containing the user's assets impact and message liveness.
*/
function visualizeEIP712Message(
bytes memory encodedMessage,
bytes32 domainHash
) external view returns (Result memory);
struct Liveness {
uint256 from;
uint256 to;
}
struct UserAssetMovement {
address assetTokenAddress;
uint256 id;
uint256[] amounts;
}
struct Result {
UserAssetMovement[] assetsIn;
UserAssetMovement[] assetsOut;
Liveness liveness;
}Structs
Liveness
struct Liveness {
uint256 from;
uint256 to;
}Represents the period during which a message is valid.
It holds the start and end timestamps of the signed message's validity period. from must always be less than to.
Parameters
from- Start of validity.
to- End of validity.
UserAssetMovement
struct UserAssetMovement {
address assetTokenAddress;
uint256 id;
uint256[] amounts;
}Represents the quantity of a user's assets over time.
It identifies assets such as ERC-20, ERC-721, and ERC-1155 tokens and specifies quantities at different times.
For NFTs, id is meaningful.
For more on ERC-20, see the following article.
[ERC-20] A Practical Introduction to ERC-20
For more on ERC-721, see the following article.
[ERC-721] A Practical Introduction to ERC-721
For more on ERC-1155, see the following article.
[ERC-1155] A Practical Introduction to ERC-1155
Parameters
assetTokenAddress- The asset's token address.
- The zero address represents the native coin.
id- The NFT's token ID.
amounts- Asset quantities at the corresponding timestamps.
Result
struct Result {
UserAssetMovement[] assetsIn;
UserAssetMovement[] assetsOut;
Liveness liveness;
}Combines incoming and outgoing user assets with the message's validity period. It groups the information a wallet needs to render a UI in one structure: assets received, assets provided, and the validity period.
Parameters
assetsIn- Minimum assets received.
assetsOut- Maximum assets provided.
liveness- Message validity period.
Function
visualizeEIP712Message
function visualizeEIP712Message(
bytes memory encodedMessage,
bytes32 domainHash
) external view returns (Result memory);Parses an EIP-712 message and returns its effects on user assets. Wallets call this function to retrieve onchain information for a visual explanation before signing. The protocol itself implements the function so that the visualization can stay aligned with its business logic.
Arguments
encodedMessage- The ABI-encoded EIP-712 message.
domainHash- The hash of the domain separator.
Return value
Result- Asset movement information and the validity period.
Additional notes
Why onchain visualization matters
EIP-712 visualization may initially seem like something that can be implemented offchain, but practical experience suggests a need for an onchain mechanism. In ERC-6865, the key idea is that developers implement visualization logic directly in their contracts. This approach is motivated by limitations identified during the development of an offchain TypeScript SDK.
The following sections explain why.
Reliability
The developers who implement a protocol are the people most familiar with its behavior. When a third party implements visualization externally, incomplete understanding of the specification can result in a visualization that differs from actual behavior. Such discrepancies can mislead users and create security risks.
Providing visualization onchain through the protocol itself helps keep the implementation and the information presented to users consistent.
Scalability
The number of Web3 protocols is growing rapidly. It is impractical for wallets or third parties to understand every protocol and implement individual EIP-712 message visualization logic for each one.
- New protocols.
- Protocol upgrades.
- Changes in business logic.
External developers cannot easily keep up with all of these changes or maintain comprehensive visualization coverage. With protocols providing their own onchain visualization, wallets only need to implement the common interface, improving both the breadth and speed of support.
Maintainability
Many protocols use upgradeable smart contracts. Even when a third party implements offchain visualization, a protocol upgrade may change behavior and render the external implementation inaccurate.
This discrepancy reduces reliability and increases maintenance costs. With onchain visualization, the protocol can update its own implementation to return current information, substantially improving maintainability.
The role of DomainHash
domainHash is the hash of the EIP-712 message's domain separator.
It plays an important role in ERC-6865 for the following reasons.
Distinguishing between versions
If a protocol supports multiple EIP-712 specifications, domainHash can distinguish which version should be used.
If the domainHash is unsupported, the protocol can stop processing rather than invoke the wrong implementation.
Avoiding confusion between protocols
Using another protocol's domainHash could result in incorrect expected values.
To prevent this, the implementation can revert when the domainHash does not match, making it clear that the message does not correspond to the intended protocol.
Supporting future rerouting of existing protocols
If an external registry is introduced in the future to route requests for existing, non-upgradeable deployed protocols, domainHash could serve as an identifier for the protocol.
Why use an amounts array?
ERC-6865 defines amounts as uint256[] (an array).
The reason is not merely to support multiple values.
The main purpose is to accommodate auctions, which are common in NFT protocols.
In auctions, prices and required asset quantities can vary over time. The following distinctions are therefore important.
| Element | Meaning |
|---|---|
| First value (amounts[0]) | Required quantity at liveness.from |
| Last value (amounts[last]) | Required quantity at liveness.to |
| Possible intermediate values | Accommodate the auction's price curve |
In most cases, amounts has one element, but the array format makes it flexible enough to support protocols such as auctions in which amounts change over time.
Security
ERC-6865 aims to display the contents of EIP-712 messages that users sign accurately and reliably. The following considerations are particularly important for security.
Reliability of visualizeEIP712Message
The information returned by visualizeEIP712Message plays an important role in a user's decision about what to sign.
If the results are incorrect, the user's assets could move in unexpected ways.
Protocols must therefore implement the function to return accurate, up-to-date information.
Reliance on the trustworthiness of verifyingContract
In this scheme, the visualization function operates at the same address as verifyingContract.
In other words, the contract used to verify the signed message is also the contract returning the visualization result.
This has the following implications.
- If
verifyingContractbelongs to a trustworthy protocol, its visualization may also be considered trustworthy. - If
verifyingContractitself belongs to a suspicious protocol, its visualization must not be trusted.
Wallets should not assess the visualization function's reliability in isolation. They must consider the trustworthiness of verifyingContract.
Citation
Abderrahmen Hanafi (@a6-dou), "ERC-6865: On-Chain EIP-712 Visualization [DRAFT]," Ethereum Improvement Proposals, no. 6865, April 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6865.
Conclusion
ERC-6865 proposes interpreting EIP-712 data onchain and presenting its potential effects on user assets in an accessible way, with the goal of making transactions safer and easier to understand.
If you have questions or feedback, feel free to reach out via Twitter DM.
You can also find my writing on the following platforms.



