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-5646 proposes an interface for tracking token state without requiring integrating protocols to understand the token's internal implementation.
This article translates, summarizes, and expands on the following proposal.
Overview
The standard concerns mutable tokens: tokens whose state can change over time. Examples include in-game items and other digital assets.
It provides a common mechanism for identifying a mutable token's state without requiring detailed knowledge of how that state is represented internally.
Developers and users can use this mechanism to track whether the relevant token state has changed. For example, a protocol may need to determine whether the state associated with an asset still matches an earlier observation before executing an operation.
A fingerprint identifies a state for comparison. It does not necessarily reveal the token's owner, its individual properties, or whether a particular business condition is satisfied. Applications that need those details must obtain them separately.
Motivation
Protocols often need information about the state of tokens they interact with. They may construct token-specific identifiers from properties that distinguish one state from another.
Without a common interface, each newly supported token may require an integration that understands its particular properties and state representation.
This creates a maintenance burden. Adding support for more tokens may require changes to protocol code and additional integration logic, making the system harder to scale.
ERC-5646 addresses this problem by allowing a token to expose an identifier for its current state without requiring a consuming protocol to understand each mutable property. The protocol can compare fingerprints instead of maintaining a separate state-identification mechanism for every token implementation.

Source: https://eips.ethereum.org/EIPS/eip-5646
Specification
pragma solidity ^0.8.0;
interface ERC5646 is ERC165 {
/// @notice Function to return current token state fingerprint.
/// @param tokenId Id of a token state in question.
/// @return Current token state fingerprint.
function getStateFingerprint(uint256 tokenId) external view returns (bytes32);
}getStateFingerprintmust return a different value when the token state changes.- It should return the same value when the token state remains unchanged.
- It should account for all mutable state properties that may change during the token's lifetime.
- It may include computed values, such as a condition based on the current block timestamp that represents expiration or maturity.
- It may include the token metadata URI.
- The contract's ERC-165 interface detection method must return
truefor interface identifier0xf5112315.
These requirements describe the intended behavior of the fingerprint. A hash-based implementation is still subject to the usual theoretical possibility of collisions.
Rationale
- Protocols can include the state fingerprint in a token identifier or signed offer, enabling support for mutable tokens without knowing the details of their state implementation.
- Immutable state properties need not be included because they can be identified by the token itself within its contract.
- This standard does not solve integrations that require detailed knowledge of specific state properties. Such integrations may still need token-specific logic.
When an application needs to interpret particular properties of a token, such as the composition or financial value of an underlying position, a fingerprint alone is insufficient. The application still needs a way to retrieve and interpret those properties.
ERC-5646 is intended for use cases in which comparing state identifiers is sufficient, rather than replacing all token-specific interfaces.

State fingerprints
A fingerprint is a compact identifier for a particular token state. That state can include properties such as asset addresses, quantities, fees, operators, or expiration conditions.
An implementation can generate a fingerprint by encoding the relevant properties and hashing them. A consuming protocol can compare the resulting value with a previously recorded fingerprint to detect changes without interpreting each property.
The example implementation below uses getStateFingerprint to retrieve the state associated with a token ID, encode selected properties, and return their hash.
Backward compatibility
The proposal identifies no specific backward compatibility issues. Existing tokens do not automatically support the interface; implementations must expose it explicitly.
Reference implementation
pragma solidity ^0.8.0;
/// @title Example of a mutable token implementing state fingerprint.
contract LPToken is ERC721, ERC5646 {
/// @dev Stored token states (token id => state).
mapping (uint256 => State) internal states;
struct State {
address asset1;
address asset2;
uint256 amount1;
uint256 amount2;
uint256 fee; // Immutable
address operator; // Immutable
uint256 expiration; // Parameter dependent on a block.timestamp
}
/// @dev State fingerprint getter.
/// @param tokenId Id of a token state in question.
/// @return Current token state fingerprint.
function getStateFingerprint(uint256 tokenId) override public view returns (bytes32) {
State storage state = states[tokenId];
return keccak256(
abi.encode(
state.asset1,
state.asset2,
state.amount1,
state.amount2,
// state.fee don't need to be part of the fingerprint computation as it is immutable
// state.operator don't need to be part of the fingerprint computation as it is immutable
block.timestamp >= state.expiration
)
);
}
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return super.supportsInterface(interfaceId) ||
interfaceId == type(ERC5646).interfaceId;
}
}states
Overview
A mapping that stores state information for each token ID.
Details
The mapping associates a token ID with its corresponding State struct.
State
Overview
A struct representing the state of a token.
Details
It contains the following properties.
asset1- The address of the first asset.
asset2- The address of the second asset.
amount1- The quantity of the first asset.
amount2- The quantity of the second asset.
fee- An immutable fee.
operator- An immutable operator address.
expiration- An expiration timestamp used in a time-dependent condition.
getStateFingerprint
Overview
Returns a fingerprint representing the state of a specified token.
Details
The function retrieves the state for the specified token ID and computes a hash of the relevant properties.
The fee and operator are excluded because the example assumes they are immutable. The expiration condition is included as a Boolean expression comparing the current block timestamp with the stored expiration timestamp.
As a result, the fingerprint can change when the expiration threshold is reached, even without an explicit storage update. It can also change when any of the encoded asset addresses or amounts changes.
The example hashes the expiration condition, not the raw expiration timestamp. If that timestamp itself can be modified, the implementation must consider whether its omission would conceal a relevant change.
Parameter
tokenId- The identifier of the token.
Return value
bytes32- The token state fingerprint.
supportsInterface
Overview
Determines whether the contract supports a particular interface.
Details
The function checks the interfaces supported by the parent contract and additionally recognizes the ERC-5646 interface.
Parameter
interfaceId- The identifier of the interface to check.
Return value
bool- Whether the interface is supported.
The code is preserved from the original article as an illustrative excerpt. It has not been compiled or independently audited as part of this translation.
Security considerations
Fingerprints may coincide across different contracts
Two different contracts may produce the same fingerprint for tokens that have identical state properties or use compatible fingerprint calculations.
A fingerprint is not a globally unique token identifier. Applications should compare it in the context of the relevant token contract and token ID, and should include the chain identifier when operating across networks.
Omitting mutable properties from getStateFingerprint
If an implementation omits a relevant mutable property, the underlying token state can change without the fingerprint changing.
For example, a marketplace may record a fingerprint when a seller creates an offer and compare it against the current fingerprint when the offer is accepted. An incomplete fingerprint could allow the asset's relevant properties to change while the offer's state check still passes.
This undermines the assumptions of protocols that rely on the fingerprint to detect changes. Implementations must account for the relevant mutable properties, and consuming protocols must evaluate whether they can trust the token contract's fingerprint behavior.
Citation
Naim Ashhab (@ashhanai), "ERC-5646: Token State Fingerprint," Ethereum Improvement Proposals, no. 5646, September 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5646.
Conclusion
ERC-5646 proposes a common interface for identifying and comparing the state of mutable tokens without requiring integrating protocols to understand their internal implementation.
Questions are welcome via Twitter @cardene777.

