Keywords

1 Introduction

The smart city is the collection of different components such as the hospitals, the smart home, the vehicular transportation, etc. Each component further consists of IoT devices that need to communicate with one another to do real-time data processing and to share data using different sensors. In this way, it increases the standard of living, the government services and the environment as well [1]. The applications of a smart city, include a biased medical data sharing between cloud servers through blockchain which is proposed in [2]. The devices do not trust each other in order to communicate with each other. A secured mechanism based on blockchain is proposed by [3], where hybrid network architecture is proposed to communicate the devices with each other. The model proposed in this paper consists of two networks. One is edge network which is connected with IoT devices forming a centralized network while the other is a miner network which is connected with the edge nodes forming a distributed network. Miner nodes have more computational power and storage resources than edge nodes. Here, the edge nodes are responsible to provide communication between devices and miner nodes are responsible to perform high computational tasks. The hybrid network uses more resources.

The security is achieved using blockchain, which is considered as the most secure technology until now. Trust is achieved by using a trust management scheme proposed in [4]. Every node/block in the blockchain stores the record of all the transactions that take place in the network which is called ledger. Due to this, it’s really hard for the attacker to tamper data in the blockchain because every block in the blockchain maintains a ledger. Using blockchain, the devices do not need to depend on the third party for any type of authentication and verification instead, they can communicate directly. A smart contract is also used to handle transactions that are stored on the blockchain.

A consensus mechanism Proof-of-Work (PoW) is also implemented in the block-chain to protect each node from the attacks which is proposed by Nakamoto [5]. Each transaction is verified at each node by performing mining. In the mining process, a complex mathematical puzzle is assigned to every miner and they compete to solve the puzzle. A reward is given to the miner who solves the puzzle first. After verification, the new transaction is then broadcasted in the network and stores in the blockchain.

By analyzing the previously proposed model, we come to know that the model is still lacking in the efficient placement of the nodes in a network. Also, there is not any need for the two networks in the model as it will use additional computational power and resources. The IoT devices are linked to the edge nodes forming a centralized network which is a single point of failure. So, a solution to this is discussed in this paper. We have used a single network and replace some edge nodes with the miner nodes in the same network. In this way, we do not need to maintain a separate network for different nodes.

2 Motivation

A smart city is based on intelligent information sharing between different IoT devices. We are taking motivation from [3], which proposed hybrid network architecture. One network is called the core network while the other is called an edge network. Edge nodes are connected directly to the smart devices in the network while miner nodes are responsible to perform high computational tasks. Also, we are getting motivation from [6], which proposed a crowd sensing network to communicate with IoT devices. It further deals with a huge amount of data. Furthermore, [9] proposed blockchain architecture for an intelligent vehicle.

3 Problem Statement

The hybrid network architecture for a smart city network proposed in [3], is not efficiently utilizing the resources. The edge nodes have low storage and they need to process raw data, uploaded by end devices. The placement of edge nodes is not handled, which is also stated as its limitation. Moreover, this architecture utilizes more time and cost. To implement the two networks, we require extra computational resources and cost. Also, it takes more time for the devices to communicate between different networks. So, we are more concerned to reduce cost and time of communication between devices by using single network instead of multiple networks.

4 Related Work

In this section, we are presenting some techniques that are using blockchain in different networks model. Existing work is also included along with the relevant research trend.

4.1 Wireless Sensor Networks

Resource-constrained IoT devices that are of limited resources are discussed in [6]. The devices run services beyond their capabilities which increases the security risks usually due to untrustworthiness. A mechanism is suggested to keep the validity status of the edge servers. The proposed model is working on the on-chain and off-chain communication modes, in a way that service business is at off-chain and the security business is on-chain. A consortium blockchain is deployed with the Proof of Authority (PoA) consensus mechanism which ensures the high throughput and low latency in the system. An other blockchain based node recovery scheme is proposed in [10].

There are three ways of data storage in Wireless Sensor Networks (WSNs) available until now [11]. However, there is not any incentive mechanism available for the data storage in WSN. An incentive mechanism is proposed, based on the blockchain through which the node who will store data for another node will get a reward. Provable Data Possession (PDP) is used which causes the waste of resources in terms of electricity, etc.

