Gas Costs on L2s
End-to-end gas costs of using UPA on L2 chains (e.g. Base Chain)
The gas costs on L2s can be split into two parts.
L2 Execution Costs: which describes the L2 execution-related gas costs.
L1 Data Fee Costs: which describes costs associated with posting L2 calldata on the associated L1.
Cost Comparison to Groth16 Verification w/o UPA
We also provide gwei
numbers for Base at the time of writing this article. A summary of the results is shown in the table below.
32
3000
11,560
64
1160
11,560
L2 Execution Costs
The L2 execution gas of verifyMixedAggregatedProof
is about the same as the L1 execution cost for this transaction. For a batch size of 32, this is about 775,000.
L2 gas for querying if a proof/submission is verified
This cost is the same as in the L1 case and comes out to 22,000.
Total per-proof L2 gas
For batch size 32, the total per-proof L2 gas, comes out to:
775,000 / 32 + 22,000 = 24,000 + 22,000 = 46,000 gas
gwei
cost
gwei
costAt the time of writing this doc, Base gas price was 0.036 gwei, so the total per-proof gwei cost is 46,000*0.036 = 1650 gwei for a batch size of 32.
L1 data fee
To get the exact L1 cost in gwei
we need to compute the l1_data_fee
, as explained in this document.
l1_data_fee = tx_compressed_size * weighted_gas_price
The weighted_gas_price
is independent of the particular transaction. This number is also chain-specific. It is a bit difficult to get exact number but backtracking of BaseScan it seems to be in the 10 gwei
range.
The tx_compressed_size
is th enumber of non-zero bytes in the calldata which is about 4300 bytes for a verifyMixedAggregated
proof transaction. So the L1 data fee comes out to about 43,000 gwei
for the entire transaction or 1350 gwei
per-proof.
Cost Comparison to Groth16 Verification w/o UPA
L2 execution cost is about 250,000 gas. Converting to
gwei
gas prices on Base Chain at the time of writing this docs gives 250,000 * 0.036 = 9000gwei
.Groth16 proof consists of 256 bytes of calldata so the
l1_data_fee
for Base Chain is 256 * 10 = 2560gwei
.
So totally the cost is 11,560 gwei
per-proof, as compared to 1650 + 1350 = 3000 gwei
per-proof when using UPA. This is about a 4x savings of 7560 gwei.
Last updated