In cryptography, a nonce is an arbitrary number that can be used just once.

But in Ethereum, the account nonce is deterministic. Deterministic vs Arbitrary -- How can both be true at the same time?

  • Arbitrary doesn't mean random. If you ask for 10 arbitrary numbers, I could just say 4 every time and that would be fine Jul 20 '18 at 13:38

"Nonce" is not really a technical term, and different uses have different requirements.

The use of account nonces in Ethereum is for replay protection. If there was no nonce, someone could take an old transaction and rebroadcast it. Thus, the main requirement for nonces in Ethereum is that no two transactions from the same account have the same nonce. One way to do this is to randomly choose an arbitrary nonce for each transaction, but this would require storing the nonce of every past transaction. Simply storing a single number and assuming all nonces less than that are used is far more efficient.

Other uses for nonces are very different, for example in (EC)DSA the nonce k must not only be unique but also unpredictable and unbiased, i.e. must be a cryptographically random number.

  • great, great answer.
    – Nathan Aw
    Jul 23 '18 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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