Gas Cost Analysis

Aggregation Cost

The cost of verifying aggregated user proofs in a Gnark Groth16 super-proof system can be broken down as follows:

  1. Base cost: 354,241 Gas for verifying the super-proof on-chain.

  2. Per-proof cost: ~6,200 Gas for processing and state updates per individual proof aggregated.

The gas cost formula for aggregation per proof turns out to be:

Cagg_per_proof=(354,241)/n+6200C_{agg\_per\_proof} = (354,241)/n + 6200

Verification Access Cost

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 7,300 Gas per call.

Total Cost Per Proof

The total cost of verifying each proof in an aggregated system consists of two components:

  1. Fixed Cost: 13,500(6200+7300) Gas This cost remains constant per proof, regardless of the number of proofs aggregated.

  2. Diminishing Cost: (354,241 / n) Gas Where n is the number of proofs aggregated in a single superproof. This cost decreases as the number of aggregated proofs increases.

total_cost_per_proof=fixed_cost+diminishing_cost=13,500+(354,241/n)Gastotal\_ cost\_ per\_proof = fixed\_cost + diminishing\_cost = 13,500 + (354,241 / n) Gas

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.

Last updated