The term blockchain gets thrown around a lot in the media in recent history, but most people don’t really know how they work or why they are so secure. A blockchain is essentially a secure way to store data without having to fear that someone will temper with that data unnoticed.
Like the name indicates, a blockchain is a chain of blocks that contains information. Once you have set up a block and put information in it, it becomes very difficult to change it. How does it work? Each block contains the stored data, the block’s hash and the hash of the previous block. The data stored varies on the application it is being used. Taking Bitcoin for example, the data stored there are the details about transactions with the clear information of sender, receiver and the amount. The hash of a block is like a digital fingerprint, a unique sequence of numbers and letters. A hash could look something like this:
Once a new block is created, a new hash is automatically calculated with it. Once you change information of the block, that hash is calculated again and thus making it a different block than it was before. The last part of the block is the hash of the previous block, that element connects the block and turns it into a connected chain.
For instance, we have a chain that consists of 100 blocks, each containing some kind of information, a hash and the hash of the previous block. Now, we want to change the information of the 50th block. Once changed, the hash is calculated again and the chain is faulty because the 51st block refers to the old hash of the block and has no way of knowing that the hash has been changed. So, the only way to change the information of the 50th block and still have a valid chain is to update each 50 subsequent block’s previous hash information, because even if you only change the previous hash part of the block, a new hash for that block is calculated and then you have to change the previous hash of the next element and so on. That is the only way to crack a blockchain. To prevent that case from happening, applications like Bitcoin made the calculation of the hash so computationally expensive that it takes on average 10 minutes to create one block in the chain, in Bitcoin’s case. This mechanism makes it nearly impossible to temper with.
To further secure the system, blockchains often decentralised their system in a P2P network, which is basically a network between users around the world where anyone can join. If one person is joining, he gets a full copy of the whole blockchain. Now if a new block is added to the chain, that block is getting shared across every participant of the network and they need to verify the authenticity of that block and must make sure that it was not changed. If everything was correct in more than 50 percent of the network, each member adds the block to their blockchain. That way it ensures, that even when you managed to change the whole blockchain in your favour, you then still need more than 50 percent of the network to verify that it hasn’t been tempered with. And that is nearly impossible.