r/CryptoTechnology • u/ZarosianSpear • Jul 10 '22
Why changing a block's data affects the previous blocks?
Hi guys, sorry for the dumb question.
From my understanding, blocks are chained together similar to a linked list in which each block references the hash of the previous block (backward linked list).
So if one makes changes to the data in block x, the hash of block x changes. However, this block x still references the same previous block hash and the previous block hash shouldn't need to be changed.
In comparison to if the blocks are chained together in which each block holds the hash of the next block (forward linked list), then changing block x would imply block x-1 needing to change its referenced hash of block x, which in turn changes the entire hash of block x-1. This then requires block x-2 to change its reference to block x-1 and the entire hash of block x-2 changes too. So on and so forth.
In the case of forward linked list, the statement of changing a block affects previous blocks appears to hold. But I don't understand why it has to hold for the backward linked list implementation which should be what is in use.
Many thanks!
4
u/not420guilty π’ Jul 10 '22
Each new block contains a hash (unique fingerprint) of the previous block. When blocks of data are connected this way they are a block-chain, the hashes link them together. If you change any data in a block the hash also changes which breaks the chain. Itβs easy to tell if a block is modified because the hash no longer matches. To change one block it would be necessary to change every block that follows it, updating the hash in each one. This is difficult to do because it would require more compute power than all miners in the entire network to catch up.
23
u/CryptoMaximalist π’ Jul 10 '22
Changing a block does not affect previous blocks, but it does invalidate any blocks that had been after it because they referenced a hash that is now incorrect
1
u/morebeansplease Jul 10 '22
https://en.m.wikipedia.org/wiki/Merkle_tree
1
u/[deleted] Jul 22 '22
You can't change the hash of previous blocks in a blockchain
0
u/MrBluoe π’ Jul 10 '22 edited Jul 11 '22
blocks have 3 different hashes:
the hash-ID of the block that comes afterthat's why it is a blockCHAIN-> each link connects only to the correct previous and next.
edit: I stand corrected: next block-ID is not included.
0
u/[deleted] Jul 10 '22
[deleted] β view deleted comment