What is Gas in Blockchain

Gas is the fee for blockchain computation: 21,000 units × 50 Gwei = 0.00105 ETH for a simple transfer.

BASICS3 min readBy AlgoSys Editorial TeamPublished Apr 25, 2026Updated Jun 24, 2026
Contents

Gas is the fee for the network to process your transaction or execute a smart contract. You encounter such a fee every time you send cryptocurrency, trade on a DEX (decentralized exchange), or use a dApp (decentralized application). Understanding how gas works is worthwhile at least to avoid overpaying and encountering unpleasant surprises out of the blue.

KEY CONCEPTS

Gas measures the computational work the network performs for your operation. Essentially, it's the price for using the blockchain's shared resources. This mechanism encourages economical resource use and discourages flooding the network with spam transactions, as each one costs something.

To speak the same language going forward, here are the main terms:

  • Gas limit: the maximum amount of gas you are willing to spend on a transaction.
  • Gas price: how much cryptocurrency you pay for one unit of gas.
  • Transaction fee: the total cost, which equals the gas used multiplied by the gas price.
  • Computational effort: how much gas the transaction or smart contract actually consumed.
  • Network congestion: high demand for block space, which pushes the gas price up.
  • Miner/validator reward: payment to network operators for processing transactions.

HOW IT WORKS

Suppose you are sending 0.05 ETH from wallet A to wallet B on the Ethereum network. When initiating the transaction, you set two parameters: gas limit and gas price. The network estimates how many computational resources your operation will require, and this work is measured in "gas units."

The final fee is obtained by simple multiplication: used gas units multiplied by your chosen gas price. Let's say the transaction requires 21,000 gas units, and you set the gas price at 50 Gwei. Then the fee will be 0.00105 ETH (21,000 × 50 Gwei). This money goes to the validators as payment for processing and verifying your transaction.

The gas limit acts as a safeguard. If the transaction consumes less gas than the limit set, the remainder is returned to you. However, if more gas is needed than the limit, the transaction aborts with an error, but the gas spent up to that point is not refunded. This is how the network insures itself against operations that consume resources uncontrollably.

USE CASES

Most often, you pay gas when simply sending coins from your wallet to another address, whether it's Bitcoin, Ether, or stablecoins. The fee is the reason why validators agree to accept and confirm your transaction.

Interacting with decentralized applications is also not free. Swapping tokens on a DEX, adding liquidity, minting an NFT, each of these actions loads the blockchain with computations, meaning it incurs a gas fee.

Gas can even be spent on seemingly minor steps, such as granting a smart contract permission to manage your token before an exchange. Understanding these costs helps in planning activity and choosing moments when the network is less busy and fees are lower.

A good illustration of how much the cost can vary is comparing a Layer 1 (L1) network with Layer 2 (L2) solutions, which process transactions off the main chain and then record the result on it.

Where the transaction occurs Gas Fee
Ethereum Mainnet (L1) noticeably higher, especially during congestion
L2 Solutions (Polygon, Arbitrum) significantly lower due to off-chain processing

FREQUENTLY ASKED QUESTIONS

The gas price is not fixed; it fluctuates with demand. When many users try to conduct transactions simultaneously, the gas price jumps. The logic is the same as with dynamic pricing for taxi services: the more people want a ride, the more expensive it gets.

The fee structure varies among different blockchains. Bitcoin charges based on the transaction data size, while Ethereum calculates based on gas. Second-layer solutions like Polygon or Arbitrum offer significantly cheaper gas because they process transactions off the main chain and only record the final result on it.

The fee for a failed transaction cannot be refunded, but reducing the risk of failure is quite possible. Often, setting a gas limit with a buffer is enough to ensure the operation has sufficient resources to complete. And to catch moments with low prices, it's useful to monitor gas trackers.

FAQ

What is gas in blockchain in simple terms?

Gas is the fee for the network to process your transaction or execute a smart contract. It measures the computational work the blockchain does for your operation and also protects the network from spam, as every transaction costs something.

How is the gas fee calculated?

The total fee is equal to the gas units used multiplied by the gas price you choose. For example, with 21,000 gas units and a price of 50 Gwei, the fee will be 0.00105 ETH. This money goes to the validators for processing and verifying the transaction.

Why do gas fees constantly change?

The gas price follows the demand for block space. When many users try to conduct transactions simultaneously, the price jumps. It's like dynamic taxi fares: the more people want a ride, the more expensive it gets.

Will gas be refunded if a transaction fails?

No, the fee for a failed transaction cannot be refunded; gas is consumed for the work already done. Setting a gas limit with a buffer helps reduce the risk of failure, ensuring the operation has enough resources to complete.

Where are gas fees lower?

Transactions are cheapest on second-layer solutions like Polygon or Arbitrum. They process operations off the main chain and only record the final result on it, so gas there is significantly lower than on the Ethereum mainnet.

Put this to work in the terminal

Live charts, derivatives, on-chain and macro data, free.

Open terminal →