GLOSSARY · BLOCKCHAIN & WEB3
Gas
What gas is on Ethereum: the unit that measures the cost of every operation, how fees are calculated (gas limit, base fee, tip) and how to pay less.
Reviewed on
What is gas?
Gas is the unit of measure that determines the computational cost required to execute operations, transactions and smart contracts on Ethereum and other blockchains compatible with the Ethereum Virtual Machine (EVM). Each instruction or function in a smart contract consumes a specific amount of gas, and the total amount of gas required for an operation reflects how complex that action is from the point of view of processing and storage.
For a transaction to be processed on the network, the user must define:
- Gas limit: the maximum amount of gas you are willing to spend.
- Gas price: the price per unit of gas, usually expressed in gwei (a fraction of ETH).
The total cost of a transaction is calculated as:gas used × gas price = fee in ETH
In Ethereum and its L2s, this system performs several functions:
- Prevents misuse of computing resources (such as infinite loops).
- Allows you to prioritize transactions depending on the price offered (greater incentive = faster).
- Rewards validators or miners that process transactions.
- Adjusts the internal economy of the network through mechanisms such as EIP-1559 (base fee + tip).
Gas can vary greatly depending on:
- The state of network congestion.
- The type of transaction (e.g. transferring ETH vs. minting an NFT).
- The blockchain used (e.g. Ethereum mainnet, Arbitrum, Polygon).
In L2 solutions, gas still exists but is usually much cheaper. In many cases, it is even abstracted away from the end user.
Learn more: What are smart contracts and what are they used for?
Explained simply
Gas is like the digital fuel you need for anything to work on the blockchain. If you want to send cryptocurrency or use a decentralized app, you have to pay a small amount of gas for the network to process it. Without gas, the transaction is not executed. The more complex the action, the more gas you need.
Gas: key points
- It is the measure of the computational cost of an operation in the blockchain network.
- Each executed transaction or action consumes a specific amount of gas
- It is paid in native cryptocurrency (such as ETH) to encourage validators or miners
- Prevents abuse and ensures the proper functioning of smart contracts
- Varies depending on network, traffic and type of operation
Gas: advantages
- Controls the efficient use of resources on the blockchain network
- Encourages transaction processing by nodes
- Allows you to adjust the execution priority depending on the gas price
- Encourages code optimization in dApps and smart contracts
- It supports the economic sustainability of the network (base fee, burning, etc.)
Gas: disadvantages
- Can be expensive in times of congestion, affecting usability
- It hinders the non-technical user experience, especially if you don't understand how it's calculated
- Requires accurate estimates to avoid failures in complex contracts
- Misconfigured, can lead to failed or slow transactions
- It's not uniform across networks, which can lead to confusion
RELATED CONCEPTS
KEEP LEARNING
RELATED SERVICES