anders94 / blockchain-demo

A web-based demonstration of blockchain concepts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing block's data also changes next block's previous hash

AkashKarnatak opened this issue · comments

If I tamper block 4's data then it's hash will change. But why does block 5's previous hash gets affected?
Screenshot 2022-10-14 at 21-34-08 Blockchain Demo

I expect it to remain the same like so.
Screenshot 2022-10-14 at 21-38-48 Blockchain Demo

This is expected behavior. The previous hash is calculated from the previous block, not something set by that block. If it doesn't change then there is no integrity guarantee being established and the usefulness of a blockchain disappears.