Skip to content

0x5ea000000/groth16-soroban

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soroban Groth16 Verifier

This project implements a Groth16 zk-SNARK verifier as a Soroban smart contract, enabling on-chain verification of zero-knowledge proofs within the Stellar network.

🚀 Features

📦 Prerequisites

  • Rust toolchain with wasm32-unknown-unknown target installed.
  • Soroban CLI for building and deploying contracts.
  • Circom, SnarkJS or Arkwork for generating proofs.

🛠️ Building the Contract

  1. Clone the repository:

    git clone https://github.com/veil-protocol-privacy/groth16-soroban.git
    cd groth16-soroban
  2. Build the contract using the Soroban CLI:

    soroban contract build

📤 Deploying the Contract

  1. Deploy the contract to the Soroban network:

    soroban contract deploy --wasm target/wasm32-unknown-unknown/release/groth16-soroban.wasm
  2. Note the contract ID returned after deployment for future interactions.

🔍 Verifying a Proof

  1. Generate a proof using Circom and SnarkJS:

    circom circuit.circom --r1cs --wasm --sym
    snarkjs groth16 setup circuit.r1cs powersOfTau28_hez_final_10.ptau circuit_0000.zkey
    snarkjs groth16 prove circuit_0000.zkey witness.wtns proof.json public.json
  2. Convert the proof and public inputs to a format compatible with the Soroban contract.

  3. Invoke the contract's verification function:

    soroban contract invoke \
      --id <CONTRACT_ID> \
      --fn verify_proof \
      --arg <PROOF_ARGUMENTS>

    Replace <CONTRACT_ID> with your deployed contract ID and <PROOF_ARGUMENTS> with the serialized proof and public inputs.

🧪 Testing

Run the test suite to ensure the verifier functions correctly:

cargo test

📚 Resources

📝 License

This project is licensed under the MIT License. See the LICENSE file for details.


For a practical example and further reference, you can explore the stellar/soroban-examples repository, which includes a proof-of-concept Groth16 verifier implementation.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published