If a node observes a fork in the bitcoin chain, then the node will choose the chain that has the highest difficulty (sum of difficulty in each block of the chain).

But the difficulty changes only once every 2016 blocks. So, if a fork occurs somewhere in between, then the difficulty is the same for both the side chains right? How does the node pick the main chain then? Just randomly?

New contributor
satya is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  1. It only considers valid chains. If either chain has an invalid block in it, it is excluded from consideration.
  2. If the chainwork (sum of the inverses of the targets of the blocks in the chain, approximately proportional to the sum of the difficulties) differs, chains with less than the maximum chainwork are excluded from consideration.
  3. If there are still multiple candidates, the one whose full block data of the tip was received first is considered active.
  • Thanks a lot for the wonderful answer. Suppose a node receives a block and observes there's a fork. The node determines the main chain as per the above logic. After that, will the node propagate the blocks in the non-main chain to its peers? – satya 2 days ago
  • 1
    No, it won't. Only the active chain is relayed. – Pieter Wuille 2 days ago

Your Answer

satya is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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