A Tutorial and Future Research for Building a Blockchain-Based Secure Communication Scheme for Internet of Intelligent Things

The Internet of Intelligent Things (IoIT) communication environment can be utilized in various types of applications (for example, intelligent battleﬁelds, smart healthcare systems, the industrial internet, home automation, and many more). Communications that happen in such environments can have different types of security and privacy issues, which can be resolved through the utilization of blockchain. In this paper, we propose a tutorial that aims in desiging a generalized blockchain-based secure authentication key management scheme for the IoIT environment. Moreover, some issues with using blockchain for a communication environment are discussed as future research directions. The details of different types of blockchain are also provided. Some of the widely-accepted consensus algorithms are then discussed. Next, we discuss different types of applications in blockchain-based IoIT communication environments. The details of the associated system models are provided, such as, the network and attack models for the blockchain-based IoIT communication environment, which are helpful in designing a security protocol for such an environment. A practical demonstration of the proposed generalized scheme is provided in order to measure the impact of the scheme on the performance of the essential parameters. Finally, some of the future research challenges in the blockchain-based IoIT communication environment are highlighted, which will also be helpful to the researchers.


I. INTRODUCTION
The Internet of Things (IoT) is a specific type of computing and communication environment that consists of different types of computing devices, electromechanical devices, people, or animals that have uniquely associated identities (for example, Internet Protocol addresses through which these devices and objects become capable of transferring data over a network without human involvement [1], [2]. On the The associate editor coordinating the review of this manuscript and approving it for publication was Nabil Benamar . basis of its applications and uses, Blockchain of Things (BCoT) has different types of applications as shown in Fig. 1. Some of the potential applicatons of IoT involve ''Internet of Medical Things (IoMT)''/''Internet of Healthcare Things (IoHT)'', ''Internet of Energy (IoE)'', ''Internet of Drones (IoD)'', ''Internet of Vehicles (IoV)'' and ''Industrial Internet of Things (IoIT)'' [3]- [11].
The IoT communication environment produces a huge amount of data. Hence, we need a powerful procedure to handle and process that data, and to make useful conclusions from this process. Such procedures can be effectively  [12].
conducted through the use of artificial intelligence (AI). The conjoining of AI and the IoT creates an intelligent computing and communication environment called the Internet of Intelligent Things (IoIT) [13]. However, the communications that use the IoIT are vulnerable to various types of attack, and need some strong protection mechanisms. Then, the question that arises is: Can we use blockchain to secure communications in the IoIT? And it is obvious that the answer is yes. Blockchain is also called a distributed ledger technology that creates a history for any type of digital asset (e.g., cryptocurrencies). That history is unalterable and transparent to the involved parties through the deployment of decentralization and cryptographic hashing mechanisms. A blockchain contains a time-stamped series of immutable records of data, commanded by a cluster of systems (i.e., cloud servers). There is no single authority that owns these clusters. The data stored and exchanged via blockchain are secured and bound together through cryptography, and there is no central authority. It is a kind of shared and immutable ledger, and therefore, the information in the blockchain is available only to the involved parties. Blockchain is a simple method of passing information from node A to node B in a safer and fully automatic way. A node (or party) can commence a transaction through block creation. Furthermore, the created block is verified by other nodes (i.e., the parties, or the miner nodes) distributed around the network. For this purpose, the nodes utilize a method called a consensus algorithm (i.e., a proof of work [PoW]). If all the other miner nodes commit to the addition of a block, then verification happens successfully; the block is added to the chain and reflected in the distributed ledger across the network. It is not just the creation of a unique record, but also the creation of a unique history. Tampering with a single record would require tampering with an entire blockchain that exists over millions of sites (nodes), which is virtually impossible. Bitcoin uses a blockchain scheme for financial transactions. However, it can also be used for other goals (i.e., secure data exchange among authenticated communicating parties [14]- [18]). The main advantage of using blockchain is to improve data security. Data security (both stored data and data in transit) is one of the essential requirements of all organizations around the globe. Such issues can be resolved through the deployment of a blockchain mechanism, which seems to be a strong mechanism for the security of cloud Internet of Things (IoT)based organizations.
• Overall protection: The blockchain methods ensure data encryption that resists a data-modification attack. The cryptographic signature corresponding to VOLUME 8, 2020 a document can be saved in the blockchain. This assures users that the file is not modified without demanding that the entire file be saved in the blockchain. Since blockchain is decentralized in nature, the file's signatures can be cross-verified by all the nodes in the network. If an adversary attempts to update a file, then signature verification will fail. The blockchain methods provide reliable and independent verification of data in an undeniable manner. The blockchain records are not stored in any central location; thus, blockchain does not have a single point of failure and cannot be compromised by a single system. The distributed and decentralized ledger of the blockchain network updates continuously in a synchronized manner. With traditional networks, hackers can get all the data from a single system (the repository, i.e., the server) and can try to compromise it, which is impossible in blockchain networks.
• Decentralized mechanisms: Blockchain does not depend on any central authority because it is decentralized in nature. Because of the use of the digital ledger, every node (site) maintains a complete copy of the data.
The system becomes more unbiased and secure because there is no central point of control. Blockchain uses different types of consensus mechanisms (e.g., PoW, practical byzantine fault tolerance) to validate the transactions. Therefore, it does not depend on any central authority for conducting secure transactions, and data are saved on multiple nodes. Therefore, it is highly secure, even if one or more systems fail. However, there are some issues with using blockchain for a communication environment, as follows.
• Effect on the communication environment: The blockchain-based IoIT environment relies on encryption techniques to provide security when establishing consensus over a distributed network. If a party wants to add something to the chain, that party has to prove he/she has permission to add a block to the chain. The procedure executes a complex algorithm, and in turn, demands excessive use of computing power. For instance, in the bitcoin network over the last year, it is said that the computing power needed for execution of networking tasks devoured the same amount of energy as was needed by 159 countries. Therefore, it is important to consider the energy requirement factor in the deployment of blockchain in an IoIT environment [20], [21].
• Cost factor: Apart from the above implementation cost is another challenge for the blockchain-based IoIT. Blockchain schemes are not that efficient in terms of execution of transactions and the related energy requirements. For example, the bitcoin scheme executes three to five transactions per second and consumes a lot of energy in that work. If we compare its performance with other platforms, such as Visa, it seems worse because Visa performs about 1,667 transactions per second. Therefore, to fulfil the requirements of a blockchainbased IoIT environment, we must accept the very high implementation costs. We cannot invest a large share of the budget of a country to secure some infrastructure of computing. Only a few countries have the budget to support such kinds of communication schemes. We need to invent efficient methods that can be deployed in the blockchain-based IoIT. Therefore, this is another issue for the people working in the same domain [20]- [23].
• Loads from blockchain technology: Blockchain is deployed with a distributed ledger and through cryptographic algorithms. Blockchain transactions require extra time and resources to process a transaction. The main objective of the blockchain-based IoIT environment is secure information exchange, which can be achieved through deployment of the blockchain mechanism. But transactions in a blockchain may require extra hours to finalize. Quick information exchange is a primary requirement in some domains (for example, battlefields, healthcare, and rescue operations). If the processing and exchange of information consumes extra time, then the intended recipient will not get the information within the required time. The concerned authority will not be able to make a decision within the desired reaction time. These issues can be sorted out by the use of lightweight cryptographic operations, because they need low computation, communications, and storage costs to process the transactions [24], [25].

A. BLOCKCHAIN AND VARIOUS CONSENSUS ALGORITHMS
In this section, we discuss overview of various blockchain technologies and consensus algorithms.

1) TYPES OF BLOCKCHAIN
In the following, we discuss different types of blockchain.
• Public blockchain: It is a non-restrictive, permissionless distributed ledger based system. Anybody having access to the Internet can register and sign in the blockchain platform. A user (called as a node), who is a part of public blockchain, is authorized to access the records, verify transactions or conduct mining for the incoming block. One of the main uses of public blockchains is to exchange cryptocurrencies (for example, bitcoin and litecoin blockchains). Most of time public blockchain is secure if the users follow security guidelines. However, sometimes it may be risky in case if the users do not follow the security guidelines. Some of the famous examples include bitcoin, Ethereum, and litecoin [26]- [29].
• Private blockchain: It is a restrictive or permission blockchain that works only for a closed network. Most of the time they are used within an organization or enterprises where we have only selected participants. Some of the important properties, such as security, authorizations and accessibility, are the control of a controlling organization. Therefore, private blockchains are like the public blockchains, but they have a small or restrictive network. Private blockchain can be deployed to perform some of the specific operation (for instance, voting, supply chain management and asset ownership). Some examples of private blockchains include multichain and hyperledger projects (i.e., fabric, and sawtooth) [26], [29]- [31].
• Consortium Blockchain: It is a semi-decentralized type in which more than one organization manages the network of blockchain. It is different than the private blockchain, which is managed by only a single organisation. In such type of blockchain, more than one organisation acts as the authority to do mining or exchanging the information. These blockchains are used in various sectors like banking or other government organizations.
• Hybrid Blockchain: It is a combination of the private and public blockchain platforms. The features of both blockchains are applied in this case (for example, users can have ''private permission-based system'' as well as ''public permission-less system''). In the hybrid platform, users can control who acquires access to which data stored in the blockchain. Only some of the selected records of the blockchain are permitted to go public and rest of them are made confidential in the private network. It is flexible system in which users can easily join a private blockchain with multiple public blockchains. The transaction in a private network of a hybrid blockchain is usually verified within that specific network. However, users can also release this in the public blockchain for the verification. The public blockchains do the increment in the hashing and also require more number of verifications. This further improves the security and transparency of the blockchain network. ''Dragonchain'' is an example of hybrid blockchain [26], [29], [34], [35].

