What happens if a miner publishes a block which contains an invalid transaction?

4

1

What happens if a miner (accidentally or maliciously) publishes a block with correct proof of works, which contains an invalid transaction (e.g., a double spending one)? Is the block ignored by the network?

Tail of Godzilla

Posted 2017-07-06T12:51:01.417

Reputation: 297

Answers

4

A block with an invalid transaction is an invalid block, regardless of the proof of work.

When it is broadcast, other full nodes will ignore it as spam, and typically disconnect from the node that sent it. A bad block is unlikely to propagate very far on the network.

When other miners see it, they will also ignore it. If they mine on top of it, they will be wasting their hashing power. This also means that the miner who did the proof of work on the invalid block has wasted their own hashing power. This is why it's important that miners validate the transactions they include in blocks.

Jestin

Posted 2017-07-06T12:51:01.417

Reputation: 8 339

if a block with any invalid transaction will be considered as an invalid block, can we say that whenever a peer commits a block into the ledger, this block is guaranteed to be a valid block?Qi Zhang 2018-07-13T03:42:30.153

I would agree that's a correct a statement, just so long as you understand that "the ledger" is an agreed upon version. There can be ledgers that barely anyone agrees are the correct one. It's probably more accurate to say that any block that miners are mining on top of is considered valid by those miners.Jestin 2018-07-13T15:25:06.723