{"eip":7992,"title":"Verifiable ML Model Inference (ZKML)","description":"Interfaces for registering ML model commitments and verifying zero-knowledge proofs of their inferences on-chain.","authors":["Aryaethn (@aryaethn)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2025-07-23","requires":[165],"discussionsTo":"https://ethereum-magicians.org/t/erc-7992-verifiable-ml-model-inference-zkml/24896","repo":"ERCs","label":"ERC-7992","officialUrl":"https://eips.ethereum.org/EIPS/eip-7992","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7992.md","url":"https://eips.huatuo.xyz/eip-7992/","tldr":{"en":"Standard registry and verifier interfaces so smart contracts can accept zero-knowledge proofs that a specific, committed ML model produced a given output.","ja":"スマートコントラクトが、特定のコミット済み ML モデルが所定の出力を生成したことを示すゼロ知識証明を受け入れられるようにする、標準的なレジストリと検証者のインターフェース。","ko":"스마트 컨트랙트가 특정한, 커밋된 ML 모델이 주어진 출력을 만들어 냈다는 영지식 증명을 받아들일 수 있게 하는 표준 레지스트리 및 검증자 인터페이스.","zh":"标准化的注册表与验证器接口，让智能合约可以接受零知识证明，证明某个特定的、已承诺的 ML 模型产生了给定的输出。"},"tags":["zk","zkml","ai","oracle","verifier"],"explainers":{"en":{"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"],"related":[165,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7992/","markdown":"## What problem does it solve?\n\nSmart 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.\n\nZero-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.\n\n## How it works\n\n**Registry (`IERCZKMLRegistry`).** An owner registers a `ModelCommitment` and gets a `modelId`. The commitment bundles:\n\n- `modelHash` – weights and architecture\n- `circuitHash` – the arithmetic circuit or AIR\n- `vkHash` – the verifying key\n- `proofSystemId` – first 4 bytes of `keccak256` of a canonical name such as `\"groth16-bn254-v1\"`\n- `uri` – optional off-chain metadata\n\nOnly the owner may update or deprecate a model; `getModel` returns commitment, deprecation flag and owner.\n\n**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.\n\nAn optional storage extension, `verifyAndStoreInference`, records verified results under `keccak256(modelId, inputCommitment, output)` for later lookup.\n\n## Sample code\n\nConsuming a verified inference in a contract:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERCZKMLVerifier {\n    function verifyInference(uint256 modelId, bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external;\n}\n\ncontract RiskGate {\n    IERCZKMLVerifier public immutable verifier;\n    uint256 public immutable modelId;\n    mapping(bytes32 =\u003e bool) public used;\n\n    constructor(IERCZKMLVerifier v, uint256 id) { verifier = v; modelId = id; }\n\n    function act(bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external {\n        require(!used[inputCommitment], \"replay\");\n        used[inputCommitment] = true;\n        verifier.verifyInference(modelId, inputCommitment, output, proof); // reverts if invalid\n        uint256 score = abi.decode(output, (uint256));\n        require(score \u003c 500, \"too risky\");\n        // ...proceed\n    }\n}\n```\n\nComputing a `proofSystemId` with ethers v6:\n\n```ts\nimport { id } from \"ethers\";\nconst proofSystemId = id(\"groth16-bn254-v1\").slice(0, 10); // bytes4\n```\n\n## Things to know\n\n- **Status: Draft.** Names and error sets may still change.\n- The verifier proves the computation matches the committed circuit; whether that circuit faithfully represents the model is an off-chain trust and audit question.\n- Updating a model's commitment can change what proofs mean. Consumers should pin a `modelId` and check deprecation, as the spec advises.\n- Ownership of a `modelId` must use some access-control scheme; [ERC-173](/eip-173/) is one option mentioned.\n- Proof verification can be gas-heavy, so the spec keeps verification and storage as separate calls.\n"},"ja":{"lang":"ja","tldr":"スマートコントラクトが、特定のコミット済み ML モデルが所定の出力を生成したことを示すゼロ知識証明を受け入れられるようにする、標準的なレジストリと検証者のインターフェース。","tags":["zk","zkml","ai","oracle","verifier"],"related":[165,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7992/","markdown":"## 何を解決するのか\n\nスマートコントラクトは実際の機械学習モデルを実行できず、「モデルは X と答えた」と主張するサーバーを信頼する理由もありません。現状、プロジェクトは中央集権的な API を信頼するか、オンチェーンに収まるようモデルを縮小するか、委員会に頼っています。\n\nゼロ知識 ML（ZKML）を使うと、証明者は、特定のモデルが特定の入力に対して特定の出力を生成したことを、非公開の入力や重みを明かさずに示せます。しかし、その接続方法はプロジェクトごとにばらばらです。ERC-7992 は、証明システムに依存しないオンチェーン側の境界を標準化します。**どのモデルか**（コミットメントのレジストリ）と、**この推論は有効か**（1 つの関数を持つ検証者）です。\n\n## 仕組み\n\n**レジストリ（`IERCZKMLRegistry`）。** オーナーが `ModelCommitment` を登録し、`modelId` を受け取ります。コミットメントには次が含まれます。\n\n- `modelHash` – 重みとアーキテクチャ\n- `circuitHash` – 算術回路または AIR\n- `vkHash` – 検証鍵\n- `proofSystemId` – `\"groth16-bn254-v1\"` のような正規名の `keccak256` の先頭 4 バイト\n- `uri` – 任意のオフチェーンメタデータ\n\nモデルを更新または非推奨にできるのはオーナーだけです。`getModel` はコミットメント、非推奨フラグ、オーナーを返します。\n\n**検証者（`IERCZKMLVerifier`）。** `verifyInference(modelId, inputCommitment, output, proof)` はコミットメントを取得し、適切な証明システムに処理を振り分け、**失敗時は常に revert します**。正常に戻れば証明は有効です。`InferenceVerified` を emit すべきです。入力は `bytes32` のコミットメントで束縛され、リプレイが問題になる場合は nonce を含めるべきです。`output` は ABI エンコードされたバイト列で、そのスキーマは利用側が合意しておく必要があります。\n\n任意のストレージ拡張 `verifyAndStoreInference` は、検証済みの結果を `keccak256(modelId, inputCommitment, output)` をキーに記録し、後から参照できるようにします。\n\n## サンプルコード\n\nコントラクトで検証済みの推論を利用する例:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERCZKMLVerifier {\n    function verifyInference(uint256 modelId, bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external;\n}\n\ncontract RiskGate {\n    IERCZKMLVerifier public immutable verifier;\n    uint256 public immutable modelId;\n    mapping(bytes32 =\u003e bool) public used;\n\n    constructor(IERCZKMLVerifier v, uint256 id) { verifier = v; modelId = id; }\n\n    function act(bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external {\n        require(!used[inputCommitment], \"replay\");\n        used[inputCommitment] = true;\n        verifier.verifyInference(modelId, inputCommitment, output, proof); // reverts if invalid\n        uint256 score = abi.decode(output, (uint256));\n        require(score \u003c 500, \"too risky\");\n        // ...proceed\n    }\n}\n```\n\nethers v6 で `proofSystemId` を計算する:\n\n```ts\nimport { id } from \"ethers\";\nconst proofSystemId = id(\"groth16-bn254-v1\").slice(0, 10); // bytes4\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** 名前やエラーセットは今後変わる可能性があります。\n- 検証者が証明するのは、計算がコミット済みの回路と一致することです。その回路がモデルを忠実に表しているかどうかは、オフチェーンの信頼と監査の問題です。\n- モデルのコミットメントを更新すると、証明の意味が変わる可能性があります。仕様が勧めるとおり、利用側は `modelId` を固定し、非推奨かどうかを確認すべきです。\n- `modelId` の所有権には何らかのアクセス制御の仕組みが必要です。[ERC-173](/eip-173/) が選択肢の 1 つとして挙げられています。\n- 証明の検証はガスを多く消費する場合があるため、仕様では検証と保存を別々の呼び出しにしています。\n"},"ko":{"lang":"ko","tldr":"스마트 컨트랙트가 특정한, 커밋된 ML 모델이 주어진 출력을 만들어 냈다는 영지식 증명을 받아들일 수 있게 하는 표준 레지스트리 및 검증자 인터페이스.","tags":["zk","zkml","ai","oracle","verifier"],"related":[165,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7992/","markdown":"## 어떤 문제를 해결하나요?\n\n스마트 컨트랙트는 실제 머신러닝 모델을 실행할 수 없고, \"모델이 X라고 했다\"고 주장하는 서버를 믿을 이유도 없습니다. 지금은 프로젝트들이 중앙화된 API를 신뢰하거나, 온체인에 들어가도록 모델을 줄이거나, 위원회에 의존합니다.\n\n영지식 ML(ZKML)을 쓰면 증명자는 특정 모델이 특정 입력에 대해 특정 출력을 만들었음을 비공개 입력이나 가중치를 드러내지 않고 보일 수 있습니다. 하지만 프로젝트마다 이를 연결하는 방식이 제각각입니다. ERC-7992는 증명 시스템과 무관하게 온체인 경계를 표준화합니다. **어떤 모델인지**(커밋먼트 레지스트리)와 **이 추론이 유효한지**(함수 하나짜리 검증자)입니다.\n\n## 어떻게 동작하나요?\n\n**레지스트리(`IERCZKMLRegistry`).** 소유자가 `ModelCommitment`를 등록하고 `modelId`를 받습니다. 커밋먼트에는 다음이 들어 있습니다.\n\n- `modelHash` – 가중치와 아키텍처\n- `circuitHash` – 산술 회로 또는 AIR\n- `vkHash` – 검증 키\n- `proofSystemId` – `\"groth16-bn254-v1\"` 같은 정규 이름의 `keccak256` 앞 4바이트\n- `uri` – 선택적 오프체인 메타데이터\n\n모델을 업데이트하거나 폐기 예정으로 표시할 수 있는 것은 소유자뿐이며, `getModel`은 커밋먼트, 폐기 예정 플래그, 소유자를 반환합니다.\n\n**검증자(`IERCZKMLVerifier`).** `verifyInference(modelId, inputCommitment, output, proof)`는 커밋먼트를 가져와 알맞은 증명 시스템으로 전달하고 **실패하면 항상 revert**합니다. 정상적으로 반환되면 증명이 유효하다는 뜻입니다. `InferenceVerified`를 emit해야 합니다. 입력은 `bytes32` 커밋먼트로 묶이며, 리플레이가 문제가 되는 경우 nonce를 포함해야 합니다. `output`은 ABI 인코딩된 바이트이고 그 스키마는 사용하는 쪽이 미리 합의해야 합니다.\n\n선택적 스토리지 확장인 `verifyAndStoreInference`는 검증된 결과를 `keccak256(modelId, inputCommitment, output)` 키로 기록해 나중에 조회할 수 있게 합니다.\n\n## 샘플 코드\n\n컨트랙트에서 검증된 추론 사용하기:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERCZKMLVerifier {\n    function verifyInference(uint256 modelId, bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external;\n}\n\ncontract RiskGate {\n    IERCZKMLVerifier public immutable verifier;\n    uint256 public immutable modelId;\n    mapping(bytes32 =\u003e bool) public used;\n\n    constructor(IERCZKMLVerifier v, uint256 id) { verifier = v; modelId = id; }\n\n    function act(bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external {\n        require(!used[inputCommitment], \"replay\");\n        used[inputCommitment] = true;\n        verifier.verifyInference(modelId, inputCommitment, output, proof); // reverts if invalid\n        uint256 score = abi.decode(output, (uint256));\n        require(score \u003c 500, \"too risky\");\n        // ...proceed\n    }\n}\n```\n\nethers v6로 `proofSystemId` 계산하기:\n\n```ts\nimport { id } from \"ethers\";\nconst proofSystemId = id(\"groth16-bn254-v1\").slice(0, 10); // bytes4\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 이름과 에러 집합은 아직 바뀔 수 있습니다.\n- 검증자가 증명하는 것은 계산이 커밋된 회로와 일치한다는 점입니다. 그 회로가 모델을 충실히 나타내는지는 오프체인의 신뢰와 감사 문제입니다.\n- 모델의 커밋먼트를 업데이트하면 증명의 의미가 달라질 수 있습니다. 스펙의 조언대로 사용하는 쪽은 `modelId`를 고정하고 폐기 예정 여부를 확인해야 합니다.\n- `modelId`의 소유권에는 어떤 접근 제어 방식이든 써야 합니다. [ERC-173](/eip-173/)이 언급된 선택지 중 하나입니다.\n- 증명 검증은 가스를 많이 쓸 수 있으므로, 스펙은 검증과 저장을 별도 호출로 나눠 두었습니다.\n"},"zh":{"lang":"zh","tldr":"标准化的注册表与验证器接口，让智能合约可以接受零知识证明，证明某个特定的、已承诺的 ML 模型产生了给定的输出。","tags":["zk","zkml","ai","oracle","verifier"],"related":[165,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7992/","markdown":"## 它解决什么问题？\n\n智能合约无法运行真正的机器学习模型，也没有理由信任一个声称“模型说了 X”的服务器。如今各项目要么信任中心化 API，要么把模型缩小到能放进链上，要么依赖委员会。\n\n零知识机器学习（ZKML）让证明者可以证明：某个特定模型在特定输入上产生了特定输出，同时不泄露私有输入或权重。但每个项目的对接方式都不一样。ERC-7992 标准化了链上的边界：**哪个模型**（承诺的注册表）以及**这次推理是否有效**（只有一个函数的验证器），与证明系统无关。\n\n## 它如何运作\n\n**注册表（`IERCZKMLRegistry`）。** 所有者注册一个 `ModelCommitment` 并获得 `modelId`。该承诺包含：\n\n- `modelHash` – 权重和架构\n- `circuitHash` – 算术电路或 AIR\n- `vkHash` – 验证密钥\n- `proofSystemId` – 规范名称（如 `\"groth16-bn254-v1\"`）的 `keccak256` 的前 4 字节\n- `uri` – 可选的链下元数据\n\n只有所有者可以更新或弃用模型；`getModel` 返回承诺、弃用标志和所有者。\n\n**验证器（`IERCZKMLVerifier`）。** `verifyInference(modelId, inputCommitment, output, proof)` 获取承诺，分派到正确的证明系统，并在**任何失败时 revert**；正常返回即表示证明有效。它应当触发 `InferenceVerified`。输入通过一个 `bytes32` 承诺绑定，在需要防重放时应包含 nonce；`output` 是 ABI 编码的字节，其模式需由使用方事先约定。\n\n可选的存储扩展 `verifyAndStoreInference` 会以 `keccak256(modelId, inputCommitment, output)` 为键记录已验证的结果，供之后查询。\n\n## 示例代码\n\n在合约中使用已验证的推理：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERCZKMLVerifier {\n    function verifyInference(uint256 modelId, bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external;\n}\n\ncontract RiskGate {\n    IERCZKMLVerifier public immutable verifier;\n    uint256 public immutable modelId;\n    mapping(bytes32 =\u003e bool) public used;\n\n    constructor(IERCZKMLVerifier v, uint256 id) { verifier = v; modelId = id; }\n\n    function act(bytes32 inputCommitment, bytes calldata output, bytes calldata proof) external {\n        require(!used[inputCommitment], \"replay\");\n        used[inputCommitment] = true;\n        verifier.verifyInference(modelId, inputCommitment, output, proof); // reverts if invalid\n        uint256 score = abi.decode(output, (uint256));\n        require(score \u003c 500, \"too risky\");\n        // ...proceed\n    }\n}\n```\n\n用 ethers v6 计算 `proofSystemId`：\n\n```ts\nimport { id } from \"ethers\";\nconst proofSystemId = id(\"groth16-bn254-v1\").slice(0, 10); // bytes4\n```\n\n## 需要注意\n\n- **状态：Draft。** 名称和错误集合仍可能改变。\n- 验证器证明的是计算与已承诺的电路一致；该电路是否忠实地表示了模型，则是链下的信任与审计问题。\n- 更新模型的承诺可能改变证明的含义。如规范所建议，使用方应固定一个 `modelId` 并检查是否已弃用。\n- `modelId` 的所有权必须采用某种访问控制方案；[ERC-173](/eip-173/) 是提到的一种选择。\n- 证明验证可能消耗大量 gas，因此规范把验证和存储作为两个独立的调用。\n"}}}
