Installation and usage of the platform

General platform configuration: consensus algorithm

The Waves Enterprise blockchain platform supports three consensus algorithms - PoS, PoA and CFT. Detailed information about the consensus algorithms used can be found in the article Consensus algorithms.

The consensus settings are located in the consensus block of the blockchain section:

consensus {
  type = ""
  ...
}

Select the preferred consensus type in the type field. Possible values: pos, poa, and cft.

type = "pos" or the commented consensus block

If you do not select a consensus type in this field, leaving it blank, the default PoS algorithm will be used. This option is equivalent to selecting the pos value. In this case other fields in the consensus block are not required, you only need to configure the PoS mining operation in the genesis block:

consensus {
  type = "pos"
}

...

genesis {
    average-block-delay = "60s"
    initial-base-target = 153722867
    initial-balance = "16250000 WEST"

    ...
    }

The following parameters of the genesis block in the blockchain section are responsible for mining with PoS:

  • average-block-delay - average block creation delay. The default value is 60 seconds.

  • initial-base-target - the initial base number to regulate the mining process. The higher the value, the more often the blocks are created. Also, the value of the miner balance affects the use of this parameter in mining - the higher the balance of the miner, the lower the value of initial-base-target becomes when calculating the queue of node-miner in the current round.

  • initial-balance - the initial balance of the network. The greater the share of the miner’s balance from the initial balance of the network, the smaller the value of initial-base-target becomes for determining the miner node of the current round.

type = "poa"

To configure the PoA consensus algorithm, add the following parameters to the consensus block:

consensus {
  type = "poa"
  round-duration = "17s"
  sync-duration = "3s"
  ban-duration-blocks = 100
  warnings-for-ban = 3
  max-bans-percentage = 40
   }
  • round-duration - length of the block mining round in seconds.

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

  • ban-duration-blocks - the number of blocks for which the miner node is banned.

  • warnings-for-ban - the number of rounds during which the miner node receives warnings. At the end of this number of rounds, the node is banned.

  • max-bans-percentage - percentage of miner node from the total number of nodes in the network that can be banned.

type = "cft"

The basic settings of the CFT are identical to those of the PoA consensus:

consensus {
  type: cft
  warnings-for-ban: 3
  ban-duration-blocks: 15
  max-bans-percentage: 33
  round-duration: 7s
  sync-duration: 2s
  max-validators: 7
  finalization-timeout: 4s
  full-vote-set-timeout: 4s
}

In comparison with the PoA, the CFT has two additional configuration parameters needed to validate blocks in a voting round:

  • max-validators – limit of validators participating in a current round.

  • finalization-timeout – time period, during which a miner waits for finalization of the last block in a blockchain. After that time, the miner will return the transactions back to the UTX pool and start mining the round again.

  • full-vote-set-timeout - опциональный параметр, определяющий, сколько времени после окончания раунда (параметр конфигурационного файла ноды: round-duration) майнер ожидает полный набор голосов от всех валидаторов.

При настройке CFT обратите внимание на следующие рекомендации:

  • Параметр sync-duration должен быть отличен от нуля. Рекомендуется устанавливать значение от 1 до 5 секунд, в зависимости от размера и сложности транзакций.

  • Примерный расчет значения параметра finalization-timeout: (round-duration + sync-duration) / 2. Не рекомендуется занижать это значение для ускорения финализации: если майнер наберет необходимое число голосов ранее окончания этого времени, он сразу выпустит финализирующий микроблок.

  • Если в сети присутствует большое количество майнеров, ограничьте количество валидаторов раунда параметром max-validators. Механизм выбора валидаторов обеспечит равномерную ротацию всех валидаторов по раундам. Слишком большое количество валидаторов может отрицательно повлиять на производительность сети. Рекомендуемый диапазон значений: от 5 до 10.

  • Если сеть работает под постоянной нагрузкой, установите параметр full-vote-set-timeout. До истечения этого периода времени майнер ждет полного набора голосов от валидаторов. Если валидатор сталкивается с какими-либо неполадками, сеть использует время full-vote-set-timeout для создания дополнительного временного промежутка, который позволяет отставшему валидатору завершить синхронизацию. Рекомендуемое значение: sync-duration * 2, не может привышать sync-duration + finalization-timeout.

See also