Design a Blockchain-Based Middleware Layer in The Internet of Things Architecture

— In next-generation computing, the role of cloud, internet and smart devices will be capacious. Nowadays we all are familiar with the word smart. This word is used a number of times in our daily life. The Internet of Things (IoT) will produce remarkable different kinds of information from different resources. It can store big data in the cloud. The fog computing acts as an interface between cloud and IoT. The extension of fog in this framework works on physical things under IoT. The IoT devices are called fog nodes, they can have accessed anywhere within the range of the network. The blockchain is a novel approach to record the transactions in a sequence securely. Developing a new blockchains based middleware framework in the architecture of the Internet of Things is one of the critical issues of wireless networking where resolving such an issue would result in constant growth in the use and popularity of IoT. The proposed research creates a framework for providing the middleware framework in the internet of smart devices network for the internet of things using blockchains technology. Our main contribution links a new study that integrates blockchains to the Internet of things and provides communication security to the internet of smart devices.


I. INTRODUCTION
The proposed research entitled "Design a blockchain based middleware layer in Internet of Things (IoT)" is a step forward in wireless networking and IoT where we propose a new middleware framework based on blockchain technology. The Wireless communication is the key of Internet of things. It is expected to exceed 50 billion connected devices by 2020 and most of these nodes cannot be connected by wireline [1]. In order to enable critical applications such as smart factories or smart buildings, the networking protocols have to deal with the non-deterministic nature of wireless links. The proposed research work in this project is an enhancement and implementation of middleware framework based on blockchain technology in the architecture of internet of things. The research outcome is to establish a new IoT framework. The proposed research uses the correct and efficient simulation of a desired study and can be implemented in a framework of Internet of Things. In the future, researchers can enhance this research and implement in the internet of everything framework [2].
Developing a new blockchains based middleware framework in the architecture of Internet of Things can be a valuable framework to improve the performance of IoT framework in heterogenous environment. The wireless communication is the fastest growing research area that facilitates users to interact each other without using wires. The Internet of Things is based on wireless networking at all. In the beginning of Internet, It was developed to communicate one device to another device using accessing the browsers [3]. However, in the current era, high speed smart efficient devices with many advance technologies like low power consumption etc. available to communicate with each other. The extension of fog in this framework works on physical things under IoT [4]. The IoT devices are called fog nodes, they can have accessed anywhere within the range of network. This study will useful in IoT framework. However, analytic framework is studied in literature review, the authors haven't explained the full framework in this research. This research adds the enhanced blockchain and fog to develop efficient IoT framework for communication among smart devices [5]. The comparison of this research with past investigations retransmission limits, affirmation, bundle length variety and worsen dissemination of packets generation are represented. The algorithm has been experimentally implemented. The proposed framework predicts well our comprehensive experiments. variety of the quantity of smart devices. In this research we consider idle state in order to makes our examination more efficient, at that point the general execution regarding the overall performance of the framework is evaluated. The IoT-Fog in this framework will monitor and analyse the real-time data collected from fog nodes and then taking the action.
The following are the key points-1. The research is primarily focused on IoT. It enables smart devices to communicate with another devices among internet of smart devices using blockchain technology. 2. The proposed framework for communication will access across the internet of smart devices. 3. The results of proposed research will be compared with previous study in the same area.

II. LITERATURE SURVEY
In 1991, Theodore S. Rappaport published an article entitles "The wireless revolution", in this paper he presented the wireless communications is the emerging technology as a key for communication among human as well as devices [6].
In 1994, Andy Harter and Andy Hopper published the article entitled "A Distributed Location system for the active office", in this paper, they presented infrared sensor arrangements using badges for communication among devices and workstations. In 1994, Tristan R Ichardson, FrazerbeNnett, Glenford Mapp, And Andy Hopper presented an article on "A ubiquitous, personalized computing environment for all Telephony in an X Window System Environment", in this article they presented X windows systems, X protocol for securing the communication between client and server. In the article, authors represented "System Software for Ubiquitous Computing" for integration of different kinds of network, also create connection among the devices in different types of network [7].
In 2002 researchers published an article entitled "Connecting the Physical World with Pervasive Networks", in this article they address the challenges and opportunities of instrumenting the physical world with pervasive networks of sensor-rich, embedded computation. The cloud computing came as a consequences of continues development of computing paradigms. The emergence of these technologies has established the appearance of (SaaS) software as a service which states that consumers are not required to purchase the software rather than baying according to their own demand [8].
In the med of 2006, Amazon achieved a prominent milestone by testing elastic computing cloud (EC 2) which initialized the spark of cloud computing in it. However, the term cloud computing has not coned until March 2007. The following year brought even more rapid development of the newly emerged paradigm. Furthermore, the cloud computing infrastructure services have widened to include (SaaS) software as a service.
In the mid of 2012, oracle cloud has been introduced, where it supports different deployment models. It is provisioned as the first unified collection of it solutions which is under continues developments. Nowadays, typing a cloud computing in any search engine will result in a tremendous result. For example, it would result more than 139,000,000 matches in Google.
In May 2014, Lihong Jiang et al published an article entitled "An IoT-Oriented Data Storage Framework in Cloud Computing Platform", they focused on data storage framework that is not only enabling efficient storing of massive IoT data, but also integrating both structured and unstructured data. In this article, introduced the IoT ecosystem and key technologies to support IoT communications [9].
In 2016, Maria Rita Palattella et al published an article entitled "Internet of Things in the 5G Era: Enablers, Architecture and Business Models", in this article they presented 5G technologies for the IoT, by considering both the technological and standardization aspects [10].
In 2018, Pradip Kumar Sharma, Mu-Yen Chen and Jong Hyuk Par published an article entitled, "A Software Defined Fog Node Based Distributed Blockchain Cloud Architecture for IoT". They presented software defined node using blockchain cloud for IoT [11].

