EIP-3338 Account nonce 2^52 limit (Limit account nonce to 2^52)
No call decision · EVM & execution · EIP status Withdrawn · created 2021-03-07
A proposal to limit the account nonce (the count of transactions sent) to between 0 and 2^52. It was withdrawn in favor of EIP-2681, which addresses the same goal.
Why it is needed
Currently the account nonce is defined as an integer with no length limit. This makes it inefficient to treat the nonce as variable-length data in state witnesses, and it also burdens other proposals that aim to design new transaction formats. In addition, from the perspective of client software, it would be advantageous if the nonce could be handled with a smaller data type rather than having to be stored as a 256-bit number. However, since reaching a nonce of 2^52 would require an enormous amount of gas, no account would actually run into a problem even with a cap in place.
What changes
Today
- The account nonce is treated as an arbitrary-length integer
- The nonce must be handled as variable-length data in state witnesses
- Clients store the nonce as a 256-bit number
After EIP-3338
- The nonce is limited to between 0 and 2^52
- Transactions with a nonce exceeding 2^52 are treated as invalid
- The CREATE opcode undergoes an exceptional halt when the account nonce is 2^52
Who is affected
- Client teams: The nonce can be handled as a 64-bit integer instead of a 256-bit one, allowing implementation optimizations.
- State witness and stateless client researchers: Fixing the nonce length allows witnesses to be designed more compactly.
- General users and wallet developers: Since the nonce cannot realistically reach the limit, the practical impact is minimal.
In depth
Specification: two constraints
After FORK_BLOCK, two rules apply. First, a transaction with a nonce exceeding 2^52 is treated as invalid. Second, executing the CREATE opcode when an account's nonce is already 2^52 causes an exceptional halt. In other words, this structure blocks both the nonce cap itself and the act of creating a new account at that cap.
A realistically unreachable limit
The original text calculates the gas cost required to raise a nonce to the limit using only external transactions, and states that this cost reaches 21000 * (2^64-1) gas. This is presented as a level no account could realistically reach, which is the basis for claiming that imposing the limit has no effect on existing accounts.
The history of the Morden testnet and replay protection
The original text explains that the Morden testnet in the past set the starting nonce of new accounts to 2^20 in order to distinguish them from mainnet transactions. It notes that this kind of nonce-based replay protection fell out of use once EIP-155 introduced a cleaner method using chain id.
Client implementation and floating-point compatibility
The original text notes that most clients, including go-ethereum, already treat the nonce field as 64-bit. It also cites the fact that integers up to 2^52 can be represented without loss as 64-bit floating-point numbers, making the nonce easier to handle even in languages that are not integer-only.
Backwards compatibility: no accounts affected
The original text states that this change is a breaking change but has no actually observable impact. As of November 2020, the account with the highest nonce was 0xea674fdde714fd979de3edf0f56aa9716b898ec8, with a value of about 29 million, far from 2^52.
Proposal status: Withdrawn
This EIP has Withdrawn status, having been superseded by EIP-2681, which addresses the same goal of limiting the nonce to 2^52. The content in this document was therefore never reflected in the actual protocol, and the successor proposal EIP-2681 should be consulted instead.