ERC-7992 · Draft · ERC · 2025-07-23
ERC-7992: Verifiable ML Model Inference (ZKML)
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 architecturecircuitHash– the arithmetic circuit or AIRvkHash– the verifying keyproofSystemId– first 4 bytes ofkeccak256of 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:
// 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:
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
modelIdand check deprecation, as the spec advises. - Ownership of a
modelIdmust use some access-control scheme; ERC-173 is one option mentioned. - Proof verification can be gas-heavy, so the spec keeps verification and storage as separate calls.