Once a miner adds a block to the chain, does every other miner have to check that block to make sure that its transactions don't violate any rules?

For instance, if a miner added a block with an invalid transaction, is every other miner expected to check that block (and perhaps compare each transaction in it with every other transaction in every other block, to prevent, say, double spending)?


I'd advise you to use the search function a bit more, as you are asking a lot of questions which have already been answered.

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.

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

  • Thanks for your answer, but in future, please vote to close the question as a duplicate rather than quoting the answer here too :)
    – meshcollider
    Mar 27 '18 at 12:12
  • True its a duplicate and I should have linked the other question for reference. I cannot comment on that question so I'll ask it here. According to that answer, it does seem that a miner does have to somehow verify previous blocks. If this is true, how many previous blocks does he check?(should I ask this as a separate question?)
    – rahs
    Mar 27 '18 at 12:27
  • 1
    @RahulSaha The miner indirectly checks all blocks. An interesting property of the bitcoin blockchain is that blocks which are once valid are never invalid in the future. So, you can only verify each block once and you are done.
    – sanket1729
    Mar 28 '18 at 8:29
  • @sanket1729 So does that mean that, say, if I just start mining, then I first need to check the entire blockchain?
    – rahs
    Mar 28 '18 at 8:53
  • 1
    @RahulSaha, yes you need to check the entire blockchain. That is the entire point of bitcoin blockchain where you trustlessly arrive at the same chain without trusting anyone about the validity of the blocks
    – sanket1729
    Mar 28 '18 at 9:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.