2) CONSENSUS ALGORITHMS
A consensus algorithm plays an important role in the mining of the blocks for a blockchain. Consensus algorithms play a decision-making process for a group (i.e., miner nodes), in which each individual member of the group constructs and supports the decision which works best for the rest of them. It is a kind of a resolution which is supported by each individual to draw some conclusion. The consensus model can have following objectives [29], [36]- [39]: • Coming to an agreement: The consensus process gathers all the agreements from the group members.
• Collaboration: Every one in the group wishes a better agreement which results in the groups' interests as a whole.
• Co-operation: All group members work like a team and put their personal interests aside.
• Equal rights: Every single participant (miner) has same weightage in voting process which means every miner's vote is important.
• Participation: Every miner has to participate in the voting process. None of them should ignore the participation.
• Activity: Every miner has to be equally active. Thus, everybody has the responsibility in the group. Some of the important consensus algorithms are discussed below [29], [36], [40].
• Proof-of-Work (PoW): It is an original consensus algorithm of blockchain. It is used to confirm transactions and produce new blocks to the chain. According to the mechanism of PoW, miners compete among each other to complete the transactions and they also get rewards. Furthermore, it is the measurement of denial-of-service (DoS) attack and other service abuses which include spam on a network by involving the service requester in the process. The major drawback of PoW is that it consumes lot of computational power. It executes through solving of computationally intensive puzzles for the validation of transactions and creation of new blocks. ''Bitcoin'' and ''ethereum'' cryptocurrency platforms use PoW consensus algorithms for their mining work.
• Proof-of-Stake (PoS): The concept of PoS states that a person can mine or validate block transactions according to the coins he/she holds. This means that the more cryptocurrency coins (i.e., bitcoin) owned by a miner, the more mining power he/she has. PoS was invented to overcome the problems with PoW and aimed for distributed consensus. The cryptocurrency platforms such as ''PIVX'' and ''NavCoin'' apply PoS for their mining works.
• Delegated Proof-of-Stake (DPoS): It is an another form of PoS algorithm in which the miners (validators) are known as delegates. The determination of block production helps to perform the transaction within a second. DPoS algorithm was designed to assure all levels of protection against the regulatory issues. Cryptocurrency platform such as ''lisk'' uses DPoS consensus algorithm for its mining work.
• Leased Proof-of-Stake (LPoS): It is another improved version of PoS consensus algorithm. According to the mechanism of LPoS, the user is capable to lease waves from his/her wallet to various contractors, who can pay a percentage to him/her as a reward. If a node gets more leased amount, it has high chance for being chosen as the miner to produce the next block for the blockchain.
• Proof of Elapsed Time (PoET): This consensus algorithm uses some specific tactics to prevent the high resource utilization along with the high energy consumption. It carries permission blockchain network through a fair lottery system.
• Practical Byzantine Fault Tolerance (PBFT): It is one of the best consensus algorithm for the enterprise consortiums in which the members are partially trusted. The only drawback of PBFT is its exponentially increasing messages count with the addition of nodes (replicas) in the set. This algorithm protects against ''Byzantine VOLUME 8, 2020 faults'' and goes for the optimization aspects of ''Byzantine Fault Tolerance (BFT)''.
• Simplified Byzantine Fault Tolerance (SBFT): In this algorithm, a block first gathers all the transactions and then batch them into another block. Finally, it validates them together.
• Delegated Byzantine Fault Tolerance (DBFT): This consensus algorithm was introduced to overcome the Byzantine generals problem. It was developed by ''NEO team'' with perfect conclusion that all transactions are 100% final after obtaining the first confirmation.
• Directed Acyclic Graphs (DAG): It is not a consensus mechanism rather a form of data structure. A blockchain is chain of blocks contains data (in blocks). However, DAG is a graph which stores data topologically. DAG is convenient for handling of some particular issues, such as data processing, routing and compression.
• Proof-of-Activity (PoA): This mechanism mixes two commonly used consensus algorithms ''Proof of Work (PoW)'' and ''Proof of Stake (PoS)''. The mixing of these two algorithms provides a more secure solution which is secured against different types of attacks.
• Proof-of-Importance (PoI): This algorithm proves the utility of nodes in a network and allows them to create a block by a process named as ''New Economy Movement (NEM)''. It offers a constituent streamlined technique for maintaining a secure ledger of transactions as compared to other traditional methods.
• Proof-of-Capacity (PoC): This consensus algorithm allows the mining devices in the network to use their computational power and available hard drive space to decide the mining rights, instead of using the other mining device's computing power (as in PoW algorithm).
• Proof-of-Burn (PoB): It avows the miners to sent few coins to an ''eater address''. The miner, who burns the coins, receives a reward and can mine a new block. However, the coins which are sent to the ''eater address'' can not be reverted back.
• Proof-of-Weight (PoWeight): It is an upgraded version of PoS algorithm. In PoS, the more coins a node owns, the greater are his/her chances to mine a block that results in a bit biased system. However, PoWeight algorithm tries to solve such biased nature of PoS algorithm with the help of ''weighted factors''. Finally, various consensus algorithms used in blockchain and their characteristics are summarized in Table 1.

