Skip to content

Commit 33ab6b9

Browse files
authored
Merge pull request #1621 from ethereum-optimism/remove-sdk
Update withdrawal flow docs
2 parents 7b1f223 + da1a65a commit 33ab6b9

File tree

2 files changed

+101
-40
lines changed

2 files changed

+101
-40
lines changed

pages/stack/transactions/fees.mdx

Lines changed: 83 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ categories:
1515
- gas
1616
- l1-data-fee
1717
- execution-gas-fee
18+
- operator-fee
1819
- eip-1559
1920
- sequencer-fee-vault
2021
is_imported_content: 'false'
@@ -26,7 +27,7 @@ import { Callout } from 'nextra/components'
2627
The OP Stack maintains a distinct gas limit compared to the Ethereum mainnet.
2728
While both chains use the same underlying transaction formats, Optimism's gas limits are tailored for optimal Layer 2 performance and scalability.
2829
As a result, transactions on Optimism may behave differently from the mainnet regarding gas usage and fee estimation.
29-
For a detailed comparison of gas limits between Optimism and Ethereum, see the [Optimism Chain Differences documentation](https://docs.optimism.io/chain/differences?utm_source=op-docs&utm_medium=docs#transaction-fees).
30+
For a detailed comparison of gas limits between Optimism and Ethereum, see the [Differences between Ethereum and OP Stack Chains](https://docs.optimism.io/chain/differences?utm_source=op-docs\&utm_medium=docs#transaction-fees).
3031
</Callout>
3132

3233
# Transaction fees on OP Mainnet
@@ -35,8 +36,23 @@ OP Mainnet is designed to be [EVM equivalent](https://web.archive.org/web/202311
3536
However, transaction fees on all Layer 2 systems need to diverge from Ethereum to some extent for a number of reasons.
3637
This page provides a detailed look at exactly how transaction fees work on OP Mainnet so you can properly account for them in your application.
3738

38-
OP Mainnet transaction fees are composed of an [Execution Gas Fee](#execution-gas-fee) and an [L1 Data Fee](#l1-data-fee).
39-
The total cost of a transaction is the sum of these two fees.
39+
OP Mainnet transaction fees are composed of an [Execution gas fee](#execution-gas-fee), an [L1 data fee](#l1-data-fee), and after the [Isthmus upgrade](/notices/upgrade-14#operator-fee), an [operator fee](#operator-fee).
40+
The total cost of a transaction is the sum of these fee components:
41+
42+
**Before Isthmus:**
43+
44+
```
45+
totalFee = gasUsed * (baseFee + priorityFee) + l1Fee
46+
```
47+
48+
**After Isthmus:**
49+
50+
```
51+
operatorFee = operatorFeeConstant + operatorFeeScalar * gasUsed / 1e6
52+
53+
totalFee = operatorFee + gasUsed * (baseFee + priorityFee) + l1Fee
54+
```
55+
4056
Continue reading to learn more about exactly how each of these fee components are charged.
4157

4258
## Execution gas fee
@@ -112,7 +128,7 @@ the L1 Data Fee are generally quite small and should not impact the average tran
112128

113129
<Callout>
114130
The L1 Data Fee formula changed with the Ecotone upgrade.
115-
Refer to the [Network Upgrade Overview](/operators/node-operators/network-upgrades) for network upgrade activation timestamps for OP Sepolia and OP Mainnet.
131+
Refer to the [Network upgrade overview](/operators/node-operators/network-upgrades) for network upgrade activation timestamps for OP Sepolia and OP Mainnet.
116132
</Callout>
117133

118134
Prior to the Ecotone upgrade, the L1 Data Fee is calculated based on the following parameters:
@@ -224,20 +240,75 @@ l1Cost = estimatedSizeScaled * l1FeeScaled / 1e12
224240

225241
The new cost function takes into account the compression ratio, so chain operators will need to adjust their `baseFeeScalar` and `blobFeeScalar` to account for any previous compression ratios that they encountered on their chains. Chain operators can use the [Fjord fee parameter calculator](https://docs.google.com/spreadsheets/d/1V3CWpeUzXv5Iopw8lBSS8tWoSzyR4PDDwV9cu2kKOrs/edit#gid=186414307) to get a better estimate of scalar values to use for their chain.
226242

227-
## Sequencer Fee Vault
243+
## Operator fee
244+
245+
<Callout>
246+
The Operator fee is introduced with the [Isthmus upgrade](/notices/upgrade-14#operator-fee) and provides OP Stack chains with more flexible pricing models.
247+
Refer to the [Network upgrade overview](/operators/node-operators/network-upgrades) for network upgrade activation timestamps.
248+
</Callout>
249+
250+
The Operator fee is a new fee component introduced with the Isthmus upgrade that enables more customizable fee structures for OP Stack chains. This fee is integrated directly into the EVM alongside the standard gas fee and L1 data fee, allowing chain operators to implement additional revenue models or cover specific operational costs.
251+
252+
### Mechanism
253+
254+
The Operator fee is automatically charged for any transaction that is included in a block after the Isthmus activation. This fee is deducted directly from the address that sent the transaction and follows the same semantics as existing fees charged in the EVM. The collected operator fees are sent to the **Operator Fee Vault**, a new vault similar to existing fee vaults.
255+
256+
<Callout>
257+
**Deposit transactions do not get charged operator fees.** For all deposit transactions, regardless of the operator fee parameter configuration, the operator fee is always zero.
258+
</Callout>
259+
260+
### Formula
261+
262+
The Operator fee is calculated using the following formula:
263+
264+
```
265+
operatorFee = (gas × operatorFeeScalar ÷ 10^6) + operatorFeeConstant
266+
```
267+
268+
Where:
269+
270+
* `gas` is the amount of gas that the transaction used
271+
* `operatorFeeScalar` is a `uint32` scalar set by the chain operator, scaled by 1e6
272+
* `operatorFeeConstant` is a `uint64` scalar set by the chain operator
273+
274+
### Configuration
275+
276+
The `operatorFeeScalar` and `operatorFeeConstant` parameters can be accessed in two ways:
277+
278+
1. **From deposited L1 attributes** of the current L2 block
279+
2. **From the L1 Block Info contract** (`0x4200000000000000000000000000000000000015`):
280+
* Using solidity getter functions (`operatorFeeScalar`, `operatorFeeConstant`)
281+
* Using direct storage reads:
282+
* Operator fee scalar as big-endian `uint32` in slot `8` at offset `0`
283+
* Operator fee constant as big-endian `uint64` in slot `8` at offset `4`
284+
285+
### EVM Integration
286+
287+
The Operator fee follows standard EVM fee semantics:
288+
289+
1. **Pre-execution validation**: Account must have enough ETH to cover worst-case gas + L1 data fees + worst-case operator fee
290+
2. **Gas purchase**: Account is charged the worst-case operator fee before execution
291+
3. **Refunds**: After execution, unused operator fee gas is refunded to the account
292+
4. **Fee distribution**: The spent operator fee is sent to the Operator Fee Vault
293+
294+
### Transaction pool impact
295+
296+
Transaction pools must account for the additional operator fee when validating transactions. Transactions without sufficient balance to cover the worst-case total cost (including operator fee) will be rejected.
297+
298+
## Sequencer fee vault
228299

229-
The Sequencer Fee Vault collects and holds transaction fees paid to the sequencer during block production on OP Mainnet. These fees cover the cost of posting transaction data to L1, ensuring network sustainability and data availability.
300+
The Sequencer fee vault collects and holds transaction fees paid to the sequencer during block production on OP Mainnet. These fees cover the cost of posting transaction data to L1, ensuring network sustainability and data availability.
230301

231-
### Fee Collection and Distribution
302+
### Fee collection and distribution
232303

233-
* **Purpose**: The sequencer deposits collected fees into the Sequencer Fee Vault. These fees reimburse the sequencer for gas costs when submitting transaction batches to L1.
234-
* **Vault Address**: The Sequencer Fee Vault is predeployed at the address `0x4200000000000000000000000000000000000011` on the OP Mainnet.
235-
* **Fee Usage**: Stored fees are eventually transferred to a designated recipient address (e.g., a treasury or distribution contract).
304+
* **Purpose**: The sequencer deposits collected fees into the Sequencer fee vault. These fees reimburse the sequencer for gas costs when submitting transaction batches to L1.
305+
* **Vault address**: The Sequencer fee vault is predeployed at the address `0x4200000000000000000000000000000000000011` on the OP Mainnet.
306+
* **Fee usage**: Stored fees are eventually transferred to a designated recipient address (e.g., a treasury or distribution contract).
236307

237308
### How it works
238309

239-
1. **Fee Collection**: During the processing of transactions, the sequencer collects fees from users as part of their transaction costs. These fees are primarily used to cover the gas expenses of posting transaction data to Ethereum L1.
240-
2. **Storage**: Collected fees are deposited into the Sequencer Fee Vault contract.
310+
1. **Fee collection**: During the processing of transactions, the sequencer collects fees from users as part of their transaction costs. These fees are primarily used to cover the gas expenses of posting transaction data to Ethereum L1.
311+
2. **Storage**: Collected fees are deposited into the Sequencer fee vault contract.
241312
3. **Distribution**: The fees are later distributed to the appropriate recipient, typically covering operational costs like L1 gas fees for data availability.
242313

243314
This system ensures effective fee management, maintaining the security and operation of the Optimism network.

0 commit comments

Comments
 (0)