> For the complete documentation index, see [llms.txt](https://docs.nebra.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nebra.one/developer-guide/gas-costs-on-l2s.md).

# Gas Costs on L2s

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 [775,000](https://sepolia.etherscan.io/tx/0x2b387f0b4970735bd8c6117389ba7b49b46e425c192b85be05cde016c7354756).

### L2 gas for querying if a proof/submission is verified

This cost is the same as in the[ L1 case ](/developer-guide/gas-costs-on-l1s.md)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

At the time of writing this doc, [Base gas price](https://tokentool.bitbond.com/gas-price/base) 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](https://docs.optimism.io/stack/transactions/fees).

`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](https://sepolia.etherscan.io/tx/0x2b387f0b4970735bd8c6117389ba7b49b46e425c192b85be05cde016c7354756). 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 = **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.`
