Expand description
§Verifier
This crate contains utilities for verifying SP1 Groth16 proofs on Solana.
§Example
use sp1_sdk::proof::SP1ProofWithPublicValues;
use sp1_solana::{verify_proof, GROTH16_VK_2_0_0_BYTES};
// Load the sp1_proof_with_public_values from a file.
let sp1_proof_with_public_values_file = "../proofs/fibonacci_proof.bin";
let sp1_proof_with_public_values =
SP1ProofWithPublicValues::load(&sp1_proof_with_public_values_file).unwrap();
// Fetch the proof and public inputs from the SP1ProofWithPublicValues.
let proof_bytes = sp1_proof_with_public_values.bytes();
let sp1_public_inputs = sp1_proof_with_public_values.public_values.to_vec();
// Typically, the vkey hash is computed from `vk.bytes32()` on the SP1 program's vkey.
let vkey_hash = "0x0083e8e370d7f0d1c463337f76c9a60b62ad7cc54c89329107c92c1e62097872";
verify_proof(&proof_bytes, &sp1_public_inputs, &vkey_hash, &GROTH16_VK_2_0_0_BYTES).unwrap();Constants§
- GROT
H16_ VK_ 2_ 0_ 0_ BYTES - GROT
H16_ VK_ 3_ 0_ 0_ BYTES - GROT
H16_ VK_ 3_ 0_ 0_ RC4_ BYTES - GROT
H16_ VK_ 4_ 0_ 0_ RC3_ BYTES - GROT
H16_ VK_ 5_ 0_ 0_ BYTES - Groth16 verification keys for different SP1 versions.
Functions§
- verify_
proof - Verifies a proof generated by [
SP1ProofWithPublicValues]. - verify_
proof_ raw - Verifies a proof using raw bytes, without any checks.