Peer-to-peer networks consist of many nodes, or computers, that communicate with each other to enable network functions. Many technologies rely on peer-to-peer networks, including blockchain. One of the most difficult problems in peer-to-peer networks is consensus, or the agreement between all nodes on the current state of the network. In blockchain, this is imperative. Each node in the network may receive or report different values for a particular event, so the network as a whole may not be in agreement. This becomes especially important, for example, when ordering transactions in the network. Consider the following 2 transactions logged by nodes A, B, and C:

Due to potential problems such as unfaithful nodes or network issues, not all nodes are in consensus! In the example above, node B believes that transaction 2 happened before transaction 1, while nodes A and C believe that it is the other way around. As you can imagine, this becomes devastating when the blockchain stores a distributed ledger of transactions.

Current State of Consensus Algorithms

So how do we solve this? Current blockchain networks use many different algorithms to reach consensus. The most common algorithm is proof of work, but many others have been developed. Unfortunately, these current blockchain consensus algorithms are not scalable, secure, and efficient.

Proof of work is inefficient due to the high computational overhead required to solve the cryptographic block creation problem. Currently, Digiconomist reports that Bitcoin miners use about the same amount of electricity as the entire country of Chile. Proof of stake lacks security, being at risk of the possibility of a “nothing-at-stake” attack, where stakers have an incentive to stake both sides of a fork. EOS’ delegated proof of stake (DPoS) also lacks security and introduces centralization into the consensus process by utilizing only a small number of decision-making delegates. Lastly, practical byzantine fault tolerance (PBFT), which many consensus algorithms are based off of, lacks scalability given the high network overhead required as the network grows.

Neural Consensus & EDA

The three issues of scalability, security, and efficiency are current limitations to all decentralized blockchain networks and technology. Seele has analyzed the advantages and disadvantages of current consensus algorithms, and proposes the Neural Consensus Algorithm and ε-differential agreements (EDA) to address these issues.

The Neural Consensus Algorithm distributedly uses ε-differential agreements, a mathematical process that converges the entire network of nodes upon a single consistent value. This value could be a specific transaction order, block height, or any other value that a decentralized network would need to agree upon. In this article we’ll use transaction order as our example.

Neural Consensus can run asynchronously and its performance scales linearly with the number of nodes in a network. It can handle 40+% failed nodes in the network and is optimizable for different use cases. We envision that it can help solve the problems of scalability, security, and efficiency that exist in current consensus algorithms and help lay the groundwork for the new era of the Internet of Value.

How It Works

The goal of EDA is to make sure that every node in the network comes to consensus upon a certain value. Let’s break down EDA into a series of steps. Before EDA begins, some parameters can be adjusted for optimal efficiency in different use cases:

s: the percentage of nodes that are sampled by every node during each round.

ε: the target convergence interval for the network’s values. When all nodes’ values are within the ε-differential, the network is considered to be in consensus.

r: the number of rounds of voting the system conducts.

Once these are set, we are ready to begin!

A demo Jupyter Notebook for the procedure below hosted on mybinder can be found here.

I. Distribution of transactions within the network: When a user makes a transaction, the transaction is distributed throughout the network to all nodes. Each node generates a disordered pool of unconfirmed transactions that are to be included in the blockchain. This state can be modeled by the graph below, representing a network of 1,000 nodes:

Here, each x-value represents a different node. The colored dots above each x-value represent different transactions, and the times recorded by each node for each different transaction are represented on the y-axis. Right now, this network is a mess! Many of the nodes have differing transaction orders

II. Sampling of nodes: Each node reaches out to a random s% of the other nodes in the network to poll and record their values. Each node then uses a statistical function to create an aggregated value from its sample. For example, it might calculate a “median transaction time” from the transaction times of the 5 other nodes it sampled. The node then adopts this statistic as its own value.

III. Convergence: Multiple rounds of sampling occur. As the sampling is random, each node samples a different selection of nodes in each round. Since each node adopts the value it calculated from the sample it took in the previous round, over multiple (at most 6 or 7) rounds, all nodes converge to the same value. The network is considered to be in consensus when the difference between all nodes’ values is less than the preset ε.

The below example visualizes multiple rounds of sampling leading to a converged order:

We can see the ε values growing lower over time:

Some Technical Details:

Determining if the network is in consensus: since nodes do not know whether the entire network is in consensus (i.e. within the ε-differential), they are only able to guess with a certain confidence percentage based on their random sample that the network is in consensus. If a node’s sample is very similar with small deviation, then there is a higher likelihood that all nodes have converged. Divergence: in the unlikely scenario (perhaps due to an odd parameter or unusual aggregation method) that the network does not converge upon a single value, the side that has the highest confidence percentage is selected. Different methods for completion: consensus can be reached through different ways, for example after a set number of rounds or when all nodes are at least some percent confident that the system is within the ε-differential Faulty nodes: for simplicity, the above demonstration has not included faulty nodes. However, EDA has been tested to be fault tolerant in networks with greater than 40% faulty or malicious nodes. Parallel sorting: in the example above, each node sorted 10 transactions in parallel for every round. This number may change between rounds or with different parameter configurations. Normally, at the start of the network, less values are sorted in parallel and are gradually added as the system stabilizes.

Conclusion and Further Reading

Neural Consensus is a scalable, secure, and efficient algorithm that allows a distributed network to reach consensus. It will help solve the many issues that are present in current consensus algorithms. Seele uses Neural Consensus and EDA on its meta-chain, allowing for quick consensus throughout its entire Heterogeneous Forest Network.

Interested in trying the algorithm out? Play around with the demo Jupyter Notebook hosted on mybinder. You can also read more about the Neural consensus algorithm in Seele’s white paper. A technical yellow paper regarding Neural Consensus and EDA will be released soon.