Configure and optimize gas
To configure gas behavior on an Arbitrum (Orbit) chain using the Arbitrum Orbit SDK, you primarily use the ArbOwner
precompile (at address 0x0000000000000000000000000000000000000070
), which allows the chain owner to manage key parameters via function calls. These are called with post-deployment using tools like cast
(from Foundry) or a custom script with a library like ethers.js
or viem
. The defaults inherit from the parent chain or standard Nitro settings, but it is possible to customize your Arbitrum chain as they are permissioned by design.
Below is a breakdown of each specified parameter, including its role, typical defaults (based on Arbitrum One), and how to configure it. Note that changes may require careful consideration to avoid impacting chain performance, user experience, or security. For example, setting limits too high could lead to state bloat or slower block processing.
Gas speed limit
- Description: This is the target gas consumption rate per second that the chain can sustainably handle. It influences the congestion mechanism: if gas usage exceeds this limit, the base fee rises to throttle demand; if below the limit, the cost decreases (down to the floor). ArbOS uses this to update gas pools and enforce dynamic per-block gas limits.
- Default: 7,000,000 gas/second.
- Configuration: Call the
setSpeedLimit(uint256 newSpeedLimit)
method on theArbOwner
precompile, wherenewSpeedLimit
is the desired gas per second.
Example using cast
:
cast send --rpc-url $ORBIT_RPC --private-key $OWNER_KEY 0x0000000000000000000000000000000000000070 "setSpeedLimit(uint256)" $NEW_SPEED_LIMIT
This setting is adjustable post-deployment. Any modifications should align with your node's capabilities to prevent issues with the congestion mechanism activating.
Refer to the Chain parameters page, or the Additional configuration parameters for additional information.
Block gas limit
- Description: This limits the maximum amount consumable by all transactions in a single L2 block - for execution, not for the parent chain data availability (DA) fee charge. It helps control block size and processing time. In practice, ArbOS enforces a dynamic limit based on the speed limit and gas pools, but this sets a hard cap.
- Default: 32,000,000 gas per block.
- Configuration: Call the
setMaxTxGasLimit(uint256 newLimit)
method on theArbOwner
precompile, wherenewLimit
is the desired max gas. This method is described as setting the block limit, although technically it may focus on per-transaction limits; in practice, it caps block usage.
Example using cast
:
cast send --rpc-url $ORBIT_RPC --private-key $OWNER_KEY 0x0000000000000000000000000000000000000070 "setMaxTxGasLimit(uint256)" $NEW_LIMIT
This setting is adjustable post-deployment. Setting it too high can harm user experience due to longer block times.
Refer to the Chain parameters page, or the Additional configuration parameters for additional information.
Gas price floor
- Description: This is the minimum L2 base fee (in
wei
per gas unit), preventing fees from dropping too low during periods of low activity. The actual base fee fluctuates based on demand, but it will not fall below this set floor. It will affect user transaction costs. - Default: 0.1
gwei
(100,000,000wei
). - Configuration:
- During deployment: Set the
minL2BaseFee
field in the Orbit setup script's config JSON. - Post-deployment: Call the
setMinimumL2BaseFee(uint256 newMinBaseFee)
method on theArbOwner
precompile, wherenewMinBaseFee
is the value inwei
.
- During deployment: Set the
Example using cast
:
cast send --rpc-url $ORBIT_RPC --private-key $OWNER_KEY 0x0000000000000000000000000000000000000070 "setMinimumL2BaseFee(uint256)" $NEW_FLOOR_IN_WEI
You can query the current floor via the ArbGasInfo precompile's getMinimumGasPrice()
.
Refer to the Chain parameters, Additional configuration parameters, or the How to manage the fee parameters pages for additional information.
Per batch gas cost
- Description: This refers to the fixed L1 base charge applied for the overhead of posting each batch to the parent chain. It is used in transaction pricing to amortize the parent chain's fixed costs (like calldata posting) over the batch's transactions. It can be adjusted to reflect actual posting costs or incentivize batching. The surplus (if any) gets rewarded to the batch poster.
- Default: Varies based on parent chain fees, but typically around 210,000 gas (adjustable to match).
- Configuration: Call the
setPerBatchGasCharge(int64 newCharge)
on theArbOwner
precompile, wherenewCharge
is the fixed gas units per batch. This configuration adjusts the allocation of L2 gas for batch overhead in pricing. Additionally, you can configure related surplus fees (extra reward to batch poster) viasetL1PricingRewardRate(uint64 rate)
. The parent chain base fee estimates influence the actual cost, which is dynamic; therefore, monitor them viaArbGasInfo
'sgetPricesInWei()
method.
Example using cast
(for per batch charge):
cast send --rpc-url $ORBIT_RPC --private-key $OWNER_KEY 0x000000000000000000000000000000000000000070 "setPerBatchGasCharge(int64)" $NEW_BATCH_COST
This configuration is adjustable post-deployment. When working with layers or parent chains, you may need to further configure the data availability setup.
Refer to the How to manage the fee parameters page for more information.
Always test changes on a devnet or testnet Arbitrum (Orbit) chain, as misconfiguration can lead to unexpected fee behavior or chain instability. Refer to the ArbOwnerPublic
precompile for reading current settings without modifications. If using a custom gas token, ensure configurations are compatible.