background

Consensus Algorithm. Opporty DPoS pBFT Solution for Distributed Ledger Security

image

Overview

Modern distributed ledger technologies solve many different tasks such as ensuring privacy, increasing trust in the network, speeding up transactions, and reducing the cost of their implementation. However, the main task is to ensure complete fault tolerance and the opportunity to solve business logic problems using smart contracts with maximum accuracy, reliability, and efficiency, leaving no chance for hacking and abuse. Find more info about our blockchain solutions.

Industry

A distributed ledger technology or a blockchain is a solution for decentralizing and solving the synchronization problem in decision making.

Blockchain is a distributed ledger able to run business logic on the network.

Blockchain makes it possible to ensure complete decentralization by applying different consensus algorithms.

All consensus algorithms have different levels of complexity, resources consumed, efficiency, and reliability.

Company

Opporty is a research project that brings innovations to the B2B field, simplifies transactions, and increases trust between business partners.

Currently, Opporty consists of:

  • Cybersecurity and cryptology specialists.
  • DAPP interface designers and performers.
  • DevOps specialists organizing and setting up the infrastructure of blockchain projects.
  • Microservice architecture developers.

Background

The first cryptosystems existed long before the advent of modern distributed systems. They originated from ancient Egypt where hieroglyphs had been first used. The very first full-fledged cryptosystem was created by the Roman emperor Caesar (100 B.C. – 44 B.C.) He did not trust messengers and used a special cipher to encrypt correspondence with generals. Each character was shifted three positions alphabetically. No one was able to decipher a message without knowing a decryption method.

The tasks and issues of cryptology were constantly evolving. New goals emerged such as confidentiality, integrity, and information authentication

Practical use of blockchain

Today, cryptography is practically applied in a variety of areas: computer networks, IT, economics, and financial technology.

Blockchain and distributed ledger have emerged at the intersection of these areas as practical cryptology.

The first task of cryptology, which is fundamental to the blockchain, is the problem of Byzantine generals that was studied half a century ago to ensure synchronization and fault tolerance in computer systems where specific nodes may be faulty.

Byzantine consensus

The Byzantine consensus is a fictional task based on the network participants’ interaction. It is presumed that a center (decentralization came into use later) and/or individual network participants may turn out to be attackers.

Let’s consider the essence of the problem. There is the Byzantine army that consists of many distantly located legions. Each legion has its own general. All generals are subject to the main general. On the eve of a battle, the main general sends commands to attack or retreat to all other generals. It is known that some generals may be traitors and intentionally send disparate commands. Further scenarios:

  • if all loyal generals attack, the army would win;
  • if all loyal generals retreat, the army would remain safe;
  • if loyal generals act disparately, the army would be defeated.

The task of the Byzantine generals is to find traitors, exclude them from the decision-making system, and reach a consensus. Obviously, simple information exchange would not be helpful in this case.

Solving the Byzantine generals problem using POW

Satoshi Nakamoto suggested one of the most effective solutions to this problem and published it in one of his email newsletters.

Nakamoto set the goal of hacking Wi-Fi (brute force) in front of the participants in the experiment (generals). Hacking is possible only if the efforts of all participants are simultaneously directed to brute force.

It doesn’t matter when the attack takes place. Attackers only have to negotiate time. Each of them can offer their own option. The option offered first becomes an official attack time. The problem is that the network does not accept signals instantaneously. If two generals announce several attack time options simultaneously, participants may get different messages.

The POW chain solves this problem.

=================================================================

All participants should agree on the common attack time. To reach a consensus, each participant solves a complex POW task, for example, includes their time in a hash and finds a hash with a certain number of zeros at the beginning. After a participant finds this hash, their option of attack time has the greatest value and importance.

Building a chain with such proofs helps to make the final decision on an optimal attack time.

=================================================================

As soon as each general gets the first announced attack time, they set up their computers to solve an extremely complex task that includes the attack time in a hash.

