---
eip: 5185
label: ERC-5185
title: NFT Updatable Metadata Extension
status: Stagnant
type: Standards Track
category: ERC
created: 2022-06-27
requires: 721, 1155
official: https://eips.ethereum.org/EIPS/eip-5185
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5185.md
canonical: https://eips.huatuo.xyz/eip-5185/
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]
---

# ERC-5185: NFT Updatable Metadata Extension

> An interface extension for ERC-721/ERC-1155 controlled metadata updates

**TL;DR:** 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.

## What problem does it solve?

NFT 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.

ERC-5185 adds a middle ground: the original metadata declares which transformations are allowed, and updates are applied as a verifiable, ordered log.

## How it works

1. The **original metadata** (from `tokenURI` in [ERC-721](/eip-721/) or `uri` in [ERC-1155](/eip-1155/)) gains an `updatable` object with:
   - `engine`: the transformation language and version. The only one defined is `jsonata@1.8.*`.
   - `recipes`: named formulas (`eval` strings) that transform the previous JSON.
   - optional `schema`: a JSON Schema every updated version must satisfy.
2. 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.
3. 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)`.
   - Unknown recipe key, evaluation error, or schema violation: the update is ignored and `prev` is kept.

Because the process is deterministic, marketplaces can cache intermediate results and only apply new events. Gas cost is just one event per batch.

## Sample code

Contract side:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IERC5185UpdatableMetadata {
    event MetadataUpdates(string URI);
}

contract Monsters is IERC5185UpdatableMetadata /*, ERC721 */ {
    address public gameMaster;
    function publishUpdates(string calldata uri) external {
        require(msg.sender == gameMaster, "only GM");
        emit MetadataUpdates(uri); // e.g. "ipfs://<cid>/updates-0042.json"
    }
}
```

Original metadata with recipes, and an updates file (field names follow the spec's schema):

```json
{
  "name": "Monster 1",
  "attributes": [{ "trait_type": "Level", "value": 0 }],
  "updatable": {
    "engine": "jsonata@1.8.*",
    "recipes": {
      "levelUp": { "eval": "$ ~> | attributes[trait_type='Level'] | {'value': value + 1} |" }
    }
  }
}
```

```json
{ "updates": [ { "tokenId": "1", "recipeKey": "levelUp" }, { "tokenId": "1", "recipeKey": "levelUp" } ] }
```

Client-side replay (TypeScript, using the `jsonata` package):

```ts
import jsonata from "jsonata";

async function current(original: any, updates: { tokenId: string; recipeKey: string; args?: any }[], id: string) {
  let meta = original;
  for (const u of updates.filter((u) => u.tokenId === id)) {
    const recipe = original.updatable?.recipes?.[u.recipeKey];
    if (!recipe) continue;
    try { meta = await jsonata(recipe.eval).evaluate(meta, u.args); } catch { /* keep prev */ }
  }
  return meta;
}
```

## Things to know

- Status is **Stagnant**: the proposal is not progressing, and marketplace support should not be assumed.
- 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.
- Recipes run arbitrary JSONata on third-party infrastructure; the spec warns this can be a DoS vector, so evaluators should sandbox and limit processing.
- If a contract later changes `tokenURI`, the "original" changes too, and earlier updates may no longer apply cleanly.
- For simply signaling "metadata changed, refresh", the widely supported option is [ERC-4906](/eip-4906/).


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-5185
