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-4906, which proposes events for notifying applications when ERC-721 NFT metadata changes.
This explanation is based on the following specification.
Overview
ERC-4906 extends ERC-721 by introducing the MetadataUpdate event.
For an introduction to ERC-721, see the following article.
Motivation
Many ERC-721 contracts emit events when token metadata changes, but different collections may emit different events for the same purpose.
Third-party platforms, including NFT marketplaces, consequently need collection-specific integrations to track updates. Maintaining those integrations takes time and effort.
The standardized MetadataUpdate event allows platforms to track metadata changes consistently across collections. Instead of building custom solutions for individual collections, platforms can support a common event and refresh NFT metadata efficiently and promptly.
Specification
The metadata update extension is optional for ERC-721 contracts.
/// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC165, IERC721 {
/// @dev This event emits when the metadata of a token is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFT.
event MetadataUpdate(uint256 _tokenId);
/// @dev This event emits when the metadata of a range of tokens is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFTs.
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}When a token's JSON metadata changes, the contract must emit either MetadataUpdate or BatchMetadataUpdate.
The specification recommends not emitting the event when tokens are minted or burned, or when tokenURI changes without changing the JSON metadata itself.
Furthermore, supportsInterface must return true when called with interface ID 0x49064906.
These requirements establish when metadata changes should be signaled and how applications can detect support for the interface.
Additional Considerations
NFT metadata varies across tokens and can contain multiple fields. Although arbitrary bytes could represent changed values, interpreting such data consistently across third-party platforms would be difficult.
The standardized events therefore identify the affected tokens without carrying arbitrary metadata values.
After receiving MetadataUpdate, a third party can refresh metadata using information returned by ERC-721's tokenURI(uint256 _tokenId). When multiple token IDs are specified, the platform can query each token's URI individually.
This provides a common way to process metadata changes and retrieve updated information.
Backward Compatibility
The original article identifies no particular compatibility issues.
Reference Implementation
Example implementation code is available here.
Specification: https://eips.ethereum.org/EIPS/eip-4906
Security Considerations
When metadata changes off-chain, a contract may expose a method for triggering MetadataUpdate. The access control of that method must be checked for vulnerabilities.
Manage who can invoke the method to prevent unauthorized operations.
Citation
Anders (@0xanders), Lance (@LanceSnow), Shrug shrug@emojidao.org, Nathan nathan.gang@gemini.com, "ERC-4906: EIP-721 Metadata Update Extension," Ethereum Improvement Proposals, no. 4906, March 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4906.
Conclusion
ERC-4906 standardizes events that notify applications of changes to ERC-721 NFT metadata.