POW tasks are so challenging that computers are expected to work for 10 minutes before one of them finds a solution. As soon as one of the generals finds proof, they send it to the network. Then everyone changes their current calculations and includes this proof in the hash they are working on. If someone works with other attack time, they switch to a generally adopted option because their testing chain is now longer.

=================================================================

Each participant takes part in POW chain generation. As a result, after generating 12 POWs, a residual solution (Wi-Fi attack time) is obtained since certain resources (CPU computation time) were spent on this solution.

By simply assessing the complexity of a health check chain, each general can determine how much parallel CPU power per hour was spent on the attack and see that most computers needed a certain amount of proof for testing. All they see this since the proof of work demonstrates their participation. If the CPU power represented by the health check chain is sufficient to crack a password, participants can safely attack at the agreed time.

Such a seemingly simple solution entailed a bunch of applications. The first POW application is the creation of cryptocurrencies and, as a result, cryptoeconomics.

POW practical application: cryptoeconomics and cryptolaw

The second very important POW algorithm application is the creation of Ethereum, a platform for smart contracts.

A completely new way to use cryptolaw has been practically implemented. Smart contracts have made it possible to look at the blockchain not only as a global app database but also as a way to write new type programs – decentralized applications.

The field of use of distributed ledger systems is incredibly huge: from eco and oil companies to medical institutions that record information on the human genome.

Nevertheless, many things still remain unexplored. Every day, new tasks are being set and new application areas are being found for the blockchain.

The fundamental properties of the blockchain

           The blockchain is extremely efficient because it is:

  • Ledger-based. This technology uses a ledger only to add data to a ledger, provide a complete history of transactions and transitions. In contrast to traditional databases, transactions and values are not redefined ​​in the blockchain.
  • Secure. The blockchain is cryptographically secure. It ensures that the data in the ledger is well-checked and not tampered.
  • Shared. The ledger is shared by several users. This provides transparency to node participants in the blockchain network.
  • Distributed. This allows scaling the number of blockchain nodes to make the system more resistant to attacks. If the number of nodes increases, the ability of a malicious participant to influence the agreed blockchain protocol decreases.

Blockchain technology in B2B space

Cryptocurrency is the first practical blockchain application.

But because of Bitcoin and cryptocurrencies standing in a spotlight, most people cannot fully understand the technology underlying current hype and the ways how this technology can be implemented in business.

The blockchain technology can increase security, efficiency, and trust in the B2B space.

Information stored in the blockchain exists as a shared database being used on millions of computers simultaneously and making data available for anyone on the Internet.

The comparison of the blockchain with Google Docs

William Mougayar’s analogy is extremely helpful when the key principles of the blockchain technology are explained: “A traditional way to exchange documents is to send a Microsoft Word file to another person and ask them to make changes.

The problem is that before you can see the work done and make your own changes, you need to wait until you receive a partner’s copy. You cannot make edits until another person finishes their operations in a doc. Modern databases work this way.

Two editors cannot mess around with the same file simultaneously.

Here’s how banks maintain cash balances and transfers: they block access (or reduce balance) for a short time during transfer, update the other side, and then open access (or make update again).

In Google Docs, multiple parties have simultaneous access to files. One version is always visible to each editor.

This system seems to a shared book. But this is a shared document. A shared part comes into play when several people participate in exchange. Just think about a tremendous number of legal documents that should be used in this way!

Why can’t *all* business documents be shared instead of constantly sending files to each other, losing intermediate versions, and not synchronizing them with other versions?

This workflow type is ideal for so many types of legal contracts! Even though you don’t need a blockchain to exchange documents, the analogy with shared documents is demonstrative.”

The importance, value, and business application of the blockchain

Modern online banking sets too many restrictions, for example, business regulation, account activity monitoring, etc.

The blockchain does not abandon traditional methods and offers new advantages:

1. Preventing costly mistakes

This technology helps users to avoid missed transactions, failures in banking programs, human typos, and uncoordinated transfers. When transaction data gets into the blockchain, it is encoded into the main ledger and a distributed ledger system. A secure verification mechanism is used. The network contains many blocks with identical information, which means that the blockchain does not have one controlling person and a single point of failure.

