Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

Background

ERC-7007 proposes issuing NFTs for AI-generated content and verifying the generation process cryptographically on-chain.

This article translates and explains the proposal below.

I also cover other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

The Verifiable AIGC-NFT Standard extends ERC-721 to register and verify AI-generated content (AIGC).

  • addAigcData registers generated data.
  • verify checks the validity of generated data.
  • AigcData announces the registration of generated data.
  • The optional Enumerable and Updatable extensions expose prompt associations and allow updates.
  • A JSON schema defines the metadata structure.

The proposal accommodates zero-knowledge machine learning (zkML) and optimistic machine learning (opML). A token is identified by its prompt, allowing users to link the issued NFT to verifiable evidence about the generation process.

Motivation

Background and goals

ERC-721 alone does not tell a buyer which model and prompt produced an NFT's content. ERC-7007 provides a way to prove the relationship between an AI model, its inputs, and its output. Owners and buyers can verify provenance claims, while model authors and creators can use that evidence in attribution and revenue-sharing systems.

Proof types

Proof type Purpose Main technique
Validity proof Prove that the correct computation produced the output. zkML
Fraud proof Allow invalid outputs to be challenged. opML

Developers can choose the approach that fits their use case.

How zkML works

zkML uses zero-knowledge proofs to establish that a model produced the correct output for an input without disclosing information that the proof keeps private.

  1. The model owner publishes the trained model and its proof-verification contract to Ethereum.
  2. A user submits an inference task with a prompt.
  3. A node holding the model performs inference, generates a proof, and sends the result and proof to the verifier.
  4. After verification, the user can own the corresponding output as an NFT.

The proof binds the result to the specified computation, preventing tampering from passing verification.

How opML works

Like optimistic rollups, opML initially accepts a result provisionally and lets others challenge it if they detect an error.

  1. The model owner publishes the trained model to Ethereum.
  2. The user submits an inference task with a prompt.
  3. A node holding the model executes inference and posts the output on-chain.
  4. Other nodes can check the result during the challenge period.
  5. If the period ends without a challenge, the output is accepted and the user can own the result as an NFT.

This approach can reduce proof-generation costs relative to zkML while preserving a mechanism for disputes.

Uses of the standard

Developers and creators can use verifiable prompt-to-output links when publishing or selling AI art, writing, or music. Potential applications include minting a unique NFT for a prompt and proving the association, routing part of a sale to the model creator, and tracking and monetizing outputs from an open-source model. The verification interface provides provenance evidence that these applications can use for attribution and revenue distribution.

Example zkML AIGC-NFT workflow

Workflow diagram

Workflow for producing and verifying a zkML AIGC-NFT https://eips.ethereum.org/EIPS/eip-7007

Component roles

Component Role
ML Model Holds trained weights and runs inference on the input.
zkML Prover Generates a zero-knowledge proof for the inference result.
AIGC-NFT Smart Contract Implements the proposal and the ERC-721 functionality.
Verifier Smart Contract Checks the inference task and proof and returns a boolean result.

The workflow follows the prompt through inference, proof generation, verification, and NFT issuance.

Specification

Implementation requirements

Required interface Role
IERC7007 Defines how AIGC data is added and verified.
ERC-721 Provides standard NFT issuance, ownership, and transfer behavior.
ERC-165 Identifies the interfaces the contract supports.

IERC7007 interface

The core interface links generated data to an NFT and checks the relationship among prompt, aigcData, and proof using a zkML or opML verification mechanism.

Complete interface

javascript
pragma solidity ^0.8.18;

/**
 * @dev Required interface of an ERC7007 compliant contract.
 * Note: the ERC-165 identifier for this interface is 0x702c55a6.
 */
interface IERC7007 is IERC165, IERC721 {
    /**
     * @dev Emitted when `tokenId` token's AIGC data is added.
     */
    event AigcData(
        uint256 indexed tokenId,
        bytes indexed prompt,
        bytes indexed aigcData,
        bytes proof
    );

    /**
     * @dev Add AIGC data to token at `tokenId` given `prompt`, `aigcData`, and `proof`.
     */
    function addAigcData(
        uint256 tokenId,
        bytes calldata prompt,
        bytes calldata aigcData,
        bytes calldata proof
    ) external;

    /**
     * @dev Verify the `prompt`, `aigcData`, and `proof`.
     */
    function verify(
        bytes calldata prompt,
        bytes calldata aigcData,
        bytes calldata proof
    ) external view returns (bool success);
}

AigcData

