What if user try to tamper the last block in blockchain?


#1

It is said that when we try to tamper second block, then the hash of that block gets changed so the block after it will have different previous hash due to which the link gets broken and that block is invalid. But what if the very last block is tampered? Because there wont be any block after it. Just the scenario to understand assuming there is last block only for some time.


#2

Hi @opensource,

This forum isn’t focused on blockchain/crypto-tech. You’ll be able to get a better answer on a forum actually focused on blockchain. The blockchain subreddit might be able to answer your question: https://old.reddit.com/r/BlockChain/


#3

Hi @opensource,

I’m confused why @zystvan would suggest this is not the place to ask your question, since:
(a) your question relates directly to the content in CodeAcademy’s Introduction to Blockchain, and
(b) the Discuss category description says, Ask questions, get help , and chat about your Codecademy coursework here!

So then, I think your answer is in Unit 7. Diving Deeper into Proof-of-Work. It says,

If a dishonest participant decides to tamper with a block, they would have to solve the Proof-of-Work for each subsequent block in order to introduce the tampered block into the network. This is computationally infeasible and almost impossible!

Furthermore, while the participant is busy finding the Proof-of-Work for each block, newer blocks are being added to the blockchain at a faster rate. The participant soon finds out that they are playing a losing battle against the entire network.

Let’s consider your bad actor, who is changing the hash in the last block. They are doing that in their own mempool, prior to pushing into the system to approve new additions to the blockchain (sorry, I’m still learning about blockchain and may not have the lingo correct). While the bad actor is switching hashes on the “last” block, it quickly, maybe near-instantaneously, is no longer the last block, since more are added in real time.

So the bad actor is thwarted by the speed of the subsequent additions to the front of the blockchain, past the actor’s own edit.

And also, someone editing the last block is just making a new edit, just as they would do if the addition was legitimate.

But I see why you asked the question. The key part is that a bad actor can’t freeze new additions while they tinker with the chain, and it’s near-impossible to make an edit mid-chain and make edits to conceal it all the way through the chain forward.