How conflicts

How conflicts are resolved in determining the truth
It may happen that by accident, two miners simultaneously add real blocks to the chain. Imagine that part of the nodes took one valid block, and the other part took another block. The first group included a block with my transaction to Alice's address, and the other included a block with my transaction to Bob's address. Now we suddenly have two different conditions of blockage at the same time!

We call this (unintentional) "branching": the blockade branches into two different chains. Who got my bitcoin, Alice or Bob? Which of the two chains is the "true" blocker?

As a rule, all consensus protocols solve this problem by a simple rule: the longest chain wins.

Visualization of blockage branching
Visualization of blockage branching (normal random branching).
When there is an unintentional branching of the block, some miners start mining on the same chain, and others - on the other. Inevitably, there will be more miners on one chain than on another, as a result, new blocks will be added to this chain more quickly. The remaining miners will then move to a longer chain, and the branch chain will die. There will be no damage to the main chain.

How do we know that this is how it will all happen?

This is due to the fact that the miners are economic entities that act in their own interests. Miner is not interested in "mining" on the branch line, knowing that she will die. Transactions on the branched chain are never registered on the main chain, which means that the miners who extract blocks on the branch chain will not receive a reward for their work. For the miner, the alternative cost of extracting blocks that will not be included in the main chain is too high - therefore there is no need to spend time and money on doing this work.

In rare cases, a large number of miners or miners with significant computational resources may appear on the branch line. In this case, it may take some time before it becomes clear which is the main chain. Wisdom wisdom suggests that for this reason it is reasonable to wait for 6 blocks before counting the transaction as confirmed.

Visualization of rarely occurring extended branching of the block
Visualization of rarely occurring extended branching of the block. In the branch almost never happens more than 5 blocks.
The rule that the longest chain wins, combined with the fact that it takes a lot of processing power to add blocks to the chain, makes the blockade incredibly safe. Practically the only way to attack a network is to return to a block in the blockroom, branch off the chain and start "mining" new blocks on it. However, for this purpose the attacker will have to redo all the work done by the miners since the moment of the winding, and "catch up" with the main chain. Without having more processing power than the aggregate hash power of the network, it is simply impossible to achieve this. Simply put, the electricity and graphics processors needed for such an operation would be too expensive