B. MOTIVATION
The IoIT environment can be used in a wide variety of applications, such as battlefield, smart healthcare, home automation, and many more. However, it suffers from different types of security and privacy related issues owing to various types of attacks, such as ''replay'', ''man-in-themiddle (MITM)'', ''impersonation'', ''credential information guessing'', ''session key leakage'', ''data disclosure'', and ''data modification''. Hence, we need secure protocols to protect such communication environment from passive and active adversaries. The blockchain mechanism has great potential, and it can be utilized for securing the communications that happen in an IoIT environment because it provides ''immutability'', ''transparency'' and ''decentralization''. In this tutorial work, we propose a generalized blockchainbased secure communication scheme, mainly from the authentication key management perspective point of view, for IoIT environments.

C. MAIN CONTRIBUTIONS
The contributions of this paper are listed below.
• The impact of blockchain on the existing communication environments is discussed.
• The details of different types of blockchain are provided. Some of the famous consensus algorithms are also discussed.
• We propose a blockchain-based, secure communication scheme for the Internet of Intelligent Things (IoIT).
• The different applications of blockchain-based IoIT communication environments are discussed.
• Network and attack models for blockchain-based IoIT communication environments are described, which are helpful in designing a security protocol for such communication environments.
• A practical demonstration of the proposed scheme is conducted in order to measure the impact of the proposed scheme on the performance of essential parameters.
• Finally, future research challenges in blockchain-based IoIT communication environments are highlighted, which will be helpful to future researchers.

