tx.gasPrice * l2GasUsed(up to
tx.gasLimit). The L2 gas price will vary depending on network congestion.
l1GasPrice * l1GasUsed. This is the cost of storing the transaction's data on L1.
l1GasPriceis the same as the normal gas price in L1 Ethereum
l1GasUsedis calculated as
1.2*(overhead + calldataGas). Thus, more calldata your transaction includes, the more expensive your L1 fee will be. For example, an ETH transfer has no calldata, so it will have the cheapest L1 fee, whereas large contract deployments can have over 25kb of calldata and will result in a high L1 fee. We currently just the overhead value to the L1 fee to ensure the fee paid covers the actual L1 costs.
tx.gasPrice * (l2GasUsed + l1GasPrice * l1GasUsed / tx.gasPrice). The total cost for BOBA is calculated as
tx.gasPrice * (l2GasUsed + l1GasPrice * l1GasUsed / tx.gasPrice) * priceRatiowhere the price ratio is
ETH price / BOBA price * discount percentage. The L2 gas Used is higher than l1, because we add the L1 security fee.
OVM_GasPriceOracle.gasPrice) or by simply making an RPC query to
eth_gasPrice. If you don't specify your
gasPriceas an override when sending a transaction ,
ethersby default queries
eth_gasPricewhich will return the lowest acceptable L2 gas price.
tx.gasLimithowever you might normally set it (e.g. via
eth_estimateGas). The gas usage for transactions on Boba Network will be larger than the gas usage on Ethereum, becuase the
l1SecurityFeeis included in the gas usage.
Fee too Lowerror detailed below, to allow users to re-calculate their
tx.gasLimitand resend their transaction if L1 gas price spikes.
tx.gasLimitto any number that is smaller than the value from
tx.gasLimitas it functions exactly like on L1. You can show the math :
Boba_GasPriceOracleto calculate total fee and get the fee token
true, then the user picks BOBA as the fee token and the total Boba transaction fee is
tx.gasLimit * tx.GasPrice * priceRatio.
ETH as the fee token
invalid transaction: insufficient funds for l1Fee + l2Fee + value
BOBA as the fee token
invalid transaction: insufficient Boba funds for l1Fee + l2Fee + value
gas price too low: 1000 wei, use at least tx.gasPrice = X weiwhere
tx.gasPricevia RPC query at
eth_gasPriceor by calling
gas price too high: 1000000000000000 wei, use at most tx.gasPrice = Y weiwhere
tx.gasPriceprovided is ≥3x the expected
tx.gasPrice, you will get this error^, note this is a runtime config option and is subject to change