NONCES IN BITCOIN
Think of a *nonce* in Bitcoin as a random mystery seasoning added to the cooking process when "baking" a new block.
The nonce drastically and randomly changes the final flavor of the block. A chef can never know ahead of time how a nonce will affect the taste.
He can only try baking dish after dish, block after block, with a different nonce each time until a good tasting dish finally comes out of the oven. If the dish tastes good, he gets paid. If it doesn't taste good, he has to try again.
______
Nonce = "Number used once"
A nonce is a wildcard number. It can be any number.
It's only useful one time in a calculation, because if it's used and turns out to be unhelpful, there's no reason to use it again. It is discarded and replaced with a different nonce.
___
Analogies aside...
In order to successfully process a new Bitcoin block and thus win a coveted coinbase reward in the form of newly minted BTC, a miner must create a fingerprint (hash) of that block which is below a certain numerical threshold.
But miners can't control what the final hash number will look like.
This presents a challenge for miners, because the Bitcoin protocol requires that a valid hash of a block must have a certain number of leading zeros at the beginning of the hash.
The more zeros that are required by the protocol to randomly appear at the front of the block's final hash, the harder it is to produce that hash. (It's unlikely for a string of zeros to randomly appear in a row at the front of a 256-digit hash)
The required number of leading zeros in a successful hash is determined by the difficulty level, which auto-adjusts to ensure blocks are only created on an average of 1 every 10 minutes. This ensures the monetary supply pace is predictable.
(This is how Bitcoin's ordinary blockchain becomes the extraordinary Timechain.)
Anyway, when a miner processes a block and the resulting hash does not start with the required amount of zeros, they have to try again. So they mix in a different nonce.
Since the nonce has an unknown effect on the final hash of the block, no one can know ahead of time which nonce will successfully result in a valid final hash.
This is interesting. Bitcoin is a fascinating mix of predictability, randomness, and algorithm.
> Predictability = the total money supply cap and the rate of new BTC created via the coinbase reward are not mysterious or random. They are known, predictable quantities.
> Randomness = although the SHA256 hash function is deterministic, a final hash value is unknowable before the hashing function is completed. It's random. Also, adding a nonce modifies that random hash output by an additional random "multiplier".
Algorithm = Since there are no hints given ahead of time about which nonces will lead to a valid hash, miners have no choice but to try them one at a time. This must happen sequentially, after the other, in a plodding Proof-of-Work way. The is no shortcut. Every nonce must be tried one at a time.