D. ORGANISATION OF THE PAPER
The remainder of the paper is arranged as follows. The details of the system models required to design a blockchain-based secure communication scheme for the Internet of Intelligent Things are provided in Section II. The details of the proposed scheme are explained in Section III. The various applications of blockchain-based IoIT communication environments are in Section IV. Future research challenges of blockchainbased IoIT environments are discussed in Section V. Finally, the work is concluded in Section VI. For the better readability of the paper, a pictorial representation of the organisation of the paper is also provided in Fig. 2.

II. SYSTEM MODELS
The overall workings and requirements of a blockchain-based IoIT environment can be explained with the help of the following models.

A. NETWORK MODEL
The generic architecture of a blockchain-based Internet of Intelligent Things environment is provided in Fig. 3. The architecture consists of smart and intelligent devices, such as drones, robots, autonomous vehicles, wearable devices and weapons for soldiers, wearable and implantable medical devices for patients, and smart home appliances. These devices not only monitor their surroundings but are also able to make required decisions using their knowledge base. VOLUME 8, 2020 FIGURE 3. Generic architecture of the blockchain-based Internet of Intelligent Things environment (adapted from [1], [41], [42]).
For example, drones can monitor the activities of the enemy and can retaliate according to the situation. A recommendation system in healthcare can suggest the required medicine to the patient in the absence of a doctor. All these devices come under the category of end devices. However, we also have other devices, such as resource-rich edge servers, also called miner nodes because they do the task of blockchain mining. At the same time, we have cloud servers in which data not frequently required can be stored. This kind of communication environment is very helpful in facilitating the daily routines people. However, there are some securityand privacy-related problems from different types of attacks, such as replay, MITM, impersonation of entities, privileged insider, secret guessing, data disclosure, and data modification. Therefore, the blockchain mechanism can be utilized to make the communication environment more secure and robust against these possible attacks. For this purpose, edge nodes (servers) can be utilized. When a smart device has some data, that device can securely send these data to the edge server with the help of an established session key. The edge node also acts as a miner node, receives the data from the smart device, prepares a block from them, and publishes it to the other miner nodes. For block mining purposes, any method, like PoW, can be utilized. If the addition of the block is done by another miner node, that block can be added to the blockchain's distributed ledger, and it is accessible to all miner nodes. If a user is interested in accessing the data of a particular device, the request will go the corresponding miner node. The miner node has access to all blocks in the blockchain (i.e., the distributed ledger), and can then securely provide the data to an authorized user using an established session key. Therefore, the deployment of blockchain mechanism in the IoIT environment is highly recommended.

