# Gas

> The unit of computational cost on Ethereum-style chains: every operation has a price, and the caller pays it.

Gas exists so that a public network cannot be shut down by an infinite loop: execution is metered, and when the budget runs out the transaction stops and reverts. Since every user pays for the work their call performs, efficiency stops being a craft preference and becomes something the user feels directly.

It reshapes design in ways that surprise people. Storing data on-chain is expensive enough that most applications store a reference and keep the payload elsewhere; loops over unbounded arrays are a denial-of-service waiting to happen; and a function that is pleasant to read can cost several times one that is not. This is why gas reporting belongs in the test suite rather than in a review at the end.

## Related terms

- https://dfieldsolutions.com/en/glossary/smart-contract.md
- https://dfieldsolutions.com/en/glossary/solidity.md

---

Source: https://dfieldsolutions.com/en/glossary/gas
DField Solutions — Dunakeszi, Hungary — dezso@dfieldsolutions.com
Booking: see https://dfieldsolutions.com/en/contact
