sp1-sui - SP1 Verifier on Sui
This crate verifies Groth16 proofs generated by SP1 zkVM in Sui Move smart contract leveraging the Groth16 Move verifier over BN254.
[!CAUTION]
This repository is not audited for production use.
sp1-sui library is located in the verifier directory. proofs directory includes the Fibonacci proof used in the test suite for the Sui Groth16 verifier and the JWT Email Domain proof from the example directory.We also provide three examples of how to use the SP1 Groth16 verifier:
examples/move/groth16-verifier directory contains a sample Sui Move smart contract for verifying SP1 proofs.examples/sp1-sui-sdk directory contains a sample example using the Sui Rust SDK for verifying SP1 proofs with PTB (Programmable Transaction Blocks).examples/sp1-jwt-verify-email-domain directory contains a fully-fledged example that verifies whether someone has access to a domain name without revealing their identity. This can be used as a complement to zkLogin. You can integrate it on Sui today. Follow the blog post explaining the code.To be able to use SP1 Groth16 proofs on Sui, you need to:
sp1-sdk and sp1-sui crates to your Cargo.toml in your Sui Rust SDK project.[dependencies]
sp1-sui = { git = "https://github.com/SoundnessLabs/sp1-sui" }
sp1-sdk = { version = "4.1.0" }
ark-bn254 format.let sp1_proof_with_public_values = SP1ProofWithPublicValues::load("../../proofs/fibonacci_proof.bin").unwrap();
let (pvk, public_inputs, proof_points) =
convert_sp1_gnark_to_ark(sp1_proof_with_public_values);
verify_groth16_bn254_proof function of the SP1 Groth16 verifier smart contract with the verification key, public inputs and proof points.// Add the proof components as inputs to the transaction
ptb.input(serialize_input(&pvk))?; // Input 0: Verification key
ptb.input(serialize_input(&public_inputs))?; // Input 1: Public inputs
ptb.input(serialize_input(&proof_points))?; // Input 2: Proof points
let package = ObjectID::from_hex_literal(&PKG_ID).map_err(|e| anyhow!(e))?;
let module = Identifier::new("groth16_verifier").map_err(|e| anyhow!(e))?;
ptb.command(Command::move_call(
package,
module.clone(),
Identifier::new("verify_groth16_bn254_proof").map_err(|e| anyhow!(e))?,
vec![],
vec![Argument::Input(0), Argument::Input(1), Argument::Input(2)],
));
This crate leverages the sp1 library by Succinct Labs for the gnark-to-ark converter and ark-bn254 for working with the BN254 elliptic curve. The repository structure was inspired by the sp1-solana verifier.
$ claude mcp add sp1-sui \
-- python -m otcore.mcp_server <graph>