Verify a Groth16 proof with the stored verification key.
proof - The Groth16 proof (A, B, C points)public_inputs - Public inputs to the circuittrue 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>