So, how does blockchain work? Each block contains Data, the ‘Hash’ of the block and the hash of the block before. These blocks make a chain and hence the name ‘blockchain’.
The data that is stored inside a block depends on the type of blockchain the Bitcoin blockchain for example stores the details about transaction in here, such as the sender, receiver and amount of coins collected.The Data stored in a block largely depends on what the blockchain will be used for. For example Bitcoin, or BTC, stores transaction details. So, the data you will find in the block are details that relate to the sender, receiver and the amount of coins sent.
A ‘Hash’ refers to cryptography, or a hash algorithm and this is a cryptocurrency staple now. Going back to Bitcoin, as the example, this is what keeps the BTC blockchain secure.
Many articles refer to the digital hash as a fingerprint, as it is unique and therefore, it can identify a block and all of its contents. A hash calculates once the block is created and if anything was to change within the block, then this would also cause the hash to alter. This is why a hash is so important to blockchain technology these days, as it makes the blockchain immutable. In other words, you will be able to tell any changes made to a block, as the hash will change and therefore, it is no longer the same block.
Hash Of Previous Block
The first block in a chain is normally called the ‘Genesis Block’. This block has it’s own hash and this is passed to the second block in the chain and the 2nd in the chain, passes it’s hash to the 3rd block in the chain, etc. A chain of blocks are created and not only does that give it the name blockchain, but more importantly, this secures the blockchain.
For example, if someone attempted to hack, or tamper with one of the blocks, then this would cause the hash of the block to change and all the following blocks would become invalid, as they would no longer store the correct hash of the block that came before. Unfortunately hashes alone aren’t enough to totally prevent tampering because computers are getting much faster at a calculating these hash rates and at thousands per second. Therefore, in theory, you could hack a block and then recalculate all the hashes of the other blocks to make the blockchain valid again.
To lower the risk of a recalculation of the hash rates, blockchain, using BTC as the example again, have something called proof-of-work. Proof-Of-Work is a mechanism that slows down the creation of new blocks. In Bitcoins case it takes about 10 minutes to calculate the required proof-of-work and add a new block to the chain. This makes it almost impossible to tamper with any of the blocks, as you would also need to recalculate the proof-of-work for all the following blocks. The security of the Bitcoin blockchain comes from its innovative use of hashing and the proof-of-work mechanism.
Instead of using a centralized server, or an entity to manage the chain, a blockchain utilizes a peer-to-peer network. Essentially everyone is allowed to join, simply by downloading a full-copy of the blockchain. This is what is known as a node and can be used to verify that everything is still, as it should be.
When someone creates a new block the block is sent to everyone on the network and each node then verifies the block to make sure that is valid and has not been tampered with. If it checks out, then each node adds this block to their own blockchain and subsequently all the nodes in the network create a consensus. Basically, they agree which blocks are valid and those that aren’t.
Blocks that have been fiddled with will be rejected by the other nodes in the network. Therefore, the only want to successfully tamper with a block, in a chain, is to tamper with all the blocks on the chain, then redo the proof-of-work for each block and then take control of more than 50% of the node-network! Then and only then will the block become accepted by everyone else on the network – this makes the blockchain immutable, as this is virtually impossible to do.
Blockchains are constantly evolving so they are harder for people to hack, but they are also adding more functionality. One of the more recent developments is the creation of smart contracts. These contracts are simple programmes that are stored on the blockchain and can be used to automatically exchange coins based on certain conditions. It’s a very exciting and new technology, that promises to one day be bigger than the internet! I hope this article has given the very basics on how does blockchain work.