How Does Blockchain Work?
The blockchain constitutes with a distributed public ledger for recording all transactions on a particular network. It is open to everyone. The Blockchain can be simply called a chain of blocks containing data or information. The data embedded into each block cannot be altered at any cost. Each blockchain imbeds data constituting the hash for the current block and the hash for the previous block.
A hash has the feature of a fingerprint. It’s always unique. Under blockchain technology, the hash determines a block with pertinent contents containing the hash of the current block as well as a hash of the previous block. Once you have created a block, compute the hash. Changing the data inside the block will automatically change the hash. If the hash of the block changes, it is not the same block again.
Another component inside each block is the hash of the previous block. Suppose we have a chain of 3 blocks.
As you can see each block has a hash and the hash of the previous block, block #1 points to block #2 and block #2 to block #3. Now that block #1 has no previous block because it’s the first one, we call this the Genesis Block.
Now imagine you wanna alter block #2. This will simultaneously change the hash of the block #2 and all the following blocks. Thus changing a single block will make the current block and all the following blocks invalid. But this is not sufficient to prevent tampering. The clock speed of Computer is much faster and is capable of calculating ’n’ number of hashes in seconds. In order to make your blockchain valid again, all you need to do is further compute the hashes of every single block. So as to check this, blockchain has something called proof-of-work. It is a mechanism that shows how to create a new block. This mechanism makes it more difficult to alter the blocks provided that you alter 1 block, you’ll have to recheck the proof-of-work for all the following blocks. The safety and security of a blockchain is the aftermath of creative using its hash mechanism and proof-of-work.
There is another way to secure blockchain data by distributing everything everywhere. Blockchain Technology uses a peer-to-peer network where anybody can get access to join the network. Blockchain Technology erases the conventional central authority management. Whoever joins the network, gets the complete copy of the blockchain. This copy can be utilized to confirm that everything’s still in order.
If you wanna add a new block, that new block is sent to everyone on the network. Each node verifies the block to ensure that it hasn’t altered. If everything is under control and right, the node automatically adds the block to their blockchain. All the nodes in the blockchain create consensus. They agree about which blockchain are valid and which aren’t. Tampered Blocks get rejected via other nodes in the network. So to successfully tamper a blockchain you’ll need to take control of more than 50% of the peer to peer network, tamper all blocks on the chain and redo the proof-of-work for each block. Only then will your tampered block becomes accepted by everyone else. Sounds great. right? But this is next to impossible!
This is how blockchain works and how blockchain technology transforms things.
Reference : How blockchain works?