pub struct Groth16Verifier;Expand description
A verifier for Groth16 zero-knowledge proofs.
Implementations§
Source§impl Groth16Verifier
impl Groth16Verifier
Sourcepub fn verify(
proof: &[u8],
sp1_public_inputs: &[u8],
sp1_vkey_hash: &str,
groth16_vk: &[u8],
) -> Result<(), Groth16Error>
pub fn verify( proof: &[u8], sp1_public_inputs: &[u8], sp1_vkey_hash: &str, groth16_vk: &[u8], ) -> Result<(), Groth16Error>
Verifies an SP1 Groth16 proof, as generated by the SP1 SDK.
§Arguments
proof- The proof bytes.public_inputs- The SP1 public inputs.sp1_vkey_hash- The SP1 vkey hash. This is generated in the following manner:
ⓘ
use sp1_sdk::ProverClient;
let client = ProverClient::new();
let (pk, vk) = client.setup(ELF);
let sp1_vkey_hash = vk.bytes32();groth16_vk- The Groth16 verifying key bytes. Usually this will be the [static@crate::GROTH16_VK_BYTES] constant, which is the Groth16 verifying key for the current SP1 version.
§Returns
A success Result if verification succeeds, or a Groth16Error if verification fails.
Sourcepub fn verify_gnark_proof(
proof: &[u8],
public_inputs: &[[u8; 32]],
groth16_vk: &[u8],
) -> Result<(), Groth16Error>
pub fn verify_gnark_proof( proof: &[u8], public_inputs: &[[u8; 32]], groth16_vk: &[u8], ) -> Result<(), Groth16Error>
Verifies a Gnark Groth16 proof using raw byte inputs.
WARNING: if you’re verifying an SP1 proof, you should use [verify] instead.
This is a lower-level verification method that works directly with raw bytes rather than
the SP1 SDK’s data structures.
§Arguments
proof- The raw Groth16 proof bytes (without the 4-byte vkey hash prefix)public_inputs- The public inputs to the circuitgroth16_vk- The Groth16 verifying key bytes
§Returns
A Result containing unit () if the proof is valid,
or a Groth16Error if verification fails.
§Note
This method expects the raw proof bytes without the 4-byte vkey hash prefix that
[verify] checks. If you have a complete proof with the prefix, use [verify] instead.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Groth16Verifier
impl RefUnwindSafe for Groth16Verifier
impl Send for Groth16Verifier
impl Sync for Groth16Verifier
impl Unpin for Groth16Verifier
impl UnwindSafe for Groth16Verifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more