LogoLogo
NEBRA HomeGithub
  • Introduction
    • What is NEBRA UPA?
    • How it works
    • Quickstart
  • Developer Guide
    • Setup
    • Registering applications
    • Submission and verification
    • Proof explorer
    • Gas costs on L1s
    • Gas Costs on L2s
    • Testing workflow
    • Frontend integration
    • Deployments
    • Off-chain verification
  • UPA protocol specification
  • Integrating with zkVMs
    • Integrating with SP1
  • Security and Transparency
Powered by GitBook
On this page

Was this helpful?

  1. Integrating with zkVMs

Integrating with SP1

PreviousIntegrating with zkVMsNextSecurity and Transparency

Last updated 8 months ago

Was this helpful?

SP1 by Succinct Labs is a zkVM technology. It generates STARK proofs but provides tooling for wrapping these STARK proofs with Groth16 or PLONK proofs, so they are more amenable for on-chain verification.

The provided by Succinct Labs provides an end-to-end workflow of how one can verify zkVM proofs on-chain. Roughly the workflow in this repo is:

  • A STARK is generated by SP1 which proves the validity of a Fibonacci program written in Rust, which computes the nnnth Fibonacci number.

  • This STARK proof is wrapped into a PLONK proof via SP1's SDK.

  • In the Fibonacci.sol smart contract, a verifyFibonacciProof function is provided, which takes in the PLONK proof and public inputs and verifies the proof on-chain via a call to a (SP1VerifierPlonk.sol) developed by SP1.

NEBRA has created an which shows how the above Fibonacci program written in Rust can be aggregated via UPA. Roughly the workflow in this repo is:

  • A STARK is generated by SP1 which proves the validity of a Fibonacci program written in Rust, which computes the nnnth Fibonacci number (same as above).

  • This STARK proof is wrapped into a Groth16 proof via SP1's SDK.

  • In the UpaFibonacci.sol smart contract, a verifyFibonacci function is provided. However, unlike the workflow above, the Groth16 proof is not submitted to this contract. Rather, this function only takes in the public inputs and calls into the UPAVerfier contract to check whether a Groth16 proof corresponding to these public inputs and the SP1 Groth16 circuit have been aggregated by the UPA system.

  • A showing the end-end-end flow is provided. In this script:

    • A UPAVerifier contract is deployed to a local hardhat node.

    • The SP1 Groth16 proof corresponding to the Fibonacci circuit, along with another Groth16 proof is submitted to the UPAVerifier contract.

    • UPA'sdev-aggregator dev tool, which mimics our actual aggregator, is used to aggregate these two proofs and submit the result on-chain.

    • The UPAFibonacci contract is called to check whether the SP1 Groth16 Fibonacci proof has been verified.

In general, for apps looking to integrate UPA with SP1, the workflow would be as follows:

  • Use SP1 SDK to wrap your SP1 STARK proof and generate a Groth16 proof.

  • Using UPA's CLI tool or SDK, parse the Groth16 proof data into UPA proof file format.

  • Use UPA's CLI tool or SDK to submit the proof to UPAVerifier contract.

  • Wait for proof to be aggregated and then use the result in business logic of the app.

SP1 Project Template
standardized smart contract
UPA-SP1 Project Template
shell script