Govur University Logo
--> --> --> -->
...

Why does changing a block on a blockchain with Proof-of-Work mean you must also change all the blocks that came after it?



A blockchain is a distributed ledger composed of individual blocks, each cryptographically linked to the one that came before it. Each block contains a "block header," which includes a unique cryptographic hash of its own contents and the cryptographic hash of the immediately preceding block. A cryptographic hash is a fixed-size string of characters, like a unique digital fingerprint, generated from data. Even a tiny change in the data of a block will result in a completely different cryptographic hash for that block. This hash function is one-way, meaning it is computationally infeasible to reverse the process and derive the original data from the hash. This inherent linking mechanism ensures the chronological order and integrity of the blockchain. If you change any data within an existing block, that specific block's cryptographic hash will immediately change, becoming entirely different from its original valid hash. The very next block in the chain contains the original hash of the block you just altered in its "previous block hash" field. Since the altered block's new hash no longer matches what the subsequent block references, the next block becomes invalid. To validate this next block, you would need to update its "previous block hash" field to correctly reflect the new hash of the altered block. However, changing any part of a block's content, including updating its "previous block hash" field, causes *its owncryptographic hash to change. This is where Proof-of-Work (PoW) becomes critical. Proof-of-Work is a computational puzzle that requires a significant amount of effort to solve. For a block to be considered valid, its cryptographic hash must meet a specific difficulty target set by the network, such as starting with a certain number of zeros. Miners achieve this by repeatedly changing a value called a "nonce" within the block header and recalculating the block's hash until they find one that satisfies the difficulty target. This process is computationally intensive and time-consuming. Since updating the next block's "previous block hash" field changes its overall content, its pre-existing cryptographic hash, which was valid under the PoW rules, is now invalid. Therefore, you would need to re-do the Proof-of-Work for this updated block, meaning you would have to spend significant computational resources to find a new nonce that generates a valid hash meeting the network's difficulty target. This creates a cascading "domino effect." Once the next block's hash changes after re-mining, the block that follows *italso becomes invalid because its "previous block hash" field now points to the old, incorrect hash of the newly re-mined block. This necessitates updating and re-mining that subsequent block, and so on, for every single block that came after the initial alteration. The immense computational cost and time required to re-do the Proof-of-Work for an entire chain of subsequent blocks make changing a historical block on a blockchain practically impossible unless an attacker possesses a majority of the network's total computing power, known as a 51% attack.