# What is the L1 data fee?

> On OP Stack chains like Base, every transaction also pays to publish its data to Ethereum. What that fee is, why agents should care and where to see it.

Source: https://hashspan.dev/learn/l1-data-fee

By Selim Aytaç, maintainer · Published Oct 1, 2026 · Updated Oct 18, 2026

## Short answer

The L1 data fee is the part of a transaction's cost on an OP Stack chain, such as Base or OP Mainnet, that pays for publishing the transaction's data to Ethereum. It comes on top of the execution gas fee, so gas used × gas price alone undercounts what the transaction cost.

Figure: The cost of a transaction on an OP Stack chain such as Base: the L2 execution fee plus the L1 data fee, which together make up blockchain.tx.fee.

## Where does it come from?

OP Stack chains publish their transaction data to Ethereum, so anyone can download it and re-execute the chain. Publishing costs Ethereum gas. The L1 data fee passes that cost on to each transaction's sender ([OP Stack fee docs](https://docs.optimism.io/app-developers/guides/transactions/fees)).

So the total cost has two main parts:

| Part | Pays for | Depends on |
|---|---|---|
| Execution gas fee | Running the transaction on the L2 | Gas used × (base fee + priority fee) |
| L1 data fee | Publishing its data to Ethereum | Compressed size of the transaction, Ethereum's base fee and blob base fee |

Since the Isthmus upgrade, a chain operator can also configure an **operator fee**. It's a third, separate part.

## Why should agents care?

Base's own docs say the L1 fee is typically higher than the L2 execution fee ([Base network fees](https://docs.base.org/base-chain/network-information/network-fees)).

That changes the math for an agent with a wallet:

- **Budgets drift.** A spend limit built on gas used × gas price misses most of the cost.
- **Same gas, different price.** Two transactions with identical gas usage can cost different amounts, because the data fee depends on their size and on Ethereum's prices at that moment.
- **Hard to spot later.** The block explorer shows the total, but not which agent step paid it.

## How do I see it?

Before sending, estimate it. viem has [`estimateL1Fee`](https://viem.sh/op-stack/actions/estimateL1Fee) for OP Stack chains.

After the transaction is mined, the receipt on an OP Stack chain carries the actual amount in an extra `l1Fee` field. That's the number to record.

**In a hashspan trace:**
The `confirm` span records both numbers, in wei:

  - `blockchain.tx.l1_fee`: the L1 data fee from the receipt
  - `blockchain.tx.fee`: `gas.used × effective_gas_price + l1_fee`

The operator fee isn't part of `blockchain.tx.fee`. Since hashspan 1.1 it has its own attribute, `blockchain.tx.operator_fee`, on chains that charge it (Isthmus and later).

The local demo chain is not an OP Stack chain, so it has no L1 fee. There, `blockchain.tx.fee` is just the execution fee: 21,660 gas × 1,875,175,000 wei = 40,616,290,500,000 wei for the [reverted withdrawal in this post](https://hashspan.dev/blog/agent-trace-stops-at-the-tool-call).

## FAQ

### Is the L1 data fee part of gasUsed?

No. Gas used times the effective gas price gives only the execution fee. The L1 data fee is a separate amount that OP Stack chains report on the receipt.

### Why does the same transaction cost different amounts at different times?

The execution fee follows the L2's own base fee. The L1 data fee follows Ethereum's base fee or blob base fee. The two move independently.

### Can I estimate it before sending?

Yes. viem's OP Stack actions include estimateL1Fee, and Base exposes a GasPriceOracle contract with getL1Fee. The final amount is on the receipt.