B. ATTACK MODEL
The widely accepted Dolev-Yao (DY) threat model [43] can be followed for designing security protocols for IoIT environments. According to this model, two communicating nodes (end-point entities) communicate over an unsecured/open/public channel. Moreover, the end-point entities (e.g., wearable devices, smart home devices) are not, in general, trusted. Therefore, the exchanged messages of the parties might be leaked, modified, or deleted because the channel is unsecured. Furthermore, Canetti and Krawczyk's adversary model (known as the CK-adversary model) [44] can be followed. This model is a current de facto standard model used for designing secure authentication and key agreement schemes. In the CK-adversary model, the attacker (A) can have all the abilities of the DY model; additionally, A can compromise secret credentials, since the session states (session keys) correspond to an established session. Apart from that, A can physical capture smart devices (for instance, the memory unit of a drone, an implantable medical device, a wearable device, the onboard unit of a smart autonomous vehicle) and tries to extract the stored secret information (i.e., the credentials) from these devices by executing a power analysis attack [45]. After that the extracted information can be used for other unauthorized tasks (for instance, computation of a session key, smart-device impersonation, launching the privileged-insider attack, the replay attack, or the MITM attack, and password guessing). Finally, the edge servers (blockchain-miner nodes) are considered fully trusted entities in the network, and they will not be compromised. However, cloud servers are treated as semitrusted entities in the network.

III. A GENERALIZED BLOCKCHAIN BASED SCHEME
To explain the overall working of the proposed generalized blockchain based scheme in the Internet of Intelligent Things (IoIT) communication environment. We divide all the activities related the proposed scheme into several phases: (i) registration and pre-deployment; (ii) authentication, key establishment, and secure data exchange; and (iii) blockchain formation similar to the scheme presented in [46]. The details of notations used in the proposed scheme are provided in Table 2. We can further expand the different phases of the proposed scheme as follows. In addition, a flow chart of the proposed scheme is provided in Fig. 4, which represents the summary of all activities conducted in blockchain-based IoIT environment.

A. REGISTRATION AND PRE-DEPLOYMENT
For registration and pre-deployment, one can follow the steps available in schemes outlined in [1] and [42]. In this phase, a miner node (edge server-trusted node) registers the smart devices. After successful registration, the corresponding secret credentials are stored in memory, and the smart devices are deployed in the specified area. Details of the VOLUME 8, 2020 activities related to this phase are provided in Fig. 5. This phase is executed through the following steps.
• RG1: Miner node registers smart devices, stores the secret credentials in memory, then the devices are deployed in the specified area.
• RG2: The miner node registers the cloud server and stores the secret credentials in memory; then, the cloud server is deployed in the specified area.
• RG3: There are some users who want to securely access the data in the smart devices. For this purpose, first of all, they have to register with the corresponding miner node (trusted node-edge server). The user sends a registration request to the miner node through a secure channel. Then, the miner node computes secret credentials for the user and stores them in the smart card or smart phone. Furthermore, the smart card is delivered to the user through a secure channel. Again note that, for registration purposes, it is mandatory to use random identities, pseudo-identities, secret keys for the users and smart devices, and a registration timestamp. This will protect against device/user impersonation attacks and helps in the device-or user-revocation process.

B. AUTHENTICATION, KEY ESTABLISHMENT AND SECURE DATA EXCHANGE
In this phase, all parties mutually authenticate each other; after that, they establish a secret session key for secure communications. The details of the activities are provided in Fig. 6. The activities can be conducted using the following steps.   protect against replay, MITM, impersonation, and illegal session key computation attacks. Each session should be established by using a freshly computed session key.

C. BLOCKCHAIN FORMATION
After securely receiving the data from the SD with secure session key KSM , the corresponding miner node (MN i ) starts the formation of the block to be added to the blockchain. A summary of all the steps is provided in Fig. 7. The details of this phase are provided below. other miner nodes commit to addition of this block. The new block is added to the distributed ledger of the blockchain.
• BKF4: If an authenticated user wants to access the data of a particular block, the request goes to the corresponding MN , and that MN fetches the data from the specified block, providing it to the user securely through the established KUM . The details of the steps of blockchain-based secure communication mechanism for IoIT environment are also explained in Algorithm 1.

Algorithm 1 Consensus Mechanism for Providing Security in IoIT Environment
Input: m is number of smart devices and n is number of users Output: Blockchain of data for m smart devices 1: for all smart devices SD p , p = 1, 2, . . . , m, users U q , q = 1, 2, . . . , n, cloud servers CS r in IoIT environment, and miner node MN i do do 2: Resister all SD p , U q and CS r .

3:
Perform mutual authentication and key establishment among SD p , U q and CS r .

4:
Prepare block (BLK x ) from the securely received data of SD p .

