Blockchains are being used to secure digital money. It would be pretty shady if someone just came along and edited the blockchain to show they owned all the coins. So, how are blockchains un-editable?
Hashes are often used to verify that information hasn’t changed.
Imagine you have a number of dice of different colours. When you throw the blue die it always lands on 6 and when you throw the red die it always lands on 1. If you were told the value of the die, you would be able to know what colour it was. I.e. if it landed on 6, it must be a blue die.
Now, you’re given a task. You have a green die. You need to give it to someone else and then later confirm that it was the same die. What do you do? You roll it and it lands on 3. You write the number 3 down. You give it to the other person and then after a while they give you back a die. If you roll it and it lands on 4, it is the wrong die.
What does the die represent? The die is a one way function. Whenever the same input is entered, it will produce the same output.
The colour of the die is the actual information itself. When this is put into the function, it will always produce the same result.
Therefore if you check the result of the function, it should always be the same unless the original information has changed.
Okay, so we can verify one piece of data but how does that work in a blockchain?
What’s useful to know here is that hash functions reduce large pieces of information into smaller pieces of data that can be used to confirm the original information.
The contents of the first block on the blockchain can be reduced to a small piece of data, ‘a hash pointer’, that can be placed in the second block. Then a hash pointer to the second block’s contents can be placed in the third block and so on.
When block 45 is made it will contain a hash pointer to the previous block’s data. This hash pointer can be used to confirm that block 44 is correct. As block 44 contains a hash pointer to block 43, this confirms 43 too. This goes back to the first block. Therefore, the entire chain is confirmed by the hash pointer on the most recent block.
So, if someone tried to change one of the blocks:
If someone tried to change block 19, it would be identified by the hash pointer in block 20. The confirmation would not be met.
If they tried to change all of the blocks, they would get back to the first block which they would not be able to change. Therefore by keeping a record of the first block, all blocks preceding the latest one can be confirmed.
If this confirms previous blocks, how do we confirm a new block?
That requires a different security element which will be in another article.
This means my money is safe?
While the blockchain cannot be edited, there are many risks to be aware of. The biggest risk is if someone takes your coins from you. This can happen if you leave your coins on an exchange and it collapses, if you have a software wallet and it gets hacked or if you fall for a scam and send your coins away. Remember, the safest wallet is a hardware or paper wallet.
Article written by Tim Copeland
[Disclaimer: I own various cryptocurrencies that may include the topic of the article. My main holdings are in XRP, NANO, ADX, DGB, NAS.]
To exchange for Ripple (XRP), NEO (NEO) or Litecoin (LTC), sign up to Binance.
If this post has informed you or helped in any way, feel free to donate ETH to 0x8c854F441248936BD12EB32373bb16Aa99129483