{"eip":7160,"title":"ERC-721 Multi-Metadata Extension","description":"Multiple metadata URIs per token, with the option to pin a primary URI.","authors":["0xG (@0xGh)","Marco Peyfuss (@mpeyfuss)"],"status":"Final","type":"Standards Track","category":"ERC","created":"2023-06-09","requires":[165,721],"discussionsTo":"https://ethereum-magicians.org/t/erc721-multi-metadata-extension/14629","repo":"ERCs","label":"ERC-7160","officialUrl":"https://eips.ethereum.org/EIPS/eip-7160","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7160.md","url":"https://eips.huatuo.xyz/eip-7160/","tldr":{"en":"An ERC-721 extension that lets one NFT carry several metadata URIs and lets apps (or owners) pin which one is shown by default.","ja":"1 つの NFT に複数のメタデータ URI を持たせ、アプリ（または所有者）がデフォルトで表示するものを固定（pin）できるようにする ERC-721 拡張。","ko":"하나의 NFT가 여러 메타데이터 URI를 가질 수 있게 하고, 앱(또는 소유자)이 기본으로 보여 줄 URI를 고정(pin)할 수 있게 하는 ERC-721 확장.","zh":"一个 ERC-721 扩展，允许单个 NFT 携带多个元数据 URI，并让应用（或所有者）固定（pin）默认显示哪一个。"},"tags":["nft","metadata","erc721","extension"],"explainers":{"en":{"lang":"en","tldr":"An ERC-721 extension that lets one NFT carry several metadata URIs and lets apps (or owners) pin which one is shown by default.","tags":["nft","metadata","erc721","extension"],"related":[721,4906,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7160/","markdown":"## What problem does it solve?\n\nA standard [ERC-721](/eip-721/) token exposes exactly one `tokenURI`. That is fine for a static picture, but many projects want more: a token whose artwork cycles through several pieces, an on-chain history of metadata revisions, versions rendered at different aspect ratios, or a collaborative piece with work from several artists.\n\nProjects could already store extra URIs, but every one did it differently, so marketplaces had no generic way to discover and display them. ERC-7160 standardises how to list all of a token's URIs and how to choose (\"pin\") the one that should be treated as primary.\n\n## How it works\n\nThe `IERC7160` interface (ERC-165 id `0x06e1bc5b`) adds:\n\n| Member | Purpose |\n| --- | --- |\n| `tokenURIs(tokenId)` | Returns `(index, uris[], pinned)`: every URI, which index is currently active, and whether it was explicitly pinned |\n| `pinTokenURI(tokenId, index)` | Make one URI the primary one; emits `TokenUriPinned` |\n| `unpinTokenURI(tokenId)` | Remove the pin; emits `TokenUriUnpinned` |\n| `hasPinnedTokenURI(tokenId)` | Cheap on-chain check for whether a pin exists |\n\nAll of these must revert for a token that does not exist.\n\nBackward compatibility is kept through the normal `tokenURI` function: it must return the pinned URI when one is pinned, and a default URI otherwise. Old wallets and marketplaces keep working; aware ones can show a gallery or carousel of all URIs.\n\nAdding and removing URIs is deliberately **not** part of the standard. Implementers write their own functions for that and are recommended to emit [ERC-4906](/eip-4906/) `MetadataUpdate` events so indexers know to refresh. Who may pin or unpin (owner, creator, admin) is also left to the implementation.\n\n## Sample code\n\nInterface plus a read from TypeScript (ethers v6):\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IERC7160 {\n    event TokenUriPinned(uint256 indexed tokenId, uint256 indexed index);\n    event TokenUriUnpinned(uint256 indexed tokenId);\n\n    function tokenURIs(uint256 tokenId)\n        external view returns (uint256 index, string[] memory uris, bool pinned);\n    function pinTokenURI(uint256 tokenId, uint256 index) external;\n    function unpinTokenURI(uint256 tokenId) external;\n    function hasPinnedTokenURI(uint256 tokenId) external view returns (bool pinned);\n}\n```\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst nft = new Contract(nftAddress, [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function tokenURIs(uint256) view returns (uint256 index, string[] uris, bool pinned)\",\n], provider);\n\nif (await nft.supportsInterface(\"0x06e1bc5b\")) {\n  const { index, uris, pinned } = await nft.tokenURIs(1n);\n  console.log(`showing #${index} of ${uris.length} (pinned: ${pinned})`, uris);\n}\n```\n\n## Things to know\n\n- Status is **Final**.\n- The spec leaves the meaning of \"unpinned\" open: the reference implementation falls back to the last URI in the list, but other contracts may choose differently. Read `index` from `tokenURIs` rather than assuming.\n- Access control for pinning is up to you. The reference implementation lets the token owner pin, and the contract owner add URIs; decide deliberately who should control what collectors see.\n- If you want tokens that own other tokens or that hold several prioritised \"assets\" with richer semantics, compare with the multi-asset approach in [ERC-5773](/eip-5773/).\n"},"ja":{"lang":"ja","tldr":"1 つの NFT に複数のメタデータ URI を持たせ、アプリ（または所有者）がデフォルトで表示するものを固定（pin）できるようにする ERC-721 拡張。","tags":["nft","metadata","erc721","extension"],"related":[721,4906,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7160/","markdown":"## 何を解決するのか\n\n標準的な [ERC-721](/eip-721/) トークンが公開する `tokenURI` はちょうど 1 つです。静止画ならそれで十分ですが、多くのプロジェクトはそれ以上を求めます。作品が複数のピースを循環するトークン、メタデータの改訂履歴をオンチェーンで残すもの、異なるアスペクト比で描画されるバージョン、複数のアーティストの作品を集めた共同作品などです。\n\n追加の URI を保存すること自体は以前からできましたが、プロジェクトごとにやり方が違うため、マーケットプレイスにはそれらを見つけて表示する汎用的な方法がありませんでした。ERC-7160 は、トークンのすべての URI を一覧する方法と、プライマリとして扱う URI を選ぶ（「pin」する）方法を標準化します。\n\n## 仕組み\n\n`IERC7160` インターフェース（ERC-165 の ID は `0x06e1bc5b`）は次を追加します。\n\n| メンバー | 役割 |\n| --- | --- |\n| `tokenURIs(tokenId)` | `(index, uris[], pinned)` を返す。すべての URI、現在有効なインデックス、明示的に pin されているかどうか |\n| `pinTokenURI(tokenId, index)` | 1 つの URI をプライマリにする。`TokenUriPinned` を emit |\n| `unpinTokenURI(tokenId)` | pin を解除する。`TokenUriUnpinned` を emit |\n| `hasPinnedTokenURI(tokenId)` | pin が存在するかをオンチェーンで安価に確認 |\n\nこれらはすべて、存在しないトークンに対しては revert しなければなりません。\n\n後方互換性は通常の `tokenURI` 関数で保たれます。pin されている場合は pin された URI を、そうでなければデフォルトの URI を返さなければなりません。古いウォレットやマーケットプレイスは引き続き動作し、対応しているものはすべての URI のギャラリーやカルーセルを表示できます。\n\nURI の追加と削除は、意図的に標準の**対象外**です。実装者が独自の関数を書き、インデクサーが更新のタイミングを知れるよう、[ERC-4906](/eip-4906/) の `MetadataUpdate` イベントを emit することが推奨されます。誰が pin / unpin できるか（所有者、作成者、管理者）も実装に委ねられています。\n\n## サンプルコード\n\nインターフェースと、TypeScript（ethers v6）からの読み取り:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IERC7160 {\n    event TokenUriPinned(uint256 indexed tokenId, uint256 indexed index);\n    event TokenUriUnpinned(uint256 indexed tokenId);\n\n    function tokenURIs(uint256 tokenId)\n        external view returns (uint256 index, string[] memory uris, bool pinned);\n    function pinTokenURI(uint256 tokenId, uint256 index) external;\n    function unpinTokenURI(uint256 tokenId) external;\n    function hasPinnedTokenURI(uint256 tokenId) external view returns (bool pinned);\n}\n```\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst nft = new Contract(nftAddress, [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function tokenURIs(uint256) view returns (uint256 index, string[] uris, bool pinned)\",\n], provider);\n\nif (await nft.supportsInterface(\"0x06e1bc5b\")) {\n  const { index, uris, pinned } = await nft.tokenURIs(1n);\n  console.log(`showing #${index} of ${uris.length} (pinned: ${pinned})`, uris);\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Final** です。\n- 仕様は「unpin」の意味を明確にしていません。リファレンス実装はリストの最後の URI にフォールバックしますが、他のコントラクトは別の選択をするかもしれません。決め打ちせず、`tokenURIs` から `index` を読み取ってください。\n- pin のアクセス制御は実装次第です。リファレンス実装ではトークン所有者が pin でき、コントラクト所有者が URI を追加できます。コレクターに見えるものを誰が制御すべきかを、意図的に決めてください。\n- 他のトークンを所有するトークンや、より豊かな意味づけで優先順位付きの複数の「アセット」を持つトークンが欲しい場合は、[ERC-5773](/eip-5773/) のマルチアセット方式と比較してください。\n"},"ko":{"lang":"ko","tldr":"하나의 NFT가 여러 메타데이터 URI를 가질 수 있게 하고, 앱(또는 소유자)이 기본으로 보여 줄 URI를 고정(pin)할 수 있게 하는 ERC-721 확장.","tags":["nft","metadata","erc721","extension"],"related":[721,4906,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7160/","markdown":"## 어떤 문제를 해결하나요?\n\n표준 [ERC-721](/eip-721/) 토큰은 `tokenURI`를 정확히 하나만 노출합니다. 정적인 그림이라면 괜찮지만, 많은 프로젝트는 그 이상을 원합니다. 작품이 여러 조각을 돌아가며 보여 주는 토큰, 메타데이터 수정 이력을 온체인에 남기는 것, 서로 다른 화면 비율로 렌더링되는 버전, 여러 아티스트의 작업이 모인 협업 작품 같은 것들입니다.\n\n추가 URI를 저장하는 것은 이전에도 가능했지만 프로젝트마다 방식이 달라서, 마켓플레이스에는 이를 찾아 보여 줄 범용적인 방법이 없었습니다. ERC-7160은 토큰의 모든 URI를 나열하는 방법과, 기본으로 취급할 URI를 고르는(\"pin\") 방법을 표준화합니다.\n\n## 어떻게 동작하나요?\n\n`IERC7160` 인터페이스(ERC-165 ID `0x06e1bc5b`)는 다음을 추가합니다.\n\n| 멤버 | 역할 |\n| --- | --- |\n| `tokenURIs(tokenId)` | `(index, uris[], pinned)`를 반환: 모든 URI, 현재 활성 인덱스, 명시적으로 pin되었는지 여부 |\n| `pinTokenURI(tokenId, index)` | URI 하나를 기본으로 지정. `TokenUriPinned`를 emit |\n| `unpinTokenURI(tokenId)` | pin 해제. `TokenUriUnpinned`를 emit |\n| `hasPinnedTokenURI(tokenId)` | pin이 있는지 저렴하게 온체인에서 확인 |\n\n이 함수들은 존재하지 않는 토큰에 대해서는 모두 revert해야 합니다.\n\n하위 호환성은 일반 `tokenURI` 함수로 유지됩니다. pin된 URI가 있으면 그것을, 없으면 기본 URI를 반환해야 합니다. 오래된 지갑과 마켓플레이스는 계속 동작하고, 이를 인식하는 곳에서는 모든 URI의 갤러리나 캐러셀을 보여 줄 수 있습니다.\n\nURI의 추가와 삭제는 의도적으로 표준에 **포함되지 않습니다**. 구현자가 직접 함수를 작성하며, 인덱서가 새로 고침해야 함을 알 수 있도록 [ERC-4906](/eip-4906/)의 `MetadataUpdate` 이벤트를 emit하길 권장합니다. 누가 pin 또는 unpin할 수 있는지(소유자, 크리에이터, 관리자)도 구현에 맡겨져 있습니다.\n\n## 샘플 코드\n\n인터페이스와 TypeScript(ethers v6)에서의 조회:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IERC7160 {\n    event TokenUriPinned(uint256 indexed tokenId, uint256 indexed index);\n    event TokenUriUnpinned(uint256 indexed tokenId);\n\n    function tokenURIs(uint256 tokenId)\n        external view returns (uint256 index, string[] memory uris, bool pinned);\n    function pinTokenURI(uint256 tokenId, uint256 index) external;\n    function unpinTokenURI(uint256 tokenId) external;\n    function hasPinnedTokenURI(uint256 tokenId) external view returns (bool pinned);\n}\n```\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst nft = new Contract(nftAddress, [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function tokenURIs(uint256) view returns (uint256 index, string[] uris, bool pinned)\",\n], provider);\n\nif (await nft.supportsInterface(\"0x06e1bc5b\")) {\n  const { index, uris, pinned } = await nft.tokenURIs(1n);\n  console.log(`showing #${index} of ${uris.length} (pinned: ${pinned})`, uris);\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Final**입니다.\n- 사양은 \"unpin\" 상태의 의미를 열어 두고 있습니다. 레퍼런스 구현은 목록의 마지막 URI로 폴백하지만 다른 컨트랙트는 다르게 선택할 수 있습니다. 가정하지 말고 `tokenURIs`에서 `index`를 읽으세요.\n- pin의 접근 제어는 여러분이 정합니다. 레퍼런스 구현은 토큰 소유자가 pin하고 컨트랙트 소유자가 URI를 추가하게 합니다. 컬렉터에게 보이는 것을 누가 제어할지 신중하게 정하세요.\n- 다른 토큰을 소유하는 토큰이나, 더 풍부한 의미를 가진 우선순위 있는 여러 \"에셋\"을 보유하는 토큰이 필요하다면 [ERC-5773](/eip-5773/)의 멀티 에셋 방식과 비교해 보세요.\n"},"zh":{"lang":"zh","tldr":"一个 ERC-721 扩展，允许单个 NFT 携带多个元数据 URI，并让应用（或所有者）固定（pin）默认显示哪一个。","tags":["nft","metadata","erc721","extension"],"related":[721,4906,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7160/","markdown":"## 它解决什么问题？\n\n标准的 [ERC-721](/eip-721/) 代币只暴露一个 `tokenURI`。对于静态图片这足够了，但许多项目想要更多：作品在多件作品之间轮换的代币、元数据修订的链上历史、以不同宽高比渲染的版本，或汇集多位艺术家作品的合作作品。\n\n项目本来就可以存储额外的 URI，但每个项目的做法都不同，所以市场没有通用的方式去发现和展示它们。ERC-7160 标准化了如何列出代币的所有 URI，以及如何选择（\"pin\"）应被视为主 URI 的那一个。\n\n## 它如何运作\n\n`IERC7160` 接口（ERC-165 ID 为 `0x06e1bc5b`）新增了：\n\n| 成员 | 用途 |\n| --- | --- |\n| `tokenURIs(tokenId)` | 返回 `(index, uris[], pinned)`：所有 URI、当前生效的索引，以及是否被明确 pin 过 |\n| `pinTokenURI(tokenId, index)` | 将某个 URI 设为主 URI；触发 `TokenUriPinned` |\n| `unpinTokenURI(tokenId)` | 取消 pin；触发 `TokenUriUnpinned` |\n| `hasPinnedTokenURI(tokenId)` | 低成本的链上检查，判断是否存在 pin |\n\n对于不存在的代币，这些函数都必须 revert。\n\n向后兼容通过普通的 `tokenURI` 函数保持：存在 pin 时必须返回被 pin 的 URI，否则返回默认 URI。旧钱包和市场继续正常工作；支持新功能的则可以展示所有 URI 的画廊或轮播。\n\n添加和删除 URI 被有意**排除**在标准之外。实现者自行编写相关函数，并建议触发 [ERC-4906](/eip-4906/) 的 `MetadataUpdate` 事件，让索引器知道需要刷新。谁可以 pin 或 unpin（所有者、创建者、管理员）同样交由实现决定。\n\n## 示例代码\n\n接口，以及用 TypeScript（ethers v6）读取：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.19;\n\ninterface IERC7160 {\n    event TokenUriPinned(uint256 indexed tokenId, uint256 indexed index);\n    event TokenUriUnpinned(uint256 indexed tokenId);\n\n    function tokenURIs(uint256 tokenId)\n        external view returns (uint256 index, string[] memory uris, bool pinned);\n    function pinTokenURI(uint256 tokenId, uint256 index) external;\n    function unpinTokenURI(uint256 tokenId) external;\n    function hasPinnedTokenURI(uint256 tokenId) external view returns (bool pinned);\n}\n```\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst nft = new Contract(nftAddress, [\n  \"function supportsInterface(bytes4) view returns (bool)\",\n  \"function tokenURIs(uint256) view returns (uint256 index, string[] uris, bool pinned)\",\n], provider);\n\nif (await nft.supportsInterface(\"0x06e1bc5b\")) {\n  const { index, uris, pinned } = await nft.tokenURIs(1n);\n  console.log(`showing #${index} of ${uris.length} (pinned: ${pinned})`, uris);\n}\n```\n\n## 需要注意\n\n- 状态为 **Final**。\n- 规范没有明确\"未 pin\"的含义：参考实现回退到列表中的最后一个 URI，但其他合约可能选择不同的做法。请从 `tokenURIs` 读取 `index`，不要想当然。\n- pin 的访问控制由你自己决定。参考实现允许代币所有者 pin，合约所有者添加 URI；请慎重决定由谁来控制收藏者所看到的内容。\n- 如果你想要拥有其他代币的代币，或持有多个带优先级、语义更丰富的\"资产\"的代币，请与 [ERC-5773](/eip-5773/) 的多资产方案做比较。\n"}}}
