Gas (Ethereum)
What is gas?
Gas is the unit that measures the computational work required to execute transactions and smart contracts on the Ethereum network. Fees paid in gas compensate validators for processing and validating that work. Gas prices are quoted in gwei, where 1 gwei = 10⁻⁹ ETH.
How gas works
- Every operation on Ethereum—sending ETH, calling a smart contract, deploying code—consumes gas according to its computational cost.
- A transaction specifies a gas limit (maximum gas the sender is willing to use) and a gas price (what the sender will pay per unit of gas).
- Validators (formerly miners, now stakers after the switch to proof-of-stake) process transactions and receive compensation via tips and staking rewards.
- EIP-1559 (introduced in 2021) changed fee mechanics: each transaction pays a network-set base fee that is burned, plus an optional priority fee (tip) that goes to the validator who includes the transaction.
Calculating gas fees
Total transaction fee = Units of gas used × (Base fee + Priority fee)
Explore More Resources
- Units of gas used: actual gas consumed by the operation.
- Base fee: dynamically determined per block and burned (reduces ETH supply).
- Priority fee (tip): optional, paid to validators to prioritize the transaction.
Example:
– Gas used = 2 units; base fee = 11 gwei; priority fee = 3 gwei
– Fee = 2 × (11 + 3) = 28 gwei = 0.000000028 ETH
Gas and the Ethereum Virtual Machine (EVM)
The EVM is a global virtual machine that executes smart contracts. Gas exists to meter and limit computation on the EVM so that:
– Contracts cannot run indefinitely.
– The network allocates resources fairly and resists spam.
Tokens and dApps built on Ethereum (for example, ERC-20 tokens) require gas to transfer or interact because their operations run on the EVM.
Explore More Resources
Why gas fees fluctuate and can be high
Gas prices depend primarily on supply and demand for block space:
– Network congestion: more transactions competing to be included leads to higher base fees and higher priority fees.
– Complex smart contract interactions consume more gas than simple transfers, raising costs for those operations.
– Validator availability, market activity (NFT drops, DeFi activity), and other demand spikes also increase fees.
The Merge (transition to proof-of-stake) changed consensus and validator incentives but did not directly solve high-fee episodes; scaling solutions are required to reduce per-transaction costs under high demand.
Explore More Resources
Ways to reduce gas costs
- Time transactions: submit when network activity is low. Gas trackers report current and historical fees.
- Adjust the priority fee: set a lower tip and accept slower confirmation.
- Use Layer 2 solutions: rollups and sidechains process transactions off the Ethereum main chain and post summaries on-chain, typically offering much lower fees.
- Batch or bundle operations where possible (some wallets and dApps support batching).
- Choose wallets that suggest efficient fee settings or integrate Layer 2 options.
Frequently asked questions
Q: What is gwei?
A: A denomination of ETH equal to 10⁻⁹ ETH; commonly used to quote gas prices.
Q: Does Ethereum “run on gas”?
A: Gas is the economic mechanism that funds the work of validators and meters computation on Ethereum. Without fees, there would be little incentive to secure and validate transactions.
Explore More Resources
Q: What part of the fee goes to validators?
A: After EIP-1559, the base fee is burned; the priority fee (tip) and staking rewards go to validators under proof-of-stake.
Q: How can I see current gas prices?
A: Gas tracker tools and many wallets display current base fee and recommended priority fees to help time and price transactions.
Explore More Resources
Bottom line
Gas fees are the mechanism that measures and pays for computation on Ethereum. They protect the network from abuse, compensate validators, and influence user behavior. While consensus upgrades and protocol changes affect how fees are handled, the primary way to reduce per-transaction costs is scaling—through Layer 2 solutions and improvements that increase throughput or shift activity off the main chain.