Offchain Verification
Rust no_std
Verification
You can verify SP1 Groth16 and Plonk proofs in no_std
environments with sp1-verifier
.
sp1-verifier
is also patched to verify Groth16 and Plonk proofs within the SP1 zkVM, using
bn254 precompiles. For an example of this, see
the Groth16 Example.
Installation
Import the following dependency in your Cargo.toml
:
sp1-verifier = {version = "4.0.0", default-features = false}
Usage
sp1-verifier
's interface is very similar to the solidity verifier's. It exposes two public functions:
Groth16Verifier::verify_proof
and PlonkVerifier::verify_proof
.
sp1-verifier
also exposes the Groth16 and Plonk verifying keys as constants, GROTH16_VK_BYTES
and PLONK_VK_BYTES
. These
keys correspond to the current SP1 version's official Groth16 and Plonk verifying keys, which are used for verifying proofs generated
using docker or the prover network.
First, generate your Groth16 or PLONK proof with the SP1 SDK. See here
for more information -- sp1-verifier
and the solidity verifier expect inputs in the same format.
Next, verify the proof with sp1-verifier
.
Loading...
Here, the proof, public inputs, and vkey hash are read from stdin. See the following snippet to see how these values are generated.
Loading...
Note that the SP1 SDK itself is not
no_std
compatible.
Wasm Verification
The example-sp1-wasm-verifier
demonstrates how to
verify SP1 proofs in wasm. For a more detailed explanation of the process, please see the README.