javascript
event AigcData(
    uint256 indexed tokenId,
    bytes indexed prompt,
    bytes indexed aigcData,
    bytes proof
);

The event announces which token received new generated data.

  • tokenId identifies the token.
  • prompt is the input used for generation.
  • aigcData is the generated content in bytes, such as an image, audio, or video.
  • proof contains verification data produced by zkML or opML.

addAigcData

javascript
function addAigcData(
    uint256 tokenId,
    bytes calldata prompt,
    bytes calldata aigcData,
    bytes calldata proof
) external;

Associates the inference result and its proof with a token. The arguments are tokenId for the NFT, prompt for the input, aigcData for the generated output, and proof for the zkML or opML evidence.

verify

javascript
function verify(
    bytes calldata prompt,
    bytes calldata aigcData,
    bytes calldata proof
) external view returns (bool success);

Checks whether the provided prompt, aigcData, and proof are consistent under the chosen zkML or opML method. It returns true on successful verification and false otherwise.

Enumerable

This optional extension exposes the association between prompts and token IDs.

Complete interface

javascript
pragma solidity ^0.8.18;

/**
 * @title ERC7007 Token Standard, optional enumeration extension
 * Note: the ERC-165 identifier for this interface is 0xfa1a557a.
 */
interface IERC7007Enumerable is IERC7007 {
    /**
     * @dev Returns the token ID given `prompt`.
     */
    function tokenId(bytes calldata prompt) external view returns (uint256);

    /**
     * @dev Returns the prompt given `tokenId`.
     */
    function prompt(uint256 tokenId) external view returns (string calldata);
}

tokenId

javascript
function tokenId(bytes calldata prompt) external view returns (uint256);

Takes the prompt bytes and returns the identifier of the NFT generated from that prompt.

prompt

javascript
function prompt(uint256 tokenId) external view returns (string calldata);

Looks up the prompt associated with the supplied NFT identifier and returns it as bytes.

Updatable

This optional extension lets opML implementations update aigcData when the challenge process requires a correction.

Complete interface

javascript
pragma solidity ^0.8.18;

/**
 * @title ERC7007 Token Standard, optional updatable extension
 * Note: the ERC-165 identifier for this interface is 0x3f37dce2.
 */
interface IERC7007Updatable is IERC7007 {
    /**
     * @dev Update the `aigcData` of `prompt`.
     */
    function update(
        bytes calldata prompt,
        bytes calldata aigcData
    ) external;

    /**
     * @dev Emitted when `tokenId` token is updated.
     */
    event Update(
        uint256 indexed tokenId,
        bytes indexed prompt,
        bytes indexed aigcData
    );
}

update

javascript
function update(
    bytes calldata prompt,
    bytes calldata aigcData
) external;

Replaces the AIGC data associated with a prompt, for example to reflect a corrected result after a challenge. It accepts the target prompt and the replacement aigcData.

Update

javascript
event Update(
    uint256 indexed tokenId,
    bytes indexed prompt,
    bytes indexed aigcData
);

Announces a replacement of AIGC data associated with an existing NFT. It identifies the updated token, the associated prompt, and the replacement data.

Metadata JSON schema

AIGC-NFT metadata follows this JSON schema.

javascript
{
  "title": "AIGC Metadata",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Identifies the asset to which this NFT represents"
    },
    "description": {
      "type": "string",
      "description": "Describes the asset to which this NFT represents"
    },
    "image": {
      "type": "string",
      "description": "A URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive."
    },
    "prompt": {
      "type": "string",
      "description": "Identifies the prompt from which this AIGC NFT generated"
    },
    "aigc_type": {
      "type": "string",
      "description": "image/video/audio..."
    },
    "aigc_data": {
      "type": "string",
      "description": "A URI pointing to a resource with mime type image/* representing the asset to which this AIGC NFT represents."
    },
    "proof_type": {
      "type": "string",
      "description": "validity (zkML) or fraud (opML)"
    }
  }
}

It standardizes how metadata identifies the original prompt, media type, and verification method.

Model publication

ERC-7007 leaves model publication to implementations. The article describes publishing a commitment, such as a hash or signature, for the trained model on Ethereum before inference. The verify function can then check the model against that commitment, giving users a way to identify and verify which model produced an output.

Additional notes

Token uniqueness

The article describes deriving the tokenId from a hash of the prompt. Hashing gives the same prompt the same identifier, makes collisions between different prompts unlikely, and can prevent issuing duplicate tokens for the same prompt under a given model and seed. This uniqueness applies within the issuing contract's rules.

