In simple words, Nithin wants to buy a cup of coffee from Pradeep. Pradeep is waiting to sell Nithin the cup of coffee at $3. Up on agreement the transaction details will be recorded in a ledger. This is exactly the principle behind block chain.
A bock chain is a distributed ledger that is completely open to anyone. They have an interesting property like, once entered information can never be erased. So the block chain contains a verifiable record of every single transaction ever made.
The block chain technology treats each transaction as separate blocks. So let me explain how does block chain work? Well, Let us take a closer look at a block.
A block is the current part of a block chain which records the recent transactions. Once it is verified it becomes a permanent part of the growing block chain. Each block of a block chain contains the data, the hash of the block and hash of the previous block.
The data that is stored inside the block depends on the type of block chain. For example a Bitcoin block chain stores the details about a transaction in data section of the block such as sender, receiver and amount of coins.
The hash is a unique identification key, which is used to identify a block and all of its contents. Once a block is created, its hash is being calculated. And changing something inside a block causes its hash to change. These hashes are also used to detect the changes happened to blocks.
The third element of each block is the hash of the previous block. This actually creates a chain of block and this technique that makes a block chain so secure.
Let us take an example; we have a chain of three blocks as you can see each block has a hash and hash of the previous blocks.
So here we can see block 3 points to block 2 and block 2 points to block 1. It is very clear that the first block is not pointed to previous block because it is the first one and this block is known as genesis block.
Now let us say that if somebody trying to alter the second block, as I mentioned earlier the hash of the block to change as well. I am just illustrating the block as a color change and in this case the changed block points to yellow color. So we can see in the below picture, the hash of the Block 2 is changed from 7BYI2 to H62Y7.
So the change in Block 2 makes Block 3 and all its following blocks invalid because they no longer store a valid hash of previous block. So altering a block will make all following blocks invalid. That’s how the block chain eliminates the intruders.
In general, the block chain runs on three important technologies like,
- Distributed Peer-to-Peer network - Distributed machines on the peer-to-peer network helps in maintaining the consistency of the public ledger.
- Private Key Cryptography – Block chain uses private key cryptography to secure identities and hash functions to make the block chain immutable.
- Proof of work – The mathematical principle of proof of work ensures that the nodes automatically and continuously agree to the current state of the ledger.