Competing Chain Problem (Longest Chain Rule)

Competing Chain Problem (Longest Chain Rule)

Consensus Protocol

Prevent Attacks

Consensus Protocol for Competing Chain Problem

mining-competition.png All the miners mines their blocks. but lets say two miners mined there block at the same time. both the miner will add that block into their blockchains, Now as we are connected through P2P network both the miners will transfer their data to all over network. Rest of the nodes will adds their block, but their will be a conflict because In a same network , nodes will have two different set of blockchains, this is the problem ,so consensus Protocol says, whoever has the longest chain only that blockchain will consider as the valid blockchain and only that will be accepted by all the nodes, others will be discarded because it become an orphan block which is no longer needed. and if their is the conflict between the two network having different set of blockchain with same numbers of blocks then that block will not be added until another block is mine by those networks, whoever adds the next block first ,and who's numbers of blocks will be more that networks blockchain will be accepted by all the nodes.

  • lets assume there are 7 nodes in a network A,B,C,D,E,F,G and let miner A and G has mined a block at the same time, now we have 2 mined blocks,and both A and G will transfer their data in the network, and others will add blocks eg. B,C,D added A's Block and E,F has added G's block, so in this A's block will be accepted by all the nodes. because A's block is accepted by more nodes than by G's. now E,F,G have to discard their block and they also have to add A's block.
  • Another one if in a network A,B,C,D,E,F,G let miner A and G has mined a block at the same time and now there are two different network one A,B,C,D and other E,F,G. and both the network have same number of blocks A has 5 blocks and G has 5 blocks, In this scenario No block will be added, these 2 networks will again start mining in two groups, whoever mines first, that chain will be accepted, eg A,B,C,D mined first and now has 6 blocks and E,F,G network has 5 blocks then A's network has the longest chain so all nodes will accept A's blockchain.

1. consensus protocol is better than Byzantine Fault Tolerance as it needs 51% majority while BFT needs approx 66%.

  1. All the transaction in the Orphan Block will be dropped and No reward are given tothatminer.
  2. Wait for 6 confirmation transaction before assuming payment to be successful.