III. CLOUD, FOG AND EMBEDDED DEVICES
The smart devices are increasing exponentially day by day in the whole world. They provide much more facility to the end users [12] and also attach with their daily life. Smart devices can connect to the internet easily for sending and receiving data within the network. The smart devices are not just smart phones, it may be smart refrigerator, Smart home automation entry point, smart air conditioners, Smart hubs, Smart thermostat [13], Color changing smart LEDs, Smart Watches and smart Tablets etc. in internet of things framework they are connected to each other through internet [14], [15]. The proposed research plan builds research on extending the communication in internet of things using fog and blockchain technology. The transfer data from one configuration to another using wireless networks starts from 1973 in the form of packets radio network [16]. They were able to communicate with another same configuration devices. Recent work is continuing on a project called the Serval Project [17]. It provides networks facility to android devices for communication in infrastructure less network. Whereas our research is concerned about the communication in internet of things [18].
The main contribution of this research is the creation of the communication framework and provides reliable and fast communication using fog and blockchain among the internet of smart devices. The previous studies have been focused on the creation and optimization the framework for communication, but such research doesn't perform the full framework for IoT-Fog communication among internet of smart devices. The main contribution of this research is designing a framework for communication in Internet of things using fog and blockchain technology [19]. The proposed framework is specifically appropriate for applications in which data is periodically transmitted in internet of smart devices environment. In these applications, on one hand, packets are being produced based on a certain periodic time pattern. On the other hand, service time is always a random variable with general distribution. Therefore, service time might temporarily exceed the period time which, as an inevitable consequence some packets might encounter a busy channel and be dropped [20], [21], [22]. We solve this problem by proposing the new middleware framework. We demonstrate that proposed IoT-Fog framework, not only increases the throughput, but also the direct connection between the generation (sensors) and communication packet systems are eliminated which make the system far more stable. Moreover, in order to enhance the proposed model, we have employed retransmission scheme, variable packet length, and saturated traffic condition. The solution of this research is summarized as follows. The implementation of IoT-Fog framework for communication among internet of smart devices in 5G will be programmed to execute on to the internet of things. The idea will implement into three-layer model, these layers are Fog, Blockchain and IoT. The proposed study supports the wireless networking technology to establish an IoT-Fog framework among internet of things devices [23], [24], [25].

V. RESULTS AND DISCUSSION
The proposed framework introduced and presented its role in IoT. The IoT-Fog framework has the following components:a) Fog computing with blockchain In the fog, the modality servers stored the secure resources, the proxies are third party servers that can store protected data and the owners are the legitimate machines [26], [27], [28]. The keys server in middleware generates the encryption and decryption keys. The token provided to the smart device by the authorized blockchains database has the authority to accesses the framework [29], [30], [31], request the keys from key server, fetch the data from cloud. The figure 2 presents the components of the proposed framework. The following steps are used in the proposed framework. 1. The smart contracts published by the modality servers, proxies and owners of fog in the authorized blockchains database. 2. The smart device of IoT finds the smart contacts from the authorized blockchains database. 3. The authorized blockchains database generates the token for the smart device of IoT. 4. The smart device requests the keys from key server in middleware and send the token with request. 5. The key server in middleware verify the token from authorized blockchain database and generates key for the smart device and response back to the smart device. 6. Now the smart device of IoT is authorized to access the data from the cloud.