Consensus settings

Блокчейн-платформа Waves Enterprise поддерживает три типа консенсуса - PoS, PoA и CFT. Настройки консенсуса располагаются в секции blockchain.

PoS configuration

The PoS consensus will be used by default if you have not specified the consensus type in the consensus.type field of the blockchain section. Here are the mining responsible parameters which are located in the genesis unit of the blockchain section:

  • average-block-delay - an average delay between the blocks creation. The default value is 60 seconds. The value of this parameter is ignored if PoA consensus is selected.

  • initial-base-target - an initial base number for the managing the mining process. The frequency of the block creation depends on the parameter value therefore the higher the value, the more often blocks are created. Also, the value of the miner’s balance affects the use of this parameter in mining - the larger the miner’s balance, the less the value of initial-base-target is used.

  • initial-balance - an initial balance in smallest units. The greater the share of the miner’s balance from the network initial balance, the smaller becomes the value of initial-base-target to determine the node miner of the current round.

We recommend to use the default parameter values specified in the configuration files examples which are represented on the GitHub page.

PoA settings

Please, uncomment or add the consensus unit of the blockchain section for the PoA consensus usage:

consensus {
  type = "poa"
  round-duration = "17s"
  sync-duration = "3s"
  ban-duration-blocks = 100
  warnings-for-ban = 3
  max-bans-percentage = 40
   }

The parameters represtnted in the consensus unit are used only for the PoA consensus.

  • type - the consensus type. Possible values are pos, poa or cft. If the pos value is specified, other parameters will not be considered. The CFT consensus is described below.

  • round-duration - a round length of the block mining in seconds.

  • sync-duration - a block mining synchronization period in seconds. The total time of the round is the sum of round-duration and sync-duration.

  • ban-duration-blocks - a blocks quantity of the ban period for the mining node.

  • warnings-for-ban - a number of rounds which is used for ban warnings for miner nodes.

  • max-bans-percentage - a percentage of mining nodes from the total number of nodes in the network that can be placed in the ban.

Using the PoA consensus allows to adjust the order of blocks creation by limiting the mining function for certain nodes. The reason is to distribute evenly the network load, if any mining nodes left the network or became inactive. Mining node can get banned for the following reasons:

  • if a node will miss its queue for mining;

  • if a node provides an invalid block;

  • if a node went offline.

Before getting into the blacklist the mining node receives warnings about the ban possibility during the number of rounds that is specified in the warnings-for-ban parameter. The mining node will be back to the mining after the ban-duration-blocks parameter value will end.

CFT configuration

Для использования консенсуса CFT также необходимо раскомментировать или добавить блок consensus в секции blockchain: Основные параметры настройки CFT идентичны параметрам консенсуса PoA:

consensus {
  type: "cft"
  round-duration: 7s
  sync-duration: 3s
  ban-duration-blocks: 14
  warnings-for-ban: 2
  max-bans-percentage: 33
  max-validators: 7
  finalization-timeout: 2s
  }

However, in comparison with the PoA consensus, CFT uses two additional configuration parameters needed for validation of blocks during a voting round:

  • max-validators – limit of validators taking part in a definite round.

  • finalization-timeout – time period, during which a miner waits for finalization of the last block in the chain. After this time, a miner returns transactions to the UTX pool and starts to main a round anew.

Consensus settings in the miner section

When you are configuring consensus settings, please, consider the following settings of the miner section:

  • micro-block-interval - an interval between microblocks. The value is specified in seconds.

  • min-micro-block-age - a minimal age of the microblock. The value is specified in seconds and should not be more than the micro-block-interval parameter value.

  • minimal-block-generation-offset - a minimal time interval between blocks. The value is specified in milliseconds.

The values of the microblock creation parameters should not conflict with the parameters values of the average-block-delay for PoS and round-duration for PoA and CFT. The number of microblocks in a block is not limited, but depends on the transactions size in the microblock.