{"eip":7585,"title":"MixHash and Public Data Storage Proofs","description":"A design for minimum value selection Storage Proofs on Merkle trees","authors":["Liu Zhicong (@waterflier)","William Entriken (@fulldecent)","Wei Qiushi (@weiqiushi)","Si Changjun (@photosssa)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2023-12-27","requires":[165,721,1155],"discussionsTo":"https://ethereum-magicians.org/t/erc-7585-mixhash-and-public-data-storage-proofs/17707","repo":"ERCs","label":"ERC-7585","officialUrl":"https://eips.ethereum.org/EIPS/eip-7585","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7585.md","url":"https://eips.huatuo.xyz/eip-7585/","tldr":{"en":"Defines MixHash, a 256-bit Merkle-root identifier that also encodes file size, and a challenge-based scheme where anyone can prove on-chain they store a copy of public data.","ja":"ファイルサイズもエンコードする 256 ビットの Merkle ルート識別子 MixHash と、誰でも公開データのコピーを保持していることをオンチェーンで証明できるチャレンジ方式を定義する。","ko":"파일 크기까지 인코딩하는 256비트 Merkle 루트 식별자 MixHash와, 누구나 공개 데이터의 사본을 보관하고 있음을 온체인에서 증명할 수 있는 챌린지 기반 방식을 정의한다.","zh":"定义 MixHash（同时编码文件大小的 256 位 Merkle 根标识符）和一种基于挑战的方案，任何人都可以在链上证明自己存储了公开数据的副本。"},"tags":["storage","merkle","proofs","data","nft"],"explainers":{"en":{"lang":"en","tldr":"Defines MixHash, a 256-bit Merkle-root identifier that also encodes file size, and a challenge-based scheme where anyone can prove on-chain they store a copy of public data.","tags":["storage","merkle","proofs","data","nft"],"related":[721,1155,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7585/","markdown":"## What problem does it solve?\n\nNFTs and on-chain records often point to files (images, datasets, media) that live off-chain. Nothing in [ERC-721](/eip-721/) or [ERC-1155](/eip-1155/) lets a contract check that copies of that data actually still exist somewhere. Decentralized storage markets, data oracles and archival incentives all need such a check.\n\nERC-7585 proposes two pieces: a content identifier called **MixHash** that supports cheap chunk-level proofs, and a **public data storage proof** game that rewards people for keeping copies of public data.\n\n## How it works\n\n**MixHash** is a 256-bit value laid out as:\n\n```\n| 2 bits hash type | 62 bits file size | 192 bits low bits of Merkle root |\n  0b00 = SHA-256, 0b10 = Keccak-256 (0b01, 0b11 reserved)\n```\n\nThe file is split into 1 KB chunks (the last one zero-padded). Each chunk hash is truncated to 128 bits as a leaf, inner nodes also use 128 bits, and the root is a full hash. This keeps proofs small while staying the same size as an ordinary `bytes32` hash.\n\n**Storage proof game:**\n\n1. A block at height `h` provides a public, unpredictable nonce (typically the block hash).\n2. A *Supplier* appends the nonce to each 1 KB chunk in turn and finds the chunk `m` that gives the **smallest** new Merkle root. This requires reading the whole file.\n3. They submit `{mixHash, h, m, path, leaf}`. The contract checks the path against the MixHash, checks that `h` is recent (e.g. within 2 blocks), and records the result.\n4. The contract cannot know whether `m` is truly optimal, so others can **challenge** with a better chunk. A successful challenge proves the earlier submitter did not have the full file and they can be penalised. If nobody challenges in time, the proof is accepted.\n\nThe short deadline is the defence against suppliers fetching data from the network on demand instead of storing it. An optional proof-of-work variant exists for slow chains, but the spec advises against using it unless necessary.\n\nOptional interfaces: `ERCPublicDataOwner.getPublicDataOwner(mixHash)`, and an NFT extension with `tokenIdIsMixHash()` and `tokenDataHash(tokenId)` that links tokens to their data.\n\n## Sample code\n\nDecoding a MixHash (TypeScript):\n\n```ts\nfunction parseMixHash(mix: bigint) {\n  const hashType = Number(mix \u003e\u003e 254n);                  // 0 = SHA-256, 2 = Keccak-256\n  const size = (mix \u003e\u003e 192n) \u0026 ((1n \u003c\u003c 62n) - 1n);       // file size in bytes\n  const rootLow192 = mix \u0026 ((1n \u003c\u003c 192n) - 1n);\n  return {\n    algo: hashType === 0 ? \"sha256\" : hashType === 2 ? \"keccak256\" : \"reserved\",\n    size,\n    chunks: (size + 1023n) / 1024n,\n    rootLow192: \"0x\" + rootLow192.toString(16).padStart(48, \"0\"),\n  };\n}\n```\n\n## Things to know\n\n- Status: **Draft**. The ERC-165 interface ids are still placeholders in the spec.\n- Security rests on economics (\"Nash consensus\"), not on a cryptographic proof of replication. The design deliberately does not prevent one copy being claimed as several (Sybil attacks).\n- Only for **public** data: proofs reveal 1 KB chunks on-chain. Very small files are unsuitable because they are too easy to fetch on demand.\n- The scheme cannot tell whether data is genuinely public. Rewarding proofs for arbitrary MixHashes lets suppliers invent data only they hold, so systems need to decide which MixHashes count, for example via NFTs that reference them.\n"},"ja":{"lang":"ja","tldr":"ファイルサイズもエンコードする 256 ビットの Merkle ルート識別子 MixHash と、誰でも公開データのコピーを保持していることをオンチェーンで証明できるチャレンジ方式を定義する。","tags":["storage","merkle","proofs","data","nft"],"related":[721,1155,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7585/","markdown":"## 何を解決するのか\n\nNFT やオンチェーンの記録は、オフチェーンにあるファイル（画像、データセット、メディア）を指していることがよくあります。[ERC-721](/eip-721/) や [ERC-1155](/eip-1155/) には、そのデータのコピーが実際にまだどこかに存在することをコントラクトが確認する手段がありません。分散型ストレージ市場、データオラクル、アーカイブのインセンティブには、いずれもこうした確認が必要です。\n\nERC-7585 は 2 つの要素を提案します。安価なチャンク単位の証明を可能にするコンテンツ識別子 **MixHash** と、公開データのコピーを保持する人に報酬を与える**公開データストレージ証明**ゲームです。\n\n## 仕組み\n\n**MixHash** は次のレイアウトを持つ 256 ビットの値です。\n\n```\n| 2 bits hash type | 62 bits file size | 192 bits low bits of Merkle root |\n  0b00 = SHA-256, 0b10 = Keccak-256 (0b01, 0b11 reserved)\n```\n\nファイルは 1 KB のチャンクに分割されます（最後のチャンクはゼロパディング）。各チャンクのハッシュは 128 ビットに切り詰められてリーフとなり、内部ノードも 128 ビットを使い、ルートは完全なハッシュです。これにより、通常の `bytes32` ハッシュと同じサイズのまま、証明を小さく保てます。\n\n**ストレージ証明ゲーム：**\n\n1. 高さ `h` のブロックが、公開された予測不能な nonce（通常はブロックハッシュ）を提供します。\n2. *Supplier* は、1 KB の各チャンクに順に nonce を連結し、新しい Merkle ルートが**最小**になるチャンク `m` を見つけます。これにはファイル全体を読む必要があります。\n3. `{mixHash, h, m, path, leaf}` を提出します。コントラクトは path を MixHash と照合し、`h` が最近のもの（たとえば 2 ブロック以内）であることを確認し、結果を記録します。\n4. コントラクトは `m` が本当に最適かどうかを知ることができないため、他の人がより良いチャンクで**チャレンジ**できます。チャレンジが成功すれば、先に提出した人が完全なファイルを持っていなかったことが証明され、ペナルティを科せます。期限内に誰もチャレンジしなければ、証明は受理されます。\n\n短い期限は、Supplier がデータを保存せずに必要に応じてネットワークから取得することへの防御です。低速なチェーン向けの任意のプルーフ・オブ・ワーク版もありますが、仕様は必要でない限り使わないよう勧めています。\n\n任意のインターフェース：`ERCPublicDataOwner.getPublicDataOwner(mixHash)`、およびトークンとそのデータを結びつける `tokenIdIsMixHash()` と `tokenDataHash(tokenId)` を持つ NFT 拡張。\n\n## サンプルコード\n\nMixHash のデコード（TypeScript）:\n\n```ts\nfunction parseMixHash(mix: bigint) {\n  const hashType = Number(mix \u003e\u003e 254n);                  // 0 = SHA-256, 2 = Keccak-256\n  const size = (mix \u003e\u003e 192n) \u0026 ((1n \u003c\u003c 62n) - 1n);       // file size in bytes\n  const rootLow192 = mix \u0026 ((1n \u003c\u003c 192n) - 1n);\n  return {\n    algo: hashType === 0 ? \"sha256\" : hashType === 2 ? \"keccak256\" : \"reserved\",\n    size,\n    chunks: (size + 1023n) / 1024n,\n    rootLow192: \"0x\" + rootLow192.toString(16).padStart(48, \"0\"),\n  };\n}\n```\n\n## 知っておくべきこと\n\n- ステータス: **Draft**。仕様の ERC-165 インターフェース ID はまだプレースホルダーです。\n- セキュリティは暗号的な複製の証明ではなく、経済性（「ナッシュ合意」）に基づいています。この設計は、1 つのコピーを複数のコピーとして主張すること（シビル攻撃）を意図的に防いでいません。\n- **公開**データ専用です。証明は 1 KB のチャンクをオンチェーンに公開します。非常に小さなファイルは、必要に応じて取得するのが簡単すぎるため不向きです。\n- この方式では、データが本当に公開されているかどうかは分かりません。任意の MixHash に対する証明に報酬を与えると、Supplier は自分だけが持つデータを作り出せてしまいます。そのため、システムはどの MixHash を対象とするかを、たとえばそれらを参照する NFT などで決める必要があります。\n"},"ko":{"lang":"ko","tldr":"파일 크기까지 인코딩하는 256비트 Merkle 루트 식별자 MixHash와, 누구나 공개 데이터의 사본을 보관하고 있음을 온체인에서 증명할 수 있는 챌린지 기반 방식을 정의한다.","tags":["storage","merkle","proofs","data","nft"],"related":[721,1155,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7585/","markdown":"## 어떤 문제를 해결하나요?\n\nNFT와 온체인 기록은 오프체인에 있는 파일(이미지, 데이터셋, 미디어)을 가리키는 경우가 많습니다. [ERC-721](/eip-721/)이나 [ERC-1155](/eip-1155/)에는 그 데이터의 사본이 실제로 아직 어딘가에 존재하는지 컨트랙트가 확인할 방법이 없습니다. 탈중앙화 스토리지 마켓, 데이터 오라클, 아카이브 인센티브는 모두 이런 확인이 필요합니다.\n\nERC-7585는 두 가지를 제안합니다. 저렴한 청크 단위 증명을 지원하는 콘텐츠 식별자 **MixHash**와, 공개 데이터의 사본을 보관하는 사람에게 보상하는 **공개 데이터 스토리지 증명** 게임입니다.\n\n## 어떻게 동작하나요?\n\n**MixHash**는 다음과 같이 배치된 256비트 값입니다.\n\n```\n| 2 bits hash type | 62 bits file size | 192 bits low bits of Merkle root |\n  0b00 = SHA-256, 0b10 = Keccak-256 (0b01, 0b11 reserved)\n```\n\n파일은 1 KB 청크로 나뉩니다(마지막 청크는 0으로 패딩). 각 청크 해시는 128비트로 잘려 리프가 되고, 내부 노드도 128비트를 쓰며, 루트는 전체 해시입니다. 이렇게 하면 일반 `bytes32` 해시와 같은 크기를 유지하면서 증명을 작게 유지합니다.\n\n**스토리지 증명 게임:**\n\n1. 높이 `h`의 블록이 공개되고 예측할 수 없는 nonce(보통 블록 해시)를 제공합니다.\n2. *Supplier*는 1 KB 청크마다 차례로 nonce를 덧붙여, 새 Merkle 루트가 **가장 작아지는** 청크 `m`을 찾습니다. 이를 위해서는 파일 전체를 읽어야 합니다.\n3. `{mixHash, h, m, path, leaf}`를 제출합니다. 컨트랙트는 path를 MixHash와 대조하고, `h`가 최근인지(예: 2블록 이내) 확인하고, 결과를 기록합니다.\n4. 컨트랙트는 `m`이 정말 최적인지 알 수 없으므로, 다른 사람이 더 나은 청크로 **챌린지**할 수 있습니다. 챌린지가 성공하면 앞서 제출한 사람이 전체 파일을 갖고 있지 않았음이 증명되어 페널티를 줄 수 있습니다. 기한 내에 아무도 챌린지하지 않으면 증명이 받아들여집니다.\n\n짧은 기한은 supplier가 데이터를 저장하지 않고 필요할 때마다 네트워크에서 가져오는 것에 대한 방어책입니다. 느린 체인을 위한 선택적 작업 증명 변형도 있지만, 명세는 꼭 필요하지 않다면 쓰지 말라고 권고합니다.\n\n선택적 인터페이스: `ERCPublicDataOwner.getPublicDataOwner(mixHash)`, 그리고 토큰을 해당 데이터와 연결하는 `tokenIdIsMixHash()`와 `tokenDataHash(tokenId)`를 갖춘 NFT 확장.\n\n## 샘플 코드\n\nMixHash 디코딩(TypeScript):\n\n```ts\nfunction parseMixHash(mix: bigint) {\n  const hashType = Number(mix \u003e\u003e 254n);                  // 0 = SHA-256, 2 = Keccak-256\n  const size = (mix \u003e\u003e 192n) \u0026 ((1n \u003c\u003c 62n) - 1n);       // file size in bytes\n  const rootLow192 = mix \u0026 ((1n \u003c\u003c 192n) - 1n);\n  return {\n    algo: hashType === 0 ? \"sha256\" : hashType === 2 ? \"keccak256\" : \"reserved\",\n    size,\n    chunks: (size + 1023n) / 1024n,\n    rootLow192: \"0x\" + rootLow192.toString(16).padStart(48, \"0\"),\n  };\n}\n```\n\n## 알아둘 점\n\n- 상태: **Draft**. 명세의 ERC-165 인터페이스 id는 아직 자리 표시자입니다.\n- 보안은 암호학적 복제 증명이 아니라 경제성(\"내시 합의\")에 기반합니다. 이 설계는 하나의 사본을 여러 사본으로 주장하는 것(시빌 공격)을 의도적으로 막지 않습니다.\n- **공개** 데이터 전용입니다. 증명은 1 KB 청크를 온체인에 드러냅니다. 아주 작은 파일은 필요할 때 가져오기가 너무 쉬워 적합하지 않습니다.\n- 이 방식은 데이터가 정말 공개인지 알 수 없습니다. 임의의 MixHash에 대한 증명에 보상하면 supplier가 자기만 가진 데이터를 만들어 낼 수 있으므로, 시스템은 어떤 MixHash를 인정할지, 예를 들어 그것을 참조하는 NFT 등으로 정해야 합니다.\n"},"zh":{"lang":"zh","tldr":"定义 MixHash（同时编码文件大小的 256 位 Merkle 根标识符）和一种基于挑战的方案，任何人都可以在链上证明自己存储了公开数据的副本。","tags":["storage","merkle","proofs","data","nft"],"related":[721,1155,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7585/","markdown":"## 它解决什么问题？\n\nNFT 和链上记录常常指向存放在链下的文件（图片、数据集、媒体）。[ERC-721](/eip-721/) 或 [ERC-1155](/eip-1155/) 中没有任何机制能让合约检查这些数据的副本是否真的还存在于某处。去中心化存储市场、数据预言机和归档激励都需要这样的检查。\n\nERC-7585 提出两个部分：一个名为 **MixHash** 的内容标识符，支持廉价的分块级证明；以及一个**公开数据存储证明**博弈，奖励保存公开数据副本的人。\n\n## 它如何运作\n\n**MixHash** 是一个 256 位的值，布局如下：\n\n```\n| 2 bits hash type | 62 bits file size | 192 bits low bits of Merkle root |\n  0b00 = SHA-256, 0b10 = Keccak-256 (0b01, 0b11 reserved)\n```\n\n文件被切分为 1 KB 的块（最后一块用零填充）。每个块的哈希被截断为 128 位作为叶子，内部节点同样使用 128 位，根是完整的哈希。这样在保持与普通 `bytes32` 哈希相同大小的同时，让证明保持很小。\n\n**存储证明博弈：**\n\n1. 高度为 `h` 的区块提供一个公开且不可预测的 nonce（通常是区块哈希）。\n2. *Supplier（供应者）* 依次把 nonce 附加到每个 1 KB 块之后，找出使新的 Merkle 根**最小**的那个块 `m`。这需要读取整个文件。\n3. 他们提交 `{mixHash, h, m, path, leaf}`。合约根据 MixHash 检查路径，检查 `h` 是否足够新（例如在 2 个区块以内），并记录结果。\n4. 合约无法知道 `m` 是否真的最优，因此其他人可以用更好的块发起**挑战**。挑战成功则证明先前的提交者并没有完整的文件，可以对其进行惩罚。如果没有人在期限内挑战，则证明被接受。\n\n较短的期限是防范供应者按需从网络获取数据而不是存储数据的手段。对于较慢的链还有一个可选的工作量证明变体，但规范建议除非必要不要使用。\n\n可选接口：`ERCPublicDataOwner.getPublicDataOwner(mixHash)`，以及带有 `tokenIdIsMixHash()` 和 `tokenDataHash(tokenId)` 的 NFT 扩展，用于将代币与其数据关联起来。\n\n## 示例代码\n\n解码 MixHash（TypeScript）：\n\n```ts\nfunction parseMixHash(mix: bigint) {\n  const hashType = Number(mix \u003e\u003e 254n);                  // 0 = SHA-256, 2 = Keccak-256\n  const size = (mix \u003e\u003e 192n) \u0026 ((1n \u003c\u003c 62n) - 1n);       // file size in bytes\n  const rootLow192 = mix \u0026 ((1n \u003c\u003c 192n) - 1n);\n  return {\n    algo: hashType === 0 ? \"sha256\" : hashType === 2 ? \"keccak256\" : \"reserved\",\n    size,\n    chunks: (size + 1023n) / 1024n,\n    rootLow192: \"0x\" + rootLow192.toString(16).padStart(48, \"0\"),\n  };\n}\n```\n\n## 需要注意\n\n- 状态：**Draft**。规范中的 ERC-165 接口 id 仍然是占位符。\n- 安全性依赖经济学（\"纳什共识\"），而不是密码学的副本存储证明。该设计有意不防止将一份副本声称为多份（女巫攻击）。\n- 仅适用于**公开**数据：证明会在链上暴露 1 KB 的块。非常小的文件不适合，因为它们太容易按需获取。\n- 该方案无法判断数据是否真正公开。对任意 MixHash 的证明给予奖励，会让供应者编造只有自己持有的数据，因此系统需要决定哪些 MixHash 算数，例如通过引用它们的 NFT。\n"}}}