Smart city network architecture [3] and in the cloud based service provider [12], a number of IoT devices are connected to each other. It arises the issues like high latency rate and more bandwidth usage. Moreover, it also affects the efficiency and scalability of the trust management system. The proposed network is divided into two groups, one is called the miner nodes network and the other one is called the edge nodes network. Edge nodes offer real-time processing and are deployed at the edge network. The IoT devices in the smart city components are connected to these edge nodes forming a centralized network whereas the edge nodes are connected to the miner nodes forming a distributed network. Miner nodes are responsible for generating new blocks and applying consensus on them. [7] have worked on the smart networks using blockchain and [7] has worked on the underwater WSNs.

4.2 Vehicular Network

Vehicular communication protocols based on cellular networks are not very updated and these are even not suitable for Intelligent Transport System (ITS) [9]. Also, the issues related to ITS communication are trust, privacy, and security. A central point of trust in the communication network is proposed which is called Intelligent Vehicle Trust Point (IVTP) using blockchain without interference from other vehicles. It also assigns a unique crypto ID to every vehicle that is the part of the network.

In the Vehicular Network (VN), the amount of traffic is huge which cannot be managed by a centralized network. It raises the issue of interoperability and compatibility [13]. Moreover, the security between vehicles is also very important. A blockchain based decentralized system is applied to handle the security issues, high cost, and efficiency. Five different blockchains are used, each handle different types of data. The first one tackles car monitoring data such as speed. The second one handles sensory data like temperature. The next one is used to store streaming data like audio, video. The Matlab tool is used to perform simulations for the proposed blockchain based vehicular network. The parameters that are used for performance evaluation include throughput and average delay time.

In [14], secure communication between vehicles is the core requirement for ITS because vehicles have to share data with each other. Moreover, the proposed system tackles the challenges of flexibility and robustness. Block-VN network is proposed to provide communication between vehicles in a distributed network. The miner nodes in the network are the vehicles that handle requests. The remaining vehicles are termed as ordinary nodes. A new vehicle/node can send a request to either the controller or the ordinary node. In this way, the system is achieving high trust between the vehicles. The controller node is responsible for the computation of data. Furthermore, no mechanism is proposed for the verification of the client and the authenticity of messages.

4.3 Data Sharing

Data sharing in smart grid is discussed in [15]. Another data sharing scenario between multiple devices that cause long time latency is discussed in [16]. The distrust issues between devices are further highlighted. A blockchain is proposed to handle the sharing of data at the edge nodes. This blockchain framework is using a consensus called Proof of Collaboration (PoC). Every edge node compete to create new blocks by showing their credits instead of showing computation power which utilizes large resources. Moreover, express transactions and hollow blocks are also proposed to increase the overall network efficiency.

Different Mobile Network Operators (MNOs) communicate with each other to share data due to trust issues [17]. The term Artificial Intelligence (AI) is used in a sense to make this communication process between networks automatically. A trust-based data sharing framework is proposed using permissioned blockchain which is based on the smart contract. Restrictions are applied to the data accessed, and this permission is only granted by the owner of the data through a smart contract. Furthermore, the data access is controlled and monitored using datachain and behavior chain. Datachain is used to control the access of the data while the behavior chain is used to keep the record of the data access. To achieve security better, permission levels are divided into four levels. L0, L1, L2, and L3. In level L0, the data is shared with the user only. In level L1, only the computation data is visible and in level L2, access is given to the authorized persons. In level L3, the data is available publicly to everyone. The model of system is implemented in Hyperledger fabric. A smart contract is used to execute all transactions between the user layer and system management layer. The economic benefits of the proposed system are not discussed properly.

4.4 Data Access Management

The validity of Channel State Information (CSI) is important because resources are assigned to the users on this basis [18]. It discusses the issues of CSI and uses a statistical-based algorithm to solve these; however, no one addressed the issues of access control in network for the authenticity of CSI. The main contributions include to find out the efficiency of the mobile users and validation of CSI of each user using blockchain consensus mechanisms. User’s information is gathered including the CSI of mobile users using devices like signal meters and Global Positioning Systems (GPS). A network representing transmitting-receiving pairs of users is considered for simulation especially the Erdös-Rényi network. Moreover, the proposed algorithm will work best and provide the optimal results for highly concentrated transmitting and receiving pair. [19] have also worked on data access rights using blockchain and [20] contains work on the monetization of data.

The already existing centralized system is dependent on the third party for the electronic payments which raises the issue of trust [21]. Every node in the blockchain stores the record of each transaction which requires a huge storage space which in the future will become difficult to manage. A storage mechanism called Network Coded Distributed Storage (NC-DS) is proposed to store the blockchain. The lack of storage and bandwidth problem collectively called bloating problem which is tackled by the proposed framework without losing any data. A block is divided into 3 sub-blocks which are further divided into 6. NC-DS is implemented in two ways. Deterministic Rate (DR) and Rate Less (RL). NC-DRDS is used when there is a finite number of encoded packets while NC-RLDS is implemented when encoded packets are unknown. Moreover, when the system wants to get data from these encoded blocks, then it has to perform decoding first. Also, every packet contains different data so it becomes easier for the attacker to manipulate the data. [22] have worked on trustfulness in complex networks and [23] implemented blockchain in smart grids.