Supporting different proof mechanisms

Proof type Technique Purpose Finality
Validity proof zkML Prove that the result is correct. Can finalize once the proof verifies.
Fraud proof opML Detect and correct invalid results. Requires a challenge window.

The addAigcData and verify arguments can represent either mechanism. The Updatable extension accommodates data corrections after an opML challenge, so projects can choose either immediate verification or optimistic verification.

Why the verify interface is designed this way

The read-only verify function checks generated data without changing state.

How verification works
Proof mechanism Check Condition
zkML Check the zero-knowledge proof. The proof must be valid.
opML Check that the challenge period ended and the data is current. The data must reflect the finalized result.
Design considerations

For zkML, the function returns true only when the proof verifies. For opML, it can return true once the challenge period is over and the data is current. The opML proof argument can be empty when the implementation relies on the elapsed challenge period and dispute mechanism. In both cases the function indicates whether the data has reached its verified or finalized state.

Why the addAigcData interface is designed this way

addAigcData associates the generated output with its prompt and token and serves as the entry point for registering the result during minting.

Flexibility
Proof mechanism Invocation Verification condition
zkML Call after generating the proof. verify must return true.
opML May be called before the challenge period ends. A later update can reflect the final result.

Although zkML proof generation takes time, smaller workloads can be verified and registered promptly. opML can handle larger workloads and update the data after the challenge period if needed.

Design rationale

The different invocation times accommodate both approaches. zkML can suit tasks with manageable proving costs, while optimistic verification can suit larger workloads.

Why the function is called update

ERC-7007 uses update for changes to the registered output.

Rationale

Successful opML challenges are expected to be uncommon. The name describes the occasional replacement of data. Requiring a separate finalize call for every token would incur gas even when the registered output needs no change.

Compatibility

ERC-7007 extends ERC-721 without changing standard behavior for ownership, transfers, or metadata lookup. Existing asset managers and viewers can continue to use the ERC-721 interface while applications that understand AIGC can access its additional operations.

Aspect Explanation
Inheritance Adds AIGC registration and verification interfaces to ERC-721 features.
Compatibility Preserves ERC-721 behavior and adds AIGC-specific operations.
Benefit Existing tooling can remain in use while applications add content verification.

Reference implementations

Component Description
ERC-7007 for zkML and opML Minimal examples for the two proof mechanisms.
ERC-7007 Enumerable Extension An implementation for looking up prompts and token IDs.

These references illustrate how to register and verify AIGC data.

Security considerations

Front-running risk

A party observing a pending mint could try to claim the same prompt before the original submitter. Implementations need a prompt acquisition process that preserves the original submitter's opportunity to complete the claim.

Requirements
Technique Description Goal
Timelock Delay the point at which an action takes effect. Give the legitimate applicant time to complete the process.
Commit–reveal Submit a commitment first and disclose the data later for verification. Keep the prompt private until the reveal.
Other defenses Use other mechanisms that mitigate front-running. Preserve fair prompt acquisition.
Example commit–reveal flow
  1. The user submits only a commitment to the prompt.
  2. Once the commitment is included, the user discloses the prompt in the reveal phase.
  3. The contract checks the reveal against the commitment before accepting the claim.

The prompt remains hidden before the reveal. Implementations also need to ensure the reveal can only complete the original claimant's commitment.

AIGC data changes during an opML challenge

The challenge period is the window in which others can dispute the result. The optional Updatable extension lets an implementation replace aigcData when a dispute requires a correction.

Requirements

Implementations should treat changes to aigcData as critical state transitions and apply the same security and verification procedures as at initial mint. Indexers should watch Update events and account for finality before displaying the result.

Example update flow
  1. Confirm the challenge window has ended or the applicable update conditions are met.
  2. Replace aigcData through the extension.
  3. Confirm that the contract emits Update.
  4. Have the indexer ingest the event and use the latest data.

Citation

Cathie So (@socathie), Xiaohang Yu (@xhyumiracle), Conway (@0x1cc), Lee Ting Ting (@tina1998612), Kartin kartin@hyperoracle.io, "ERC-7007: Verifiable AI-Generated Content Token," Ethereum Improvement Proposals, no. 7007, May 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7007.

Conclusion

ERC-7007 proposes representing AI-generated content as NFTs and verifying the generation process cryptographically on-chain.

Questions are welcome by direct message.

Twitter @cardene777

Find more of my writing and resources here.

https://chaldene.net/