---
description: >-
  This text dives into the 63/64 rule in Ethereum, which determines the maximum
  amount of gas a caller can provide to a callee during a function call.
---

# Understanding Gas Limits: Exploring the 63/64 Rule

## Gas Allocation Limits: Understanding the Maximum Gas for Callee Calls

The _**caller**_ of a contract specifies the amount of gas given to the _**callee**_ when making a function call. However, there is a limit on how much gas can be provided.\
\
After the "Tangerine Whistle" hard fork (which introduced [EIP-150](https://eips.ethereum.org/EIPS/eip-150)), the maximum amount of gas that a _**caller**_ can give to a _**callee**_ is calculated as follows:

$$
gasAvailable - (1/64 * gasAvailable)
$$

This means that the _**caller**_ can only allocate a maximum of approximately 98.43% (63/64) of the total gas available to the _**callee**_. The remaining gas (approximately 1.56% or 1/64) is reserved for the caller's own use.\
\
This restriction is in place to prevent certain types of attacks (such as _**Call Stack Depth Attack**_) and to ensure that the _**caller**_ always retains a small portion of the total gas for its own execution.\
\
This is because [EIP-150](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-150.md) ensure the _**caller**_ is left with at least 1/64 of the gas available, regardless of what happens to the call.

{% hint style="info" %}
Understanding this limitation helps developers and users plan their gas allocation appropriately and consider the available gas when making function calls between contracts.
{% endhint %}

## The 63/64 Rule Explained: Balancing Gas Provision for Caller-Callee Transactions &#x20;

The introduction of the 63/64 rule in Ethereum was intended to address a specific issue that existed in previous implementations. Previously, the _**caller**_ of a contract could send the entire amount of gas available to them when making a function call to a _**callee**_.

However, this created a potential problem. Since the gas cost of a call is relatively low, it allowed for a situation where contracts could call other contracts recursively, potentially leading to an infinite loop or excessive stack usage. This posed a risk of causing a _**Call Stack Depth Attack**_**&#x20;** that led to a **"stack too deep"** issue in the implementation of Ethereum nodes, which could lead to instability and unexpected behavior.

A maximum depth limit of 1024 was imposed on the call stack. This means that after reaching a depth of 1024 calls, the last call would throw an exception, preventing further recursion.\
\
By introducing the 63/64 rule, the _**caller**_ is now limited in how much gas they can provide to the _**callee**_, ensuring that a portion of the gas is reserved for the caller's own execution. This limitation helps prevent excessive recursion and mitigates the risk of encountering stack-related issues in Ethereum node implementations.

{% hint style="info" %}
The solution involves reserving a portion of the available gas in the _**caller**_ contract, specifically 1/64 of the total available gas. As the recursive calls continue, the amount of gas available diminishes rapidly, naturally limiting the depth of recursion. Although there is still a maximum call depth limit of 1024 in the node implementation, it is practically unreachable due to the diminishing gas.
{% endhint %}