4.5 Smart Cities

No single protocol exists for the communication of different IoT devices [24]. Also, security issues related to these devices are further addressed. Moreover, the standards that exist already are not scalable enough. The blockchain contains a distributed ledger that is maintained through a consensus at each node. IoT chain, IoTex, and NeuroMesh have used to overcome storage issues but they all have some drawbacks. Their solution provides communication for IoT based on integrity.

A huge data is shared between different devices [25]. Also, a low-latency trusted data exchange platform is required. Moreover, a blockchain based trusted data exchange system is proposed which is called SpeedyChain. It further consists of smart vehicles, Roadside Infrastructure Units (RSIs) and Service Providers (SPs). Furthermore, it provides more secure communication between vehicles to infrastructure and maintains privacy by continuously changeable keys.

Smart city environment challenges are addressed in [27], like storage and communication. Moreover, a blockchain based scheme is proposed for big data auditing. Also, a Data Auditing Blockchain (DAB) that collects proofs instead of a transaction is proposed. They are performing both the batch auditing and dynamic auditing. In this way, the security, reliability and efficiency have been improved. Furthermore, the scheme is validated using Java JDK and all algorithms are implemented using Java Pairing Base Cryptography library (JPBC). [26] have worked on light weight clients based on blockchain.

Fig. 1.
figure 1

Proposed system model

5 System Model

Different components combine together to form a smart city network. The components/systems that are connected to this network are called smart components/systems because they are using different IoT devices for communication. So in this system model, each system is named as a smart application as clearly seen from Fig. 1. Secure data sharing among different IoT devices was a problem as stated in [28]. According to this, a device will not share any information unless it makes sure that communication is secure. This paper proposes a more efficient solution. This model is categorized into three layers. At the bottom, there are some applications of a smart city. These applications can be a smart home, hospital, building, roads, smart grid or industry. A building can be said smart, if it contains a large number of smart devices that communicate with each other.

At the middle layer, a whole smart city network is illustrated which is communicating with the layer above it by using different kinds of arrows. Different arrows show that devices are communicating using different mediums. These mediums can be different kind of networks through which the devices communicate with each other. Moreover, the devices are using the above layer which contains blockchain network. This network contains multiple blockchains that are communicating with each other for the proper functioning of the devices.

The proposed system model is motivated from [3, 4] and [16]. At the top level, two blockchains are used, in which a miner node is surrounded by few edge nodes. Edge nodes are connected to a single miner node in a blockchain which means that one edge node is connected to multiple IoT devices. Miner node is responsible for creating new blocks and verifying through PoW consensus mechanism. Miner nodes have high computational power and storage space as compared to the edge nodes. This is basically a mesh network of different IoT devices. These devices communicate with each other through edge nodes and generate an enormous amount of data which require huge storage space. Moreover, when a smart application tries to interact with the system, it first send request to the edge nodes which further passes the request to the core nodes for validation and approval. The work flow of the proposed model can be clearly understandable from Fig. 1.

It can be clearly seen that the smart city is surrounded by blockchain clouds. The previously proposed model uses multiple networks that will utilize extra resources and more computational power to run the network. We have eliminated two networks that were proposed in the base model and have merged them to one. Miners are responsible to verify the new devices that wanted to enter into the network. As all miners are performing the same task, so instead of using multiple nodes, we can assign this task to any of the edge nodes. We can do this by using high storage capacity and powerful edge nodes or placing a single miner node to each edge node network.

Smart city is the collection of multiple components of a city like smart hospitals, smart parking, smart organization and smart home, etc. As it can be seen in Fig. 2, that the interaction of each single component of a smart city; such as a smart home. The smart home contains multiple IoT devices that will communicate with each other using the proposed blockchain model. A device may need to communicate with other devices for it’s proper functioning. But sometimes they do not trust each other because of their privacy and security.

Fig. 2.
figure 2

Smart home with IoT devices