5:
Call mining procedure for addition of BLK x using the PoW with other MN s. 6: if other MN s commit on addition of BLK x then 7: Add BLK x in blockchain 8: The proposed scheme utilizes the blockchain mechanism. Details of the blockchain-based secure communication scheme for Internet of Intelligent Things environments are provided above. It is resilient against various kinds of attacks, such as replay attacks, man-in-the-middle, impersonation, privileged insider, illegal session key computation, data modification, data leakage, and smart device physical capture. The use of random nonce and timestamps in all exchanged messages protects them against replay and MITM attacks. The secret keys are not installed directly in memory of any smart device. Consideration for, and inclusion of, these parameters protects against various types of attacks, like impersonation, privileged insider, password guessing, illegal session key computation, and smart device physical capture. The utilization of blockchain methods (i.e., signature generation and verification procedures) provides data integrity and authenticity. Furthermore, it maintains transparency and immutability.

E. PRACTICAL DEMONSTRATION
A practical demonstration of the proposed scheme using the blockchain mechanism was performed as follows [7] with the parameters listed in Table 3. Three different cases were considered in the simulations, which were conducted in the Windows 10, 64-bit OS installed on an Intel Core i5-8250U with a 1.60-1.80 GHz processor and 8 GB RAM. The programming platform was the Eclipse IDE 2019-12 with Java. The smart devices considered numbered 5 (case 1), 10 (case 2) and 15 (case 3), with 2, 4, and 6 users, respectively, along with four miner nodes (MNs). Mobility affects the performance of a blockchain system operating in a vehicular ad hoc network (VANET). The mobility of nodes causes a distinctive challenge to the blockchain operations due to the dynamicity and continuous change in the connectivity of the nodes. More specifically, mobility makes a proof-of-work (PoW) mechanism difficult. This is happens when the nodes move, they can only have a limited duration of time for a ''rendezvous'' to exchange a new block for the verification. As the information provided in [47], it is easy to discover that a slow moving VANET can accommodate exchange of a larger number of blocks as it holds a rendezvous for a longer time. However, in the proposed generalized scheme we only consider the static nodes. Therefore, we can neglect the effect of mobility on the blockchain operations. The level of difficulty in consensus (mining) was 4. The level of difficulty is a value for how difficult it is to find (mine) a hash below a given target for the PoW consensus protocol. Finding (mining) a hash is called solving a puzzle sometimes. The target values were present by the system. PoW is also used for implementation of Bitcoin and Litecoin blockchain frameworks. Hence, a similar approach was followed in the proposed framework. The different fields used in a block are as follows. • Block-version It depicts the version, i.e., identity, of a block. The size of this field is assumed to be 32 bits.
• Timestamp It is the timestamp value for a particular block. The size of this field is assumed to be 32 bits.
• Random nonce It is a value for a particular block. The size of this field is assumed to be 160 bits.
• Transaction details It includes information about the ongoing transactions, for example, which entity is sending which information and for what purpose. The size of this field is assumed to be 1024 bits.
• Owner (miner) identity It depicts the identity of the owner (or miner) node. The size of this field is assumed to be 160 bits.
• Owner's public key It contains information about the public key of the owner (miner) node. The size of this field is assumed to be 320 bits in the elliptic curve cryptography (ECC) algorithm.
• Hash of previous block It contains the hash value. The size of this field is assumed to be 256 bits in the SHA256 algorithm.
• Hash of current block It contains the hash value. The size of this field is assumed to be 256 bits in the SHA256 algorithm.
• Block signature It contains signature information for a particular block. The size of this field is assumed to be 320 bits in the ECC algorithm.  Some snippets of code are provided in Fig. 8 for the structure of a block, and in Fig. 9 for data inside a block.
The following results were obtained during the simulations.

1) IMPACT OF NUMBER OF USERS
The impact of increasing the number of users on the creation and addition of blocks (blockchain mining) is computed as the computation cost (in ms). The values for computation cost were 1.76, 2.34, and 3.28 for 2, 4, and 6 users, respectively. These results are illustrated in Fig. 10. It is important to note that the computation cost increases with the number of users because incrementing the number of users causes the creation and addition (mining) of more blocks in the blockchain.

2) IMPACT OF NUMBER OF BLOCKS
The impact of increasing the number of blocks in the blockchain is analyzed in terms of computation cost. The values of the computation cost (in ms) were 1.76, 2.34, and 3.28 for 5, 10, and 15 blocks, respectively. These results are illustrated in Fig. 11. It is important to note that the computation cost increases with more blocks, because incrementing number of blocks causes the creation and addition (mining) of more blocks in the blockchain.

IV. APPLICTIONS FOR BLOCKCHAIN-BASED IoIT COMMUNICATION ENVIRONMENT
Blockchain-based IoIT environments can be utilized in various types of applications. The information on some of the potential applications is provided below [20]- [25].

