Abstract
Fog computing enables the data analysis done nearer to the place of data generated, which makes a very short response time. Trust is essential for the effective performance of the fog nodes to overcome uncertainty, vulnerability, and risk. To enhance the trusted connection in fog computing, blockchain technology is adopted as a solution. Inclusion of blockchain in fog environment ensures consistency and security among the fog nodes. Each fog node mines every transaction and stores them as block creating a chain of blocks. In this proposed work, the adaption of blockchain technology is designed as a suitable solution for establishing trusted security between fog nodes and for which a qualitative assessment is done.
Introduction
Fog computing takes the responsibility of giving short time response to the events by avoiding the round trip to cloud for analysis. Fog node can be any device, which features computing, storage with network connectivity. Example includes routers, switches, servers etc. In recent researches, the usage of fog nodes in the IoT solutions are been considered as one of prominent solution. Furthermore, the blockchain technology is booming with a massive growth in implementation in the communities of distributed environment. This technology with its supportive features forms a decentralized, immutable and distributed record of transactions. Following are the key benefits of the blockchain technology in any applications implementation:
Blockchain technology can be treated as a key enabling technology for providing solutions for current challenging security problems encountered [1]. Usually the first factor of security, authentication relies on centralised system and will be done by a trusted third party system. However, centralized approach faces the problem of single point of failure, high cost and dependency, privacy elusion and hacking. To overcome these issues of centralized based authentication, the proposed work concentrates on a decentralized authentication approach using fog nodes and blockchain technology. By taking the advantage of fog node deployment, authentication is performed in the distributed manner using blockchain avoiding the centralized system dependency.
First most popular blockchain application is Bitcoin [2], with the arrival of Ethereum Blockchain [3], where smart contracts are implemented, makes ethereum a potential use space of blockchain enormously. It is a distributed, decentralised technology used to track and record digital actions [4]. According to [5], blockchain utilises a chain-like data structure, runs on a peer-to-peer network without a centralised trusted authority, and integrates encryption such as cryptographic hash and public-key cryptography. Different blocks that are connected together and have a high repetition rate include transactions. This makes it exceedingly difficult to alter any data on the blockchain because it is very difficult to add or delete any blocks, and if it does happen, it is quite visible. Blockchain also uses the Proof of Work (PoW) approach, which requires users to solve a difficult mathematical puzzle in order to validate transactions and add new blocks to the chain [4, 6]. The blocks in the ethereum blockchain holds the details of block height, timestamp, transactions, mined by, block reward, uncle’s reward, difficulty, total difficulty, size, gas used, gas limit and extra data. Each and every transaction holds the unique id called transaction hash/id where the detail of a particular transaction will be stored. Furthermore, ethereum blockchain mining time is less compared to the bitcoin to mine also; it is self-executable considering pre-defined conditions.
In this paper, the primary contributions are: Without the use of an intermediary or third-party service, we addressed the security of the Fog, particularly identity authentication of Fog nodes. A novel framework for secured data transfer is proposed using blockchain technology for tamper proof data utilization. An analytical analysis of the data security based on the block mining time shows the prevention of various security attacks and ensures the data consistency among the fog nodes. Our suggested sequence of action is decentralised and self-reliant, and it enhanced in terms of security by comparing with and without blockchain technology adaption.
The remaining paper includes literature survey, proposed work, implementation details, simulation results, conclusion, and future enhancements.
Literature survey
The Fog nodes, which are to a great degree of distributed computing needs the information driven security systems for worthiness is needed for the maintenances ofQoS (Quality of Service), which specifies the need to upgrade the security and trust of the Fog nodes in the fog computing environment [7]. Though the fog nodes in the fog computing provides many services to the connected end-users, it also focus on various security issues. The data from the end nodes travel across the network are open to different kinds of attacks. In fog computing, the data can be stored, analysed and processed anywhere between cloud and device. This increases the proximity of the data transmitted to be attacked. Therefore, there must always exist a risk to end users’ data security and privacy on being compromised by attackers and malicious insiders. Few of the solution include the usage of encryption algorithm as solution for the authentication and authorization, like implementation of ABE encryption in the fog level [8].
In recent times, the fog computing is being in applications of healthcare, smart applications, vehicular networks, etc., where the user data are highly vulnerable to attack. Relating to fog the attack is closer to the end user, as data are transmitted among the fog nodes. So, it is very important to address the security aspects in the fog layer. This shows the importance of real-time data to be focused more on security [9]. From the literature analysis done, it is quite evident that authentication is the most worked upon security issue (33.33%) at fog level while intrusion detection is the least explored one (9.87%). Through the analysis, authentication is found to be the most worked upon security issue while intrusion detection is the least addressed yet [10]. Having many different types of fog computing architecture from the point of applications, challenges, requirements, technologies used, fog, cloud and edge layers, the authors have recognized different patterns of the fog computing applied to healthcare [11]. As the fog computing supports the fact of collection and transmission of data to the cloud by the fog nodes, the concentration on data security, data privacy, interoperability and big data applied to fog computing in healthcare need secured collaboration among the heterogeneous resources [12].
Blockchain technology is used over the IoT devices for their security by ensuring the validity and integrity of the of the associated data to create a trustable environment in the industrial application [13]. The most popularly known and most valuable cryptocurrency are Bitcoin and Ethereum. Both work on the principle of blockchain technology, where the data are stored in blocks that are chained and adapt the feature of immutable. This intends to promote a trustable mechanism in a distributed peer-to-peer network, the validation of the transaction is based on the consensus done by the majority of the sensor nodes [14].
Most of the Fog computing authentication solutions now in use are centralized from both a representation and deployment standpoint, and they rely on a Trusted Third Party for Fog device authentication [15–18]. The efficiency, low scalability, data privacy, latency issues, single point of failure, high cost, and susceptibility to malicious attacks are some of the disadvantages of these techniques. To fix these problems, Fog devices must be authenticated using a decentralised authentication approach. As seen the fog nodes in the fog computing environment needs a trustable and secured data transmission in respectable to any application. This can be achieved by adapting blockchain technology, which creates a reliable environment as shown in Fig. 1. The capacity of the blockchain system to operate properly in a distributed environment without the assistance of a trusted third party is referred to as trustworthiness or trust-free. Blockchain technology, is been used for various purposes and in various domains. In few of the studies done, it is understood that integration of the blockchain technology for the purpose of establishing trust and security is possible. Moreover, the adaption of blockchain technology is very addressed least in fog computing environment for the security purpose. For secure device authentication and secured data transmission in fog computing, we have combined the strengths of blockchain technology and fog computing.