The security of the model is tackled in a way that edge nodes manage all IoT devices because all the devices are directly connected to the edge nodes. Data is passed by the end devices (IoT) to the edge node which provides real-time processing of the data. The edge nodes process the data that is uploaded by the end devices. They perform the scrutinization process to get useful information/data. The edge node then transfers this data to the core node (if required in terms as needed more resources and power). The miner node will validate the data by applying PoW to find out any illegalities in the data. The Miner node is responsible to perform the high computational tasks. The Miner nodes compete each other to solve the task to get the reward. The reward may be in terms of bitcoins or ratings, etc. It is a kind of game, in which a puzzle is given to the nodes to solve.

Fig. 3.
figure 3

Calculated cost against transactions

6 Results and Discussion

We have used the solidity language to implement the proposed idea. A blockchain is used to store records of multiple transactions. A smart contract is written in .sol file to handle the transactions in the blockchain. Furthermore, we have used an array list to store the transactions. All the transactions are then added in the array of blockchain manually using the code. The results are obtained by deploying the contract in an online tool called Remix using Ganache and metamask. A remix is an online tool used to implement the contract directly without making its javascript file. Ganache provides some fake accounts with real money to perform transactions. The transaction id is linked with the online contract deployment tool account and the money is provided in the form of ether. Ether is the currency used for the ethereum platform to exchange transactions. For every transaction, a block is created in Ganache. The PoW consensus mechanism is applied in the edge node network to process and to validate new transactions in the blockchain.

The total cost is calculated against the values of gas consumed in Rinkeby and Ropsten network and the transaction rate as shown in Fig. 3. Gas consumed is calculated using Ganache and the transaction rate is provided by the metamask. At the x-axis, the number of transactions are presented ranging from 1 to 5. On the y-axis, the estimated cost is given. The figure shows that by increasing the number of transactions, the cost price remains almost stable except for the first transaction as clearly seen from the figure above. This cost is calculated against each gas consumption. The gas which is consumed by each transaction to mine the block and the transaction rate that it takes using metamask. From this, we can conclude that there are not any major changes in cost. As it remains almost the same in almost every transaction. This is also represented in the tabular form in the following Table 1.

Table 1. Number of transactions vs cost

These both values are then multiplied in order to get the value of the cost. As stated above, Ropsten test network is also used to run the same contract. This network uses PoW consensus mechanism by default. Figure 4 looks almost same as the previous one but the results are different. It also shows that by increasing the number of transactions, the cost remains almost constant except for the second transaction. Furthermore, the total gas is calculated by multiplying the transaction rate and gas consumed as calculated in the previous network.

This tells us that the cost is totally dependent on the type of network, used to run the transactions. As Ropsten uses PoW consensus that is why it costs less than the other network which was a Rinkeby network in this case.

Fig. 4.
figure 4

Calculated cost against transactions using Ropsten Network

The above data is also represented in the tabular form in the following Table 2.

Table 2. Number of transactions vs cost in Ropsten Network

The computational resources are considered as the number of devices. As by increasing the number of devices, we are assuming that they will increase the computational resources, as shown in Fig. 5.

Fig. 5.
figure 5

No. of devices vs time/sec

In the above chart, the time is calculated against the number of devices. The number of devices are increased one by one manually to see the changes in the block time and the changes in the results as shown in Fig. 5. As it can be clearly seen that every device time is different from each other except the device number 3 and 4. This may be due to several reasons; same type of devices or devices are added at the same time. Furthermore, it means that as the number of devices increased, the time also fluctuates just because every device is different from others. The parameters at both the axes are also shown in Table 3 below.

Table 3. No. of devices vs time

Trade-off exists when we are achieving the value of something by compromising/degrading the value of another thing. In the proposed system, the trade-off between two parameters exist such as between the number of transactions and the cost. It means that we are controlling/minimizing the cost by paying the price in terms of increasing the number of transactions. The cost is calculated on two different networks and we are concluding that the cost is reducing by using PoW consensus mechanism network.

7 Conclusion

Huge amount of data is generated by different IoT devices in the smart city network. Our proposed model provides a single network that reduces the time and cost for communication between devices. Also, the consensus mechanism is implemented to make the network secure and to achieve privacy among the devices. The model is deployed on two different networks to find out the difference in the transaction cost. The results show that the network using the PoW consensus mechanism obtained better cost than the other network. The results are limited to a specific network and are not applied against other different consensus mechanisms.

8 Limitations and Future Work

Our work still have some limitations regarding the number of blockchains used by the network. We only use single blockchain in the implementation. More then one blockchain, can be used to see the impact on results. The scope of proposed model is small so that the results obtained are also single sided. Also, we have not tested the scalability of the proposed model. We are aiming to continue this work in the future.