A. BLOCKCHAIN-BASED BATTLEFIELDS
The Internet of Intelligent Battlefield Things is a scenario of battlefield environments that consist of smart devices, such as drones (unmanned aerial vehicles), robots, and wearable devices and weapons for soldiers. These devices monitor their surroundings and send the corresponding data to the base station (control system). These devices also have an inbuilt artificial intelligence component, and on the basis of this component, devices can act automatically (for example, target tracking and retaliation through drones). However, such kinds of communication environments suffer from various types of security and privacy issues. Various attacks are possible such as the replay, MITM, impersonation, privileged insider, password-or other secrets-guessing, illegal sessionkey computation, data leakage, and data modification. The blockchain ledger can provide security to different types of Internet of Things environments. With billions of connected devices, security experts worry about making sure this distributed information is secure. Therefore, the blockchain mechanism can be utilized to secure communications that take place for the Internet of Intelligent Battlefield Things, and also in other types of environments, such as smart homes and smart grids [48].

B. BLOCKCHAIN-BASED FINANCIAL SERVICES
Traditional systems are cumbersome, have errors, and unfortunately, are slow. We need the involvement of intermediaries to facilitate the activities and to resolve conflicts. This causes further stress and requires extra time and money. However, if we use a blockchain, things will be much cheaper, more transparent, more effective, and robust. Small financial services firms are growing in number, promoting systems for innovations (for example, smart contracts and smart bonds). This system is much better, because it automatically pays bondholders their money upon completion of preprogramed terms. They are self-executing and self-maintaining in nature. This environment can work more intelligently with the use of smart devices, for example, smart sensing devices. It also provides more security for all communications by making use of the blockchain mechanism. Hence, this is one of the emerging applications of the blockchain-based IoIT environment.

C. BLOCKCHAIN-BASED SMART PROPERTY
There are different types of property, such as houses, cars, patents, property titles, company shares, etc. Scenarios can be deployed with smart and intelligent devices, such as smart sensing devices and devices with a physical uncloneable function (PUF), which facilitates the overall functioning of the environment. The registration of these properties can be stored in the distributed ledger of a blockchain, along with contractual details (i.e., who is allowed ownership of this property). Furthermore, smart keys can be deployed to provide access to authorized parties. The maintained distributed ledger stores and allows the exchange of smart keys when a contract is verified. The ledger is also a system for recording and managing property rights, and it enables smart contracts to be duplicated if the smart key is lost or stolen. Making a property smart reduces mediation fees and the risk of fraud. Simultaneously, it increases the trust and efficiency of the system. Therefore, this can be another important application of blockchain-based IoIT environments.

D. BLOCKCHAIN-BASED SMART HEALTHCARE SYSTEMS
The smart and intelligent healthcare system is another potential application of the IoIT. Such communication environments consist of smart healthcare devices (e.g., implantable medical devices, wearable health devices). They also have various types of users (i.e., relatives of patients, doctors, and nursing staff). In order to recommend medicine, health staff members require the health data of the patient, which should be transmitted and received in a secure way. In this communication environment, a recommendation system can also be deployed that can act in a doctor's absence.
However, a smart, or intelligent, healthcare system can have various types of security and privacy issues. It is vulnerable to the attacks listed earlier. In such environments, personal health records could be encrypted and stored in the blockchain, along with a private key that provides access only to authorized personnel. Moreover, the records of surgery could be stored in a blockchain and automatically sent to insurance companies as proof of delivery. Apart from that, the ledger can be used for general healthcare management, for example, for the supervision of drugs, adherence to compliance regulations, recording results from testing, and management of healthcare supplies. Therefore, the blockchain procedure will be helpful in securing the communications that take place in an intelligent healthcare system.

E. BLOCKCHAIN-BASED INTELLIGENT TRANSPORTATION SYSTEMS
A smart, or intelligent, transportation system consists of autonomous vehicles (e.g., the autonomous car), roadside units, and cloud/fog servers. These devices can communicate with each other using the Internet. It is an extensive network of multiple sensors, antennas, embedded software, and technologies that assist in navigating a complex route. The intelligent units of the system have a responsibility to make decisions with speed, consistency, and accuracy. Such kinds of communication environments provide a comfortable and safe journey to passengers. However, they are also vulnerable to the different types of attacks listed earlier. The use of blockchain technology in an intelligent transportation system makes communications stronger and more reliable against outside and inside network threats.

F. BLOCKCHAIN-BASED INDUSTRIAL INTERNET OF INTELLIGENT THINGS
The Industrial Internet of Intelligent Things is a combination of connected machines and devices in industry, for example, power generation, oil, gas, and other manufacturing/production systems. Unplanned downtime and system failures in an industrial plant can threaten the lives of the people working inside, which can be avoided through the deployment of an Industrial IoIT environment. A system embedded with smart monitoring and sensing devices can help create a safe and reliable working environment. The IoIT environment consists of smart IoT devices, gateway nodes, and various types of servers. The resource-rich devices, such as servers, can execute machine learning algorithms and make predictions about some phenomena (e.g., chances of a fire inside a plant). However, the communications that happen in such kinds of communication environments are vulnerable to different types of attacks (e.g., hacking of control systems in a plant). Therefore, we can make use of the distributed ledger in a blockchain to make communications more secure and reliable against intruders.

