Adding a Nonce Field to Achieve Decentralized Operation
Next, we’ll add a new field to the block called the Nonce (a random number used once).
The Nonce is combined with the Previous Block Hash and Data to calculate the Block Hash.
Once the Nonce changes, the resulting Block Hash will also change.
Now, here’s a challenge:
When the Data is "This book is good"
and the Previous Block Hash is0000000000000000000000000000000000000000000000000000000000000000
Your task is to find a Nonce value that makes the resulting Block Hash start with 0
.
The only thing you can do is try different Nonce values repeatedly until you find one that satisfies the condition.
Try entering different numbers in the Nonce field!
I’ll reveal the answer shortly.
Did you find it?
If you enter 132
, the calculated Block Hash is:079355a8fc30bc29eb29afe0cf21a878fb423840871ab968f5c6f6f8880e62b1
This Block Hash satisfies the rule of starting with 0
.
You may also find other Nonce values that produce a Block Hash starting with 0
.
For example, 53
and 91563
also generate valid hashes that meet the requirement.
That’s right—there can be many valid Nonce values, as long as they result in a Block Hash that begins with 0
.
The process of finding a valid Nonce involves trying many different random numbers.
In Bitcoin, the rule is even stricter—the hash must start with multiple zeros to be considered a valid block.
This rule is called difficulty.
The higher the difficulty, the more Nonce values need to be tried before finding a valid one.
Below is a simulation of a blockchain with a difficulty level requiring the hash to start with three zeros.
Click the Find button and see how many attempts it takes to discover a valid Nonce!
What’s the Benefit of Requiring Each Block to Be Found by Trying Random Nonce Values?
The process of generating a block requires repeatedly trying different random numbers (Nonce)
until a block is found that meets the condition of having three leading zeros in its hash.
This mechanism introduces a level of difficulty in block creation—
and this is a key element that enables decentralization in blockchain systems.
Imagine three different computers all trying to find a block by testing random Nonce values,
aiming to meet the "starts with three zeros" condition.
No one knows which computer will get lucky and find a valid block first.
This means that the power to generate blocks is distributed among the three computers.
When one of them successfully finds a valid block, it will notify the others.
The other computers will then verify the new block by hashing its contents
to confirm whether the hash truly starts with three zeros.
Once verified, the block is accepted as a valid block.