Open In App

Why is it Difficult to Modify Records in Blockchain?

Improve
Improve
Like Article
Like
Save
Share
Report

Finding a valid block is the hard work that bitcoin miners are doing when they mine. BlockChains have what’s called a difficulty, which is essentially an arbitrary setting that determines how hard it is to create blocks. This is where all the value comes from. If anyone could create blocks and throw them on the chain, there would be no value there, and networks would never agree on which block should go on the chain. 

Having created a block means miners must have done a bunch of work. That’s what proof-of-work means. By finding a block that is valid, it is proven that work has been done. For blockchains like Bitcoin and Ethereum, the difficulty level can change in order to ensure that blocks are created at regular intervals.

  • A block is only defined as valid if the hash value(the hash value is a number) of the entire block, is below another threshold number.
  • That threshold is set by the difficulty. Take the block, and hash the whole thing. When hashing is done, a unique signature is obtained for all the data it contains.
  • If any change is done in the data, it necessarily changes the hash.
  • To determine if a block is valid, simply ask if the block’s hash is below the difficulty threshold?
  • The greater the difficulty, the lower the hash output number would have to be for the block to be valid. Since hashes are effectively random, lower values are harder to find. It’s like rolling a die.

One can only change the block data and see if a valid hash is obtained, and do it over and over again. But what data can you change in your block?

  • It contains important transaction data that one can’t alter. Well, this is where the nonce comes in.
  • The nonce is there just so that miners have a piece of data that they can essentially play with. They can change it randomly to change the block’s output hash until they luck out and happened to find one that is below the required difficulty threshold.
  • Once they have found a nonce that results in their block’s hash being below the difficulty threshold, the block is finally considered valid and it can broadcast to the network with that miner taking a reward for their effort. 
  • This process is purely based on chance. Miners just try over and over again changing the nonce and rehashing the block and hoping that they will luck out and find a hash below the threshold number.

Below is a simple diagram of a Block:

SIMPLE BLOCK DIAGRAM

Problem With Recalculating Hash in Blockchain

The critical part of including a block into a blockchain is the inclusion of a cryptographic hash. A cryptographic hash function is an algorithm that accepts an arbitrary quantity of data as input and creates a hash value, which is a fixed-size output of encrypted text of the previous block.

  • In this way, blocks are linked all the way back to the very first origin/source block and are verified by hashes. Because each block contains the previous hash and that gets hashed within the next block, in a sense, all the previous hashes are included in all future block hashes.
  • This is where absolute immutability comes in. All the blocks are connected through the inter-relationships of all their hashes.
  • If anything changes in a block anywhere in the chain, there’s a ripple effect invalidating all the blocks that come afterward.

Example: Now, Suppose a malicious person, Alex, was trying to alter the transactions on the chain. As it is known, that one can’t just change data because that will create a new hash which would create an invalid block. 

  • Alex would have to re-mine that block and find a nonce that yields a hash value below the target difficulty. 
  • Since all the blocks must contain the hash of the previous blocks, all the following blocks would be invalidated as well. Only if Alex had an incredible near impossible amount of computing power, would he be able to rebuild the whole chain to include his fraudulent transactions, and Alex doesn’t have nearly that much computing power. 
  • As a result, the distributed blockchain’s robustness is its strength, and it’s why it’s regarded to be incorruptible.

It can be concluded that it’s nearly impossible to change records in blocks since all of the blocks are linked through the inter-relationships of all of their hashes, and any modification in a block anywhere in the chain invalidates all subsequent blocks.


Last Updated : 19 Jun, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads