This project is an implementation of the Groth16 zk-SNARK proving system on Solana.
The project is consist of:
- An on-chain proof verifier program
- A circuit demo
- A client can send proof and input to verifier program
The following dependencies are required to build and run this example, depending on your OS, they my have already been installed:
-
Install Rust v1.56.1 or later from https://rustup.rs/
-
Install Solana v1.8.1 or later from https://docs.solana.com/cli/install-solana-cli-tools
you're on Windows, it is recommended to use WSL to run these commands
- Set CLI config url to localhost cluster
solana config set --url localhost
- Create CLI Keypair
If this is your first time using the Solana CLI, you will need to generate a new keypair:
solana-keygen new
This example connects to a local Solana cluster by default.
Start a local Solana cluster:
solana-test-validator
Note: You may need to do some system tuning (and restart your computer) to get the validator to run
Listen to transaction logs:
solana logs
cd contract
cargo build-bpf
solana program deploy target/deploy/contract.so
cd client
cargo build
../target/debug/client