ERC-7007 · Final · ERC · 2023-05-10
ERC-7007: Verifiable AI-Generated Content Token
An ERC-721 extension for AI-generated content NFTs where the token ID is tied to the prompt and the output can be verified on-chain with zkML (validity proofs) or opML (fraud proofs).
What problem does it solve?
Anyone can mint an image and claim "this was generated by model X from prompt Y". Nothing in a regular NFT proves it. That makes it hard for model authors to share models while capturing value from their outputs, and hard for buyers to trust provenance.
ERC-7007 standardizes NFTs whose content is verifiably the output of a specific ML model for a specific prompt, using either:
- zkML: a zero-knowledge proof that the inference was computed correctly (validity proof), or
- opML: an optimistic result that anyone can challenge during a challenge period (fraud proof).
How it works
Every compliant contract implements ERC-721, ERC-165 and IERC7007 (interface ID 0x702c55a6):
| Function / event | Purpose |
|---|---|
addAigcData(tokenId, prompt, aigcData, proof) |
Bind a prompt and its generated output to a token |
verify(prompt, aigcData, proof) |
Return true only if the output is finalized and correct |
AigcData(tokenId, prompt, aigcData, proof) event |
Records what was added |
How verify behaves depends on the proof type:
- zkML: checks the ZK proof against a verifier contract.
addAigcDatashould only succeed ifverifyreturnstrue. - opML:
proofmay be empty;verifyreturnstrueonly after the challenge period has ended and the data is up to date.addAigcDatamay be called before finalization.
The tokenId is defined as the hash of the prompt, so the same prompt cannot be minted twice in a collection.
Optional extensions:
- Enumerable (
0xfa1a557a):tokenId(prompt)andprompt(tokenId). - Updatable (
0x3f37dce2):update(prompt, aigcData)plus anUpdateevent, for opML results that change after a successful challenge.
The metadata JSON adds prompt, aigc_type (image, video, audio…), aigc_data (URI of the content) and proof_type (validity or fraud). The spec recommends publishing a commitment to the model on-chain beforehand and checking it inside verify.
Sample code
Reading and verifying an AIGC-NFT (ethers v6):
import { Contract, JsonRpcProvider, keccak256, toUtf8Bytes } from "ethers";
const abi = [
"function supportsInterface(bytes4) view returns (bool)",
"function verify(bytes prompt, bytes aigcData, bytes proof) view returns (bool)",
"function tokenURI(uint256) view returns (string)",
"event AigcData(uint256 indexed tokenId, bytes indexed prompt, bytes indexed aigcData, bytes proof)",
];
const provider = new JsonRpcProvider(process.env.RPC_URL);
const nft = new Contract(process.env.AIGC_NFT!, abi, provider);
console.log("ERC-7007:", await nft.supportsInterface("0x702c55a6"));
const prompt = toUtf8Bytes("a lighthouse in a storm, oil painting");
const tokenId = BigInt(keccak256(prompt)); // common implementation choice: id = hash(prompt)
console.log("tokenURI:", await nft.tokenURI(tokenId));
// aigcData and proof come from the generator / prover off-chain
const ok = await nft.verify(prompt, process.env.AIGC_DATA!, process.env.PROOF ?? "0x");
console.log("verified:", ok);
Things to know
- Status: Final.
- The exact hash used for
tokenIdis implementation-specific; check the contract rather than assuming keccak256 of the raw prompt bytes. - Prompts are visible in the mempool, so someone could front-run a claim. The spec says implementations must use an anti-front-running scheme such as commit-reveal or time locks.
- In opML,
aigcDatacan change during the challenge period. Indexers and marketplaces should watch forUpdateevents and not treat data as final untilverifyreturnstrue. - The standard proves the output came from a committed model and prompt. It does not address copyright or licensing of the generated content.