---
eip: 4803
label: EIP-4803
title: Limit transaction gas to a maximum of 2^63-1
status: Stagnant
type: Standards Track
category: Core
created: 2022-02-02
official: https://eips.ethereum.org/EIPS/eip-4803
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4803.md
canonical: https://eips.huatuo.xyz/eip-4803/
lang: en
tldr: Proposed making any transaction with a gas limit above 2^63-1 invalid, retroactively from genesis, so the consensus rules match the 64-bit gas handling clients already use.
tags: [gas, transactions, consensus, core]
---

# EIP-4803: Limit transaction gas to a maximum of 2^63-1

> Valid transactions must have a reasonable gas limit

**TL;DR:** Proposed making any transaction with a gas limit above 2^63-1 invalid, retroactively from genesis, so the consensus rules match the 64-bit gas handling clients already use.

## What problem does it solve?

A transaction's `gasLimit` field is RLP-encoded, so in principle it can be an arbitrarily large integer. Real clients do not work that way: most cap it at 256 bits, and clients such as geth handle gas internally as a 64-bit number. That mismatch between "what the spec allows" and "what clients can represent" is a latent source of consensus edge cases.

EIP-4803 proposed writing a reasonable upper bound into consensus.

## How it works

One rule, applied retroactively from genesis:

> A transaction whose gas limit exceeds `2^63 - 1` is invalid and cannot be included in a block.

Why `2^63 - 1` and not `2^64 - 1`? It fits in a **signed** 64-bit integer, so an implementation can subtract gas and detect "out of gas" with a simple `remaining < 0` check.

The spec also considered `2^31 - 1`, which is easy to handle in JavaScript, but chose the 64-bit-friendly bound.

Applying it from genesis is safe because no historical transaction could have exceeded it: every transaction must fit in its block's gas limit, and the block gas limit can only change slowly, so it has never come anywhere near `2^63`.

## Sample code

The validity check a client would add:

```python
MAX_TX_GAS = 2**63 - 1  # 9_223_372_036_854_775_807

def validate_gas_limit(tx) -> None:
    if tx.gas_limit > MAX_TX_GAS:
        raise InvalidTransaction("gas limit exceeds 2^63-1")
```

The same bound in Go, where it is simply `math.MaxInt64`:

```go
import "math"

func validGasLimit(gas uint64) bool {
    return gas <= math.MaxInt64
}
```

## Things to know

- Status is **Stagnant**: the rule was not adopted through this EIP.
- The spec expects no visible effect on the chain: it only formalizes a limit that real blocks already respect.
- A much lower per-transaction gas cap was later introduced by [EIP-7825](/eip-7825/), for different reasons (bounding the cost of a single transaction).
- JavaScript numbers are only exact up to `2^53 - 1`, so tooling that handles gas values near this bound should use `bigint`, not `number`.
- Before [EIP-1559](/eip-1559/) a zero gas price let `gasLimit * gasPrice` stay within any balance, but the block gas limit still kept historical values small.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-4803
