title |
---|
Consensus |
Ostracon is extending Tendermint-BFT with VRF-based election.
Ostracon's Tendermint-BFT based block generation mechanism consists of three phases. We here refer to the generation of blocks as height, and a single approval round consisting of the following three processes as round.
Elect a proposer from the set of validator (candidate) nodes. This is the same as a leader election in a general distributed system. However, in a blockchain, it must be designed to prevent artificial selection so that malicious interference doesn't degrade the overall performance of the system. Also note that there is no centralised authority is involved in the Ostracon election to ensure fairness. Since all nodes can compute the election results deterministically, each node can autonomously determine whether it has been elected as a proposer.
The selected proposer proposes a block. The unconfirmed transactions that have not yet been added in the blockchain are shared via P2P between the nodes nodes in the network and stored in an area of each node called the mempool. The node selected as the proposer generates a block from the unconfirmed transactions remaining in its mempool and proposes it to the validators.
The validators validate the block proposed by the proposer. Each validator votes on whether the block is correct, and Tendermint-BFT replicates the votes to the other validators. If more than
TIP: In Tendermint-BFT, this re-election process can be routed to a particular stage of the election process, depending on reasons for rejection.
VRF is an algorithm for generating a hash value
A VRF hash generator
In Ostracon, the proposer of the next block is randomly selected by a verifiable random number from the proposer who created the previous block. A VRF Proof field
The node receiving the new block starts the election phase. In this phase, it verifies the VRF Proof
The node selected as proposer by at this phase takes the unapproved transactions from its own mempool and generates a proposal block (at this point the block is not yet confirmed). The proposer then computes the VRF Proof
Note that the message
A validator checks the received Proposal block and votes on it. The votes are replicated by Tendermint-BFT through prevote, precommit, and commit. The block is confirmed if more than a quorum of valid votes are collected.
During the verification phase, in addition to the block verification, the following VRF-related verifications are performed:
- The proposer that generated the block must be a node selected based on the VRF hash of its previous block. This can be determined by matching the node that actually generated the block with the proposer selected by weighted random sampling using the VRF hash
$t$ . - The
$\pi$ contained in the block must be a VRF Proof generated using the proposer's private key. If the$t$ computed from the VRF Proof$\pi$ matches the$t$ computed by thevrf_verify()
function, we can conclude that$\pi$ is not forged.
By repeating this sequence of rounds, fair random sampling can be chained across all block generations.
Recall that the node receiving the block can deterministically calculate which node is the next proposer. By revealing the nodes responsible for generating blocks in a given round, we can penalise nodes that are elected but don't actually do their job, or that behave maliciously, such as in Eclipse attacks. On the other hand, it's still difficult to predict the proposer beyond one block, as they are only revealed for the minimum time necessary.
Although Ostracon's consensus scheme works correctly even if a few nodes fail, it's ideal that failed nodes aren't selected for the consensus group to avoid wasting network and CPU resources. In particular, for cases such as intentional malpractice, not caused by general asynchronous messaging problems, evidence of the behavior will be shared, and action will be taken to eliminate the candidate from the selection process by forfeiting the stake, whether malicious or not.
In a system with such a disciplinary rule, it's important to have a mechanism to prevent nodes from causing unintended behavior; Ostracon saves all received messages in its WAL (write-ahead log), and when it recovers from a node failure, it can correctly apply processing after the last message it applied.
For more information on WAL, see Tendermint | WAL.