What Happens if a Miner Wants to Change Data in the Blockchain?

Published by Mario Oettler on

A miner could decide not to follow the actual chain. Maybe he doesn’t like a particular transaction in one of the blocks.

The situation is as follows.

Blockchain with a faulty block
Blockchain with a faulty block

Our malicious miner now doesn’t like a transaction in block 3. He can’t simply delete this transaction since this would break the hash pointer to block 4. (If you cannot remember what a hash pointer is, you can read it in lesson 1 topic Consensus). The network would recognize that and wouldn’t accept his version of the chain. But he could try something else. Instead of changing the existing chain, he could fork off a new chain starting from block 2.

A miner created its own chain without the disliked transaction in block 3.
A miner created its own chain without the disliked transaction in block 3.

In this situation, we would have two valid chains. The question is, how does the network decide? The network favors the chain with the most work in it. Given that the difficulty is the same in both chains, the branch with the most blocks in it is accepted as the correct (canonical) chain. This rule is given in the protocol.

To create the longest chain (or rather heaviest chain), our malicious miner would need to find his blocks faster than the rest of the network. This, however, is very expensive since he needs more hashing power than all other miners together (which would be more than 50 % of the total network hashing power).

This mechanism secures the blockchain against miners with a minor hashing power and makes sure the consensus is always there where the majority of hashing power is.

Categories:

if()