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.
1 Answer
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
-
2But 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 ?– MattDec 4, 2017 at 16:48
-
I think you forgot to talk about the extra nonce... and that answers my question above.– MattDec 4, 2017 at 16:57
-
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. Dec 5, 2017 at 15:51
-
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 ;) bitcoin.stackexchange.com/questions/32603/…– MattDec 5, 2017 at 19:32