2. Transparent transactions

When choosing a blockchain, B2B wins because of secure and transparent transactions. But what does it mean?

You may no longer worry about scammers’ manipulations or data corruption. The network periodically checks itself, acting as a digital self-monitoring system.

Each transaction is coordinated with a 10-minute interval. A group of such transactions is called a block.

Therefore, transparency data is embedded in the network and is publicly available, while information cannot be damaged or replaced.

3. Digitization for real goods

Blockchain is ideal for recording the data of any real goods.

For example, a digital representation of a certain car can be created in the blockchain. Thanks to the security of the network, no one can manipulate information. It will be convenient for you to use records for keeping a car log. Also, it is the opportunity to obtain a product authenticity proof, quantities, owners’ names, and other data at any time.

4. Smart contracts

Smart contracts are programs configured individually for specific transactions. Business rules and algorithms for automatic fulfillment of contract terms are incorporated in them.

This increases security, reduces the risk of hacking, optimizes transactions, and eliminates the need for intermediaries.

5. Speed ​​and security of payments

Even if you use digitized payment systems, they are still mostly centralized.

This means that if you want to make a payment, it must first be processed by a third-party organization. Therefore, the transfer of funds may take several days or even weeks.

Blockchain transactions can be many times faster.

Smart contracts accelerate transactions / payments for B2B companies. The blockchain technology removes third-party elements, focusing on peer-to-peer transactions. As a result, costs and time being spent to process transactions are reduced.

Your translation no longer passes through third parties for weeks. Instead, it is quickly confirmed by the blockchain system.

Benefits:

  • High transaction speed ensures a faster supply chain and customer satisfaction.
  • Distribution and logistics are optimized.
  • Overhead costs for third-party services are reduced.

Let’s consider a SWIFT payment system as an example. SWIFT places priority on using the blockchain to increase the speed of international financial transactions:

When it comes to transferring payments from one bank to another, we can turn a three-day billing period into a five-minute billing period… So blockchain speeds up the process and saves companies’ time and money.”

To reach the level of SWIFT or VISA, besides speed, a very strict network coordination mechanism is also needed – a consensus algorithm.

The Challenge

In the Opporty POE protocol, scaling is achieved by introducing Plasma Cash smart contracts. However, there is a data availability problem as well as block withholding.

At some point, an operator may begin to refuse transactions, subject them to censorship, or simply publish a block with delay.

There are many solutions. But an algorithm is needed to answer the basic questions:

  • Who does submit a block to a root chain?
  • When should the block be submitted to a root chain?
  • Is it possible to submit the block (verification)?

The Solution

Consensus algorithm at Opporty’s Plasma Cash

Opporty has reached 300,000 transactions per second without full version of the consensus algorithm. But in order to make the system as secure as possible, developers have decided to use the DPOS (delegated proof of stake) algorithm and PBFT (practical byzantine fault tolerance).

These algorithms have been chosen because of their high speed as well as the ability to test a block before it enters the main Plasma network.

Any consensus algorithm is an agreement concluded by the majority of the network participants. The inability of decentralized systems (such as cryptocurrency) to reach an agreement has long prevented them from flourishing — before consensus mechanisms were invented.

Consensus algorithms play the role of trusted third parties in peer-to-peer networks. Now there is no need to entrust your money to a bank or a conditional centralized escrow. Instead, you can entrust it to a decentralized system of individual nodes united by an agreement.

To achieve a correct and fair consensus, participants must have honest networking intentions. The problem is that many people choose full nodes and mine only for the rewards they can get. They participate in a consensus because of greed that often gives rise to corruption and dishonest behavior of participants.

The overview of basic consensus algorithms

Decentralized networks reach consensus using various algorithms or logic schemes. The three main blockchain consensus algorithms, in order of decreasing popularity, are Proof of Work (PoW), Proof of Stake (PoS), and Delegated Proof of Stake (DPoS). Proof of Work is the oldest, the most proven and the most frequently used consensus algorithm in the blockchain.

