Consensus Components
Venom's consensus protocol consists of four distinct components:
- Election: Selection of validators from the overall validator set;
- Block Generation: Creation and verification of blocks by validators;
- Consensus: Validators reaching consensus on the state of the blockchain;
- Message Passing Protocol: Messages passing between validators.
The following provides more detail on each component.
The consensus process of the Venom blockchain begins with the election process of validators. The election determines which network participants are eligible to participate as validators.
A weight-sorted list of all validators is used for the Proof of Stake-based election. The staked tokens of a validator determine their weight during the election.
The smart contract responsible for executing the election algorithm takes the following factors into consideration when selecting validators:
- Validator stake size
- Minimum and maximum stake size
- Minimum and maximum number of allowed validators
- Maximum allowed difference between smallest and largest validator
The election process finishes with the definition of the overall validator set and the launch of the validator session.
Validator Session
Each validator session consists of several rounds of block generation. During each round, a validator executes the consensus algorithm which results in the elected block being added to the blockchain.
The number of validators that can propose the commitment of blocks to the rest of the network is limited in each round. Validators selected for block generation have several attempts to commit valid blocks. If this fails, the process starts over with new validators.
Block Generation
The block generation rules define the criteria a block needs to meet before it can be proposed by a validator. These rules include:
- Block size
- Volume of transactions included in a block
- Time between blocks
- Block header
- Transaction format
- Etc.
Only if these criteria are met, the new block can be proposed and committed to the blockchain.
Consensus algorithm
An agreement on block production during the book generation round is reached based on the parameters defined by the Byzantine Fault Tolerant (BFT) algorithm.
The following outlines the different stages of reaching an agreement during the consensus process:
- Candidate block generation: A new block is generated by validators with block generation priority.
- Candidate block approval: The other validators collect the candidate block and verify that it is not corrupted. Each validator then approves the block and broadcasts it to the network. The network considers a block to be approved then it receives the approval of more than 2/3 of the validators.
- Voting attempts: Once approved, the block enters the voting phase. There can be several voting attempts and each has a defined time limit. If an approved block receives more than 2/3 of all validator votes, it becomes a pre-commit block (i.e. a candidate block for signing).
- Block committing: Signing of the block begins once a pre-committed block has been defined. The validator that gets the pre-committed block signs it and broadcasts it to the other validators. If the validator receives 2/3 of the signatures of the other validators, the block is committed to the blockchain, and the next round is started.
A round is considered failed if no block is committed to the blockchain. The process then moves to the next round to reach an agreement between validators.
Message Passing Protocol
Communication and coordination between the validators of the Venom network are organized through the message-passing protocol. The network-layer protocol is used for the following purposes:
- Broadcasting of messages by validators to other nodes (with details about candidate blocks, approvals, votes, and signed blocks).
- Synchronizing the validator session state among the nodes.