Ethereum Mining – Difference Between Account Nonce and Block Nonce

blocksethashminingnonce

Block and accounts both use a value called "nonce" but they seem to represent something very different.

  • For account I understand that the nonce is an integer quantity indicating the number of transactions created by this account to prevent replay of transactions.

  • For block, I understand that it's a 64-bit value that, combined with mix-hash, proves the computational work required to build the block was made.

If my understanding is right, do you have more info on how this block nonce is computed? And perhaps why it's called the same way as the account nonce even if they are not the same things?

Best Answer

Your understanding is correct about both nonces.

The block nonce is what miners keep changing to compute a solution to Proof of Work (in Ethereum, it's Ethash). Miners probably start with a value of 0 (all bits set to 0) and then keep incrementing it by 1 until they find a solution.

A definition of nonce is "occurring, used, or made only once or for a special occasion". A nonce for a block fits the definition well: it's rare for the same nonce to be valid in other blocks.

A crytopgraphic nonce is a technique to prevent replay attacks, and matches the purpose of the account nonce. Replay attacks across blockchain forks, however, have shown that the account nonce isn't enough to prevent replays across forks.

Related Topic