Opporty’s Protocol Consensus Algorithm

Opporty BP
Opporty
Published in
3 min readDec 19, 2018

Currently, a very large number of different algorithms are used to reach consensus in distributed systems. Proof of Work (PoW) is the algorithm most commonly used with Blockchain. This is a long-standing and proven algorithm that solves the well-known “Byzantine Generals Problem.”

Algorithms other than PoW are gaining popularity. The DPoS (delegate proof of stake) algorithm, a variation of the Proof of Stake (PoS) algorithm, has become particularly popular. This algorithm is used specifically in the EOS system, which is becoming increasingly widespread. The advantage of this algorithm is that it is much faster than its predecessors, while simultaneously providing sufficient decentralization.

The following tasks are solved by consensus:

  1. Who should submit the block to the current?
  2. When it is necessary to submit the block?
  3. How should the block be checked and validated?

DPoS answers the first two questions. In the Opporty protocol, there are special types of transactions that allow for execution:

* add yourself as a validator

* vote for another validator

* Shoot voice recognition

* remove yourself from the list of validators

Each transaction type requires a certain number of OPP tokens (1 OPP by default). Further, all validators are sorted by weight (number of stakes).

The concurrent list of validators consists of the first eight validators on the list.

The entire timeline is divided into periods equal to 10 seconds (adjustable), and every 10 seconds the validators are sorted in a certain way.

Only one validator is currently active. Thus, we have a current validator timestamp and block submitter for each time period.

In order to come to the current synchronized state in the distributed network, it is necessary to solve the Problem of Byzantine Generals — the classic effective algorithm is pbft by Castrov and Liskov.

This algorithm was chosen because it allows for instant finalization of transactions that are necessary for Opporty Plasma chains.

PBFT runs in certain periods of rounds, where each node plays a different role: the role of a leader (block proposer) and the role of a validator. Each round consists of three (3) phases as shown in the figure.

1. Pre-prepare phase:

The leader initiates the consensus process by sending a signed PRE-PREPARE message, which is a proposition of a block containing a certain number of transactions.

2. Prepare phase:

After receiving the PRE-PREPARE message, each node in the consensus group checks the correctness and validity of the block and sends a signed PREPARE message (yes / no) to all other nodes.

3. Commit phase:

Based on the analysis of the messages received by PREPARE, each node sends the signed COMMIT message to the consensus group. The block will be registered only if a certain number of nodes confirm its correctness.

At the end of the three phases, all honest nodes will have the same ledger.

In PBFT, the Prepare and Commit phases imply intense interactions between the nodes of the consensus group. If a consensus group consists of n players with a level of tolerance, then:

f = ⌊ (N — 1) / 3⌋ byzantium nodes in PBFT.

Each node from the consensus group should verify 2f + 1 digital signatures for two phrases, which limits the possibility of using a large number of validators.

Therefore, it is necessary to use a very efficient signature algorithm. For the Opporty protocol, BLS signatures were chosen that were already implemented for BN128 curves (Baretto Naehrig curves). The keys themselves can be very small in size and effective enough that all phases are completed in a few seconds.

After implementation of the consensus algorithm, we have a completely identical state on all blockchain nodes, using only eight (8) nodes and the pbft algorithm. We have 10–20 times less than in the case of proof of authority (PoA), and one node as a validator. Each transaction is now distributed throughout network, which reduces the ability of the existing bandwidth, and a three-phase PbFT algorithm is conducted.

This algorithm has sufficient decentralization for practical use of the blockchain and for the Opporty project protocol.

--

--

Opporty BP
Opporty

Three-layered business relationships ecosystem, consisting of a Proof-of-Expertise protocol, a business scoring system, and a B2B transaction platform.