ERC-1923 zk-SNARK Verifier Registry (zk-SNARK Verifier Registry Standard)

Stagnant · Other · created 2018-12-22

A standard that registers zk-SNARK proofs, verifying keys, and verification results in a single registry contract, so that apps using zero-knowledge proofs can record and look up proof-related information in a common way.

Why it is needed

zk-SNARKs can prove that a transaction or computation was performed correctly without revealing its contents, so they can be used for private transactions, private contract operations, and scaling solutions that batch multiple transactions together. However, if the way proofs are registered and verified differs from app to app, it becomes difficult for other contracts or services to determine which proof was actually verified with which verifying key. Since the information left on the blockchain during verification is limited, without a common registry, applications implementing private transactions or scaling solutions struggle to extract and interpret proof-related information.

What to implement

In depth

Role of the Registry

This standard defines an API for registering all zk-SNARK (zero-knowledge proof) verification activity in a single registry contract. It specifies ERC-165, ERC-196, and ERC-197 as requirements; ERC-196 and ERC-197 are precompiles for addition, scalar multiplication, and pairing operations on the alt_bn128 elliptic curve, used in zk-SNARK verification computations. The original text lists private transactions, private operations, and scalability through transaction batching as the main use cases.

Verifying Key (vk) and vkId

registerVk(uint256[] _vk, address[] _verifierContracts) registers a verifying key, designates the list of verifier contracts that will use it, and returns a bytes32 vkId. getVk(bytes32 _vkId) looks up a registered verifying key. createNewVkId(uint256[] _vk) is a pure function that computes a vkId from a verifying key. Registration triggers a NewVkRegistered event.

Proof Submission and proofId

submitProof is defined in two forms. One takes only (proof, inputs, vkId), and the other also takes a verifier contract address. Both return a bytes32 proofId. createNewProofId(uint256[] _proof, uint64[] _inputs) is a pure function that computes a proofId from a proof and its inputs, and submission triggers a NewProofSubmitted event.

Verifier Contract Registration

registerVerifierContract(address _verifierContract) registers in the registry the address of the contract that will perform the actual verification computation, returns a bool, and triggers a NewVerifierContractRegistered event upon registration. submitProofAndVerify performs proof submission and verification via the verifier contract in a single call.

Attestation of Verification Results

attestProof(bytes32 _proofId, bytes32 _vkId, bool _result) records the verification result (true or false) for a given proof in the registry. attestProofs takes arrays of proofId, vkId, and results to attest multiple proofs at once. In both cases a NewAttestation event is triggered, exposing proofId, the verifier address, and the result, all as indexed fields.

Challenge Procedure

challengeAttestation(bytes32 _proofId, uint256[] _proof, uint64[] _inputs, address _verifierContract) is a function for challenging an already recorded verification result. The original text defines only this function's signature and gives no concrete explanation of the follow-up process after a challenge or how the outcome is reflected.

ERC-165 Support

The interface is specified to inherit from ERC-165 (`is ERC165`), and the specification includes a separate ERC165 interface with a supportsInterface(bytes4 interfaceID) function. However, the original text leaves as a TODO that the ERC-165 interface identifier value for this standard itself has not yet been determined.

Current status of the standard

This ERC is in Stagnant status. Several sections, including Motivation, Rationale, Backwards Compatibility, Test Cases, Implementations, and References, remain as TODOs, and the interface name and ERC-165 identifier value have not been finalized either. The referenced example implementation is also explicitly stated in the original text not to be used in production, making this a proposal that stalled without further refinement or completion.

Original ERC · ← ERCs