This report provides a comprehensive analysis of gas consumption for various Zero-Knowledge Proof (ZKP) systems implemented in Solidity. The analysis includes deployment costs, function execution costs, and local VM view gas measurements across different frameworks and schemas.
| Framework | Schema | Public inputs | Local VM View Gas | Sepolia deployment gas | Sepolia function gas |
|---|---|---|---|---|---|
| gnark | groth16 | 2 | 195,099 | 1,917,298 | 220,583 |
| gnark | groth16(compressed proof) | 2 | - | 1,945,169 | 231,209 |
| gnark | groth16 with pedersen | 1 | - | 1,439,031 | 337,291 |
| gnark | groth16(compressed with pedersen) | 1 | - | 1,439,031 | 350,842 |
| gnark | plonk | 2 | 253,087 | 2,083,848 | 287,310 |
| snarkjs | groth16 | 2 | 195,836 | 412,528 | 221,305 |
| snarkjs | plonk | 2 | 256,348 | 1,591,128 | 291,197 |
| snarkjs | fflonk | 2 | 167,842 | 5,273,847 | 201,077 |
| noir | plonk | 1 | - | 2,571,102 | 441,681 |
| halo2 | plonk(degree:16) | 16 | - | 308,351 + 828,497 | 321,377 |
| halo2 | plonk(degree:16) | 2 | - | 308,315 + 828,497 | 305,073 |
| halo2 | plonk(degree:16, efixed:200) | 2 | - | 2,904,633 + 841,012 | 307,900 |
| plonky3 | No solidity verifier | - | - | - | - |
| nova | groth16 with kzg (compressed proof) | 32 | 750,000 | - | - |
Notes:
- Local VM View Gas: Executed the public view in Remix VM (Cancun)
- Sepolia function gas: Executed verify in Sepolia testnet with a simple wrapper function without view
On Ethereum, the gas cost formulas for Groth16 and FFLONK verifiers (snarkjs) can be expressed as:
- Groth16 Gas Cost ≈ 207k + 7.16k × l
- FFLONK Gas Cost ≈ 200k + 0.9k × l
Where l represents the length of the public signals. Both systems have similar cost structures but with different constants, resulting in varying overall gas costs.
Reference: https://hackmd.io/Fa4A8lVKRM2TwVh1dhUb1Q
For detailed information and the reproducible code about each framework, please refer to following: