---
eip: 7585
label: ERC-7585
title: MixHash and Public Data Storage Proofs
status: Draft
type: Standards Track
category: ERC
created: 2023-12-27
requires: 165, 721, 1155
official: https://eips.ethereum.org/EIPS/eip-7585
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7585.md
canonical: https://eips.huatuo.xyz/eip-7585/
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]
---

# ERC-7585: MixHash and Public Data Storage Proofs

> A design for minimum value selection Storage Proofs on Merkle trees

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

## What problem does it solve?

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

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

## How it works

**MixHash** is a 256-bit value laid out as:

```
| 2 bits hash type | 62 bits file size | 192 bits low bits of Merkle root |
  0b00 = SHA-256, 0b10 = Keccak-256 (0b01, 0b11 reserved)
```

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

**Storage proof game:**

1. A block at height `h` provides a public, unpredictable nonce (typically the block hash).
2. 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.
3. 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.
4. 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.

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

Optional interfaces: `ERCPublicDataOwner.getPublicDataOwner(mixHash)`, and an NFT extension with `tokenIdIsMixHash()` and `tokenDataHash(tokenId)` that links tokens to their data.

## Sample code

Decoding a MixHash (TypeScript):

```ts
function parseMixHash(mix: bigint) {
  const hashType = Number(mix >> 254n);                  // 0 = SHA-256, 2 = Keccak-256
  const size = (mix >> 192n) & ((1n << 62n) - 1n);       // file size in bytes
  const rootLow192 = mix & ((1n << 192n) - 1n);
  return {
    algo: hashType === 0 ? "sha256" : hashType === 2 ? "keccak256" : "reserved",
    size,
    chunks: (size + 1023n) / 1024n,
    rootLow192: "0x" + rootLow192.toString(16).padStart(48, "0"),
  };
}
```

## Things to know

- Status: **Draft**. The ERC-165 interface ids are still placeholders in the spec.
- 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).
- 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.
- 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.


---

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