Transactions on Scroll, like on Ethereum, must pay the cost of executing their computations and storing the data they produce.
In short, it is calculated very simply:
l2TransactionExecutionFee = l2TransactionGasUsed * l2TransactionGasPrice
The total fee depends on what the transaction does (
l2TransactionGasUsed) as well as the current market conditions (
l2TransactionGasPrice). Users set the gas price, and the "gas used" is determined by the
estimateGasendpoint on our Nodes.
Currently, all L2 tx fees are collected into our L2
FeeVaultpredeploy at address
0x5300000000000000000000000000000000000005. This contract also tracks the amount we’ve historically withdrawn to L1.
Check amount withdrawn to L1 (in ETH):
cast call --rpc-url "https://alpha-rpc.scroll.io/l2" "0x5300000000000000000000000000000000000005" "totalProcessed()(uint256)" | cast --from-wei
Check fees that have been collected on L2 but haven’t been bridged back to L1 (in ETH):
cast balance --rpc-url "https://alpha-rpc.scroll.io/l2" "0x5300000000000000000000000000000000000005" | cast --from-wei