EIPs Explained

ERC-1923 · Stagnant · ERC · 2018-12-22

ERC-1923: zk-SNARK Verifier Registry Standard

An unfinished proposal for a standard on-chain registry where zk-SNARK verifying keys, verifier contracts, proofs and their verification results are recorded.

What problem does it solve?

zk-SNARKs let someone prove a statement is true without revealing the underlying data. They are used for private transactions, private computation and rollup-style scaling. On Ethereum, verification is made affordable by the elliptic-curve precompiles from EIP-196 and EIP-197.

In 2018 every project deployed its own verifier contract with its own API, and the limited information emitted during verification was in a different shape each time. ERC-1923 proposes a single Verifier Registry interface through which verifying keys, verifier contracts and proofs are registered, so applications and observers can interact with and read verification activity in a uniform way.

How it works

The registry tracks three things, each identified by a hash:

  • Verifier contracts, registered with registerVerifierContract(address).
  • Verifying keys (VKs), registered with registerVk(vk, verifierContracts), which returns a vkId. getVk(vkId) reads one back.
  • Proofs, submitted with submitProof(proof, inputs, vkId[, verifier]), which returns a proofId.

Verification can happen in two ways:

  • Directly: submitProofAndVerify(...) runs the verifier on-chain and records the result.
  • By attestation: a verifier posts a result with attestProof or in bulk with attestProofs. Anyone can dispute it with challengeAttestation, which re-runs the check on-chain.

Events (NewVkRegistered, NewVerifierContractRegistered, NewProofSubmitted, NewAttestation) let off-chain tools follow everything. createNewVkId and createNewProofId are pure helpers that compute the IDs.

Sample code

The core of the interface (modernized syntax; the draft's interface ID is still a placeholder):

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

interface IVerifierRegistry /* is ERC165 */ {
    event NewVkRegistered(bytes32 indexed vkId);
    event NewProofSubmitted(bytes32 indexed proofId, uint256[] proof, uint64[] inputs);
    event NewAttestation(bytes32 indexed proofId, address indexed verifier, bool indexed result);

    function registerVerifierContract(address verifier) external returns (bool);
    function registerVk(uint256[] calldata vk, address[] calldata verifiers) external returns (bytes32);

    function submitProofAndVerify(
        uint256[] calldata proof,
        uint64[] calldata inputs,
        bytes32 vkId,
        address verifier
    ) external returns (bytes32 proofId);

    function attestProof(bytes32 proofId, bytes32 vkId, bool result) external;
    function challengeAttestation(
        bytes32 proofId, uint256[] calldata proof, uint64[] calldata inputs, address verifier
    ) external;
}

Things to know

  • Status: Stagnant. The document is visibly incomplete: the abstract, rationale, backwards compatibility and the ERC-165 interface ID are all marked TODO, and the interface is still named EIP-XXXX.
  • The referenced example implementations are labelled as not for production use.
  • Public inputs are typed as uint64[], which is narrower than the field elements most modern proving systems use. Check carefully before building on it.
  • In practice, zk projects today ship their own verifier contracts (often generated by tools such as snarkjs or circuit compilers) rather than using a shared registry.

#zk-snark #zero-knowledge #privacy #registry #verifier

Details

Authors
Michael Connor <[email protected]>, Chaitanya Konda <[email protected]>, Duncan Westland <[email protected]>
Status
Stagnant
Type
Standards Track / ERC
Created
2018-12-22
Requires

Machine-readable: Markdown · JSON