---
eip: 3338
label: EIP-3338
title: Limit account nonce to 2^52
status: Withdrawn
type: Standards Track
category: Core
created: 2021-03-07
official: https://eips.ethereum.org/EIPS/eip-3338
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3338.md
canonical: https://eips.huatuo.xyz/eip-3338/
lang: en
tldr: A withdrawn proposal to cap account nonces at 2^52 so they fit in compact encodings and float64; it was dropped in favour of the 2^64-1 limit in EIP-2681.
tags: [nonce, core, state, withdrawn]
---

# EIP-3338: Limit account nonce to 2^52

> Limit account nonce to be between 0 and 2^52.

**TL;DR:** A withdrawn proposal to cap account nonces at 2^52 so they fit in compact encodings and float64; it was dropped in favour of the 2^64-1 limit in EIP-2681.

## What problem does it solve?

In the original protocol an account nonce is an arbitrarily large unsigned integer. That is awkward in a few places:

- State proofs and witnesses have to handle variable-length data instead of a compact fixed-size field.
- Some transaction-format proposals wanted a bounded nonce.
- Clients store nonces as 256-bit numbers when 64 bits would do.

ERC-3338 proposed a hard upper bound to clean this up. It picked `2^52` specifically because every integer up to `2^52` can be represented exactly in a 64-bit floating-point number, which helps languages such as JavaScript that only have floats.

## How it works

After a fork block, two rules would apply:

1. Any transaction whose nonce exceeds `2^52` is invalid.
2. `CREATE` aborts with an exceptional halt if the creating account's nonce is `2^52`.

The spec argues no one would ever hit the limit in practice. Sending enough transactions to reach even a 64-bit limit would cost an absurd amount of gas, and at the time of writing the highest nonce on mainnet was about 29 million.

It also notes that the old Morden testnet started account nonces at `2^20` as a crude form of replay protection, an approach made obsolete by chain IDs in [EIP-155](/eip-155/).

## Sample code

Pseudocode for the proposed checks:

```python
MAX_NONCE = 2**52

def validate_transaction(tx, state):
    if tx.nonce > MAX_NONCE:
        raise InvalidTransaction("nonce too high")
    ...

def op_create(evm, sender):
    if state.get_nonce(sender) == MAX_NONCE:
        raise ExceptionalHalt("nonce limit")
    ...
```

Why `2^52` was attractive for JavaScript:

```ts
console.log(Number.isSafeInteger(2 ** 52));   // true
console.log(Number.MAX_SAFE_INTEGER);         // 9007199254740991 (2^53 - 1)
```

## Things to know

- Status is **Withdrawn**. The authors withdrew it in favour of [EIP-2681](/eip-2681/), which limits nonces to `2^64 - 1` instead.
- The 2^64-1 limit matches what clients such as go-ethereum already did internally, so it achieves the compactness goal without the float-specific bound.
- If you need to handle nonces in JavaScript, use `bigint` rather than relying on any float-safe ceiling.


---

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