V. FUTURE RESEARCH ROADMAP FOR BLOCKCHAIN-BASED IoIT ENVIRONMENT
As discussed earlier, the blockchain-based Internet of Intelligent Things communication environment can be utilized in a wide variety of applications. Moreover, deployment of the blockchain mechanism makes it more strong and robust against the existing forms of attack. However, like other kinds of communication environments, it also has some challenges that need to be addressed by research in the future. The roadmap for the blockchain-based IoIT environment is provided below [2], [29], [49].

A. DESIGNING LIGHTWEIGHT SECURITY PROTOCOLS
Security protocols can be categorized into various types, such as key management, user authentication and key agreement, access control/user access control, and intrusion detection and prevention. All these protocols use cryptographic methods for message generation and exchange. Some of these cryptographic methods utilize heavy algorithms that require very high computation, communications, and storage capabilities. But some of the devices in blockchain-based IoIT environments, such as sensing devices, are resource-constrained in nature and do not have high computation, communications, and storage capabilities. Therefore, we cannot use security schemes having high requirements in computation, communications, and storage capacities. Moreover, deployment of the blockchain procedure also creates extra burdens on the system when it requires such capabilities. Hence, we should be selective when going for the design of security protocols for blockchain-based IoIT environments or for other resource-restricted computing environments. The use of lightweight cryptographic operations will be helpful to researchers who resolve this problem.

B. INTER-PLATFORM COMPATIBILITY
In a blockchain-based IoIT environment, we have different types of devices and users. They use different types of platforms, tools, and technologies to communicate among themselves. In such situations, there may be an issue of compatibility among the devices operating on different platforms. Hence, we should design a security protocol in such a way that it is strong enough to prevent attacks and does not have any compatibility issues. Therefore, designing such security protocols can be an important research problem for the future.

C. RELIABLE SECURITY SCHEMES
Different types of security schemes in the literature do not combat some types of attack. Furthermore, some schemes work for a particular attack and do not work for others. Therefore, it is important to design a security scheme so that it detects and prevents different types of attack at the same time. Hence, designing a reliable blockchain-based security scheme can be a challenging problem for future researchers.

D. SELECTION OF BLOCKCHAIN ALGORITHMS
In a blockchain-based IoIT environment, we have different types of devices, and some of them are resource-constrained (e.g., sensing devices). Moreover, this type of environment is vulnerable to the various types of attacks listed earlier, which can be prevented through the blockchain mechanism. However, selection of a blockchain algorithm is very tricky. For example, which consensus algorithm should we use, and on which node (device)? It is always preferable to use algorithms like Merkle root, which are efficient compared to the other existing algorithms. Therefore, selection of a blockchain's algorithm for securing the environment can also be another interesting problem for researchers.

E. SUPPORT FOR DIVERSITY
Blockchain-based IoIT environments consist of different types of devices: smart and intelligent devices (e.g., drones, smart autonomous vehicles), laptop systems, desktop systems, personal digital assistants, mobile handheld devices, other low-powered sensing devices, and RFID tags. Furthermore, these devices operate under the existing specifications of communication protocols. Apart from that, these devices have different types of computation strengths, storage capacities, communication strengths, underlying operating systems, and other software. Hence, the security scheme for blockchain-based IoIT environments should be designed in such a way that they can support and protect all types of devices and associated mechanisms.

VI. CONCLUSION AND FUTURE WORK
Blockchain technology has great potential, and can be useful in securing a communication environment. A blockchainbased IoIT environment can also be secured through deployment of the blockchain mechanism. The system models (i.e., network and attack models for blockchain-based IoIT environments) that will be helpful in designing a security protocol were presented. After that, we provided details of the proposed blockchain-based secure communication scheme for Internet of Intelligent Things environments. The provided security analysis depicts the scheme's resilience against possible attacks. A practical demonstration of the proposed scheme was provided in order to measure the impact of the proposed scheme. The details of different types of blockchain are provided. Some of the famous consensus algorithms are also discussed. The details of various types of applications of blockchain-based IoIT environments were provided, and some future research challenges in this domain were highlighted.
It is worth noticing that in this tutorial paper, we proposed a generalized blockchain based security scheme, which was particularly focused on the authentication and key management issues. In future, we aim to provide the mathematical details related to all the steps of the proposed generalized scheme. For this purpose, a concrete formal security analysis under the standard oracle model and also the formal security verification using automated software validation tools are needed. Next, a detailed performance analysis with respect to computation cost, communication cost and storage cost is essential.