SHA-256 function via Crypto.js
Note: Please configure your browser settings to access the API, or the simulation won't work.
Having constructed data blocks, we can now consider the situation where a chain of blocks are, well, chained together. Let's set up three such data blocks where each block has an additional meta-component called the "Hash of Previous Block":
Each block is said to be chained to the previous and succeeding block through a cross-reference of their respective hash values. For example, Block 2's previous hash points to Block 1's hash, and Block 3's previous hash points to Block 2's hash.
Let's see what happens when someone changes the data in Block 2 (go ahead, change it!). You'll see that Block 2's hash changes, thus breaking the link between Block 2 and Block 3. Similarly, changing the data in Block 1 breaks the link between Block 2 and Block 3. Once any link within a blockchain is broken, the blockchain's integrity is suspect, and it can be put out of commission.
This is the start of blockchain security and data immutability, important concepts and values in the world of Web 3.0.