How blockchain data is stored and secured
Understand how blockchain data is kept manageable and secure to accommodate a constantly growing database
Blockchain works by including the identifier of the last block into the identifier in the following block to create an unbreakable and immutable chain. But as more and more blocks are added, how does the data remain manageable?
The key to keeping blockchain data manageable – and secure – is through an algorithm called hashing in combination with a consolidating data structure known as a Merkle Tree.
What is hashing?
When a transaction has been verified and needs to be added to a block in a chain, it will be put through a hash algorithm to convert it into set of unique numbers and letters, similar to what would be created by a random password generator. Then two transaction hashes will be combined, and put through the hash algorithm to produce another unique hash. This process of combining multiple transactions into new hashes continues until finally there remains just one hash – the ‘root’ hash of several transactions.
What makes hashes unique, and a key security feature for blockchains, is that they only work one way. While the same data will always produce the same hash of numbers and letters, it is impossible to ‘un-hash’, or reverse the process, using the numbers and letters to decipher the original data.
What is a Merkle Tree?
If the hashing process is epeated with exactly the same transactions, exactly the same hashes will be created. This allows anyone using the blockchain to check that the data has not been tampered with, because ANY change in any part of the data will result in a completely different hash, affecting every iteration of hashes all the way to the root. This is known as a Merkle Tree.
Merkle Trees serve the purpose of significantly reducing the amount of data required to be stored and transmitted or broadcast over the network by summarising sets of hashed transactions into a single root hash. As each transaction is hashed, then combined and hashed again, the final root hash will still be a standard size.