Skip to content

HPB Consensus Algorithm Compare

BlockGeek edited this page Apr 24, 2019 · 5 revisions

1 General introduction

HPB is a high-performance blockchain infrastructure based on specific hardware devices. It runs on a distributed network — each node is connected through a P2P neighbor node, and each type of node maintains its respective block independently. HPB consensus algorithm is the core of the system, which is responsible for coordinating various nodes to ensure data consistency in transactions and smart contracts in the whole system.

HPB algorithm is a POA promotion algorithm based on trusted voting. Proof of Authority [1] is a type of consensus algorithm running on trusted blockchain nodes, and its light message exchange mechanism makes its more efficient in consensus than other consensus algorithms. POA was originally proposed by the Ethereum [2] team. Each node in POA is called as Authority and each node has an unique ID. We assume that most (N/2 + 1) nodes are honest. The transaction sequence of each Authority guarantees transaction order. POA adopts the pattern of “mining” in turn. Each Authority generates its own block and broadcasts immediately after “mining”. In order to avoid the instantaneous network traffic jam caused by concurrent broadcast, each block has different priority to each Authority. The authority with higher priority can generate blocks first and broadcast immediately. The priority is based on a certain operation relationship and alternates in different Authorities.

The traditional POA mode runs on trusted nodes, meaning each nodes trust each other. However, in the actual operating environment, the network environment is so intricate that it cannot guarantee the trusted relationship between nodes. At the same time, the relationship between traditional POA nodes cannot be managed automatically, and there is no effetive way to manage the system network. HPB algorithm, combining traditional POA solutions, hardware acceleration and smart contract-based elections, improves POA performance while addressing its own security and system autonomy issues. The HPB consensus algorithm, based on POA general principle, optimizes and enhances network, storage and processing efficiency. Specifically, HPB adopts the combination of hardware verification, hardware TCP/IP protocol stack and hardware LevelDB [3] to optimize algorithm efficiency. At the same time, HPB resorts to hardware pseudo-random to ensure the unpredictability of "mining".

1.1 Role description

HPB consensus algorithm divides the blockchain system into four different types of roles, clients, synchronization nodes, candidate nodes and high-performance nodes. As is shown in the following Figure 1, all candidate nodes are directly connected with high-performance nodes to reduce the discovery time of neighbor in P2P network. The synchronization nodes are connected with several candidate nodes or high-performance nodes, and the clients are directly connected with synchronization nodes. Synchronization nodes do not participate in the maintenance of blockchain system. We describe the main function of each role as follows: 1548746934831

​ Figure 1: Description of system role

  • Clients: responsible for the formation, check, and other business processing of transactions. The client is the medium for direct communication between the users. The client here represents the exchange, Dapp [4] program, wallet, etc.

  • Synchronization nodes: mainly responsible for real-time synchronization of data in the main network for interactive use by clients.

  • Candidate nodes: are selected by community voting. Candidate nodes and high-performance nodes are periodically replaced based on real-time performance (such as bandwidth, currency, number of votes). Candidate node does not generate blocks and are mainly responsible for assisting high-performance nodes to promote blocks and transactions.

  • High-performance nodes: mainly solidify transactions into blocks. High-performance nodes conduct mining rotations in the cycle according to the hardware random numbers.

1.2 Workflow

The overall process of the HPB algorithm works is shown in Figure 1. The community elects the optimal candidate nodes through smart contract. Candidate nodes elect high-performance nodes group in the next round based on block historical indicators (bandwidth, currency, day voting results, etc.). High-performance nodes group is responsible for generating blocks and winning system rewards. 1548747436648

Figure 2 Overall design plan of HPB algorithm

1.3 Election

The election of candidate nodes is automatically completed by smart contracts, whose codes are transparent and auditable. The system releases a new contract every three months. The community staff select candidate nodes for the current three months according to the new contract. At the same time, the smart contract supports continuous voting on the current candidate nodes. The system finally calculates the revenue of the day based on the election result.

The election of high-performance nodes is accomplished by the automatic elections of historical data in the blocks. The election indicators include: the number of voting Pv in the real time, the amount of currency held Pb in the real time, and the bandwidth factor Pn. The number of vote is directly obtained by calling smart contracts, the number of coins held by candidate nodes is directly obtained by checking local databases, and the bandwidth data is obtained by the statistics of block data (in specific, the system automatically backtracks blocks to obtain the average bandwidth of nearest 2000 zones carried in the blocks).

Weighted formula

Ri = Vi * Pv + bi * Pb + ni * Pn

Through the calculation of the above formula, the high-performance node list is finally selected. The random number sequence of the hardware determines the block-out priority order of the high-performance list, and the randomness guarantees the unpredictability of the priority of the high-performance nodes. The hardware random numbers of all high-performance nodes use the same random algorithm, and the initial values are the same, ensuring that the random values obtained by each round are consistent. At the same time, the frequency of calling random values is limited so that subsequent random values cannot be predicted.

1548747798036

​ Figure 3 Generating Process of HPB Hardcore Random Numbers

Summary: The continuously running smart contract guarantees the mobility of high-performance nodes, solves the problem of fixed nodes in the original POA algorithm, and the hardware random number solves the problem that the block priority is predicted.

1.4 Hardware acceleration

