## At which point do blocks get validated in the mining process?

5

0

I'm trying to understand how mining works and I'm stuck on the part about validating blocks and adding them to the blockchain.

When a miner finds a solution to a block, he shares it with the network, where other miners validate his new block by checking if the hash of the block (using the found nonce) is smaller than the target, right?

At which point does the validation of the block happen and how many users do have to validate the block so it gets appended to the blockchain?

Does this happen before a miner creates a new block? So basically he'd take a new block in the network, validate it, if it's okay, he takes that one as his "previous block" reference?

5

A block is checked in two places: First, it's checked before a miner starts working on it, and second, it's checked by every other node before accepting the block as valid.

3

The thing you have to keep in mind is that there isn't just one chain. Every individual running a full node has their own chain, and validates all the blocks on it as they receive them from the miners. If a block is invalid, full nodes and other miners will ignore it, and not include it in their own chains. It is possible that two nodes disagree on which block is the head of the chain.

This type of fork happens about once per day, where half the network thinks block A is the real block, and half the network thinks block B is the real block. This is perfectly fine, and resolves itself when either block A + 1 or block B + 1 is found. The protocol dictates that nodes accept the longest chain as the real chain, and alternative chains get removed.