I read these paragraphs from the Whitepaper and Mastering Ethereum book. And I'm confused. Is nonce stored at state, or not?

Whitepaper says:

If the value transfer failed because the sender did not have enough money, or the code execution ran out of gas, revert all state changes except the payment of the fees, and add the fees to the miner's account.

When our transactions go out of gas, our nonces increments (I tested it). So, for this paragraph nonce is not stored at state.

Mastering Ethereum book says:

Strictly speaking, the nonce is an attribute of the originating address; that is, it only has meaning in the context of the sending address. However, the nonce is not stored explicitly as part of an account’s state on the blockchain. Instead, it is calculated dynamically, by counting the number of confirmed transactions that have originated from an address.

So, it is ok. These paragraphs are saying the same thing: Nonce is not stored at the state.

But later on the same book:

At the top level, we have the Ethereum world state. The world state is a mapping of Ethereum addresses (160-bit values) to accounts. At the lower level, each Ethereum address represents an account comprising an ether balance (stored as the number of wei owned by the account), a nonce (representing the number of transactions successfully sent from this account if it is an EOA, or the number of contracts created by it if it is a contract account), the account’s storage (which is a permanent data store, only used by smart contracts), and the account’s program code (again, only if the account is a smart contract account). An EOA will always have no code and an empty storage.


As code execution progresses, the gas supply is reduced according to the gas cost of the operations executed. If at any point the gas supply is reduced to zero we get an "Out of Gas" (OOG) exception; execution immediately halts and the transaction is abandoned. No changes to the Ethereum state are applied, except for the sender’s nonce being incremented and their ether balance going down to pay the block’s beneficiary for the resources used to execute the code to the halting point.

And as I understand, the last two paragraphs says: Nonce is stored at state.

What the hell is going on? Which one is true? Am I missing something?

1 Answer 1


I'm almost certain the nonce is stored in state and not determined dynamically every time it's needed. (I can't immediately see a way for this to be easily determined, given the layout of the other state tries... See here.)

Section 4.1 of the Yellow Paper states the following:

The account state, σ[a], comprises the following four fields:

  • nonce: A scalar value equal to the number of transactions sent from this address or, in the case of accounts with associated code, the number of contract-creations made by this account. For account of address a in state σ, this would be formally denoted σ[a]n.
  • balance: ...
  • storageRoot: ...
  • codeHash: ...
  • Thank you for your answer. Isn't so silly that the whitepaper and the yellow paper say something different about this? I guess we should believe in the yellow paper, right? Jun 2, 2022 at 7:40
  • 1
    I agree :-) I always just look at the Yellow Paper! :-) Jun 4, 2022 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.