---
eip: 7992
label: ERC-7992
title: Verifiable ML Model Inference (ZKML)
status: Draft
type: Standards Track
category: ERC
created: 2025-07-23
requires: 165
official: https://eips.ethereum.org/EIPS/eip-7992
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7992.md
canonical: https://eips.huatuo.xyz/eip-7992/
lang: en
tldr: Standard registry and verifier interfaces so smart contracts can accept zero-knowledge proofs that a specific, committed ML model produced a given output.
tags: [zk, zkml, ai, oracle, verifier]
---

# ERC-7992: Verifiable ML Model Inference (ZKML)

> Interfaces for registering ML model commitments and verifying zero-knowledge proofs of their inferences on-chain.

**TL;DR:** Standard registry and verifier interfaces so smart contracts can accept zero-knowledge proofs that a specific, committed ML model produced a given output.

## What problem does it solve?

Smart contracts cannot run real machine-learning models, and they have no reason to trust a server that claims "the model said X". Today projects either trust a centralised API, shrink models until they fit on-chain, or rely on a committee.

Zero-knowledge ML (ZKML) lets a prover show that a particular model, run on particular inputs, produced a particular output, without revealing private inputs or weights. But every project wires this up differently. ERC-7992 standardizes the on-chain boundary: **which model** (a registry of commitments) and **is this inference valid** (a verifier with one function), independent of the proof system.

## How it works

**Registry (`IERCZKMLRegistry`).** An owner registers a `ModelCommitment` and gets a `modelId`. The commitment bundles:

- `modelHash` – weights and architecture
- `circuitHash` – the arithmetic circuit or AIR
- `vkHash` – the verifying key
- `proofSystemId` – first 4 bytes of `keccak256` of a canonical name such as `"groth16-bn254-v1"`
- `uri` – optional off-chain metadata

Only the owner may update or deprecate a model; `getModel` returns commitment, deprecation flag and owner.

**Verifier (`IERCZKMLVerifier`).** `verifyInference(modelId, inputCommitment, output, proof)` fetches the commitment, dispatches to the right proof system and **reverts on any failure**; returning normally means the proof is valid. It should emit `InferenceVerified`. Inputs are bound by a `bytes32` commitment that should include a nonce when replay matters; `output` is ABI-encoded bytes whose schema the consumer must agree on.

An optional storage extension, `verifyAndStoreInference`, records verified results under `keccak256(modelId, inputCommitment, output)` for later lookup.

## Sample code

Consuming a verified inference in a contract:

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

interface IERCZKMLVerifier {
    function verifyInference(uint256 modelId, bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external;
}

contract RiskGate {
    IERCZKMLVerifier public immutable verifier;
    uint256 public immutable modelId;
    mapping(bytes32 => bool) public used;

    constructor(IERCZKMLVerifier v, uint256 id) { verifier = v; modelId = id; }

    function act(bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external {
        require(!used[inputCommitment], "replay");
        used[inputCommitment] = true;
        verifier.verifyInference(modelId, inputCommitment, output, proof); // reverts if invalid
        uint256 score = abi.decode(output, (uint256));
        require(score < 500, "too risky");
        // ...proceed
    }
}
```

Computing a `proofSystemId` with ethers v6:

```ts
import { id } from "ethers";
const proofSystemId = id("groth16-bn254-v1").slice(0, 10); // bytes4
```

## Things to know

- **Status: Draft.** Names and error sets may still change.
- The verifier proves the computation matches the committed circuit; whether that circuit faithfully represents the model is an off-chain trust and audit question.
- Updating a model's commitment can change what proofs mean. Consumers should pin a `modelId` and check deprecation, as the spec advises.
- Ownership of a `modelId` must use some access-control scheme; [ERC-173](/eip-173/) is one option mentioned.
- Proof verification can be gas-heavy, so the spec keeps verification and storage as separate calls.


---

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