The blockchain is a distributed and decentralized ledger that stores data such as transactions, and that is publicly shared across all the nodes of its network.
The block is an information holder similar to the cheque in the bank.
The block also holds a unique hash (H) for its identity in addition to the information(I). The hash(H) is a very important concept.
As there are many transactions, there will be many blocks, and these blocks are connected through a chain to form a blockchain.
Why are the blocks connected?
The blocks are connected in order to provide the security to the information. The hash of the current block is dependent on the hash of the previous block.
Let’s understand this with an example below.
Assume that we have 3 blocks with the following information as below:
- Block 1 holds the I1 as the information with a hash value of H1.
- Block 2 holds the I2 as the information with a hash value of H2.
- Block 3 holds the I3 as the information with a hash value of H3.
Currently, the above blockchain is stable.
Now, let’s say someone changed the information from I2 to I2′ and hash from h2 to h2′ of the block2 and left the other blocks as they were earlier.
In this case, the blockchain will become unstable like below. In this way, any modification requires an end-to-end modification and verification. It’s not easy to modify any data by some hack. If done with the hack, the blockchain will become unstable.
Summing it all up, The block will be built by chaining these ten transactions in a particular sequence. Each time a new transaction is chained, it is broadcasted to the entire network. Now each node can also validate the chain by running the hash function from the start. Ideally, all the nodes should have the same hash (assuming they have the same transactions)