Gas Cost Analysis
Last updated
Last updated
The cost of verifying aggregated user proofs in a Gnark Groth16 super-proof system can be broken down as follows:
Base cost: ~380,000 Gas
for verifying the super-proof on-chain.
Per-proof cost: 0 Gas
for processing and state updates per individual proof aggregated.
The gas cost formula for aggregation per proof turns out to be:
Users can verify that a certain zk-proof, corresponding to specific public inputs, is included in the superproof. This verification is done through a cross-contract call, as described in the integration docs. The gas cost for this verification process is approximately 16,000 Gas
per call.
The total cost of verifying each proof in an aggregated system consists of two components:
Fixed Cost: 16,000 Gas
This cost remains constant per proof, regardless of the number of proofs aggregated.
Diminishing Cost: (380,000 / n) Gas
Where n is the number of proofs aggregated in a single superproof. This cost decreases as the number of aggregated proofs increases.
Key Point: The Diminishing Cost represents an economy of scale – the more proofs aggregated into a single superproof, the lower the per-proof cost for this component.