In Chapter 2, We learned about how relative timestamps work in Blockchain System (decentralized system).
And now We face a new problem.
In peer-to-peer network system(P2P), every node in network must know the latest timestamp.
The Proof of Work
algorithm will solve this problem.
The Proof of Work
algorithm's Principles is to guarantee only making 1 ~ 2 new blocks for 10 minutes.
When we have to find h(x) < 0xfff
.
Then, finding x
is really hard because of the hash function's character.
However, we know h(a) = 0x100
It is too easy verify h(a) < 0xfff
This is a Proof of Work
In Blockchain 0xfff
is nonce
.
The nonce
is controlled by other algorithm that guarantees only making 1 ~ 2 new blocks for 10 minutes.
But we have to consider one more problem.
There are too many nodes in networks.
So, It can made into two new blocks from the same before block.
New concept : consensus algorithm
consensus algorithm
is simple.
1. If the two block's height is different, choose more long block.
2. If the two block's height is equal, choose harder proof of work.
If The block was not chosen must delete after copying data into the selected block.