Chain Selection in DPoS

Published by Mario Oettler on

In the case of a fork, witnesses chose the longest chain. The longest chain is the chain where most of the witnesses create and validate blocks.

Let us consider a network with three witnesses A, B, and C. One epoch consists of three rounds. Under normal operation, there is no fork and the chain would look like that. A, B, and C are the blocks created by the according block producers (witnesses).

Now A and B follow branch I (upper branch) and C follows branch II (lower branch). This would create a fork.

In one epoch, the maximum number of blocks produced would be 9 blocks (3 witnesses * 3 blocks/witness = 9 blocks). In branch I, there are two witnesses. This means they can produce 2 * 3 = 6 blocks. Branch II, however, has only one witness and contains 1 * 3 = 3 blocks. Therefore, the branch I is longer than branch II.

This works only if non-responding witnesses are skipped and not replaced immediately by other witnesses.

However, we have a problem here which is known from PoS as nothing at stake. Witnesses can produce blocks on both branches without losing anything. But creating blocks on two or more branches and validating on two or more branches is considered bad behavior since it makes it hard to find a consensus, and it is expected that voters vote such witnesses out.

As long as a minority (less than 1/3 of the witnesses) creates multiple blocks, it does not affect the consensus since it would create a shorter chain and not stop the longer chain’s block validation process.

Another remedy could be to impose penalties for creating and validating blocks on more than one branch.

Network fragmentation

The network can fragment. In this situation, no branch has a majority of witnesses. In such a situation, there is no 2/3 majority, and finalization is not possible. If block validation is left aside, the longest chain will win again. But witnesses cannot be sure whether this is really the longest chain.

It is conceivable that there are two branches of the same length. This can be avoided or solved by:

  1. Having an odd number of witnesses
  2. Randomly shuffling the witnesses.

Not enough witnesses

If for some reason, the witnesses don’t come to a 2/3 majority for validating blocks, it will not be clear whether a block is final or not. In such a situation, witnesses can continue creating blocks. In these blocks, voters can vote for new witnesses.

The hope is that this restores the quorum of the witnesses to 100 % in at least one branch. This chain then will overtake all other chains and become the longest chain.

The problem here is that in the meantime, voters could vote on different chains differently. This could create two chains with 100% of the witnesses.

As long as there is no clear winner, blocks are not finalized and users should not make any transactions.

Malicious majority of witnesses

If more than 2/3 of the witnesses are corrupted, they can produce and validate an unlimited number of branches. Every branch would have 2/3 of the confirmation signatures. In this situation, the longest chain rule is applied. The minority of honest witnesses would break the tie between the competing branches.

In such a situation, voters should vote untrustworthy witnesses out. But this can cause two problems:

  1. If the malicious witnesses include only those voting transactions that vote for them, they can maintain their position as witnesses forever.
  2. If the malicious witnesses do not include any voting transaction, the whole network will stop.

Categories: