L1 Data Fee Calculation (Fjord)

This page describes how to calculate the L1 data fee for a specific transaction on a Zircuit network post Fjord upgrade.

Retrieve the parameters

To perform the calculation the following parameters are needed:

  • L1 base fee

  • L1 base fee scalar

  • L1 blob base fee

  • L1 blob base fee scalar

They are available by calling the Gas Price Oracle smart contract predeployed on every Zircuit network on this address: 0x420000000000000000000000000000000000000F

To retrieve them we can use Foundry's cast. You will need the block number in which the transaction was included to retrieve the parameters from the right point in time. You will also need a valid RPC url. For example you'll find the RPC urls on this page:

RPCs

L1 base fee:

cast call 0x420000000000000000000000000000000000000F "l1BaseFee()(uint256)" --rpc-url $RPC_URL --block $BLOCK_NUMBER

L1 base fee scalar:

cast call 0x420000000000000000000000000000000000000F "baseFeeScalar()(uint256)" --rpc-url $RPC_URL --block $BLOCK_NUMBER

L1 blob base fee:

cast call 0x420000000000000000000000000000000000000F "blobBaseFee()(uint256)" --rpc-url $RPC_URL --block $BLOCK_NUMBER

L1 blob base fee scalar:

Get the raw RLP-encoded signed transaction:

intercept

-42_585_600

Linear regression intercept (scaled by 1e6)

fastlzCoef

836_500

Linear regression coefficient (scaled by 1e6)

minTransactionSize

100

Minimum transaction size in bytes

fastLzSize can be calculated using the bytes represented by the raw RLP-encoded signed transaction as the parameter.

Now that you have all the info you need, you can just apply the following formula:

Last updated

Was this helpful?