Run one of the Groth16 verifier examples fromDocumentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-groth16-examples.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
zk-examples/zk-ton-examples and confirm the proof both locally and on-chain in TON.
For the underlying export flow, see Zero-knowledge proofs on TON.
Objective
Run one of these upstream circuits on TON:Multiplierfrom CircomSudokufrom Nonamecubic-gnarkfrom GnarkMulCircuitfrom Arkworks
Prerequisites
Clone the examples repository
Choose an example
| Example | Stack | Circuit | What the proof exposes publicly | Tolk test |
|---|---|---|---|---|
Multiplier | Circom | circuits/Multiplier | c = a * b | npx blueprint test Verifier_multiplier_tolk |
Sudoku | Noname | circuits/Sudoku | A partially filled grid | npx blueprint test Verifier_sudoku_tolk |
cubic-gnark | Gnark | circuits/cubic-gnark | y = x^3 + x + 5 | npx blueprint test Verifier_cubic_tolk |
MulCircuit | Arkworks | circuits/Arkworks/MulCircuit | z = x * y | npx blueprint test Verifier_ark_tolk |
Run the Multiplier example
Select Multiplier for a minimal end-to-end Groth16 verifier flow with two private inputs and one public output.
The proof is generated at test time from Multiplier_js/Multiplier.wasm and Multiplier_final.zkey.
Verify = 88655 gas and code size 5805 bits / 11 cells.
Run the Sudoku example
Select Sudoku for a larger verification key and many public inputs.
The Sudoku source checks rows, columns, and diagonals. It does not check 3x3 boxes (subgrids).
SOLUTION_JSON— JSON object with the private solved grid in the format expected bycircuits/Sudoku/src/main.noGRID_JSON— JSON object with the public partially filled grid in the format expected bycircuits/Sudoku/src/main.no
Verify = 858163 gas and code size 46975 bits / 78 cells.
Run the cubic-gnark example
Select cubic-gnark when the proving stack is Go.
The upstream main.go proves the public relation y = x^3 + x + 5 and exports proof.json plus verification_key.json in snarkjs format.
Verify = 88655 gas and code size 5805 bits / 11 cells.
Run the MulCircuit example
Select MulCircuit when the proving stack is Rust.
The upstream main.rs proves a multiplication circuit over Bls12_381 and exports json/proof.json plus json/verification_key.json.
Verify = 88655 gas and code size 5805 bits / 11 cells.
Verify
Run-time verification succeeds when all of the following are true:snarkjs.groth16.verify(...)returnstrue- The contract
getVerifymethod returnstrue npx blueprint test ...exits with code0
Troubleshoot
- If
npx blueprint test ...fails because the Tolk contract is missing, rerun the matchingnpx export-ton-verifier ... --tolkcommand for that example. - If
snarkjs.groth16.verify(...)returnsfalse, confirm that the proof, public signals, and verification key come from the same circuit build. - If
export-ton-verifierrejects the input file, confirm that the example uses Groth16 overbls12-381.