Blockchain technology in Fog Layer.
Blockchain technology, in simple words described as the chain of blocks. Each block holds the record of transactions over which advanced cryptography with computer science withholds the records that cannot be changed without anyone knowing. Once the data in the form of blocks are added to the blockchain, they become immutable and this make the data trustworthy information, which can be checked at any time by anybody. This property of the blockchain assures the trust over the data without trusting any third parties. Therefore, adaption of the blockchain technology in the fog layer makes all the data to be transferredbetween the fog nodes without trusting any centralized node when data are transmitted.
In various industries, implementation of blockchain technology removes the intermediaries and third parties from handling transactions where transactions are executed by connecting to the affiliated peers. This leads to the faster and cheaper transactions. This technology allows all the peers in the network share the same set of records making them public and they are constantly compared to make sure they are same. All the past transactions are permanently stored and modification of those details are not possible without others knowing.
Blockchain is secured with strong cryptographic mechanisms. All the data in the block are encrypted data. Since each and every transaction consist of public and private key where they form as a digital signature. Here, in blockchain Secure Hashing Algorithm (SHA-256)is used. Any data given to the algorithm becomes a hash data which when altered in the future makes the digital signature modified. The miner does the verification of every transaction, which is one of the nodes among the connected nodes in the blockchain network.
The Fig. 2, describe the proposed framework of implementation of the Ethereum blockchainin the fog-computing environment for secured data transfer among the fog nodes. When a Fog Node, FN1 is requesting the data from anotherFog Node FN2, the data are transmitted by submitting the data to the developed Ethereum Smart Contract. This smart contract is compiled and deployed in Ethereum Virtual Machine by the Fog Node 1, where on successful deployment the transaction is made as block and added to the distributed network of the ethereum blockchain. Using the transaction id and senders private key the data can be viewed by the FN2. As the data are hash values during transmission, they are safe and immutable.

