LogoLogo
NEBRA HomeGithub
  • Introduction
    • What is NEBRA UPA?
    • How it works
    • Quickstart
  • Developer Guide
    • Setup
    • Registering applications
    • Submission and verification
    • Proof explorer
    • Gas costs on L1s
    • Gas Costs on L2s
    • Testing workflow
    • Frontend integration
    • Deployments
    • Off-chain verification
  • UPA protocol specification
  • Integrating with zkVMs
    • Integrating with SP1
  • Security and Transparency
Powered by GitBook
On this page
  • L2 Execution Costs
  • L2 gas for querying if a proof/submission is verified
  • Total per-proof L2 gas
  • gwei cost
  • L1 data fee
  • Cost Comparison to Groth16 Verification w/o UPA

Was this helpful?

  1. Developer Guide

Gas Costs on L2s

End-to-end gas costs of using UPA on L2 chains (e.g. Base Chain)

PreviousGas costs on L1sNextTesting workflow

Last updated 5 months ago

Was this helpful?

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.

Batch Size
gwei cost w/ UPA on Base
gwei Cost w/o UPA on Base

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 .

L2 gas for querying if a proof/submission is verified

This cost is the same as in theand 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

L1 data fee

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.

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 = 9000 gwei.

  • Groth16 proof consists of 256 bytes of calldata so the l1_data_fee for Base Chain is 256 * 10 = 2560 gwei.

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.

At the time of writing this doc, was 0.036 gwei, so the total per-proof gwei cost is 46,000*0.036 = 1650 gwei for a batch size of 32.

To get the exact L1 cost in gwei we need to compute the l1_data_fee, as explained in this .

The tx_compressed_size is th enumber of non-zero bytes in the calldata which is about 4300 bytes for a verifyMixedAggregated proof . So the L1 data fee comes out to about 43,000 gwei for the entire transaction or 1350 gwei per-proof.

775,000
L1 case
Base gas price
document
transaction