Consensus Algorithm in Blockchain

Abstract

The adoption of Internet of Things (IoT) technology across many applications, such as autonomous systems, communication, and healthcare, is driving the market’s growth at a positive rate. The emergence of advanced data analytics techniques such as blockchain for connected IoT devices has the potential to reduce the cost and increase in cloud platform adoption. Blockchain is a key technology for real-time IoT applications providing trust in distributed robotic systems running on embedded hardware without the need for certification authorities. There are many challenges in blockchain IoT applications such as the power consumption and the execution time. These specific constraints have to be carefully considered besides other constraints such as number of nodes and data security. In this paper, a novel approach is discussed based on hybrid HW/SW architecture and designed for Proof of Work (PoW) consensus which is the most used consensus mechanism in blockchain. The proposed architecture is validated using the Ethereum blockchain with the Keccak 256 and the field-programmable gate array (FPGA) ZedBoard development kit. This implementation shows improvement in execution time of 338% and minimizing power consumption of 255% compared to the use of Nvidia Maxwell GPUs.

1. Introduction

The global IoT market is expected to reach a value of USD 1,386.06 billion by 2026 from USD 761.4 billion in 2020 at a CAGR of 10.53%, during the period 2021–2026 .

The IoT technology is connecting various devices such as mobile phones, sensors, and household appliances together for collecting and sharing data for the next industrial revolution of intelligent connectivity. The fourth industrial revolution (Industry 4.0) interconnects smart digital technology with real worlds to create smart manufacturing and supply chain management . In the current context, the emergence of Industry 4.0 and the adoption of IoT devices require manufacturers to implement innovative ways to advance production with intelligent connectivity that uses more robotics and avoids industrial accidents and machines’ downtime failure. Therefore, industries, hospitals, supply chains, governments, banks, and logistics need to be connected using Distributed Ledger Technologies (DLT) such as blockchain technology to react quickly for a more connected world. This will enable more secured process dealing with big data analysis generated by IoT devices.

Blockchain is mainly dealing with data storage and management and a distribution technology that is transparent and secure and operates regardless of a central control body.

Unlike traditional methods, blockchain allows peer-to-peer transfer of digital assets without the need for an intermediary. This technology was inspired by Bitcoin cryptography and then has emerged, evolved, and spread in several applications including finance , health , administration , industry , agriculture , and smart cities . It affects also other sectors such as the transfer of goods (supply chain), digital media transfer (sale of works of art), remote service delivery (travel and tourism), distributed intelligence (graduation), electricity generation and distribution, startup fundraising, electronic voting, identity management, crowdfunding (increasing startup funds), and crowd-operation (remote voting).

The first blockchain success notified with Bitcoin, was followed by other blockchains such as Ethereum, Hyperledger Fabric, Azur, Grid+, IOTA, and Tezos.

Representing the new generation of blockchain, Ethereum can play a major role of a public blockchain like Bitcoin, or a private blockchain such as Hyperledger Fabric. It is also the basis of other blockchains which are specific frameworks for applications, such as the Azur. For example, the blockchain proposed by Microsoft, which was optimized to take advantage of the characteristics of the cloud. Another example is the Grid + blockchain which is used in energy management applications.

To preserve the security of the blockchain, a specific algorithm, known as consensus, is used. It allows a new block to be added to the blockchain without compromising the integrity of data stored in the distributed ledger.

Moreover, some blockchains are defined with intelligent contracts and software platforms to play the role of links in the blockchain. However, all these blockchains are using consensus to preserve their security. In this context, several types of consensus are proposed in the literature such as the Proof of Work (PoW), the Proof of Stake (PoS), the Proof of Authority (PoA), the PBFT, and the Ripple and the Raft . These consensus algorithms have different complexity levels. One of the most complex and energy-intensive consensuses is PoW which was used in several blockchains such as Bitcoin, Ethereum, and IoTA. As an example, the mining process time is approximately 10 minutes for Bitcoin  and 15 seconds for Ethereum using Nvidia RTX 3080 GPU. Regardless of the number of miners, it still takes about 10 minutes to mine one Bitcoin. At 600 seconds (10 minutes), all else being equal it will take 72,000 GW (or 72 terawatts) of power to mine a Bitcoin using the average power usage provided by ASIC miners.

