Gas
The unit measuring computational work and the associated fees required to execute transactions on a blockchain.
Last Updated
2026-03-19
Related Concepts
What is Gas?
Gas is the fundamental unit used to measure the computational effort required to execute operations on a blockchain. A "Gas Fee" is the actual cost paid in the network's native cryptocurrency (like ETH) to validators or miners to process and confirm a transaction.
How does Gas work?
- Each operation (e.g., sending tokens or calling a smart contract) has a fixed gas cost based on its complexity.
- Users set a "Gas Limit" (maximum units they're willing to use) and a "Gas Price" (how much they'll pay per unit in Gwei).
- The total fee is calculated by multiplying the gas actually consumed by the gas price.
- Under EIP-1559, the fee includes a "Base Fee" (which is burned) and a "Priority Fee" or "Tip" (paid to the validator).
- The calculation follows this formula: Total Fee = Gas Used × (Base Fee + Priority Fee)
Why does Gas matter?
Gas decouples the cost of computation from the volatile market price of the cryptocurrency. It prevents network spam and infinite loops by making it expensive to overwhelm the blockchain with useless data or inefficient code, while incentivizing validators to secure the network.
Key features of Gas
- Fixed unit of computational work for every opcode
- Fees vary based on network demand and congestion
- Prevents infinite loops and network abuse
- Determines transaction priority in the mempool
- Paid in the blockchain's native currency (e.g., ETH, MATIC)
Examples of Gas
A simple ETH transfer typically requires exactly 21,000 gas units. A complex swap on a decentralized exchange might require 150,000 gas units or more.
During high network traffic, you might pay 50 Gwei
per gas unit, making a simple transfer cost significantly more than during quiet periods.
