A Hardhat template integrating Circom and SnarkJS via the hardhat-circom
plugin. This workflow simplifies zero-knowledge proof (ZKP) development by automating the compilation of circuits, generation of proofs, and deployment of Solidity verifiers.
- ✅ Compile Circom circuits
- 🔒 Apply final trusted setup beacon
- 🧠 Output
.wasm
and.zkey
files - 📜 Generate Solidity verifier contracts
- 🧾 Create and verify proofs on-chain
Install the required plugin in your Hardhat project:
npm install hardhat-circom
To generate intermediate files and the MultiplierVerifier.sol
contract, run:
npx hardhat circom
This will output:
circuit.wasm
circuit_final.zkey
MultiplierVerifier.sol
(or a verifier for your custom circuit)
To generate a proof and deploy the verifier contract, run:
npx hardhat run scripts/deploy.ts
This script will:
- Deploy the Verifier contract to the configured network
- Generate a zk-SNARK proof via
generateProof()
- Generate Solidity calldata using
generateCallData()
- Call
verifyProof()
with calldata to verify it on-chain
To work with your own .circom
files:
- Place your
.circom
file in thecircuits/
folder - Update
circuits.config.json
with your circuit name and path - Modify
hardhat.config.ts
to match your new circuit entry
This project is compatible with all EVM-based networks.
- ✅ Tested on Sepolia Testnet
To deploy to your preferred network, update the Hardhat network configuration with your RPC URL and private key.
├── circuits/ # Circom circuit files
├── scripts/deploy.ts # Deployment and proof generation script
├── contracts/Verifier.sol # Auto-generated Solidity Verifier
├── hardhat.config.ts # Hardhat configuration
└── circuits.config.json # Circuit and zkey configurations
After completing the workflow, expect the following:
- Compiled circuit files:
.wasm
,.zkey
- Solidity verifier:
contracts/MultiplierVerifier.sol
- Proof and calldata JSON
- On-chain verification result: ✅ true
Suraj R
Email: surajwork.aug28@gmail.com
LinkedIn: linkedin.com/in/suraj-r
This template is built using the excellent hardhat-circom
plugin by Project Sophon.