Skip to main content
Run Groth16 verifier examples from zk-examples/zk-ton-examples via Circom, Noname, Gnark, and Arkworks, then confirm the proof both locally and on-chain in TON. For the underlying export flow, see Zero-knowledge proofs on TON.

Objective

The goal is run one of these upstream circuits on TON:
  • Multiplier from Circom
  • Sudoku from Noname
  • cubic-gnark from Gnark
  • MulCircuit from Arkworks

Prerequisites

Clone the examples repository

Choose an example

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.
Expected output
The checked-in upstream Tolk snapshot records Verify = 88665 gas and code size 5829 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).
Define placeholders
  • SOLUTION_JSON — JSON object with the private solved grid in the format expected by circuits/Sudoku/src/main.no
  • GRID_JSON — JSON object with the public partially filled grid in the format expected by circuits/Sudoku/src/main.no
Expected output
The checked-in upstream Tolk snapshot records Verify = 857057 gas and code size 48111 bits / 79 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.
Expected output
The checked-in upstream Tolk snapshot records Verify = 88665 gas and code size 5829 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.
Expected output
The checked-in upstream Tolk snapshot records Verify = 88665 gas and code size 5829 bits / 11 cells.

Verify

Run-time verification succeeds when all the following are true:
  • snarkjs.groth16.verify(...) returns true
  • The unnamed Sudoku verifier exposes a getVerify() getter, while named verifiers expose a suffixed getter, such as getVerifyMultiplierVerifier() — both should return true
  • npx blueprint test ... exits with code 0
Not runnable. Partial snippet from the upstream Tolk tests:

Troubleshoot

  • If npx blueprint test ... fails because the Tolk contract is missing, rerun the matching npx export-ton-verifier ... --tolk command for that example.
  • If snarkjs.groth16.verify(...) returns false, confirm that the proof, public signals, and verification key come from the same circuit build.
  • If export-ton-verifier rejects the input file, confirm that the example uses Groth16 over bls12-381.

See also