{"eip":5185,"title":"NFT Updatable Metadata Extension","description":"An interface extension for ERC-721/ERC-1155 controlled metadata updates","authors":["Christophe Le Bars (@clbrge)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2022-06-27","requires":[721,1155],"discussionsTo":"https://ethereum-magicians.org/t/erc-721-erc-1155-updatable-metadata-extension/9077","repo":"ERCs","label":"ERC-5185","officialUrl":"https://eips.ethereum.org/EIPS/eip-5185","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5185.md","url":"https://eips.huatuo.xyz/eip-5185/","tldr":{"en":"Lets NFT metadata evolve only through recipes declared up front in the original metadata, with each batch of updates announced by an on-chain event, so anyone can deterministically recompute and verify a token's current metadata.","ja":"NFT メタデータを、元のメタデータにあらかじめ宣言されたレシピを通じてのみ進化させ、更新のバッチごとにオンチェーンイベントで通知する。誰でもトークンの現在のメタデータを決定論的に再計算して検証できる。","ko":"NFT 메타데이터가 원본 메타데이터에 미리 선언된 레시피를 통해서만 진화하게 하고, 업데이트 묶음마다 온체인 이벤트로 알린다. 누구나 토큰의 현재 메타데이터를 결정적으로 다시 계산해 검증할 수 있다.","zh":"让 NFT 元数据只能通过原始元数据中预先声明的配方（recipe）演进，每批更新由链上事件公布，使任何人都能确定性地重新计算并验证代币的当前元数据。"},"tags":["nft","metadata","gaming","json"],"explainers":{"en":{"lang":"en","tldr":"Lets NFT metadata evolve only through recipes declared up front in the original metadata, with each batch of updates announced by an on-chain event, so anyone can deterministically recompute and verify a token's current metadata.","tags":["nft","metadata","gaming","json"],"related":[721,1155,4906],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5185/","markdown":"## What problem does it solve?\n\nNFT metadata usually sits at a `tokenURI`. If that URI points to an immutable file (e.g. IPFS), nothing can ever change. If it points to a server, the issuer can change anything at any time. Many use cases sit in between: a game character whose level rises but whose looks are fixed, or a property title where the owner history may only be appended.\n\nERC-5185 adds a middle ground: the original metadata declares which transformations are allowed, and updates are applied as a verifiable, ordered log.\n\n## How it works\n\n1. The **original metadata** (from `tokenURI` in [ERC-721](/eip-721/) or `uri` in [ERC-1155](/eip-1155/)) gains an `updatable` object with:\n   - `engine`: the transformation language and version. The only one defined is `jsonata@1.8.*`.\n   - `recipes`: named formulas (`eval` strings) that transform the previous JSON.\n   - optional `schema`: a JSON Schema every updated version must satisfy.\n2. The contract emits `MetadataUpdates(string URI)`. The URI points to a JSON file listing updates, each with a `tokenId`, a `recipeKey` and optional `args`. One event can batch thousands of updates for many tokens.\n3. To get current metadata, a client starts from the original and applies every update for that token, in event order: `next = jsonata(eval).evaluate(prev, args)`.\n   - Unknown recipe key, evaluation error, or schema violation: the update is ignored and `prev` is kept.\n\nBecause the process is deterministic, marketplaces can cache intermediate results and only apply new events. Gas cost is just one event per batch.\n\n## Sample code\n\nContract side:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC5185UpdatableMetadata {\n    event MetadataUpdates(string URI);\n}\n\ncontract Monsters is IERC5185UpdatableMetadata /*, ERC721 */ {\n    address public gameMaster;\n    function publishUpdates(string calldata uri) external {\n        require(msg.sender == gameMaster, \"only GM\");\n        emit MetadataUpdates(uri); // e.g. \"ipfs://\u003ccid\u003e/updates-0042.json\"\n    }\n}\n```\n\nOriginal metadata with recipes, and an updates file (field names follow the spec's schema):\n\n```json\n{\n  \"name\": \"Monster 1\",\n  \"attributes\": [{ \"trait_type\": \"Level\", \"value\": 0 }],\n  \"updatable\": {\n    \"engine\": \"jsonata@1.8.*\",\n    \"recipes\": {\n      \"levelUp\": { \"eval\": \"$ ~\u003e | attributes[trait_type='Level'] | {'value': value + 1} |\" }\n    }\n  }\n}\n```\n\n```json\n{ \"updates\": [ { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" }, { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" } ] }\n```\n\nClient-side replay (TypeScript, using the `jsonata` package):\n\n```ts\nimport jsonata from \"jsonata\";\n\nasync function current(original: any, updates: { tokenId: string; recipeKey: string; args?: any }[], id: string) {\n  let meta = original;\n  for (const u of updates.filter((u) =\u003e u.tokenId === id)) {\n    const recipe = original.updatable?.recipes?.[u.recipeKey];\n    if (!recipe) continue;\n    try { meta = await jsonata(recipe.eval).evaluate(meta, u.args); } catch { /* keep prev */ }\n  }\n  return meta;\n}\n```\n\n## Things to know\n\n- Status is **Stagnant**: the proposal is not progressing, and marketplace support should not be assumed.\n- The spec is internally inconsistent: its schema calls the field `recipeKey` (with `args` as a string), while its example uses `action` and passes `args` as an object. Pick one and document it.\n- Recipes run arbitrary JSONata on third-party infrastructure; the spec warns this can be a DoS vector, so evaluators should sandbox and limit processing.\n- If a contract later changes `tokenURI`, the \"original\" changes too, and earlier updates may no longer apply cleanly.\n- For simply signaling \"metadata changed, refresh\", the widely supported option is [ERC-4906](/eip-4906/).\n"},"ja":{"lang":"ja","tldr":"NFT メタデータを、元のメタデータにあらかじめ宣言されたレシピを通じてのみ進化させ、更新のバッチごとにオンチェーンイベントで通知する。誰でもトークンの現在のメタデータを決定論的に再計算して検証できる。","tags":["nft","metadata","gaming","json"],"related":[721,1155,4906],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5185/","markdown":"## 何を解決するのか\n\nNFT のメタデータは通常 `tokenURI` に置かれます。その URI が不変のファイル（たとえば IPFS）を指していれば、何も変えられません。サーバーを指していれば、発行者がいつでも何でも変更できます。多くのユースケースはその中間にあります。レベルは上がるが見た目は固定のゲームキャラクターや、所有者の履歴の追記のみが許される不動産の権利証書などです。\n\nERC-5185 は中間の選択肢を加えます。元のメタデータがどの変換を許可するかを宣言し、更新は検証可能な順序付きログとして適用されます。\n\n## 仕組み\n\n1. **元のメタデータ**（[ERC-721](/eip-721/) の `tokenURI`、または [ERC-1155](/eip-1155/) の `uri` から得られるもの）に `updatable` オブジェクトを追加します。内容は次のとおりです。\n   - `engine`: 変換言語とそのバージョン。定義されているのは `jsonata@1.8.*` だけです。\n   - `recipes`: 直前の JSON を変換する、名前付きの式（`eval` 文字列）。\n   - 任意の `schema`: 更新後のすべてのバージョンが満たすべき JSON Schema。\n2. コントラクトは `MetadataUpdates(string URI)` を発行します。URI は更新の一覧を含む JSON ファイルを指し、各更新には `tokenId`、`recipeKey`、任意の `args` が含まれます。1 つのイベントで、多数のトークンに対する数千件の更新をまとめられます。\n3. 現在のメタデータを得るには、クライアントは元のメタデータから始めて、そのトークンに対するすべての更新をイベントの順に適用します。`next = jsonata(eval).evaluate(prev, args)`。\n   - 未知のレシピキー、評価エラー、スキーマ違反の場合、その更新は無視され、`prev` が維持されます。\n\nこのプロセスは決定論的なので、マーケットプレイスは中間結果をキャッシュし、新しいイベントだけを適用できます。ガスコストはバッチごとに 1 イベント分だけです。\n\n## サンプルコード\n\nコントラクト側:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC5185UpdatableMetadata {\n    event MetadataUpdates(string URI);\n}\n\ncontract Monsters is IERC5185UpdatableMetadata /*, ERC721 */ {\n    address public gameMaster;\n    function publishUpdates(string calldata uri) external {\n        require(msg.sender == gameMaster, \"only GM\");\n        emit MetadataUpdates(uri); // e.g. \"ipfs://\u003ccid\u003e/updates-0042.json\"\n    }\n}\n```\n\nレシピを含む元のメタデータと、更新ファイル（フィールド名は仕様のスキーマに従っています）:\n\n```json\n{\n  \"name\": \"Monster 1\",\n  \"attributes\": [{ \"trait_type\": \"Level\", \"value\": 0 }],\n  \"updatable\": {\n    \"engine\": \"jsonata@1.8.*\",\n    \"recipes\": {\n      \"levelUp\": { \"eval\": \"$ ~\u003e | attributes[trait_type='Level'] | {'value': value + 1} |\" }\n    }\n  }\n}\n```\n\n```json\n{ \"updates\": [ { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" }, { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" } ] }\n```\n\nクライアント側のリプレイ（TypeScript、`jsonata` パッケージを使用）:\n\n```ts\nimport jsonata from \"jsonata\";\n\nasync function current(original: any, updates: { tokenId: string; recipeKey: string; args?: any }[], id: string) {\n  let meta = original;\n  for (const u of updates.filter((u) =\u003e u.tokenId === id)) {\n    const recipe = original.updatable?.recipes?.[u.recipeKey];\n    if (!recipe) continue;\n    try { meta = await jsonata(recipe.eval).evaluate(meta, u.args); } catch { /* keep prev */ }\n  }\n  return meta;\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。提案は進んでおらず、マーケットプレイスの対応は期待すべきではありません。\n- 仕様は内部で矛盾しています。スキーマではフィールド名が `recipeKey`（`args` は文字列）ですが、例では `action` を使い、`args` をオブジェクトとして渡しています。どちらかに決めて文書化してください。\n- レシピは第三者のインフラ上で任意の JSONata を実行します。仕様はこれが DoS の経路になりうると警告しており、評価側はサンドボックス化して処理に制限を設けるべきです。\n- コントラクトがのちに `tokenURI` を変更すると、「元の」メタデータも変わるため、それまでの更新がきれいに適用できなくなる可能性があります。\n- 単に「メタデータが変わったので再読み込みを」と知らせたいだけなら、広くサポートされている選択肢は [ERC-4906](/eip-4906/) です。\n"},"ko":{"lang":"ko","tldr":"NFT 메타데이터가 원본 메타데이터에 미리 선언된 레시피를 통해서만 진화하게 하고, 업데이트 묶음마다 온체인 이벤트로 알린다. 누구나 토큰의 현재 메타데이터를 결정적으로 다시 계산해 검증할 수 있다.","tags":["nft","metadata","gaming","json"],"related":[721,1155,4906],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5185/","markdown":"## 어떤 문제를 해결하나요?\n\nNFT 메타데이터는 보통 `tokenURI`에 있습니다. 그 URI가 불변 파일(예: IPFS)을 가리키면 아무것도 바꿀 수 없고, 서버를 가리키면 발행자가 언제든 무엇이든 바꿀 수 있습니다. 많은 사용 사례는 그 중간에 있습니다. 레벨은 오르지만 외형은 고정된 게임 캐릭터, 소유자 이력만 추가할 수 있는 부동산 권리증 같은 경우입니다.\n\nERC-5185는 중간 지점을 추가합니다. 원본 메타데이터가 어떤 변환을 허용하는지 선언하고, 업데이트는 검증 가능하고 순서가 있는 로그로 적용됩니다.\n\n## 어떻게 동작하나요?\n\n1. **원본 메타데이터**([ERC-721](/eip-721/)의 `tokenURI` 또는 [ERC-1155](/eip-1155/)의 `uri`에서 가져온 것)에 `updatable` 객체가 추가됩니다. 내용은 다음과 같습니다.\n   - `engine`: 변환 언어와 버전. 정의된 것은 `jsonata@1.8.*` 하나뿐입니다.\n   - `recipes`: 이전 JSON을 변환하는 이름 있는 수식(`eval` 문자열).\n   - 선택적 `schema`: 업데이트된 모든 버전이 만족해야 하는 JSON Schema.\n2. 컨트랙트는 `MetadataUpdates(string URI)`를 발생시킵니다. URI는 업데이트 목록이 담긴 JSON 파일을 가리키며, 각 업데이트에는 `tokenId`, `recipeKey`, 선택적 `args`가 있습니다. 하나의 이벤트로 여러 토큰에 대한 수천 건의 업데이트를 묶을 수 있습니다.\n3. 현재 메타데이터를 얻으려면 클라이언트는 원본에서 시작해 해당 토큰의 모든 업데이트를 이벤트 순서대로 적용합니다. `next = jsonata(eval).evaluate(prev, args)`.\n   - 알 수 없는 레시피 키, 평가 오류, 스키마 위반이 있으면 그 업데이트는 무시되고 `prev`가 유지됩니다.\n\n이 과정은 결정적이므로 마켓플레이스는 중간 결과를 캐시하고 새 이벤트만 적용할 수 있습니다. 가스 비용은 묶음당 이벤트 하나뿐입니다.\n\n## 샘플 코드\n\n컨트랙트 쪽:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC5185UpdatableMetadata {\n    event MetadataUpdates(string URI);\n}\n\ncontract Monsters is IERC5185UpdatableMetadata /*, ERC721 */ {\n    address public gameMaster;\n    function publishUpdates(string calldata uri) external {\n        require(msg.sender == gameMaster, \"only GM\");\n        emit MetadataUpdates(uri); // e.g. \"ipfs://\u003ccid\u003e/updates-0042.json\"\n    }\n}\n```\n\n레시피가 있는 원본 메타데이터와 업데이트 파일(필드 이름은 명세의 스키마를 따름):\n\n```json\n{\n  \"name\": \"Monster 1\",\n  \"attributes\": [{ \"trait_type\": \"Level\", \"value\": 0 }],\n  \"updatable\": {\n    \"engine\": \"jsonata@1.8.*\",\n    \"recipes\": {\n      \"levelUp\": { \"eval\": \"$ ~\u003e | attributes[trait_type='Level'] | {'value': value + 1} |\" }\n    }\n  }\n}\n```\n\n```json\n{ \"updates\": [ { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" }, { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" } ] }\n```\n\n클라이언트 쪽 리플레이(TypeScript, `jsonata` 패키지 사용):\n\n```ts\nimport jsonata from \"jsonata\";\n\nasync function current(original: any, updates: { tokenId: string; recipeKey: string; args?: any }[], id: string) {\n  let meta = original;\n  for (const u of updates.filter((u) =\u003e u.tokenId === id)) {\n    const recipe = original.updatable?.recipes?.[u.recipeKey];\n    if (!recipe) continue;\n    try { meta = await jsonata(recipe.eval).evaluate(meta, u.args); } catch { /* keep prev */ }\n  }\n  return meta;\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 제안이 진행되지 않고 있으므로 마켓플레이스 지원을 기대해서는 안 됩니다.\n- 명세는 내부적으로 일관되지 않습니다. 스키마에서는 필드 이름이 `recipeKey`(`args`는 문자열)인데, 예제에서는 `action`을 쓰고 `args`를 객체로 전달합니다. 하나를 골라 문서화하세요.\n- 레시피는 제3자 인프라에서 임의의 JSONata를 실행합니다. 명세는 이것이 DoS 경로가 될 수 있다고 경고하므로, 평가하는 쪽은 샌드박스를 쓰고 처리량을 제한해야 합니다.\n- 컨트랙트가 나중에 `tokenURI`를 바꾸면 \"원본\"도 바뀌므로, 이전 업데이트가 깔끔하게 적용되지 않을 수 있습니다.\n- 단순히 \"메타데이터가 바뀌었으니 새로고침하라\"고 알리려는 것이라면, 널리 지원되는 선택지는 [ERC-4906](/eip-4906/)입니다.\n"},"zh":{"lang":"zh","tldr":"让 NFT 元数据只能通过原始元数据中预先声明的配方（recipe）演进，每批更新由链上事件公布，使任何人都能确定性地重新计算并验证代币的当前元数据。","tags":["nft","metadata","gaming","json"],"related":[721,1155,4906],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5185/","markdown":"## 它解决什么问题？\n\nNFT 元数据通常放在 `tokenURI` 上。如果该 URI 指向不可变的文件（例如 IPFS），就永远无法改变任何内容；如果指向服务器，发行方则可以随时更改任何内容。许多用例介于两者之间：等级会上升但外观固定的游戏角色，或者所有者历史只能追加的房产权属证明。\n\nERC-5185 增加了一个折中方案：原始元数据声明允许哪些变换，更新则作为可验证的、有序的日志来应用。\n\n## 它如何运作\n\n1. **原始元数据**（来自 [ERC-721](/eip-721/) 的 `tokenURI` 或 [ERC-1155](/eip-1155/) 的 `uri`）增加一个 `updatable` 对象，包含：\n   - `engine`：变换语言及其版本。目前定义的只有 `jsonata@1.8.*`。\n   - `recipes`：命名的公式（`eval` 字符串），用于变换上一版 JSON。\n   - 可选的 `schema`：每个更新后的版本都必须满足的 JSON Schema。\n2. 合约触发 `MetadataUpdates(string URI)`。该 URI 指向一个列出各项更新的 JSON 文件，每项更新包含 `tokenId`、`recipeKey` 和可选的 `args`。一个事件可以批量包含针对许多代币的数千项更新。\n3. 要获得当前元数据，客户端从原始元数据开始，按事件顺序应用该代币的所有更新：`next = jsonata(eval).evaluate(prev, args)`。\n   - 配方键未知、求值出错或违反 schema：该更新被忽略，保留 `prev`。\n\n由于该过程是确定性的，市场可以缓存中间结果，只应用新的事件。gas 成本只是每批一个事件。\n\n## 示例代码\n\n合约端：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC5185UpdatableMetadata {\n    event MetadataUpdates(string URI);\n}\n\ncontract Monsters is IERC5185UpdatableMetadata /*, ERC721 */ {\n    address public gameMaster;\n    function publishUpdates(string calldata uri) external {\n        require(msg.sender == gameMaster, \"only GM\");\n        emit MetadataUpdates(uri); // e.g. \"ipfs://\u003ccid\u003e/updates-0042.json\"\n    }\n}\n```\n\n带配方的原始元数据，以及一个更新文件（字段名遵循规范中的 schema）：\n\n```json\n{\n  \"name\": \"Monster 1\",\n  \"attributes\": [{ \"trait_type\": \"Level\", \"value\": 0 }],\n  \"updatable\": {\n    \"engine\": \"jsonata@1.8.*\",\n    \"recipes\": {\n      \"levelUp\": { \"eval\": \"$ ~\u003e | attributes[trait_type='Level'] | {'value': value + 1} |\" }\n    }\n  }\n}\n```\n\n```json\n{ \"updates\": [ { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" }, { \"tokenId\": \"1\", \"recipeKey\": \"levelUp\" } ] }\n```\n\n客户端重放（TypeScript，使用 `jsonata` 包）：\n\n```ts\nimport jsonata from \"jsonata\";\n\nasync function current(original: any, updates: { tokenId: string; recipeKey: string; args?: any }[], id: string) {\n  let meta = original;\n  for (const u of updates.filter((u) =\u003e u.tokenId === id)) {\n    const recipe = original.updatable?.recipes?.[u.recipeKey];\n    if (!recipe) continue;\n    try { meta = await jsonata(recipe.eval).evaluate(meta, u.args); } catch { /* keep prev */ }\n  }\n  return meta;\n}\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**：该提案没有进展，不应假定市场会支持。\n- 规范自相矛盾：其 schema 把该字段称为 `recipeKey`（`args` 为字符串），而示例使用的是 `action`，并把 `args` 作为对象传入。请选定一种并写入文档。\n- 配方会在第三方基础设施上运行任意 JSONata；规范警告这可能成为 DoS 攻击向量，因此求值方应使用沙箱并限制处理量。\n- 如果合约之后更改了 `tokenURI`，\"原始\"元数据也会随之改变，之前的更新可能不再能干净地应用。\n- 如果只是想发出\"元数据已更改，请刷新\"的信号，被广泛支持的选择是 [ERC-4906](/eip-4906/)。\n"}}}
