โ›ฝTutorial 51: Ethereum's 63/64 Gas Rule

Ethereum's gas model is fundamental to how smart contracts execute on the blockchain. Gas represents the computational effort required to execute operations, ensuring that network resources are fairly allocated and preventing infinite loops or excessive computation. However, a lesser-known but important aspect of Ethereumโ€™s gas model is the 63/64 gas rule, which has a significant impact on how smart contracts behave, especially in interactions between contracts.

The 63/64 gas rule dictates that when one smart contract calls another, only 63/64ths (roughly 98.4%) of the available gas can be forwarded to the called contract. This rule was introduced to mitigate reentrancy attacks and ensure that the calling contract has enough gas left to complete its execution after the called contract returns.

While this mechanism is crucial for Ethereumโ€™s security and robustness, it can also introduce complexities and unintended vulnerabilities in contract interactions. Users and attackers can exploit this rule by supplying just enough gas to cause certain transactions to fail, especially in multi-contract systems where multiple gas-limited calls are made.

In this section, we'll dive deeper into the implications of Ethereum's 63/64 gas rule and explore how users can intentionally cause transactions to fail by manipulating gas limits. Understanding this rule is essential for building gas-efficient and resilient smart contracts.

Last updated