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?

  • 2
    blockchain-basics.com/HashPuzzle.html the nonce of block is just the number that you need to be added to the block to get a hash with leading #x number of Zeros, that is simple way to explain proof of work, you cannot computed , the miners can just try random numbers until they find it
    – Majd TL
    Commented Jun 20, 2019 at 13:39
  • In you example can I compare 'data' to mix-hash? Commented Jun 20, 2019 at 13:45
  • 1
    yes the data in that example is a reference for the mix-hash
    – Majd TL
    Commented Jun 20, 2019 at 13:46
  • Do you want to write an answer or I can write one from your hints? Commented Jun 20, 2019 at 14:13

2 Answers 2


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.

  • if nonce is the number used to adjust the block hash during mining, what is called the target random number that this block hash have to be smaller to be valid? I just have issues finding a name except the "pseudo random number" that I found in the yellow paper. Commented Jun 20, 2019 at 16:00
  • given your rep, if @biplavo edits his answer to have something a bit better, I will select it. Both are great though. Commented Jun 21, 2019 at 12:27
  • 1
    I didn't answer your first comment because I don't know enough about ethash. If biplavo or anyone else is able to explain that part well, you should pick that answer :) I think it's the most interesting part to the question and hasn't been answered by biplavo or explained well by @Majd TL comments.
    – eth
    Commented Jun 23, 2019 at 12:31

First of all, in bitcoin and subsequently in every other blockchain nonce is shortcut for nonsense. It does not make any sense to the block data but it is there. Lets see why is it there?

A Block basically should have

1) Previous block hash, and

2) List of transactions to be mined in that block

With these values no matter how many times you calculate the block hash it will always be the same. And that hash might not be a valid hash. The only way to get different hash is by changing some data in the block.You cannot change Previous hash or transaction data but you can insert new transactions in your list or remove some of them or use different set of transactions. But, this is inefficient to do every time because the goal is to find a valid block hash faster than others. Inefficient because to insert a new transaction into that list you have to first verify the transaction.

Therefore, you introduce a random variable in the block whose sole purpose is to help generate a new block hash. This variable is called nonce. Now, the block structure changes to following:

1) Previous hash

2) List of Trasactions

3) Nonce

Now, you calculate block hash based on these data. If your hash is invalid again, you choose a different nonce and try again repeatedly unless you get a valid block hash.

You can clearly see Nonce can be any data randomly selected. It can be anything, number, string, bytes, anything but for simplicity you chose it to be a number with initial value 1. This ease you to quickly calculate a hash because now you do not have to take a random value but increase the nonce by 1 and hash the block again.

Account Nonce

Conceptually it is same as block nonce. Block Nonce is used to differ the block hash, account nonce is used to differ the transaction hash. And since transaction count from an account is always in an increasing order (unique), lets use this value as Account Nonce.

  • 1
    "nonce is shortcut for nonsense." - I've not heard that before. I think it's generally considered that the origin is either "number used once", or it's derived from the term "nonce word", which is "a lexeme created for a single occasion to solve an immediate problem of communication". Commented Jun 20, 2019 at 15:17
  • I never heard about nonsense neither, and the used only once origin is the most advertised one : en.wiktionary.org/wiki/nonce Commented Jun 20, 2019 at 15:50
  • @RichardHorrocks perhaps from here ? coincentral.com/what-is-a-nonce-proof-of-work -> see the title Commented Jun 21, 2019 at 12:17
  • @biplavo I like your answer but it would need some fixes on typos and make it more concise, remove the "nonsense" thing and maybe give so examples. Commented Jun 21, 2019 at 12:25
  • @NicolasMassart - It does make the title sound catchy :-) Commented Jun 21, 2019 at 13:01

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.