Proof of Work became popular thanks to Bitcoin. This algorithm is performed using special resources. Of course, it was initially possible to mine Bitcoin on ordinary computers, but due to the increasing complexity of the mining processes, this is impossible now. Therefore, miners willing to participate in Proof of Work should build mining installations that constantly seek the next Bitcoin blockchain block.

This algorithm has long proved its great reliability and importance. At the same time, it has a significant drawback – it is necessary to spend a huge amount of electricity and resources. Therefore, the profit from currency acquisition does not pay back losses.

Theoretically, the program that finds hashes and performs Proof of Work even faster can be invented. Then it would be possible to crack the consensus and the network would become much more decentralized.

The second algorithm, Proof of Stake, involves that interested parties should “vote” for the next blocks to reach consensus. Users get more coins as a reward for participating in the network. This method is very similar to how PoW miners get rewards for their efforts.

The Proof of Stake algorithm is still decentralized. At the same time, it is not necessary to spend a huge amount of electricity and resources. You just should buy a certain number of tokens.

The main disadvantage may be described as “nothing at stake“. Investments take place when energy is spent. But in the case with PoS, nothing is at stake.

Also, it is a problem that more and more tokens are accumulated by the largest token owners. Therefore, the centralization risk is high. It is necessary to develop an algorithm for evenly selecting consensus participants. But such an algorithm would be very complex.

After Proof of Work and Proof of Stake had been implemented in various cryptocurrencies, Delegated Proof of Stake (DPoS) was presented. In a traditional PoS, anyone can act as a stake node. However, DPoS has elected delegates. In any context, delegates are chosen by their colleagues to perform a particular role. In a DPoS environment, only elected nodes are allowed to choose blocks and contribute to consensus.

The main advantage is that this algorithm encourages users to behave honestly – simply because this benefits them.

Another great advantage is that DPoS provides increased scalability. If the set of node delegates is known, many parameters can be optimized. The consensus then would be achieved quickly.

Increased centralization is a downside.

The rationale for choosing DPoS for Opporty Plasma Cash

Despite the above-mentioned drawbacks, DPoS is a perfect solution for Plasma Cash implementation! A child chain is needed to increase throughput. Full decentralization is not necessary for a child chain.

Ideally, Plasma Cash can work as one massive operator. But the larger number of delegates increases the reliability of the network at times. They can be controlled by various organizations.

That is, DPoS answers the question of who will participate in the consensus.

For this, new transactions are introduced in the Plasma chain: to vote / to remove the vote for a delegate. This gives the opportunity to nominate candidates for delegate roles. Further, at the consensus stage, all delegates would be sorted according to the number of votes and a stake.

It should be understood that all stages are divided into equal parts depending on the block submission time. At each stage, the order of delegates in a list changes in a pseudo-random manner.

At each moment, there can be only one delegate known to everyone.

If the delegate behaves inappropriately, they can simply be excluded from the list.

Block verification and confirmation algorithm pBFT

The DPoS algorithm only determines who and when can send a block to a root chain. It is also necessary to know whether it is possible to do it and reach a consensus between all validators before the block enters a root chain.

The pBFT (practical Byzantine Fault Tolerance) algorithm is used for this.

The pBFT model mainly focuses on providing an ultimate practical Byzantine replication machine that permits Byzantine faults (malicious nodes). It is assumed that there are independent node failures and manipulated messages distributed by specific, independent nodes. The algorithm is designed to work in asynchronous systems. It is optimized for ensuring high performance, impressive execution time, and a slight increase in delay.

In fact, all nodes in the pBFT model are sequentially ordered. One of them is the main node (a leader), while others are called backup nodes. All nodes in the system interact with each other. The goal of all honest nodes is to agree on the system’s state based on the opinion of the majority. It is important not only to prove that messages came from a specific peer-to-peer nod but also to make sure that the message was not changed during transmission.

