Skip to content
Blockchain

Gas Limit

Quantidade mÔxima de gas que o usuÔrio autoriza uma transação a consumir; protege contra custos inesperados e contra execuções que travariam a rede.

Key points

  • Gas limit is the maximum amount of gas a user authorizes a transaction to consume in order to be processed.
  • It works as a safety ceiling: if the operation requires more gas than the limit, it fails instead of spending without control.
  • Setting an adequate limit matters, since a value too low makes the transaction fail, while one too high does not reduce the actual cost.

What is the gas limit?

Gas limit is the maximum amount of gas a transaction can use, set by whoever sends it. Since every operation on a network compatible with the Ethereum Virtual Machine consumes gas according to its complexity, the limit acts as a lock: it prevents a transaction from consuming resources indefinitely and gives predictability to the maximum possible cost.

How it works

When sending a transaction, the user sets a gas limit and a price per unit, usually quoted in gwei. The actual cost is the amount of gas effectively consumed multiplied by that price, not the entire limit: if the operation uses less than the limit, only what was used is paid. The limit is just the authorized maximum.

The tricky part is what happens when the limit is too low. If executing the transaction requires more gas than the limit allows, it is reverted for running out of gas, and the amount spent up to the point of failure is not refunded. In other words, a poorly calculated limit can make someone pay for a transaction that never even went through.

Simple transfers have predictable, standardized gas consumption, while interactions with complex smart contracts require higher limits, which wallets usually estimate automatically.

Why it matters

Understanding the gas limit helps avoid failed transactions and control costs. For a company running many on-chain transactions, especially with contracts, calculating adequate limits avoids waste and failures. Wallets automate most of this, but knowing the concept helps diagnose errors.

Limitations

Estimating the required gas is not always trivial, especially in complex interactions whose consumption depends on the network state at the time. A limit that is too low causes the transaction to fail and still consumes part of the spending; a limit that is too high is not refunded beyond what was used, but may require more reserved balance. Each network has its own particularities, which requires attention.