Ethereum Fundamentals
Gas: Paying for Computation on a Shared Machine · 1/2

Why a global computer needs a meter

Every full node on Ethereum re-executes every transaction to verify the network's shared state, which means computation isn't free the way it is on your own laptop, it's work that thousands of independent computers around the world all redo. Without some limit, a single poorly written or malicious program could contain an infinite loop and force every node to compute forever, effectively freezing the entire network. Gas exists to prevent exactly that.

Gas is Ethereum's unit for measuring computational effort. Every operation the EVM can perform, adding two numbers, writing to storage, calling another contract, has a fixed gas cost attached to it. When you send a transaction, you specify a gas limit, the maximum amount of computational work you're willing to pay for, and if execution would exceed that limit, it's stopped and reverted. This turns an open-ended 'how much work will this take' problem into something bounded and payable upfront.