What is a nonce?



When I see the block info on blockchain, I see that there is a field named "nonce", I could not find any relevant information on web regarding what a nonce is. Please explain what a nonce is what is the purpose of it.


Posted 2017-05-21T14:47:11.667

Reputation: 285



Nonce is a 32 bit arbitrary random number that is typically used once. In Bitcoin's mining process, the goal is to find a hash below a target number which is calculated based on the difficulty.
Proof of work in Bitcoin's mining takes an input consists of Merkle Root, timestamp, previous block hash and few other things plus a nonce which is completely random number. If the output results in hash is smaller than the target hash you win the block and the consensus is reached.
You need to brute force all possible nonce in order to luckily find a hash smaller than the target hash. It could literally be any number between 0 and 2^31


Posted 2017-05-21T14:47:11.667

Reputation: 814

1But if the nonce is 32-bit, that is only 4 billion tries maximum, which is about a few minutes with a good nVidia card, right ? or is the speed much lower than that ? – Matt – 2017-12-04T16:48:22.927

I think you forgot to talk about the extra nonce... and that answers my question above. – Matt – 2017-12-04T16:57:21.247

2There is no extra nonce. Your right. its a small number relatively but you have to remember the each second the timestamp changes new tx comes which changes the root and others so all accumulated plus nonce become a large set of options for miners. – abeikverdi – 2017-12-05T15:51:21.623

Only a fixed set of tx are accepted when creating the block. And there is a max number of tx for a block. And please browse for extra nonce ;) https://bitcoin.stackexchange.com/questions/32603/why-didnt-satoshi-make-the-nonce-space-larger

– Matt – 2017-12-05T19:32:14.210