Leaderless Byzantine Fault Tolerance
Total Page:16
File Type:pdf, Size:1020Kb
Leaderless Byzantine Fault Tolerance Tian Qin Electrical Engineering and Computer Sciences University of California at Berkeley Technical Report No. UCB/EECS-2020-121 http://www2.eecs.berkeley.edu/Pubs/TechRpts/2020/EECS-2020-121.html May 29, 2020 Copyright © 2020, by the author(s). All rights reserved. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission. Acknowledgement I would like to express my appreciation to Jian Liu and Peng Gao for their guidance, advice, and feedbacks during this research work. Leaderless Byzantine Fault Tolerance by Tian Qin Research Project Submitted to the Department of Electrical Engineering and Computer Sciences, University of California at Berkeley, in partial satisfaction of the requirements for the degree of Master of Science, Plan II. Approval for the Report and Comprehensive Examination: Committee: Professor Dawn Song Research Advisor (Date) * * * * * * * Professor Sylvia Ratnasamy Second Reader Leaderless Byzantine Fault Tolerance ABSTRACT transaction commitment is deterministic; it is built upon a gossip In this work, we propose Leaderless Byzantine Fault Tolerance protocol to relay messages and data across the whole network, prac- (LBFT), a novel consensus algorithm that combines Snowball algo- tical Byzantine Fault Tolerance algorithm to commit transactions rithm and Practical Byzantine Fault Tolerance (pBFT) algorithm, in a deterministic manner, and Snowball to realize decentralization two existing consensus algorithms. Achieving consensus in decen- of nodes (i.e. leaderless). tralized systems has been dicult as they lack certain properties In this paper, we identied the requirements of a leaderless con- that many algorithms assume. Our approach looks to take advan- sensus protocol, designed algorithmic architecture, built a gossip tage of the decentralized aspect of Snowball and the deterministic protocol, the Snowball protocol, the pBFT protocol, and the LBFT property of pBFT so that the weaknesses of Snowball’s probabilis- protocol, integrated optimization techniques such as transaction tic property and pBFT’s reliance on "leader" are eliminated. The pipeline to mitigate loss in performance of LBFT compared to pBFT, algorithm we propose is applicable to decentralized systems such and tested, evaluated, and cross-compared each of the four proto- as blockchain systems even though Snowball and pBFT both make cols. stronger assumptions than decentralized systems allow. By simu- Thus, this paper makes the following contributions: lating real-world environments and comparing with pBFT perfor- Design and Analysis of LBFT, which assumes asynchro- • mances, we show that LBFT is feasible in the context of real-world nous network decentralized systems and has sucient performances that are close System implementation and testing of LBFT • to those of pBFT. 2 BACKGROUND Machines in a distributed system have shared states. Consensus is 1 INTRODUCTION unanimous agreement on state values across a network. A consen- A distributed system is simply a group of computers working to- sus algorithm is a procedure that achieves such states in a network. gether. Distributing a system brings many advantages such as hori- In other words, consensus algorithms coordinate network nodes in zontal scalability, fault tolerance, low latency, etc. A core feature of a distributed setting. The ability to achieve consensus is at the core a distributed system is that it should appear as a single computer of every distributed system. during all interactions with users. The scalability, parallelism, and To create formal proofs of consensus algorithms, distributed communications among dierent machines in a distributed sys- systems are generally assumed to be synchronous, partially syn- tem shall be abstracted away. The power of distributed systems chronous, or asynchronous. These three timing models each have comes with a downside: achieving consensus is dicult due to dierent properties regarding latency of message transmissions faults, malicious actors, and many other factors and without agree- among network nodes. In a synchronous model, which has the ment/coordination among individual nodes, a distributed system strongest assumptions, message transmissions delays have a known fails. upper bound, message transmissions follow FIFO (rst in, rst out) Practical Byzantine Fault Tolerance [4] is one consensus algo- rule, and local clocks of all nodes in the network are synchronized; rithm that carries out a three-phase procedure: pre-prepare, prepare, in a partially synchronous model, there exists an upper bound on and commit. pBFT is robust for distributed systems with the weak- transmission delay but it’s unknown; in an asynchronous model, est assumptions: asynchronous networks, a type of networks where nodes’ clocks are not synchronized and message transmissions can consensus is very dicult due to a complete lack of understanding be delayed for an arbitrary amount of time and there’s no order of timing of message transmissions. in message arrival. In The choice of timing model assumption is Snowball [1] is a consensus algorithm that takes majority votes important to correctness and liveness of consensus algorithms as from random subsets of the network to achieve network-wide agree- a distributed system’s timing model determines whether a node ment in a probabilistic way. It is robust in partially synchronous can dierentiate between a peer that has failed and one that is networks. just taking time to respond. Assumption of a more friendly timing Both pBFT and Snowball are robust in presence of Byzantine model makes designing consensus algorithms much easier. faults, which are conditions where there’s incomplete information The asynchronous model has the weakest assumptions and re- on whether a node has failed. However, each has its downsides. sembles real-world systems the most, where nodes fail and messages During each round of consensus execution, pBFT relies heavily on a get dropped all the time. Consequently, reaching consensus in a node being the "leader" and such a centralized concept renders the real-world distributed system is dicult in the presence of pro- algorithm vulnerable to numerous attacks. Unlike pBFT, Snowball cess failures and communication failures. These challenges are laid is decentralized, but its consensus is probabilistic and is not robust out in many theoretical scenarios such as The Byzantine Generals’ in asynchronous networks. Problem, which describes a situation where consensus is very di- We propose a new consensus algorithm that doesn’t rely on cult with presence of corrupt parties and false information. Many any notion of leaders and works in asynchronous environments distributed consensus algorithms have a notion of leaders, which - Leaderless Byzantine Fault Tolerance (LBFT). It is applicable to is a subset of all network nodes that make core decisions on how decentralized systems, in particular blockchains; it is leaderless and the system should move forward. One example practical Byzantine deterministic: there is no dierentiation among network nodes and Fault Tolerance (Castro and Liskov, 1999). It proposes a pre-prepare, 2 prepare, commit process Not to mention that such a notion of leader On the other hand, blockchain systems have shown potential renders the system more vulnerable, these consensus algorithms in revolutionizing many elds such as nance, supply chain, and are not applicable to decentralized systems such as blockchains, internet of things. However, current widely deployed consensus which are more robust than traditional distributed systems and thus algorithms have dierent drawbacks: ineciency, unfairness, etc. can uphold fewer assumptions that many consensus algorithms As consensus algorithms have been a bottleneck for adoption of rely on. blockchain systems, an ecient and secure consensus algorithm for Practical Byzantine Fault Tolerance [4] is a consensus algorithm blockchain systems has been a widely pursued area of research and that was introduced in the late 90s and its consensus procedure is our proposed algorithm also looks to contribute to it. By combining carried out in three phases: pre-prepare, prepare, and commit. Nodes pBFT and Snowball, we aim to arrive at an algorithm that’s robust move through a succession of congurations called views and in in decentralized systems. each view, one node is assigned as the primary. The pre-prepare and prepare phases guarantee that non-faulty nodes agree on a total 3 OVERVIEW order of requests within a view and the commit phase guarantees a total order of requests across views. In pre-prepare phase, the The protocol consists of two layers of implementation: primary assigns a sequence number to the request and multicasts a peer-to-peer (p2p) base layer the request, digest of the request, the sequence number, and the • a consensus layer on top of the p2p layer that implements view number to all other nodes, who then transition to prepare • a deterministic and leaderless consensus algorithm built phase if message and signature are correct and sequence number upon Snowball and practical Byzantine Fault Tolerance and view number are valid. In prepare phase, each node multicasts to every other