- Link to the paper or docs
- https://ethereum.org/en/whitepaper/
- Your question
- Why does every transaction need gas?
- Read a web page https://ethereum.org/en/whitepaper/✓
Your question
Gas exists because Ethereum's scripting language can express loops, so a program could run forever. Each step of computation costs a fee paid by the sender, which caps how much work any transaction can demand and pays the miners who do it.
"In order to prevent accidental or hostile infinite loops or other computational wastage in code, each transaction is required to set a limit to how many computational steps of code execution it can use."
In plain words
Ethereum is a blockchain with a built-in programming language, so anyone can write rules for money (contracts) and the network enforces them. Accounts hold ether and can also hold code and storage. Every action costs a small fee, called gas, paid in ether.
How it works
- You sign a transaction: who it's to, how much ether, optional data, and a gas limit and price.
- The fee (gas limit × gas price) is taken up front from your balance.
- If the recipient is a contract, its code runs step by step, each step using gas.
- If gas runs out, the changes are undone but the fee is kept; otherwise unused gas is refunded.
- Miners include the transaction in a block and collect the fees.
Key claims
- "a blockchain with a built-in Turing-complete programming language"
- contracts "can be created to encode arbitrary state transition functions"
- applications "can be built far more easily than on Bitcoin"
Check before you trust
- "Far more easily" is a comparison with 2013-era Bitcoin scripting; compare with today's tooling, not the paper.
- Mining and fees: the paper describes proof of work. Ethereum moved to proof of stake in 2022, so the fee and reward sections describe the old design. Check the current docs for EIP-1559 and staking.