export-ton-verifier
v1.2.6
Published
Tool for generating a Groth16 verifier code for the TON blockchain from SnarkJS .zkey files.
Maintainers
Readme
Export TON Verifier
Export TON Verifier is a CLI tool and JavaScript library for generating Groth16 bls12-381 smart contract verifiers for the TON blockchain from .zkey or .json verification key files.
It integrates with the snarkjs library and supports circuits built with Circom, Noname, and gnark (via verification_key.json).
This allows you, for example, to generate a verifier contract that checks gnark proofs in a format compatible with snarkjs.
Verifier code can be generated for three TON languages: FunC, Tolk, and Tact (selected via the --func, --tolk, or --tact flags).
Installation
npm install export-ton-verifier
# Help
npx export-ton-verifier --helpImport as a library
import { dictFromInputList, groth16CompressProof } from 'export-ton-verifier';Usage CLI
# From .zkey, FunC by default:
npx export-ton-verifier ./circuits/verifier.zkey ./verifier.fc
# From verification_key.json (auto-detected by .json):
npx export-ton-verifier ./circuits/verification_key.json ./verifier.fc
# Force JSON mode (even if extension is not .json):
npx export-ton-verifier ./vk.txt ./verifier.tolk --tolk --vk
# Generate Tact verifier:
npx export-ton-verifier ./circuits/verifier.zkey ./verifier.tact --tact
# Generate and also drop the TypeScript wrapper:
npx export-ton-verifier ./circuits/verification_key.json ./verifier.fc --func --wrapper-dest ./wrappers/ --force
# Only copy the TypeScript wrapper:
npx export-ton-verifier import-wrapper ./wrappers/Verifier.ts --force