Gas
Gas is the unit that measures how much computational work a transaction requires on Ethereum and similar blockchains.
Gas measures the computational effort a transaction uses. Each operation that the Ethereum Virtual Machine performs, such as adding numbers, storing data, or calling another contract, has a fixed gas cost. A plain ETH transfer uses 21,000 gas. A token swap on a decentralized exchange might use 100,000 to 200,000 gas. Deploying a large contract can use millions.
Gas exists to price computation fairly and to stop infinite loops. Every transaction specifies a gas limit, the maximum it is willing to consume. If execution runs out of gas before finishing, the transaction fails but the gas already used is still paid. This ensures that nobody can clog the network with a program that never halts.
Gas is a quantity, not a price. The fee a user actually pays is gas used multiplied by the gas price, which is quoted in gwei. Other smart contract chains use similar models with different names and costs, and layer 2 rollups charge much lower effective gas prices by batching many transactions together.
What are gas fees? covers this in 6 minutes, with a quiz at the end.
Coinucation