{"eip":1922,"title":"zk-SNARK Verifier Standard","description":"A standard interface for \"Verifier\" contracts which verify zk-SNARKs.","authors":["Michael Connor \u003cmichael.connor@uk.ey.com\u003e","Chaitanya Konda \u003cchaitanya.konda@uk.ey.com\u003e","Duncan Westland \u003cduncan.westland@uk.ey.com\u003e"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-09-14","requires":[165,196,197],"discussionsTo":"https://github.com/ethereum/EIPs/issues/1922","repo":"ERCs","label":"ERC-1922","officialUrl":"https://eips.ethereum.org/EIPS/eip-1922","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1922.md","url":"https://eips.huatuo.xyz/eip-1922/","tldr":{"en":"Proposes one generic verify(proof, inputs, verificationKeyId) function for on-chain zk-SNARK verifier contracts, so applications can call any verifier the same way.","ja":"オンチェーンの zk-SNARK 検証コントラクト向けに、汎用の verify(proof, inputs, verificationKeyId) 関数を 1 つ提案する。アプリケーションがどの検証コントラクトも同じ方法で呼び出せるようにする。","ko":"온체인 zk-SNARK 검증자(verifier) 컨트랙트를 위한 범용 verify(proof, inputs, verificationKeyId) 함수 하나를 제안한다. 애플리케이션이 어떤 검증자든 같은 방식으로 호출할 수 있게 한다.","zh":"为链上 zk-SNARK 验证者合约提出一个通用的 verify(proof, inputs, verificationKeyId) 函数，使应用可以用同样的方式调用任何验证者。"},"tags":["zk-snark","zero-knowledge","verifier","privacy","interface"],"explainers":{"en":{"lang":"en","tldr":"Proposes one generic verify(proof, inputs, verificationKeyId) function for on-chain zk-SNARK verifier contracts, so applications can call any verifier the same way.","tags":["zk-snark","zero-knowledge","verifier","privacy","interface"],"related":[165,196,197,1108],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1922/","markdown":"## What problem does it solve?\n\nzk-SNARKs let someone prove a statement about private data, for example \"this transaction is valid\", without revealing the data. On Ethereum, the proof is checked by a **verifier contract**, typically using the alt_bn128 pairing precompiles ([EIP-196](/eip-196/), [EIP-197](/eip-197/)).\n\nEach proving system and each tool generated verifiers with its own function signature and its own way of passing the proof. ERC-1922, originally proposed by EY, defines one minimal interface so that private-transaction, private-computation and scaling applications can call any compliant verifier in the same way.\n\n## How it works\n\nThe standard has a single required function, alongside [ERC-165](/eip-165/) interface detection:\n\n```\nverify(uint256[] proof, uint256[] inputs, bytes32 verificationKeyId) returns (bool)\n```\n\n- `proof`: the proof flattened into a one-dimensional `uint256` array. A dynamic array is used because different proving schemes (the spec mentions PGHR13, Groth16 and GM17) produce proofs of different sizes. The contract decides how to unflatten it.\n- `inputs`: the public inputs to the circuit, also as `uint256[]`.\n- `verificationKeyId`: which circuit this proof is for. Verification keys are stored on-chain once, and callers refer to them by a `bytes32` ID rather than re-sending the key every time. How IDs are assigned is up to the implementation; how keys are loaded is out of scope.\n\n`verify` must return `true` for a valid proof and `false` otherwise.\n\n## Sample code\n\nThe interface, and an application that only accepts actions backed by a valid proof:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IZkVerifier /* is ERC165 */ {\n    function verify(\n        uint256[] calldata proof,\n        uint256[] calldata inputs,\n        bytes32 verificationKeyId\n    ) external returns (bool result);\n}\n\ncontract PrivateVoting {\n    IZkVerifier public immutable verifier;\n    bytes32 public immutable voteCircuit;\n    mapping(uint256 =\u003e bool) public nullifierUsed;\n\n    constructor(IZkVerifier v, bytes32 vkId) {\n        verifier = v;\n        voteCircuit = vkId;\n    }\n\n    function castVote(uint256[] calldata proof, uint256[] calldata inputs) external {\n        uint256 nullifier = inputs[0];\n        require(!nullifierUsed[nullifier], \"already voted\");\n        require(verifier.verify(proof, inputs, voteCircuit), \"invalid proof\");\n        nullifierUsed[nullifier] = true;\n        // ... record the vote from inputs[1]\n    }\n}\n```\n\n## Things to know\n\n- **Status: Stagnant.** The spec still contains many TODOs, and it never calculated its own ERC-165 interface ID.\n- `verify` is declared non-`view`, so implementations may emit events or record state, but callers cannot rely on a `staticcall`.\n- The standard does not cover loading verification keys or the trusted setup; any secret setup randomness (\"toxic waste\") must be destroyed, or false proofs become possible.\n- Generated verifiers from common tools (the spec names ZoKrates) did not follow this interface, and current tooling generally emits its own verifier signatures. Pairing gas costs were later reduced by [EIP-1108](/eip-1108/).\n"},"ja":{"lang":"ja","tldr":"オンチェーンの zk-SNARK 検証コントラクト向けに、汎用の verify(proof, inputs, verificationKeyId) 関数を 1 つ提案する。アプリケーションがどの検証コントラクトも同じ方法で呼び出せるようにする。","tags":["zk-snark","zero-knowledge","verifier","privacy","interface"],"related":[165,196,197,1108],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1922/","markdown":"## 何を解決するのか\n\nzk-SNARK を使うと、プライベートなデータについての主張、たとえば「このトランザクションは有効である」を、データを明かさずに証明できます。Ethereum では、証明は**検証コントラクト（verifier contract）**によって確認されます。通常は alt_bn128 のペアリングプリコンパイル（[EIP-196](/eip-196/)、[EIP-197](/eip-197/)）を使います。\n\n証明システムごと、ツールごとに、独自の関数シグネチャと独自の証明の渡し方を持つ検証コントラクトが生成されていました。もともと EY が提案した ERC-1922 は、プライベートトランザクション、プライベート計算、スケーリングのアプリケーションが、準拠するどの検証コントラクトも同じ方法で呼び出せるように、最小限のインターフェースを 1 つ定義します。\n\n## 仕組み\n\nこの標準には、[ERC-165](/eip-165/) のインターフェース検出とあわせて、必須の関数が 1 つだけあります。\n\n```\nverify(uint256[] proof, uint256[] inputs, bytes32 verificationKeyId) returns (bool)\n```\n\n- `proof`: 1 次元の `uint256` 配列に平坦化された証明。証明方式（仕様では PGHR13、Groth16、GM17 に言及）によって証明のサイズが異なるため、動的配列が使われます。どう元に戻すかはコントラクトが決めます。\n- `inputs`: 回路への公開入力で、これも `uint256[]` です。\n- `verificationKeyId`: この証明がどの回路のものか。検証鍵は 1 回だけオンチェーンに保存され、呼び出し側は毎回鍵を送り直すのではなく、`bytes32` の ID で参照します。ID の割り当て方は実装に任されており、鍵の読み込み方は対象外です。\n\n`verify` は、有効な証明には `true` を、そうでなければ `false` を返さなければなりません。\n\n## サンプルコード\n\nインターフェースと、有効な証明に裏付けられたアクションだけを受け付けるアプリケーションです。\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IZkVerifier /* is ERC165 */ {\n    function verify(\n        uint256[] calldata proof,\n        uint256[] calldata inputs,\n        bytes32 verificationKeyId\n    ) external returns (bool result);\n}\n\ncontract PrivateVoting {\n    IZkVerifier public immutable verifier;\n    bytes32 public immutable voteCircuit;\n    mapping(uint256 =\u003e bool) public nullifierUsed;\n\n    constructor(IZkVerifier v, bytes32 vkId) {\n        verifier = v;\n        voteCircuit = vkId;\n    }\n\n    function castVote(uint256[] calldata proof, uint256[] calldata inputs) external {\n        uint256 nullifier = inputs[0];\n        require(!nullifierUsed[nullifier], \"already voted\");\n        require(verifier.verify(proof, inputs, voteCircuit), \"invalid proof\");\n        nullifierUsed[nullifier] = true;\n        // ... inputs[1] から投票を記録する\n    }\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** 仕様にはまだ多くの TODO が残っており、自身の ERC-165 インターフェース ID も計算されていません。\n- `verify` は `view` ではないと宣言されているため、実装はイベントを emit したりステートを記録したりできますが、呼び出し側は `staticcall` に頼れません。\n- この標準は検証鍵の読み込みやトラステッドセットアップを対象としていません。秘密のセットアップ用乱数（「toxic waste」）は破棄しなければならず、そうしないと偽の証明が可能になります。\n- 一般的なツール（仕様では ZoKrates を挙げています）が生成する検証コントラクトはこのインターフェースに従っておらず、現在のツールは通常、独自の検証コントラクトのシグネチャを出力します。ペアリングのガスコストは、後に [EIP-1108](/eip-1108/) によって引き下げられました。\n"},"ko":{"lang":"ko","tldr":"온체인 zk-SNARK 검증자(verifier) 컨트랙트를 위한 범용 verify(proof, inputs, verificationKeyId) 함수 하나를 제안한다. 애플리케이션이 어떤 검증자든 같은 방식으로 호출할 수 있게 한다.","tags":["zk-snark","zero-knowledge","verifier","privacy","interface"],"related":[165,196,197,1108],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1922/","markdown":"## 어떤 문제를 해결하나요?\n\nzk-SNARK를 사용하면 비공개 데이터에 대한 진술, 예를 들어 \"이 트랜잭션은 유효하다\"를 데이터를 드러내지 않고 증명할 수 있습니다. 이더리움에서는 증명을 **검증자 컨트랙트(verifier contract)**가 확인하며, 보통 alt_bn128 페어링 프리컴파일([EIP-196](/eip-196/), [EIP-197](/eip-197/))을 사용합니다.\n\n증명 시스템마다, 도구마다 자체 함수 시그니처와 자체 증명 전달 방식을 가진 검증자를 생성했습니다. 원래 EY가 제안한 ERC-1922는 프라이빗 트랜잭션, 프라이빗 연산, 확장성(scaling) 애플리케이션이 표준을 따르는 어떤 검증자든 같은 방식으로 호출할 수 있도록 최소한의 인터페이스 하나를 정의합니다.\n\n## 어떻게 동작하나요?\n\n이 표준에는 [ERC-165](/eip-165/) 인터페이스 감지와 함께 필수 함수가 하나뿐입니다.\n\n```\nverify(uint256[] proof, uint256[] inputs, bytes32 verificationKeyId) returns (bool)\n```\n\n- `proof`: 1차원 `uint256` 배열로 평탄화된 증명. 증명 방식(명세는 PGHR13, Groth16, GM17을 언급)에 따라 증명의 크기가 다르기 때문에 동적 배열을 사용합니다. 이를 어떻게 다시 펼칠지는 컨트랙트가 결정합니다.\n- `inputs`: 회로의 공개 입력으로, 역시 `uint256[]`입니다.\n- `verificationKeyId`: 이 증명이 어떤 회로를 위한 것인지. 검증 키는 온체인에 한 번만 저장되고, 호출자는 매번 키를 다시 보내는 대신 `bytes32` ID로 참조합니다. ID를 어떻게 할당할지는 구현에 달려 있고, 키를 어떻게 불러오는지는 범위 밖입니다.\n\n`verify`는 유효한 증명에는 `true`를, 그렇지 않으면 `false`를 반환해야 합니다.\n\n## 샘플 코드\n\n인터페이스와, 유효한 증명이 뒷받침하는 액션만 받아들이는 애플리케이션입니다.\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IZkVerifier /* is ERC165 */ {\n    function verify(\n        uint256[] calldata proof,\n        uint256[] calldata inputs,\n        bytes32 verificationKeyId\n    ) external returns (bool result);\n}\n\ncontract PrivateVoting {\n    IZkVerifier public immutable verifier;\n    bytes32 public immutable voteCircuit;\n    mapping(uint256 =\u003e bool) public nullifierUsed;\n\n    constructor(IZkVerifier v, bytes32 vkId) {\n        verifier = v;\n        voteCircuit = vkId;\n    }\n\n    function castVote(uint256[] calldata proof, uint256[] calldata inputs) external {\n        uint256 nullifier = inputs[0];\n        require(!nullifierUsed[nullifier], \"already voted\");\n        require(verifier.verify(proof, inputs, voteCircuit), \"invalid proof\");\n        nullifierUsed[nullifier] = true;\n        // ... inputs[1]에서 투표를 기록\n    }\n}\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** 명세에는 아직 TODO가 많이 남아 있고, 자체 ERC-165 인터페이스 ID도 계산된 적이 없습니다.\n- `verify`는 `view`가 아닌 것으로 선언되어 있으므로 구현이 이벤트를 emit하거나 상태를 기록할 수 있지만, 호출자는 `staticcall`에 의존할 수 없습니다.\n- 이 표준은 검증 키 로딩이나 신뢰 설정(trusted setup)을 다루지 않습니다. 비밀 설정 난수(\"toxic waste\")는 반드시 파기되어야 하며, 그렇지 않으면 위조된 증명이 가능해집니다.\n- 일반적인 도구(명세는 ZoKrates를 언급)가 생성한 검증자는 이 인터페이스를 따르지 않았고, 현재의 도구는 대체로 자체 검증자 시그니처를 내보냅니다. 페어링 가스 비용은 이후 [EIP-1108](/eip-1108/)로 낮아졌습니다.\n"},"zh":{"lang":"zh","tldr":"为链上 zk-SNARK 验证者合约提出一个通用的 verify(proof, inputs, verificationKeyId) 函数，使应用可以用同样的方式调用任何验证者。","tags":["zk-snark","zero-knowledge","verifier","privacy","interface"],"related":[165,196,197,1108],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1922/","markdown":"## 它解决什么问题？\n\nzk-SNARK 让人可以在不泄露数据的情况下，证明关于私有数据的某个陈述，例如\"这笔交易是有效的\"。在以太坊上，证明由**验证者合约（verifier contract）**检查，通常使用 alt_bn128 配对预编译（[EIP-196](/eip-196/)、[EIP-197](/eip-197/)）。\n\n每种证明系统和每个工具生成的验证者都有自己的函数签名和自己传递证明的方式。ERC-1922 最初由 EY 提出，它定义了一个最小接口，使隐私交易、隐私计算和扩容类应用可以用同样的方式调用任何符合标准的验证者。\n\n## 它如何运作\n\n该标准只有一个必需函数，并配合 [ERC-165](/eip-165/) 接口检测：\n\n```\nverify(uint256[] proof, uint256[] inputs, bytes32 verificationKeyId) returns (bool)\n```\n\n- `proof`：被展平成一维 `uint256` 数组的证明。之所以使用动态数组，是因为不同的证明方案（规范提到 PGHR13、Groth16 和 GM17）产生的证明大小不同。如何还原由合约决定。\n- `inputs`：电路的公开输入，同样是 `uint256[]`。\n- `verificationKeyId`：这份证明对应哪个电路。验证密钥只需在链上存储一次，调用方用 `bytes32` 的 ID 来引用它们，而不是每次都重新发送密钥。ID 如何分配由具体实现决定；密钥如何加载不在范围之内。\n\n`verify` 对有效证明必须返回 `true`，否则返回 `false`。\n\n## 示例代码\n\n接口，以及一个只接受有有效证明支持的操作的应用：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IZkVerifier /* is ERC165 */ {\n    function verify(\n        uint256[] calldata proof,\n        uint256[] calldata inputs,\n        bytes32 verificationKeyId\n    ) external returns (bool result);\n}\n\ncontract PrivateVoting {\n    IZkVerifier public immutable verifier;\n    bytes32 public immutable voteCircuit;\n    mapping(uint256 =\u003e bool) public nullifierUsed;\n\n    constructor(IZkVerifier v, bytes32 vkId) {\n        verifier = v;\n        voteCircuit = vkId;\n    }\n\n    function castVote(uint256[] calldata proof, uint256[] calldata inputs) external {\n        uint256 nullifier = inputs[0];\n        require(!nullifierUsed[nullifier], \"already voted\");\n        require(verifier.verify(proof, inputs, voteCircuit), \"invalid proof\");\n        nullifierUsed[nullifier] = true;\n        // ... 根据 inputs[1] 记录投票\n    }\n}\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 规范中仍有许多 TODO，而且它从未计算出自己的 ERC-165 接口 ID。\n- `verify` 被声明为非 `view`，因此实现可以发出事件或记录状态，但调用方不能依赖 `staticcall`。\n- 该标准不涉及验证密钥的加载或可信设置（trusted setup）；任何秘密的设置随机数（\"toxic waste\"）都必须销毁，否则就有可能伪造证明。\n- 常见工具（规范提到 ZoKrates）生成的验证者并未遵循这一接口，目前的工具通常输出自己的验证者签名。配对的 gas 成本后来被 [EIP-1108](/eip-1108/) 降低了。\n"}}}
