We're well known about timestamps.
Unix time appears like 1660634801
, and we can manufacture It to 2022-08-16 07:26:41
When A
remit money to B
, they must know the same timestamp.
Otherwise, It can't prove by the fact of remit.
But In the real world, we can not guarantee the same timestamp. (some computers can have a personal timestamp, someone can change the timestamp easily.)
The centralized system solved this problem.
The center system's timestamp becomes the standard, then clients use the timestamp.
This is really useful for maintaining integrity.
But our purpose is no admin in the system
.
How we can the same timestamp without the center system?
It is the principle of Blockchain's timestamp.
Blockchain distinguishes absolute time
and relavite time
.
The absolute time
is such as Unix time.
The relative time
is made by Hash-chain.
We focus on Hash-chain
Hash-chain structured like as follows
1 : h(x)
2 : h(h(x))
3 : h(h(h(x)))
4 : h(h(h(h(x))))
If we know only x
then we can know the order.
The function h
is a hash function.
Like upper, If we save all timestamps linearly, then It could be too big.
So, We use the hash tree timstamp.
The hash tree works as follows
First, split the data into many pieces.
Second, calcuate hash value combine two pieces.
Third, If pieces are odd, duplicate last piece to make odd.
Finally, repeat the upper level until only one hash remain.
This process creates blocks, and the system chains them
We call It Blockchain
.