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-2477 proposes a way to verify that the metadata associated with a token has not been altered relative to its expected cryptographic digest.
This article translates, summarizes, and explains the original proposal.
Other EIP proposals are covered here.
Overview
ERC-2477 enables clients to check the integrity of token metadata when retrieving it. The approach resembles the W3C's Subresource Integrity (SRI) specification for the web.
What is the W3C?
The World Wide Web Consortium (W3C) develops international web standards. Many foundational web technologies, including HTML, CSS, and WebAuthn, are covered by standards developed by the W3C.
These specifications establish common rules that browsers and other web software can follow. Standardization helps websites display and behave consistently across implementations.
What is Subresource Integrity (SRI)?
Subresource Integrity (SRI) allows a browser to verify the integrity of external resources, such as scripts and stylesheets, loaded by a web page.
Suppose a website loads JavaScript from a content delivery network (CDN). If the file on the CDN is modified maliciously, the website could otherwise execute the altered code.
With SRI, the HTML specifies an expected cryptographic digest for the resource. The browser verifies the downloaded content against the expected digest and refuses to load the resource if verification fails.
ERC-2477 defines an interface with two functions, tokenURIIntegrity and tokenURISchemaIntegrity. Clients such as NFT marketplaces and wallets can use these functions to check whether retrieved metadata or its schema matches the expected content.
Motivation
Tokens are used in many applications, often to represent, track, or reference assets outside the blockchain. Examples include items in mobile games and physical goods such as luxury watches tracked through global supply chains.
Token metadata is commonly referenced through URIs, as defined by RFC 3986. Existing metadata standards include:
- The ERC-721 metadata extension (ERC721Metadata).
- The ERC-1155 metadata extension (ERC1155MetadataURI).
- The ERC-1046 metadata extension for ERC-20.
For background on ERC-1046, see:
[ERC-1046] Extending ERC-20 Metadata Using the ERC-721 Model
Metadata can also be embedded entirely onchain using a data URI (RFC 2397) or referenced through content-addressed systems such as IPFS. In the historical context of the proposal, ordinary URLs were common, with projects such as The Sandbox cited as examples of IPFS URI usage.
An ordinary URL does not by itself guarantee that the returned content matches the issuer's intended metadata.
ERC-2477 provides a mechanism for detecting discrepancies by allowing clients to compare retrieved metadata against an expected digest. This establishes integrity relative to that digest, not the truth of the metadata's claims or its permanent immutability if the contract can update the digest.
Design
ERC-2477 discusses several approaches to verifying token metadata and associated schemas.
Approach A (conventional references)
The token simply references a metadata URL. The metadata may reference a schema URI using the $schema key, but this alone does not provide standardized integrity verification.
- Advantage
- Simple to implement.
- Disadvantage
- Neither the metadata nor the schema has an integrity guarantee.
TokenID → Metadata → Schema(改ざん検知なし)Approach B (metadata integrity only)
ERC-2477 allows the expected metadata digest to be stored onchain. Referencing a schema remains optional.
- Advantage
- Modifications to the metadata can be detected.
- Disadvantage
- The schema is not independently integrity-protected.
TokenID → Metadata(整合性あり)→ Schema(任意)
↑
tokenURIIntegrity(メタデータのハッシュ)Approach C (integrity of metadata and schema)
The metadata uses an extended JSON Schema reference with integrity information for the schema itself. The client can verify both documents.
- Advantage
- Both metadata and schema content can be integrity-checked.
- Disadvantage
- Greater implementation complexity.
TokenID → Metadata(整合性あり)→ Schema(整合性あり)
↑ ↑
tokenURIIntegrity tokenURISchemaIntegrityApproach D (ordinary schema reference with onchain schema integrity)
The metadata references the schema conventionally, while the expected schema digest is provided onchain alongside the metadata integrity information.
- Advantage
- Clients can verify the metadata and schema independently.
- Disadvantage
- The schema reference within the metadata does not itself carry a separate integrity declaration.
TokenID → Metadata(整合性あり)→ Schema(整合性あり)
↑ ↑
tokenURIIntegrity tokenURISchemaIntegrityApproach E (schema references with integrity information and onchain verification)
The metadata includes integrity information for its schema, and the expected schema digest is also available onchain.
- Advantage
- Multiple integrity references allow clients to cross-check the expected schema content.
- Disadvantage
- The design requires additional implementation and consistency checks.
TokenID → Metadata(整合性あり)→ Schema(整合性あり)
↑ ↑
tokenURIIntegrity tokenURISchemaIntegrityThese approaches provide different levels of integrity assurance. Applications can choose an appropriate design based on their requirements. The original diagrams are preserved above; approaches C, D, and E use the same simplified illustration in the source, so their distinctions are described in the accompanying text.
Specification
ERC-2477 defines an interface for verifying the integrity of token metadata and associated schemas.
A conforming smart contract implements the ERC2477 interface. Its two functions, tokenURIIntegrity and tokenURISchemaIntegrity, return the expected cryptographic digest of the metadata or schema together with the name of the hash algorithm.
Implementers may choose their hash algorithm, but compliant clients must support at least sha256. Contracts may optionally emit events to notify clients of changes.
Metadata
Metadata may optionally contain $schema and $schemaIntegrity fields. The latter includes information about the expected schema digest and the hash algorithm. The original article provides this illustrative JSON structure.
{
"$schema": "https://example.com/schema.json",
"$schemaIntegrity": {
"digest": "abc123...",
"hashAlgorithm": "sha256"
}
}The placeholder digest is not a complete SHA-256 value. Implementations should follow the proposal's encoding requirements rather than treating this schematic example as a complete test vector.
Clients
Clients supporting ERC-2477 must support at least sha256.
Scope
Although the proposal lists ERC-721 and ERC-1155 as requirements because of their existing metadata specifications, the underlying pattern can be applied to other token standards that expose metadata through a token-ID-based function such as tokenURI(uint id). Such adaptations may require a corresponding interface definition.
Interface
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.7;
/// @title ERC-2477 Token Metadata Integrity
/// @dev See https://eips.ethereum.org/EIPS/eip-2477
/// @dev The ERC-165 identifier for this interface is 0x832a7e0e
interface ERC2477 /* is ERC165 */ {
/// @notice Get the cryptographic hash of the specified tokenID's metadata
/// @param tokenId Identifier for a specific token
/// @return digest Bytes returned from the hash algorithm, or "" if not available
/// @return hashAlgorithm The name of the cryptographic hash algorithm, or "" if not available
function tokenURIIntegrity(uint256 tokenId) external view returns(bytes memory digest, string memory hashAlgorithm);
/// @notice Get the cryptographic hash for the specified tokenID's metadata schema
/// @param tokenId Identifier for a specific token
/// @return digest Bytes returned from the hash algorithm, or "" if not available
/// @return hashAlgorithm The name of the cryptographic hash algorithm, or "" if not available
function tokenURISchemaIntegrity(uint256 tokenId) external view returns(bytes memory digest, string memory hashAlgorithm);
}tokenURIIntegrity
function tokenURIIntegrity(uint256 tokenId) external view returns(bytes memory digest, string memory hashAlgorithm);Returns the expected cryptographic digest of a token's metadata document and the name of the hash algorithm used to generate that digest.
A client can hash the retrieved metadata using the specified algorithm and compare the result to the expected digest.
Parameters
tokenId- The identifier of the token.
Return values
digest- The expected metadata digest.
hashAlgorithm- The hash algorithm name, such as sha256.
tokenURISchemaIntegrity
function tokenURISchemaIntegrity(uint256 tokenId) external view returns(bytes memory digest, string memory hashAlgorithm);Returns the expected cryptographic digest of the schema associated with a token's metadata and the name of the hash algorithm used.
Clients can use these values to verify whether a retrieved schema matches the expected content. Both functions may return empty values when the corresponding integrity information is unavailable.
Parameters
tokenId- The identifier of the token.
Return values
digest- The expected schema digest.
hashAlgorithm- The hash algorithm name, such as sha256.
Rationale
Function and parameter naming
ERC-2477 adopts the term integrity from the W3C's Subresource Integrity specification. This makes the purpose familiar to developers who already use SRI.
Return value format
SRI integrity metadata includes a hash algorithm, digest, and optional information. ERC-2477 returns a tuple of (digest, hashAlgorithm) without the optional component, because the proposal notes that SRI's options were not in use and their future format was uncertain.
The digest is returned first to accommodate callers interested primarily in the digest itself, reflecting the proposal's efficiency considerations.
Return value types
The digest is a dynamically sized byte array, bytes, allowing hash algorithms with different output lengths. Raw bytes are more natural for Ethereum contracts than Base64-encoded strings.
The hashAlgorithm is a string. The proposal uses simple identifiers such as sha256, consistent with SRI terminology, rather than defining a new naming system.
Choice of hash lengths
Clients must support SHA-256. Support for SHA-384 and SHA-512 is optional. The SRI specification supports all three, but SHA-256 was selected as the minimum requirement because it is straightforward and relatively inexpensive to use on Ethereum.
SHA-1 is discouraged because practical collision attacks have undermined its security. The original proposal also considers historical recommendations for higher-security networks, including US National Security Agency guidance favoring hash lengths of at least 384 bits in certain contexts.
The proposal anticipated the use of SHA-256 and asset certification approaches such as 0xcert for metadata protection. This is a historical expectation, not a claim about current adoption.
Why integrity information is not included in URL parameters
An alternative would be to append a value such as ?integrity=XXX to the metadata URL. The proposal rejects this approach for several reasons.
- SRI uses a separate integrity field rather than embedding the digest in the resource URL.
- Storing a digest directly onchain is simpler than parsing URL strings.
- Not all URI schemes support adding query parameters in the same manner.
The same considerations apply to tokenURISchemaIntegrity. JSON-LD can link to schemas or contexts, but the link alone does not establish their integrity. The proposal therefore adds an explicit integrity interface rather than introducing new URI syntax.
Compatibility
ERC-2477 extends existing metadata standards without replacing their metadata interfaces.
- ERC-721 and ERC-1155 already define URI-based metadata mechanisms. ERC-2477 can complement these interfaces with integrity verification.
- ERC-1523 extends ERC-721 for tokenized insurance policies and can likewise use ERC-2477.
- ERC-1046 extends ERC-20 metadata. ERC-2477's interface expects a token ID, so it is not directly applicable to ERC-1046's fungible-token metadata interface. The proposal welcomes a corresponding adaptation without a token ID.
- ERC-918 also discusses metadata in the context of an ERC-20 extension. A similar adaptation would be needed.
Citation
Kristijan Sedlak (@xpepermint), William Entriken github.com@phor.net, Witek Radomski witek@enjin.io, "ERC-2477: Token Metadata Integrity [DRAFT]," Ethereum Improvement Proposals, no. 2477, January 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2477.
Conclusion
ERC-2477 provides a way for clients to verify token metadata and its schema against cryptographic digests exposed by the token contract. It can complement conventional URI-based metadata without requiring the metadata document itself to be stored onchain.
Questions are welcome through Twitter direct messages.
I also publish on the following platforms.