In order for the pBFT model to work correctly, the instantaneous number of malicious nodes should not be equal to or exceed 1/3 of all network nodes in a relevant vulnerability window. The more nodes the system has, the less mathematically likely it is that 1/3 of all nodes are malicious. The algorithm effectively provides both viability and security if no more than n-1/3 nodes (n is the total number of nodes) are malicious or faulty simultaneously.

As a result, sequential consistency is achieved —  2f+1 correct responses are obtained. Therefore, all nodes are in a correct consistency – consensus.

pBFT rounds

Each round (representation) of pBFT consensus consists of 4 stages:

  • A client sends a request to a host in order to start a service operation.
  • A leader node sends a request to backup nodes.
  • Nodes make a request and then send a response to a client.
  • The client expects from f+1 (f is the maximum number of nodes that may be faulty) responses from different nodes with the same result. This result is the operation result.

In this way, a consensus can be obtained at the level of a specific block in Plasma. This consensus is very fast and the most suitable for use in a child chain.

In Opporty Plasma, a consensus is even more optimized because non-standard block signing methods are used. A non-interactive version of BLS threshold signatures is applied to sign blocks.

Results/Achievements

Opporty has introduced a new DPoS consensus. It ensures maximum security and an adequate centralization level.

A child chain is a complete trivial blockchain implementation:

  • Chain with blocks;
  • Distributed database;
  • Consensus algorithm for negotiation;
  • Compressed Patricia Trie for state saving.

Two blockchains work in complete synchronization and complement each other.

Ethereum ensures maximum stability. Opporty’s PoE reaches the speed of up to 25,000 transactions per second, outruns the key international payment systems, maintains a sufficient level of reliability, efficiency, as well as stability and low transaction cost.

Look for more interesting
articles

Recent publications


Ultimate Guide to Top Search Engines 2021

Among a vast array of search engines, Google remains the indisputable world leader in web search. Because the majority of people and organizations use Google as their primary desktop and mobile search engine, ranking high on Google is a number one goal for most businesses and private firms.

Tags: Seo

App Stack: What Is App Stack for Android

The birth of a great web app relies on a carefully orchestrated combination of factors that unfold as your project progresses. The Agile approach provides us with great insight into the minds of our clients, and defines our technological solutions for every specific project.

Tags: Development

9 Best NodeJS Frameworks for Backend Development in 2020

Node.js is a progressive backend development technology that was first released in 2009. It continues to grow in popularity among software developers for creating both the frontend and backend of apps, using a single programming language, JavaScript. Its straightforwardness and ease of use make it a good choice for beginners who want to launch full-fledged apps without having to learn multiple complex technologies. It saves time for programmers, who can create code that other engineers will easily understand.

Tags: Development

When and Why to Use Node.js for Backend Development

Node.js is a technology built on Chrome's V8 JavaScript engine that was first released in 2009 and continues to grow in popularity. nt, read our Node JS vs Django comparison analysis. Walmart, LinkedIn, Uber, NASA and some other giant entities have used this open-source, straightforward and easy-to-customize environment for their web applications. 

Tags: Development

Everything You Need to Know About rel=”noopener noreferrer” Tags: Purpose, Benefits and SEO Impact

WordPress included the rel="noopener noreferrer” clause in the list of its default features starting from version 4.7.4. As with every update, the new tags made SEOs concerned that they would threaten their projects’ positions in search rankings. Many feared the update would be a variation of the nofollow clause, preventing search robots from transitioning to linked pages when crawling websites. 

Tags: Seo

WebDesignRankings Lists Clever Solution Among the Best SEO Companies

WebDesignRankings is an analytic platform that conducts ongoing research in the global market for online marketing services. It provides its readers with the latest evidence-based ratings, helping consumers choose the most reliable, authoritative and cost-effective partners for web promotion. 

Tags: Seo

Request a free quote

    Type of Project *
    Budget Range *
    Have you ever performed seo before? *
    Do you already have Google AdWords account? *
    Do you agree to give access to the Google Adwords account in viewing mode? *
    Do you already have Amazon account? *
    Do you agree to give access to the seller account in viewing mode?
    Is your brand registered?
    Budget Range *

    Contact Us