Glossary termFee mechanism

Gas (Ethereum)

Also known as: Gas fees

Unit measuring the computational work needed to execute operations on Ethereum, used to calculate transaction fees and limit resource use.

Gas is the unit Ethereum uses to measure the computational effort required by a transaction. Every operation in the Ethereum Virtual Machine, from adding two numbers to storing data, has a defined gas cost. A transaction sets a gas limit, the most it may consume, and pays a fee equal to the gas used multiplied by a price per unit, usually quoted in gwei, a billionth of an ether. If execution runs out of gas, its changes are reverted but the fee for the work already done is still paid.

Metering computation in this way stops programs from running forever and makes users pay for the resources they consume on a shared global computer. The London upgrade of 2021 implemented EIP-1559, which changed how fees are set. Since then, each block has a base fee per unit of gas, adjusted automatically according to demand and destroyed rather than paid to block producers, plus an optional priority fee, or tip, that goes to validators. Blocks have a target size and can temporarily expand when demand is high.

Gas costs shape how developers write smart contracts, encouraging code that minimizes storage and computation. During congestion, fees can rise high enough to price out small transactions, one reason for the growth of layer 2 networks that bundle many transactions together. Users should understand that fees vary with demand, that failed transactions still cost gas and that fee estimates in wallets are approximations. Other blockchains use comparable fee mechanisms under different names.

Key points

  • Every Ethereum operation has a gas cost that reflects its computational work.
  • Fees equal gas used multiplied by a price per unit of gas.
  • Since 2021 a protocol-set base fee is burned and validators receive optional tips.
  • High fees during congestion drove the growth of layer 2 networks.

Related entries

Technology

Ethereum

BlockchainProgramming

Decentralized blockchain platform, launched in 2015, that runs smart contracts and uses its native cryptocurrency, ether, to pay for computation.

Glossary term

Smart Contract

BlockchainProgramming

Program stored on a blockchain that runs automatically when its conditions are met, carrying out agreements or rules without a central operator.

Glossary term

Layer 2

Blockchain

Protocol built on top of a base blockchain that processes transactions off the main chain while relying on it for security and final settlement.

Technology

Solidity

BlockchainProgramming

Statically typed, object-oriented programming language for writing smart contracts on Ethereum and other EVM-compatible blockchains.

Glossary term

Financial services such as lending, trading and derivatives built from smart contracts on public blockchains, operating without traditional intermediaries.

Organization

Swiss nonprofit foundation that supports the development of the Ethereum blockchain through research, grants, client software and events.