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 | Tact test |
|---|---|---|---|---|
Multiplier | Circom | circuits/Multiplier | c = a * b | npx blueprint test Verifier_multiplier_tact |
Sudoku | Noname | circuits/Sudoku | A partially filled grid | npx blueprint test Verifier_sudoku_tact |
cubic-gnark | Gnark | circuits/cubic-gnark | y = x^3 + x + 5 | npx blueprint test Verifier_cubic_tact |
MulCircuit | Arkworks | circuits/Arkworks/MulCircuit | z = x * y | npx blueprint test Verifier_ark |
Run the Multiplier example
Select Multiplier for the smallest end-to-end Groth16 verifier flow in the repository.
The proof is generated at test time from Multiplier.wasm and Multiplier_final.zkey.
Verify = 90637 gas and code size 5402 bits / 10 cells.
Run the Sudoku example
Select Sudoku for a larger verification key and many public inputs.
The current 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.no<GRID_JSON>— JSON object with the public partially filled grid in the format expected bycircuits/Sudoku/src/main.no
Verify = 866113 gas and code size 44890 bits / 80 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 = 90637 gas and code size 5402 bits / 10 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 = 90637 gas and code size 5402 bits / 10 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 build artifacts are missing, runnpx blueprint build --allfirst. - 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.