Blockchain & Crypto Fundamentals

Gas

The unit measuring the computational effort required to execute operations on EVM chains; gas fees are gas used × gas price.

Gas — Gas is the unit of measurement for the computational effort required to execute transactions and smart contract operations on a blockchain. On Ethereum and EVM-compatible networks, users pay gas fees in the native token (ETH, BNB, MATIC) to compensate validators for processing their transactions, with more complex operations consuming more gas.

How Gas Works

Every operation on an EVM blockchain has a fixed gas cost defined by the protocol. A simple ETH transfer costs 21,000 gas. An ERC-20 token transfer costs approximately 65,000 gas. A complex DEX swap might cost 150,000-300,000 gas. The total transaction fee is calculated as: gas used multiplied by the gas price (measured in gwei, where 1 gwei = 0.000000001 ETH).

Since Ethereum's EIP-1559 upgrade, gas pricing uses a base fee (set by the protocol based on network demand) plus an optional priority fee (a tip to validators for faster inclusion). The base fee is burned, removing ETH from circulation, while the priority fee goes to the validator who includes the transaction in a block.

On non-Ethereum chains, gas works similarly but with different cost scales. BNB Chain transactions typically cost 0.0001-0.001 BNB ($0.01-$0.10). Solana uses a different fee model where base fees are fixed at 5,000 lamports (approximately $0.001) per signature, with optional priority fees for faster inclusion during congestion.

Why Gas Matters

Gas fees directly impact trading profitability. On Ethereum mainnet, a single DEX swap can cost $5-$50 in gas during normal conditions and $100+ during network congestion. This means small trades on Ethereum mainnet may lose money to gas alone. Layer-2 networks like Arbitrum and Base reduce these costs to $0.01-$0.50 per transaction while inheriting Ethereum's security.

Understanding gas is essential for optimizing trading strategies. Timing transactions during low-congestion periods (weekends, early morning UTC) can reduce costs by 50-80%. Setting appropriate gas limits prevents wasted fees on failed transactions. For automated trading tools like those provided by OpenLiquid, gas optimization is built into the execution logic to minimize costs across multiple transactions.

Real-World Example

A trader wants to swap USDC for a new ERC-20 token on Uniswap V3 on Ethereum mainnet. The swap uses 184,000 gas. With a base fee of 25 gwei and a priority fee of 2 gwei, the total cost is 184,000 x 27 gwei = 4,968,000 gwei = 0.004968 ETH (approximately $15 at $3,000/ETH). The same swap on Arbitrum would use similar gas units but at a much lower gas price, costing approximately $0.10. On Solana, an equivalent Jupiter swap would cost roughly $0.001 in SOL fees. This cost difference is a primary reason traders choose Layer-2 and alternative chains for frequent trading.

Common questions about Gas in cryptocurrency and DeFi.

Gas prices fluctuate based on network demand. When many users submit transactions simultaneously (during token launches, NFT mints, or market volatility), competition for block space drives gas prices up. The EIP-1559 base fee adjusts every block — increasing when blocks are more than 50% full and decreasing when they are less than 50% full.

If your gas price is below the network's minimum base fee, your transaction will sit in the mempool until gas prices drop or the transaction expires. On Ethereum, pending transactions can be replaced by sending a new transaction with the same nonce and a higher gas price. Setting gas too low during volatile market conditions can cause your trade to execute at a worse price or fail entirely.

Yes. If a transaction is included in a block but fails during execution (due to a reverted smart contract call, insufficient token balance, or expired slippage tolerance), the gas used up to the point of failure is still consumed and charged. The transaction fee is paid to the validator even though the intended action did not complete.

Ready to put your knowledge into practice?

Start Boosting