This project provides tools to verify Gnark generated groth16 proofs on Solana.
Install Solana CLI and other requisite tools:
curl --proto '=https' --tlsv1.2 -sSfL https://solana-install.solana.workers.dev | bashConfirm the installation:
solana --version
rustc --versionOptionally, configure your Solana CLI to use the devnet:
solana config set --url https://api.devnet.solana.com-
Generate a verification key with Sunspot.
-
Place the newly generated verification key file inside the
verifier-binfolder of this project.- For example:
verifier-bin/my_verification_key.vk
- For example:
Then run the following commands:
VK_PATH="my_verification_key.vk" cargo build
cargo build-sbfNote: The build process automatically looks for the verification key inside the
verifier-binfolder. If theVK_PATHenvironment variable is not set, it will default to using:verifier-bin/default.vk
This will generate the Solana program and its keypair files in the target/deploy folder.
Once the program is compiled, you can deploy it to your desired Solana cluster.
- Choose your cluster (devnet, testnet, or mainnet):
# Example: set cluster to devnet
solana config set --url https://api.devnet.solana.com- Deploy the program using the compiled
verifier-bin.sofile intarget/deploy:
solana program deploy target/deploy/verifier-bin.so- The deployment command will return a program ID, which you will use to interact with the program.
- Verify the deployment (optional):
solana program show <program_id>This confirms that your program is deployed and ready to use on the selected Solana cluster.
Verification of a proof and public witness will cost between 170000 and 500000 compute units, depending on the complexity of the circuit. Proof sizes will be between 324 and 388 bytes.