Consensus voting mechanism

BFChain block forgers are selected based on the trustee's votes and online rate and other parameters in accordance with the underlying consensus rules (see Block Forger Campaign for details).

The number of votes obtained by the trustee is obtained by voting on the trustees who have started to receive votes through the address account that holds the equity of the main chain on the entire network.

All address accounts on the chain that hold the equity of the main chain can vote for trustees in various supported Dapps (such as BFChain APP) or BCF node programs. The more votes the trustee gets, the greater the probability of becoming a forger.

This chapter will introduce the voting rules of BFChain in five parts:

  • Get votes
  • Automatic voting
  • Manual voting
  • Voting incentive distribution
  • End-of-round calculation

Get votes

A ballot is a bill used by an address account on the chain to vote for a trustee. The address account can only vote for the trustee if it receives votes.

In order for an on-chain address account to get votes, it needs to ensure:

  • The address account holds the main chain equity
  • Turn on voting governance and be online for 6 consecutive hours (that is, online for three consecutive rounds)

The consensus formula for the number of votes that an address account can obtain in each round (for the next round of voting) is:

The number of votes that the address account can get in each round = balance balanceWeight + numberOfTransaction numberOfTransactionWeight * Rate

among them:

  • balance: As of the last round, the main chain equity owned by the address account;
  • balanceWeight: the weight of the main chain equity, constant, the creation consensus default is: 5000;
  • numberOfTransaction: The number of events that the address account has been confirmed in the previous round;
  • numberOfTransactionWeight: the proportion of event volume, constant, the creation consensus default is: 1;
  • Rate: max (the main chain equity of each address account participating in the last round of voting)/max (the number of confirmed events for each address account participating in the last round of voting).

BFChain will calculate the number of votes each account has in the next round at the end of each round.

Automatic voting

Automatic voting means that the bottom layer of BFChain provides a recommendation algorithm, and nodes independently configure algorithm parameter values. When the node turns on automatic voting, the bottom layer will automatically vote for the trustees who meet the conditions according to the algorithm and configuration parameter values.

Automatic voting recommendation algorithm

In BFChainPC.Config.AutoVoteModel, the configuration parameters involved in the underlying recommendation algorithm are listed in detail. The definitions of several configuration parameters are as follows:

Parameter name Interpretation Value
enable Whether to enable automatic voting for nodes true: enable
false: disable
useConfigFee Whether to use the default configuration of automatic voting on the chain fee true: Automatic voting on the chain fee uses the value set in the parameter ‘fee’
false: Do not use the value set in the parameter ‘fee’
fee Automatic voting on the chain fee
priorRecommendedNumber Whether to prioritize the number of candidates true: According to the recommendation algorithm, the number of candidates set in the parameter ‘maxNumberofRecommended’ is selected first
false: not used
maxNumberofRecommended The maximum number of candidates selected by this node
numberofRounds Selected block range, from which block range the statistics of several parameter values ​​in the following recommended algorithm are calculated (from the most recent 100 rounds)
productivityPercent Online rate percentage
forgedBlocksPercent Proportion of forged blocks
applyTxPercent Percentage of packaged transactions
votePercent Last round of votes
newDelegatePercent Proportion of new trustees
minBeSelectProductivity Minimum online rate of recommended accounts

For example:

Parameters Interpretation Setting Values ​​
enable Whether to enable automatic voting for the node true
priorRecommendedNumber Whether to give priority to guarantee the number of recommenders Yes
maxNumberofRecommended The maximum number of candidates selected by this node 57
productivityPercent Online rate percentage 30%
forgedBlocksPercent Proportion of forged blocks 30%
applyTxPercent Percentage of packaged transactions 20%
votePercent Last round of votes 10%
newDelegatePercent Percentage of new trustees 10%

The settings in the above table indicate that this node needs to select 57 candidate trustees at most through automatic voting. The composition of these 57 candidate trustees is:

The 17 (57*0.3) trustees who have the highest online rate within the selected block range to start receiving votes;

The 17 (57*0.3) trustees who have the largest number of blocks forged within the selected block range are open to receive votes

The 11 (57*0.2) trustees with the largest number of packaged transactions within the selected block range to start receiving votes

The 6 (57*0.1) trustees who received the highest vote rate in the previous round

The 6 newly registered trustees in the selected block range are open to accept voting trustees. The selection rule is: number of votes> number of main stakes> public key

Automatic voting interface

BFChain biological chain forest provides the following interfaces for automatic voting of nodes:

Manual voting

Manual voting means that the node can vote on any trustee who has started to receive voting on the chain, and the number of votes cast is controlled by the node itself, as long as it does not exceed the maximum number of votes currently owned by the node.

Manual voting interface

BFChain biological chain forest provides the following event interfaces for nodes to vote manually:

  • Manual voting
    • The full name of the interface: [trVote](/en/API_reference/PC_full_node/Interface_list/1-3#_9-Create a voting event)

Voting incentive distribution

After the forger has forged a block, the bottom layer will directly calculate the voting incentives that all address accounts that voted for the forger in the previous round should receive, and the incentive rights will be directly issued to each voting address account.

Motivation formula

The total reward of votes obtained for forging the block totalRewardOfVote: {rewardPerBlock + sum(eachtransactionfeeOftheBlock)} * votePercent

  • rewardPerBlock: Block incentive, which is determined by the underlying consensus. When different block heights are forged, the block forging incentives given will be different. At the current height, the underlying consensus is 15BFT by default;
  • sum(eachtransactionfeeOftheBlock): Each event on the chain requires a certain amount of on-chain fee. This on-chain fee can be set when the account initiates the event, or the best on-chain fee recommended by the underlying consensus algorithm. Among them, eachtransactionfeeFortheBlock is the on-chain fee of each event packaged into this block; sum(eachtransactionfeeOftheBlock) is the sum of the on-chain fee of each event packaged into this block. -votePercent: the percentage of voting incentives, this is a constant, determined by the underlying consensus, the current default is 0.6

The voting incentives that each address account that voted for this forger in the previous round should receive = totalRewardOfVote * (The number of votes cast by the address account to the forge in the previous round / the total number of votes the forge obtained in the previous round)

For the consensus incentive mechanism of the BFChain ecosystem, please refer to the chapter Consensus Incentive Mechanism. This section will not describe it in detail.

End-of-round calculation

The following data will be calculated at the end of each round:

  • Count the number of votes accumulated in the current round of the trustee account that has opened to receive votes
  • Count and save the number of votes for the next round that should be obtained by the address account that has turned on voting governance
  • Update the account master equity at the end of the round and the number of confirmed events in this round for each address account that has turned on voting governance
  • Update the Rate value (Rate = max (the main chain equity of each address account participating in the previous round of voting)/max (the number of events that have been confirmed for each address account participating in the previous round of voting))