Innovative BOE module is proposed in HPB algorithm, which is divided into four sub-modules, TOE network interface, Pcie host interface, TSU task scheduling unit and FAP function acceleration unit. The system mainly achieves three functions. The first is to provide hardware identification. The ECC signature module in the chip signs the received information, and the signature can be used to verify whether the target system is equipped with BOE board. The second is to implement TCP/IP protocol by hardware so as to reduce the number of TCP connection data copies and channel delays and also reduce the usage of CPU and memory in the host. The third is to accelerate extremely time-consuming software processing functions. For security reasons, all transactions and blocks need to be signed and verified. Now the software can only verfiy signatures several thousands per second, far from performance requirement. As a result, multiple signature verification modules are designed in BOE boards to work concurrently and can verify up to 20,000 times per second. In addition, in the blockchain system, the more smart contracts and transactions are, the more frequently the database merges. The merging of software operation LevelDB [3] consumes a lot of CPU and memory resources and seriously affect the speed to access data. HPB uses hardware to accelerate the merging of LevelDB, greatly reducing CPU load and speeding up access. 1548747867411

​ Figure4 BOE function framwork

2 Algorithm Comparison

2.1 Introduction to consensus algorithm

The POW consensus mechanism was originally adopted by Bitcoin [5]. The computing power determines the billing rights, and the probability of obtaining the billing rights is determined by the percentage of computing power held. Nodes need to constantly compute and make hash calculations to find the desired random numbers. The verification node is called “miner” and the random number lookup process is called “mining”. “Mining” has three important functions: issue new currency, maintain the system payment function and ensure system security by computing power. POS is proof of stake mechanism, which is first proposed in the white paper of dot-coin [7]. The core idea is to select the number of money holders and the accumulation time of holding as the capital for consensus nodes. DPOS consensus mechanism is a consensus algorithm based on voting elections similar to representative democracy. On the basis of POS, DPOS first elects a number of agents, which are verified and booked by agents, and agents generate blocks in turn. Compared with POS, DPOS can greatly improve election efficiency and achieve performance improvement at the expense of some decentralization features. BFT algorithm was first proposed by Lamport, Shostak and Pease in 1982 [6]. But Lamport et al. only demonstrated the theoretical feasibility of the algorithm in synchronous environments (all messages always arrive in time). In effect, the purpose of BFT consensus algorithm is to build trust between nodes in an untrusted network (such as the World Wide Web) and maintain consistency and high availability of distributed systems. The POA runs in a set of trusted nodes. In POA, the validator is the key to the entire consensus mechanism. The verifier does not need an expensive graphics card or sufficient asset, only a known and authenticated identity is needed. The verifier obtains the right to secure network by placing this identity in exchange for block rewards.

2.2 System comparison

POW POS DPOS BFT POA HPB
Transaction speed slow medium fast medium fast Fast
Consistency Final consistency Final consistency Final consistency Immediate consistency Final consistency Final consistency
Hareware acceleration NO NO NO NO NO YES
Security high medium medium low low high
Node scale large medium small small medium support large
Centralization weak medium strong strong strong medium
Energy consumption High Low Low Low Low Low
Cases Bitcoin, Ethereum, Litecoin NXT, Tezos, soon Ethereum EOS, BitShares Hyperledger Kovan, Rinkeby, Giveth HPB

Analysis: With the comparison listed above , it can be concluded that HPB consensus algorithm has greatly improved in terms of performance, security, and decentralization. HPB consensus algorithm is based on POA algorithm. It improves the security risks and enhances TPS while maintaining POA advantages. In terms of performance, HPB adopts a hardware acceleration scheme, which exponentially increases the signature verfication speed in transaction and optimizes TCP/IP protocol stack. The separate processing mechanism increases the processing speed of transaction data and block data network. In terms of security, HPB adopts a hardware pseudo-random sequence to ensure the unpredictability of high-performance nodes. Finally, HPB adopts a transparent contract voting method to solve the role transition between different node types.

3 Reference

[1]. De Angelis, Stefano, Leonardo Aniello, Roberto Baldoni, Federico Lombardi, Andrea Margheri, and Vladimiro Sassone. "PBFT vs proof-of-authority: applying the CAP theorem to permissioned blockchain." (2018).

[2]. Wood, Gavin. "Ethereum: A secure decentralised generalised transaction ledger." Ethereum project yellow paper 151 (2014): 1-32.

[3]. Ghemawat, Sanjay, and Jeff Dean. "LevelDB." URL: https://github. com/google/leveldb,% 20http://leveldb. org(2011).

[4]. Raval, Siraj. Decentralized Applications: Harnessing Bitcoin's Blockchain Technology. " O'Reilly Media, Inc.", 2016.

[5]. Nakamoto, Satoshi. "Bitcoin: A peer-to-peer electronic cash system." (2008).

[6]. Lamport, Leslie, Robert Shostak, and Marshall Pease. "The Byzantine generals problem." ACM Transactions on Programming Languages and Systems (TOPLAS) 4, no. 3 (1982): 382-401.

[7]. King, Sunny, and Scott Nadal. "Ppcoin: Peer-to-peer crypto-currency with proof-of-stake." self-published paper, August 19 (2012).

Clone this wiki locally