The chain

So, what is the reference number? Remember that, on page #1, the reference number was 0?

For page #2, it will be 0031993. Exactly! The reference number of page #2 is the output number found for the previous page. In technical terms, we call it the previous hash or the hash value of the previous block. This allows the pages to be linked with one another, or to be chained to one another.

So, when page #2 is filled, the process repeats: every villager gathers at the wall, which displays new information on screens A and B:

  • Screen A's reference number (hash of the previous page, page #1): 0031993
  • Screen B's date and time (timestamp): 2018/07/03, 10:08 AM

The following diagram displays the new information on the wall:

Then, the villagers input the transactions of page #2 in Screen C. Finally, everyone tries to find the correct number X (the nonce) on Screen D, which will return an output number starting with two leading zeros.

When an output number following the rule is found, number X is announced to everyone else who checks that number X, combined with 0031993, the timestamp, and the transactions, returns a number that starts with two leading zeros. If everyone agrees, we put the page on the wall and reward the villager who found the correct input with 5 Villagecoin.

And then the process repeats with page #3, page #4, and so on:

Let's evaluate how secured this system is. Let's assume that Chuck wants to modify a transaction on page #2. He wants to erase the 5 Villagecoin he sent to Alice during the completion of page #2, and change it to 1 Villagecoin. 

What will happen?

He will have to solve again the mathematical problem for page #2 because he modified the transaction of page #2 (hence, the data of Screen C). Because of this slight change, the wall returns an entirely different output number, say 37882, which does not respect the rule anymore. Therefore, Chuck has to calculate the new number X on Screen D that would return a number starting with two leading zeros for page #2.

How is that a complication for Chuck? 

Imagine that Chuck actually finds a new correct number X that returns an output number that starts with two leading zeros. Because hash functions are change-sensitive (a slight modification in the input returns a totally different output), even if Chuck finds a new correct input, the output will totally be different from the original. Say the new output number for page #2 is 00829 instead of the initial 0088. What will happen on page #3? The reference number (previous hash) will be different and so will be the output number of page #3. Furthermore, it is very likely that the new reference number of page #3 (00829 instead of 0088) combined with the rest of the data on the other screens will return a number that does not start with two leading zeros, hence making the page (and the transactions with it) invalid. In this fashion, Chuck will also have to compute again number X of page #3, then of page #4 and #5 and every page validated afterward.

This is how security is achieved in a blockchain, by sealing and chaining the blocks containing the transactions. 

The more pages (blocks) are put on the wall (validated), the more secure and unalterable are the transactions. Because it would take a tremendous amount of time and computing power to re-calculate every number X (nonce) of every page (blocks) in order to find the correct output numbers that start with two leading zeros (hashes), the wall (the blockchain) is the best technology for storing and securing the transactions of the villagers (nodes and users).