Voting in DPoS

Published by Mario Oettler on

Voting is the process of electing witnesses from a set of witness candidates. Therefore, witness candidates need to register and voters can cast their votes on their favorite candidates.

The voting process consists of three basic steps

  • Registration/deregistration as witness candidates
  • Casting votes
  • Tallying votes

Registration of witness candidates

To get elected, witness candidates need to register. While this registration process differs in detail from blockchain to blockchain, here are some general steps:

  1. Send a registration transaction: The potential witness candidate needs to register with a blockchain-based list. This is done by sending a transaction. In some cases, it is necessary to deposit a certain amount as collateral with the registration.
  2. Make candidacy public: This step is optional. Most DPoS blockchains have a website where witness candidates can register and make their profile public. These websites can be operated by a community or by a company that also takes care of the maintenance of the network. A problem with these websites is that they run on a centralized server and the operators can exclude nodes. Typically, these websites request information like the name of the node, location, type of server, a website, and a logo. In some cases, witness candidates that own sufficient funds to vote successfully for themselves don’t need to run a public campaign.
  3. After the unlocking period, the former witness can unlock and withdraw the deposited coins.

Casting votes

Voters vote for witnesses and delegates for epochs. An epoch consists of one or more rounds. In each round, the order of the block producers is shuffled. Within an epoch, the active witnesses remain the same. After an epoch, the set of witnesses is newly determined according to the votes.

There are different ways to design the voting process. Here, we talk about general design principles.

It is important to avoid votes from fake accounts. This is also called a Sybill-attack. Therefore, votes depend on the number of coins a voter holds. Usually, voters need to lock these funds for the time they vote. In most cases, epochs are very short (a couple of minutes). That’s why many DPoS blockchains apply an ongoing election. As long as a voter leaves his coins in the voting contract, his votes are counted. If he chooses to withdraw his coins, he doesn’t participate in the election.

Typically, voters can vote for multiple witnesses. In EOS, for example, each voter can vote for up to 30 witnesses.

From all candidates, the N candidates with the most votes become active witnesses. An active witness is a witness candidate that is allowed to create and validate blocks and participate in block validation. The number N varies from protocol to protocol. In EOS, N is 21, whereas in BitShares, N is 101. It is useful to maintain an odd number of witnesses to break ties in the case of a fork.

Usually, there are more candidates than active witnesses. In some protocols, some of those not elected candidates become so-called “stand-by witnesses”. They also receive a reward.

Some protocols require the witnesses to deposit a stake when registering as witness candidates. This stake can be used to punish malicious witnesses and it reduces the number of witness candidates since only wealthy nodes can afford the stake. This creates a certain degree of centralization.

An account can either be allowed to vote for only one witness candidate or for more than one.

There are two schemes which we will explain in a numerical example:

  1. Votes get split when voting for more than one candidate (split vote scheme)
  2. Each candidate receives the full votes of a voter (full vote scheme)

In the following paragraphs, we explain both schemes and their potential impact on the election outcome.

Splitting of votes

If a voter wants to vote for more than one candidate in the split vote scheme, he must split its coins according to his approval and dedicate those shares to each candidate. Each coin counts as a single vote. If a voter controls 100 coins and wants to vote for three candidates C1, C2, and C3. He could dedicate 25 coins to candidate C1, 30 coins to candidate C2, and 45 coins to candidate C3. In total, he distributed 100 coins (=votes) among his favorite candidates.

Now let us consider two voters A and B, and six candidates. Each voter is eligible to vote for three candidates. And the three candidates with the most votes win.

Voter A holds 51 % of the total funds. A favors candidates C1, C2, and C3. B holds the remaining 49% of the funds and favors the C4, C5, and C6.

A can elect two of its candidates with certainty into the witness set. B is always able to outvote at least one of A’s favorite candidates. The safest thing A can do is to dedicate 25.5 % to C1 and 25.5 % to C2 and give no vote to C3. In this case, B can dedicate 25 % to C4 and 24% to C5 and provide no vote to C6.

The following table shows the results.

candidatePercentage of votesWinner

If A distributed its coins evenly among its favorite candidates, C1, C2, and C3 would get 16.67% of the votes. B would now be able to outvote two of them by giving 25% and 24% respectively to C4 and C5.

Full voting

In the full voting scheme, our voter doesn’t need to split its funds among its candidates. He can dedicate 100 coins to candidate C1, 100 coins to candidate C2, and 100 coins to candidate C3 at the same time.

Compared to the split voting scheme, the outcome of the election can be different. Let’s again assume that voter A holds 51 % of the total funds. A favors candidates C1, C2, and C3. B holds the remaining 49% of the funds and favors candidates C4, C5, and C6.

Now A can dedicate 100% of its votes to each of its favorite candidates. B will never be able to outvote one of them. Hence, A controls the total set of active witnesses.

candidatePercentage of votesWinner

Hence, a full voting scheme is prone to coalitions.

Incentive to vote

The first incentive to vote is to maintain a reliable set of witnesses. But if the voter has to lock away the coins, this causes some costs for him.

Besides the motivation to maintain a reliable set of witnesses, voters have a financial interest. Voters can receive a share of the block reward from those witnesses they voted for. This creates competition among the witness candidates to pay the highest fraction of their block reward.

While the buying of votes offers a strong incentive to participate in the election, it also biases the voters to vote only for candidates that safely will win the election. This disadvantages smaller candidates and fosters the position of those candidates that are already in the active witness set.

Voting Decay

As mentioned above, epochs are usually short. Therefore, most blockchains apply an ongoing election scheme. Once a voter dedicated his votes to a witness candidate, he supports the candidate until he withdraws its coins.

While such ongoing elections are convenient, they are prone to unaware voters. At the beginning of their voting, voters are more interested in who they vote for. But after a while, many people tend to lose interest. This results in votes for candidates that do not exist anymore or even for candidates that violated the protocol.

A solution to this problem is called voting decay. It means that votes lose weight after a certain time. In EOS, the decay of votes starts 14 days after the voting transaction. Within two years, the weight of a vote reduces itself to zero.

Hence, voters who want to maintain their full voting power must refresh their vote every 14 days.