Contract 5a8560c0ea21f927a240b78f0b11504301523199429c045ebcc4d1184c611e99

← Back to Index 📥 Download WASM

Meta

rssdkver 25.1.1#94c2a3b3a5ded6b9cf9cef0c207bf8804f3eb294
rsver 1.91.1

Instances

  • CANHIRYKYPWJFOGRMSGLJGK46QOYXJ666WMDPNBXKZQBS4VNLZ7K6OVK

Interface

Verify a Groth16 proof with the stored verification key.

Arguments

  • proof - The Groth16 proof (A, B, C points)
  • public_inputs - Public inputs to the circuit

Returns

true if the proof is valid

fn verify(
    env: soroban_sdk::Env,
    proof: Proof,
    public_inputs: soroban_sdk::Vec,
) -> bool

Upgrade this contract to a new WASM (admin only).

fn upgrade(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), VerifierError>

Get the admin address.

fn get_admin(env: soroban_sdk::Env) -> Result

Initialize the contract with an admin address.

Must be called once after deployment. The admin can set the VK and upgrade.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
) -> Result<(), VerifierError>

Compute the linear combination of IC points with public inputs.

L = IC[0] + sum(inputs[i] * IC[i+1])

This is exposed for debugging and testing.

fn compute_vk_x(
    env: soroban_sdk::Env,
    ic: soroban_sdk::Vec>,
    public_inputs: soroban_sdk::Vec,
) -> soroban_sdk::BytesN<64>

Create a simple proof structure (for testing).

In production, proofs are generated off-chain by the prover.

fn create_proof(
    env: soroban_sdk::Env,
    a: soroban_sdk::BytesN<64>,
    b: soroban_sdk::BytesN<128>,
    c: soroban_sdk::BytesN<64>,
) -> Proof

Verify a Groth16 proof with a provided verification key.

Useful for one-off verifications or testing.

fn verify_with_vk(
    env: soroban_sdk::Env,
    vk: VerificationKey,
    proof: Proof,
    public_inputs: soroban_sdk::Vec,
) -> bool

Get the stored verification key.

fn get_verification_key(env: soroban_sdk::Env) -> Option

Store a verification key (admin only).

This should be called once after deployment with the VK generated from the trusted setup.

fn set_verification_key(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    vk: VerificationKey,
) -> Result<(), VerifierError>

Imports

WebAssembly Text (WAT) ▶