This repository contains an Ethereum-compatible zk-SNARK verifier smart contract implementing the Ultra Honk proving system, a test for that contract, and a Hardhat Ignition module that deploys that contract. It includes verification logic, custom field operations, elliptic curve utilities, and Fiat-Shamir transcript generation, all optimized for zero-knowledge proof verification in Solidity.
Try running some of the following tasks:
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat ignition deploy ./ignition/modules/Lock.js- zk-SNARK verifier for Ultra Honk
- Efficient finite field arithmetic (
Fr) with modular inversion via precompiles - Support for:
- Permutation & lookup arguments
- Arithmetic & delta range constraints
- Elliptic curve and auxiliary relations
- Fiat-Shamir transcript generation
- G1 point compression & decompression for calldata-friendly proof parsing
FrLib: Finite field arithmetic over BN254 scalar fieldFr.Honk: Data structures for proofs, verification keys, and challenges.TranscriptLib: Fiat-Shamir challenge generation from a zk-proof.RelationsLib: Evaluates relation constraints for proof verification.HonkVerificationKey: Hardcoded verification key for a specific circuit.pairing(...): Bilinear pairing checks using Ethereum's BN254 precompile.
To build or test this contract, you will need:
If you plan to test locally or simulate proof verifications, you'll also need:
- An Ethereum development node (e.g. Anvil)
- Sample proof and VK inputs (not included here)
Clone this repository
git clone https://github.com/cypriansakwa/Ultra_Honk_zk-SNARK_Verifier.git
cd Ultra_Honk_zk-SNARK_VerifierThis contract is not meant to be deployed directly. Instead, it serves as a reference or dependency for a larger verifier system.
To verify a proof:
- Load the verification key using
HonkVerificationKey.loadVerificationKey(). - Parse the proof bytes using
TranscriptLib.loadProof(bytes). - Generate Fiat-Shamir challenges using
TranscriptLib.generateTranscript(...). - Recompute and evaluate all constraints via
RelationsLib. - Perform a final bilinear pairing check with
pairing(...).
- Solidity
>=0.8.21 - No external libraries required (only Ethereum precompiles used)
- Circuit size:
2^12 = 4096 - Number of public inputs:
0 - Constant parameters:
CONST_PROOF_SIZE_LOG_N = 28NUMBER_OF_SUBRELATIONS = 26NUMBER_OF_ENTITIES = 40NUMBER_OF_ALPHAS = 25
This contract is adapted from internal tooling at Aztec Protocol and reflects the Ultra Honk proving system described in their zk-SNARK architecture.