The use of blockchain, particularly the mining part, requires significant computing resources. In this paper, a feasibility study of implementing the blockchain on an embedded system and particularly on field-programmable gate array FPGA is presented taking into consideration all the resource requirements to validate this approach.

An embedded architecture is proposed to implement the PoW consensus, especially on FPGA-based architecture. This optimized architecture should accelerate the classical PoW process and consequently minimize the energy consumption. This proposed architecture is chosen according to a comparison between different software (SW), hardware (HW), and mixed architectures.

More precisely, the contribution of this paper is as follows.

The main contribution of this paper consists of two parts. First, an embedded architecture is proposed to implement the PoW consensus algorithm on FPGA. This part is called the off-chain system block. And, the second part is dedicated to the design of an off-chain/on-chain system. The PoW implementation and particularly the hash algorithm were off-chain (on FPGA). The node smart contract, transactions, and blocks where on-chain (they are implemented on the Raspberry Pi 3 platform).

The remainder of this paper is as follows. In Section 2, we describe the basic notions of the blockchain, particularly its different consensus followed by a study on embedded technologies and mixed HW/SW architectures. In Section 3, a description of the PoW used in the blockchain Ethereum will be dissected. The profiling of this function will allow to describe the embedded architecture to be chosen. Section 4 is reserved for the choice of the architecture and the different parts of our system containing the consensus implementation. The last part will be reserved for the results obtained and the comparison between SW on GPU and HW-implemented architecture from execution time and energy consumption point of view. Finally, in Section 5, we conclude and give potential perspectives.

2. Background

2.1. Blockchain Overview

In this section, we give an overview of the blockchain technology and its different classes and main components.

2.2. Security-Based Blockchain Classification

From the security point of view, blockchain can be classified as public, consortium, and private.

2.3. Public Blockchain

The blockchain is said to be public because it is open to everyone. Thus, it is assimilated to a marketplace, where anyone can open a store to offer any products and services. In this case, there are no restrictions on the comings and goings of visitors who are free to visit the different stores to make purchases.

Consequently, a public blockchain has several characteristics, such as a decentralized network which is open to all actors without any restriction, data can be consulted by all without any restriction, and data can be consulted by all without any restriction, but it is indelible, forgery-proof and cannot be modified afterwards. In this class of blockchain, the use of the PoW consensus makes the blockchain’s transactions impossible to falsify and very easy to manipulate.

There are many examples of public blockchains: Bitcoin, Ethereum, Ripple, Litecoin, and Dash.

2.4. Consortium Blockchain

It consists of a permitted blockchain which is partially decentralized and differs from public blockchains because its network is only accessible to a limited number of users.

New members must be validated by the nodes and already existing members in the consortium, and the accessibility of the data depends on the access rights granted to each node. It can be compared to a corporate marketplace (here, the “consortium”) for which only consortium members would be allowed to open a store to offer products and services. However, the consortium may grant some exemptions to open additional stores. The comings and goings in this marketplace are normally restricted by the rules defined by the consortium.

It should be noted that the vast majority of existing consortium blockchains operate under the Proof of Authority (PoA) system. As examples of public blockchains, we can cite Ripple , Funds DLT, etc.

2.5. Private Blockchain

In contrast to public blockchains, private blockchains (of which permitted blockchains are a special case) are like distributed databases.

Their characteristics are as follows:(i)The network is accessible to a limited number of users. New entrants must be validated by a central decision-making body.(ii)The accessibility of the data depends on the access rights of each node. This is defined by the central decision-making body.(iii)On a private blockchain, the consensus is based on the trust placed in all the validator nodes.

A private blockchain can be compared to a marketplace where all members authorized to launch a store, or to sell products and services, are only members of this same structure.

As a result, the cases of use are very frequent. As for distributed databases, they are useful for sharing confidential or important data within an organization or within the different entities of a group.

There are many examples of private blockchains. We can cite Hyperledger Fabric, Grid+, Azur, Ethereum (both private and public blockchains), etc.

2.6. Consensus Algorithms

