Class Groth16VerificationKey

Represents the verification key stored on-chain used to verify Groth16 proofs.

Implementation - Serialization

alphaG1: G1Bytes

The alpha * G, where G is the generator of G1

betaG2: G2Bytes

The alpha * H, where H is the generator of G2

deltaG2: G2Bytes

The delta * H, where H is the generator of G2

gammaAbcG1: [G1Bytes, G1Bytes]

The gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H, where H is the generator of G1

gammaG2: G2Bytes

The gamma * H, where H is the generator of G2

  • Converts the verification key to a JSON format compatible with snarkjs groth16.verify

    Returns {
        curve: string;
        IC: string[][];
        nPublic: number;
        protocol: string;
        vk_alpha_1: string[];
        vk_beta_2: [string, string][];
        vk_delta_2: [string, string][];
        vk_gamma_2: [string, string][];
    }

    An object containing the verification key in snarkjs format

Constructors

Methods

  • Calculates the hash of the serialized form of the verification key. This is useful for comparing verification keys or using them as unique identifiers.

    Returns Uint8Array

    The SHA3-256 hash of the serialized verification key as a Uint8Array

  • Verifies a Groth16 proof using the verification key given the public inputs hash and the proof.

    Parameters

    • args: { groth16Proof: Groth16Zkp; publicInputsHash: bigint }
      • groth16Proof: Groth16Zkp

        The Groth16 proof

      • publicInputsHash: bigint

        The public inputs hash

    Returns boolean

    true if the proof is valid

MMNEPVFCICPMFPCPTTAAATR