Gas Fees

In Lumia L2, the gas fee is calculated by applying a fixed factor over the L1 gas fee. This price factor is a fixed value that doesn't change often, and its value is based on the rollup's cost to publish transactions to L1. In simple terms, gas prices in L2 will linearly follow gas prices in L1.

The formula for calculating the L2 gas fee is as follows:

𝐿2ğ‘”ğ‘Žğ‘ ğ‘“ğ‘’ğ‘’=𝐿1ğ‘”ğ‘Žğ‘ ğ‘“ğ‘’ğ‘’âˆ—ğ¹ğ‘Žğ‘ğ‘¡ğ‘œğ‘Ÿğ¿2{ğ‘”ğ‘Žğ‘ _𝑓𝑒𝑒} = 𝐿1{ğ‘”ğ‘Žğ‘ _𝑓𝑒𝑒} ∗ ğ¹ğ‘Žğ‘ğ‘¡ğ‘œğ‘Ÿ


  • 𝐿2{ğ‘”ğ‘Žğ‘ _𝑓𝑒𝑒} represents the gas fee on Lumia L2

  • 𝐿1{ğ‘”ğ‘Žğ‘ _𝑓𝑒𝑒} represents the gas fee on the Ethereum L1

  • ğ¹ğ‘Žğ‘ğ‘¡ğ‘œğ‘Ÿ is the fixed value that determines the relationship between L1 and L2 gas fees

The L1 fee will vary depending on the number of transactions on the L1 network. If the timing of your transaction is flexible, you can save costs by submitting transactions during periods of lower gas on the L1 (for example, over the weekend).

In the future, Lumia L2 plans to support a congestion mechanism based on EIP-1559, which will make the L2 gas fee dynamic and more responsive to network conditions.

Fetching Gas Price from Lumia L2 RPC Node

To fetch the current gas price on Lumia L2, you can make the following RPC call to the Lumia L2 Sequencer:

curl \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_gasPrice","params":[],"id":1,"jsonrpc":"2.0"}'

The result of this RPC call will be the hex value of the gas price in wei.

By understanding the relationship between L1 and L2 gas fees and utilizing the provided RPC call, developers and users can make informed decisions about transaction costs and optimize their interactions with the Lumia L2 network.

Last updated