It consists of the transition from centralized systems where the administrator or the central system can validate or invalidate transactions such as the banking system and database management systems.

In this kind of systems, the administrator is the valid or invalid manager. In decentralized systems such as blockchains, the absence of an administrator requires another protocol for verification and validation. The intermediary functions are moved to the periphery participating pair in the infrastructure of the chain. Since the peers do not necessarily know each other, it is a decentralized system.

The consensus algorithm consists of firstly setting up a process to validate, verify, and confirm transactions, then recording the transactions in a large distributed directory, creating a block record (a chain of blocks), and finally implementing a consensus protocol.

Thus, validation, verification, consensus, and immutable recording lead to trust and security of the blockchain.

Several types of consensus are used in the blockchain including PoW, PoS, PoA, PBFT, Ripple , and DAC. In this paper, we will describe only the PoW algorithm that will be implemented in HW (FPGA platform). In the next part, we will describe the state-of-the-art of embedded systems.

3. Overview of Embedded Architectures’ Solutions

The evolution of electronics and microelectronics has made it possible to minimize the size of transistors to increase the number of electronic components integrated on the same chip. The main component is the microprocessor. Microprocessors consist of one or more central processing units (CPUs), as well as other modules required for their operation such as memory controllers, cache memory, and I/O controllers.

However, in some systems, the integrated circuit contains not only the microprocessor but also other components such as microcontrollers and GPUs. Such a system is called System on Chip (SoC). These SoCs are based on the minimization of space and power consumption, while preserving the necessary performance for the constraints of the appropriate applications.

For example, a typical modern SoC contains the CPU, the GPU, the communication modules (Wi-Fi, Bluetooth, etc.), a module for localization, as well as other subsystems and coprocessors providing various functions such as device security.

These SoCs are used in applied computer systems generally called embedded systems. Although there is no formal definition of the latter, they are generally information systems designed for well-defined tasks and are integrated in other products.

The use of embedded systems has also touched the blockchain technology. Thus, e-health, agriculture, light and heavy industry, e-learning, and augmented reality applications are often based on SoCs to set up systems that meet their different needs.

Thus, we find different architectures that are in adequacy with the different needs. We can find single processor systems whose performance is enhanced by HW accelerators (IPs) , or massively parallel architectures that take advantage of the large number of processors operating in perfect parallelism.

If the use of embedded systems has touched several domains, its use in the blockchain domain has remained rather limited, especially for FPGAs’ technology. In fact, despite its various internal resources such as embedded high-speed memory, parallel computing blocks, and flexible architecture, which are suitable for computationally complex applications, it is still limited to the use of the PoW consensus.

Such idea is rarely discussed in the literature. We mention particularly in the work presented in, where the authors presented the possibility of implementing an embedded robotics application managed by blockchain.

In the work by Chaari, an embedded system based on a Raspberry Pi 3 platform was used. One of the problems encountered in this work is essentially that the Raspberry is unable to run all the PoW consensus software functions due to its limited capabilities.

In this paper, the main target is to propose an embedded architecture suitable for blockchain applications and able to support the implementation of the PoW consensus. Hence, we will show the feasibility as well as the gain realized by using such architecture adopted at Ethereum PoW on FPGAs.

3.1. Ethereum Blockchain Components

In this section, we are interested in blockchain components, especially Ethereum blockchain and its different components.

The blockchain is based on specific terminology representing important concepts. Among the frameworks of the blockchain, there are the following.

3.1.1. Transactions

These are the exchanges of data between different users. Each transaction is signed by the sender’s private key. Thanks to this signature, the security of the transactions is guaranteed. Therefore, any modification of these transactions during transmission can be avoided.

3.1.2. Blocks

A block is a record in the blockchain which contains the confirmed transactions. Thus, each open transaction will be added to a block. After a period, for a new block containing transactions to be added to the blockchain, it must be validated by a selected person called a minor. This validation operation is called mining.

3.1.3. The Block Chains

Each block in the blockchain is linked to the previous block. This link is done by inserting the hash specific to the previous block. Therefore, the hash of each block includes not only its own hash but also the hash of the previous block. Figure 1 illustrates what has been described. This way we can protect the blockchain from any form of corruption.