Key Terms and Concepts
Gas
A unit of measurement representing the work done to execute a transaction, “gas” varies based on the complexity of the transaction being executed.Gas Price
The amount of Sei paid per unit of gas used when executing a transaction. The gas price is set by the user and is used to calculate the fee for the transaction.Gas Limit
The maximum amount of gas the user wants the transaction to use. If the gas limit is set too low, the node attempting to run the transaction will run out of gas and fail to complete the transaction, using up the entire max gas without completing the transaction.Fee
Fee = Gas Price * Gas Used.
The gas limit caps the maximum possible charge at Gas Price * Gas Limit. Note
that on Sei, excess gas (the gas limit beyond the actual gas used) may not be
refunded in full or in part, so avoid setting gas limits far above what a
transaction actually needs. See
Sei EVM vs Ethereum for details.
To estimate fees on Sei, query the network directly using the standard EVM
JSON-RPC methods eth_gasPrice, eth_maxPriorityFeePerGas, and
eth_feeHistory. These return real-time gas pricing straight from the chain
with no third-party service required. See
Estimating gas prices below for examples.
Maximum Gas
The maximum gas limit for a transaction ensures that complex transactions do not consume excessive resources. You can find the maximum gas limits for each chain in the Sei chain registry or by querying the/consensus_params of the RPC node itself (ex.
https://rpc.sei-apis.com/consensus_params).
Minimum Gas Price
Sei enforces minimum gas prices to prevent spam transactions. These prices are set per chain and are detailed in the chain registry.Max Bytes
Each transaction has a maximum size in bytes, which is set per chain. This limit can be queried on the RPC node directly using the/consensus_params endpoint.
Max Gas for Queries
Since queries also use gas, there is a maximum gas limit for queries. This limit is RPC specific, so check with your RPC provider to determine the maximum gas limit for queries.Sending Gas in Transactions
When submitting a TX to be broadcast, users specify the gas price and the gas limit to create the fee.Using seid
When using seid, the fee is set using the --fees flag, gas limit and gas
price can be set with --gas and --gas-prices flags respectively.
Using EVM (wagmi)
Optimizing Gas Prices for Smart Contracts
Optimizing gas prices involves efficient smart contract coding practices:- Minimize storage operations.
- Use fixed-size data structures where possible.
- Avoid unnecessary computations.
Estimating Gas Prices
Sei’s EVM RPC exposes the standard Ethereum JSON-RPC methods for gas estimation, so you can read real-time pricing directly from the network without relying on a third-party service:eth_gasPrice— current recommended gas price for legacy transactions.eth_maxPriorityFeePerGas— suggested priority fee (tip) for EIP-1559 transactions.eth_feeHistory— recent base fees and priority-fee percentiles, useful for building custom fee strategies.
pacific-1) directly: