This question already has an answer here:

I can't understand how account nonce actually avoids double spending. Every answer about this on the internet follow the pattern "If you only have 50 Eth and try to send 50 to A and 50 to B with higher gas price the network refuses because che counter skipped a unit bla bla..". Ok this is how it works now but.. what if nonce did not exist? Suppose i'm sending two transactions, 50 Eth to A and 50 to B with higher gas price but i only have 50 Eth. And suppose there is no nonce in Ethereum. What will happen? What will the nodes do?

marked as duplicate by Mikko Ohtamaa, shane, Achala Dissanayake, Ismael, Richard Horrocks Oct 4 at 7:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The nonce is not intended to stop you spending the same money twice. If you had two transactions sending the same 50 ETH, the first transaction would go into the blockchain as a successful transfer, and, assuming you had enough money for the gas of the second, the second transaction would go into the blockchain as a failed transfer. (Note that this last part is different to systems like Bitcoin that don't have the concept of a transaction getting into the blockchain but failing - for them, a transaction either succeeds or is invalid, and if it's invalid, it won't be included in a block at all.)

The nonce is intended to prevent the same signed transaction being sent twice. If I have 100 ETH, and I make a transaction sending you 50 ETH, I don't want you to be able to copy the data I send, then send the exact same transaction to the network a second time, spending my remaining 50 ETH so you get 100 ETH when I only intended to send you 50 ETH. The nonce system avoids this: Each account has a record on the blockchain of the last nonce it processed, so if you try to send a transaction that has already been processed, the blockchain knows to reject it.

There are alternative methods used in other systems that don't require a nonce - UTXO-based systems like Bitcoin don't need nonces - but they share the requirement that there has to be something unique in your transaction that can only be processed by the blockchain once.

  • this is a complete and well argumented answer. Thank you very much. – kwcheights Oct 4 at 0:45

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