Transaction between Fog Nodes using Ethereum Blockchain.
The supportingtools used to develop and deploy this system are given below:
The proposed system consists of a private network of the Ethereum blockchain. Ethereum is a decentralized open source Blockchain. The programmer VitalikButerin proposed it in 2013. The Ethereum Virtual Machine can execute the smart contracts and can run decentralized applications. This actively used Blockchain can be used in the applications of financial and non-financial transactions, where non-financial implementation includes land registry, supply chain, IoT surveillance, Public health, communication etc. This is the most actively used blockchain.
Smart contracts are a self-enforcing piece of software managed by peer-to-peer network. This acts as a management tool, which coordinates between the participants of the network on mutual agreement. It consists of functions, modifiers, mappings and events. Ethereum smart contract are compiled to EVM byte code and are executed in Ethereum blockchain for deployment.
Meta mask is a Ethereum wallet which is a browser plugin. The wallet can be used for interaction among the decentralized applications. In simple, it works as a bridge between web browser and ethereum blockchain network.
Remix is a IDE on open source web and also a desktop application. It has plugins with intuitive GUIs, which makes it stand-in fast development cycle. Remix IDE is used for the smart contract development and deployment.
Etherscan provides transparency to the users for the interaction with the smart contracts. Etherscan is a API for Ethereum developer. The transaction details of the ethereum blockchain can be viewed in Etherscan. In particular, for a transaction the transaction hash, block number, age (block’s life time), from (source), to (destination), value (Ethers transmitted) and txn fee (transaction fee in gas).
The implementation starts with creation of account in Metamask, where cryptocurrency wallet is created, which consists of ethers. More than one account can be created in the same wallet. In Metamask apart from Ethereum Mainnet, it supports four different types of testnet. For our setup, we assume five fog nodes in the ropsten testnet network for utilizing ethereum blockchain distributed web for execution.
To this account test ethers can be deposited. Each account, the considered fog node has individual hash address (public key) for identification and a private key in hash. Ingeneral when an Ether is transmitted from one account to another it needs gas price and gas limit as transaction fee charges. For non-financial transactions also the same manner is adopted. Etherscan is used to view all the transaction details using any one of the following attribute: address, Txn hash, block/token/ENS (Ethereum Name Service). Etherscan, which is a public ledger of the distributed ethereum network, displays the encrypted data using the fog node keys. We are utilizing the smart contract to be deployed in the distributed peer-to-peer fog nodes in the fog computing environment. The smart contract is developed in Solidity code, which is compiled and deployed in the Remix IDE.
Remix IDE is connected to the Metamask account by selecting Injected Web3 in environment field under deploy & run transactions. The other fields include our account name, which will hold the fog node public address, gas limit, gas value and the contract details.
On successful compilation of the smart contract, it is deployed to the sender fog node through its public address. Again the same contract will be deployed to the receiver fog node public address. Through the smart contract the data are transmitted securely. All the transaction details of the fog nodes can be viewed in Etherscan. The receiver node using its private key can decrypt the data transmitted.
Simulation results
As the blockchain supports a decentralized database records of the transactions from the beginning of the network, the entire network without the need to trust any central entity continuously verifies the data integrity. Because of this property,the security can be guaranteed by the size and computing power of the complete network participated in the blockchain. Any Fog node, which is a participant of a blockchain fog network, joins through a cryptocurrency wallet.A wallet is a public and private key pair, and that is used in the Transport Layer Security. Every transaction is broadcasted to the entire network and that is signed the senders private key. The network will validate the transaction and after validation, it will be added to the block. When the block is added to the blockchain network, it can be regarded as completed. Using the key-pair of a fog node, their identity on the blockchain is registered. The registered information will hold the node details in hash values containing different attributes. As these hash data cannot be modified, this process assures a strong authentication for each fog node.
By implementing the ethereum smart contract the peer-to-peer fog nodes communicate without any third party involved.This helps to build the trust between the fog nodes in the fog-computing environment. As the blocks in the blockchain network are immutable, the data transferred cannot be edited. If hacked, when verified with the other nodes in the network, they won’t have the same hash value, where the modification can be identified. The transmitted data in hash and encrypted values, in the distributed ropsten test network using the Etherscan tool as be viewed in real time. This assures the secured data transfer between the fog nodes.
Each transaction done by the fog node using the blockchain has to provide the transaction charges for performing a transaction, which actually will be given to the miner node on successful block creation. From Fig. 3 it is evident that, the increase in the gas charge reduces the transaction time, which in turn leads to the data security. As the time consumed by a transaction is less the attacks like man in the middle attack, denial of services etc., can be directly addressed. Figure 4 shows each transaction performance with respect to gas utilization.

Transaction Time and Gas Price.

Gas Utilization per Transaction.
The data stored and transmitted in blockchain network are tamper proof. Supporting the blockchain technology in the fog network of systems, the data is stored and transmitted as hash values. Considering the scenario in the recommender system, where one fog node is recommending the other fog node for trust and distrust of that node. Though the values are encrypted data, the chances of vulnerability are high. In this concept, the adaption of blockchain technology is showing results of being tamper proof when security concerns are raised. Figure 5 shows the comparison of the trust values shared between the fog nodes with blockchain and without blockchain.

Comparison of with and without Blockchain.
The proposed work assures in providing fog node authenticity and secured data transmission among the fog nodes. The implication of the ethereum smart contract supports the decentralized solution adapting peer-to-peer network model. The hash values are generated from the data values, any modification made to the original data will change the hash value generated. Adaption of the blockchain technology treats all the data in the system as hash values. Any change made in data on one will not affect the other fog nodes block values, which leads to easy identification of the intrusionoccurred. Results have shown that usage of the blockchain technology in the fog nodes has a trustable authentication of each other. With the usage of Ethereum blockchain takes a least computational time for transmitting a secured data from one fog node to other fog node.In addition, with the increased transaction fee, the block computation time is reduced which lowers the chance of the intrusion attacks like DDoS, man in the middle attack etc. The future work needs the analysis of the different consensuses used for the blockchain technology used to for the better handling of sensitive data.
Funding
Not applicable
Availability of data and material
Not applicable
Code availability
Not applicable
