# Authenticated Wireless Links between a Drone and Sensors Using a Blockchain: Case of Smart Farming

Authors: Kahlid S. Alqarni; Faris A. Almalki; Ben Othman Soufiene; Obaid Ali; Faisal Albalwy
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

Agriculture is confronted with several significant difficulties, such as rising air temperatures and population growth, causing the implementation of smart farming operations as an optimum solution. This research aims to contribute to the growing knowledge of the potential role of blockchain technology in promoting the concept of smart farming by enhancing the efficiency of farming operations by boosting agricultural production, lowering environmental impact, and automating the work of farmers. It proposes a secure blockchain-based framework to establish trust among smart farming users. The framework utilizes asymmetric key exchange mechanism using an ECC authentication algorithm and SHA-256 hash function cryptography to secure communication between sensors and drones in the farm field. The SHA-256 hashing function ensures data integrity as attempts to tamper with data result in a different hash value, breaking the chain of blocks. To demonstrate the feasibility of the proposed framework, a proof-of-concept implementation was developed on the Ethereum blockchain, in which smart contracts were used to model the framework operations. The proof of concept’s performance was examined using Hyperledger Caliper for latency, throughput, and transaction success rate. The findings clearly indicate that blockchain technology can provide an efficient and scalable mechanism to advance smart farming and address some of the barriers that inhibit smart farming, particularly regarding to data integrity and availability.


---

## Body

## 1. Introduction

Smart farming refers to the use of various technologies and gadgets, such as the Internet, cloud, and IoT devices. By 2050, the world’s population is projected to reach 9.7 billion people, requiring greater agricultural production to feed those billion people [1]. Because of causes like as industrialization, commercial marketplaces, and residential structures being constructed on agricultural areas, the population is increasing, while agricultural land is decreasing. Using these works need to be boosted for output to feed these billions, which can be done by integrating IoT in farming as shown in Figure 1. Due to several reasons, including insect attacks, plant disease, a lack of knowledge about essential nutrients for crops, and other problems, farmers are no longer able to enjoy the benefits of their work. To eliminate these obstacles and make farming more profitable, smart, and enjoyable for farmers, technological advancement is needed [2]. In every way, smart farming and conventional farming are diametrically opposed. Without regard for market demand, rates, weather predictions, or other variables, traditional farming uses historic and traditional agricultural methods, as well as antiquated equipment for labor and seasonal crop production. Smart farming takes use of modern technology like smart linked devices, Internet of Things sensors, a farmers’ chat room, and continuous evaluations of different variables like the optimum circumstances for a plant to develop, the quantity of nutrients needed, soil quality, and water quality monitoring. Smart farming lowers labor costs, boosts crop yields, and enhances production while making farming easy and cheap (cost-effective). Agriculture has progressed to the point where smart farming is the next stage. The use of the Internet of Things (IoT) and unmanned aerial vehicle (UAV) technologies to enhance the efficiency of agricultural operations is referred to as smart farming [3].Figure 1
Example of the smart farming application.A UAV may autonomously and properly reacts to its surroundings based on its context. Agricultural products must be increased mostly because to the rapid expansion of the global population, despite substantial contributions from scientific discoveries in genetics, chemistry, and robotics to the improvement of agricultural technology [4]. At the same time, the agricultural sector is confronted with major challenges such as climate change, land scarcity, and the growing need for freshwater. Information and Communication Technology (ICT) services may be a potential solution to these pressing issues.UAVs and the IoT are two of the most popular technologies being used for civilian and industrial reasons, as well as to support Industry 4.0. An unmanned aerial vehicle (UAV) is a remotely controlled autonomous vehicle that does not need a human pilot. Unmanned aerial vehicles (UAVs) were originally developed for military purposes, but their growing popularity and technological developments have highlighted their potential for civilian and industrial applications [5, 6]. The Internet of Things (IoT) allows a large number and diversity of linked devices, allowing for remote monitoring and control of various activities [7]. Smart homes or home automation, smart cities, security and surveillance applications, remote patient monitoring, and precision agriculture are all examples of IoT use cases [8–10].The combination of these two technologies (UAV and IoT) expands the number of options for improving people’s lives. Data collection operations in UAV-based applications may be aided by a well-implemented Internet of Things architecture. While UAVs may help gather data from difficult places for IoT applications, the usage of sensor-equipped UAVs in municipal and industrial applications is expanding IoT’s power. According to research, UAV-enabled IoT systems might be utilized for a variety of interesting and helpful applications. UAV and IoT integration applications are aimed at smart cities, agriculture, healthcare, disaster management, rescue operations, supply chains, and geoscience [11–13]. Combining UAVs with IoT has a lot of promise, but it also has a lot of technical and legal issues. Examples of applications include air traffic control, obstacle detection, flight schedule and path integrity, the use of different communications designs, data collection via sensors, actual or near real-time data analysis and delivery, and lightweight encryption algorithm to align with restricted on-board resources.As an emerging technology, blockchain applications are being explored in various industries, including healthcare [14–17], finance [18, 19], real estate [20, 21], agriculture [22, 23], and education [24, 25]. Blockchain implementation is ideal for communication networks, thanks to new improvements in blockchain technology such as decentralization, immutability, security, and transparency. A blockchain is an immutable database that nodes in a distributed and decentralized peer-to-peer network continually update and agree on [26]. Elliptic-curve Public-Key Cryptography is the most prevalent public-key cryptographic technique used in blockchain technology (ECC). This technique has an advantage over Public-Key Cryptography (PKC) in that the authentication and transparency of new transactions are dependent on a widespread agreement among its users. As a result, deploying blockchain technology for distributed UAV networks might provide a slew of security advantages.The main contribution of this paper is threefold. Firstly, it proposed a novel blockchain-based framework to support Authenticated Wireless Links between a Drone and Sensors. Secondly, it demonstrated a proof-of-concept implementation for the proposed framework by walking through an intelligent farming case study. Lastly, it provided a performance evaluation of the implemented proof of concept.


## 2. Related Works

The UAV networks’ drones can communicate with one another over a wireless link. UAV networks are vulnerable to forgery attacks, man-in-the-middle attacks, and reply to assaults due to their low computing capacity and complicated external environment. Before the drones may communicate with each other, identity authentication is critical, and assuring a legal drone in the network is the top priority of UAV network security. Traditional authentication mechanisms based on username/password or dynamic key have a low level of security. RSA certification necessitates the use of a lengthy session key, which is incompatible with the lightweight requirements of UAV networks. Many security issues are avoided by blockchain’s decentralization and secure communications using public cryptography.This research [9] proposed VAHAK, an Ethereum blockchain-based secure outdoor healthcare medical supply using UAVs. VAHAK enables timely delivery of important medical supplies to critical patients by facilitating decentralized communication between UAVs and entities. In VAHAK, the Ethereum smart contract was utilized to address concerns about security, privacy, and dependability, while the IPFS protocol was used to address storage costs. The VAHAK’s security vulnerabilities are tested using the open-source application MyThril. VAHAK is cost-effective in terms of data storage since it uses the InterPlanetary File System (IPFS) for healthcare record storage and 5G-enabled Tactile Internet (TI) for communication. Finally, when compared to conventional systems, VAHAK performance assessment outperformed existing approaches in various performance evaluation parameters such as scalability, latency, and network capacity.Authors in [27] suggested a blockchain-based intelligent technique for securing the privacy of unmanned aerial vehicles (UAVs) and drones. They presented the hashing process and how it was used in their system, including the creation of a hash code. They created a security mechanism that encrypts information using hashing by combining picture collection and sensing from drones and UAVs with blockchain security. All transactions between the server and the drone, as well as the drone’s GPS position, were tracked using the timestamp.Researchers in [28] built a blockchain-based access management system for the IoD environment, which allows for secure communication between drones and the GSS. Secure data is collected by the GSS in the form of transactions, which are subsequently converted into blocks. Finally, in a peer-to-peer cloud server network, cloud servers connected to the GSS through the Ripple Protocol Consensus Algorithm (RPCA) upload the blocks to the blockchain. After they have been added to the blockchain, the transactions in the blocks cannot be modified, edited, or even removed. They carried out several security analyses, including formal security under the random oracle model, informal security, and simulation-based formal security verification, to ensure that the proposed scheme can withstand a wide range of potential attacks with a high probability, as is required in an IoD environment.According to Khalifeh et al. [29], a UAV might be used as a data mule to unload sensor nodes and securely transfer monitoring data to a remote control center for further analysis and decision-making. They also spoke about the challenges of putting the proposed framework into reality. Experimenting with their suggested design in the presence of different types of obstructions may be found in typical outdoor fields. During the testing, some differences between the performance metrics provided in the hardware-specific datasheets were uncovered. They uncovered disparities between the declared coverage distance and signal strength via their experiments.A study in [30] employed a blockchain-enabled identity authentication scheme and a safe data sharing paradigm for drones. Authentication and access control are handled by smart contracts, account creation and security are handled by Public-Key Cryptography, and security auditing is handled by a distributed ledger. To speed up outsourced calculations, ABEM-POC, which is based on the Spark cluster and MapReduce architecture, is presented. The ABE and a modified approach based on ABEM-POC can be used to facilitate parallel outsourced computations. The results showed that both the ABEM-POC and general techniques were successful and straightforward to implement.ACSUD-IoD, an access control approach for illegal UAV detection and mitigation in an IoD environment, was presented by the authors in [31]. The transactional data to the GSS was stored on a private blockchain, allowing the GSS to identify unauthorized UAVs. They used a range of security tests to show that the suggested system is resilient to a variety of potential attacks that may occur in an IoD environment. Many cryptographic primitives’ effectiveness and resilience have been shown in trials.This study in [32] offered a novel approach for safeguarding communications between unmanned aerial vehicles (UAVs) engaged in various tasks. A one-of-a-kind method for UAVs to enable network transactions without delivering encrypted communications is included in the proposed technique. They also proposed a consensus method based on the proof of communication. They concluded that the suggested approach may be used safely in communication networks.To mitigate such attacks and achieve trust, this paper [33] proposed a new and systematic framework that combines interest-key-content binding (IKCB), forwarding strategy, and on-demand verification to investigate poisoned content quickly and effectively in NDN-based unmanned aerial vehicles ad hoc networks (UAANETs). They presented a permissioned blockchain network built on top of NDN, as well as a scalable adaptive delegate consensus approach for providing a decentralized IKCB store and detecting internal attackers. Their results show that the suggested architecture may effectively cleanse poisoned material at a low cost and that their techniques performed well enough to be suitable for UAANETs.In this research [34], the SENTINEL architecture was proposed to facilitate mutual authentication between drones and base stations. SENTINEL generates a flight session key for a drone with a flight plan and registers the flight session key and the drone’s flight plan in a centralized database accessible by all ground stations. Ground stations utilize the registered flight session key to authenticate the drone as the MAC key when it is flying. We devised a straightforward certificate format that may be utilized in IoD scenarios. The proposed certificate is designed to convey just the bare minimum of data required to construct public key infrastructure in the Internet of Things (IoT) scenarios. To reduce certificate size even further, they chose a binary format instead of the human-readable text format used in X.509 v3 certificates.A unique task-oriented authentication method based on blockchain (ToAM) for UAVs was proposed in [35]. They divided UAV authentication into group building authentication and intragroup authentication using a two-stage authentication architecture. They also exhibited a lightweight and cross-domain authentication system based on blockchain that enables for the secure purchase of cross-domain UAVs and task group setup. The job is then performed utilizing a chord ring and a preshared key authentication protocol, which allows for quick and secure authentication inside the UAV group even when the network connection is poor.The authors of [36] presented a mutual-healing group key distribution technique based on blockchain. The GCS group keys are stored on a private blockchain that is integrated into the Ground Control Station (GCS). Meanwhile, the blockchain was used to manage a dynamic list of UAANET membership certificates. According to different attack situations, a basic mutual-healing protocol and an upgraded one were designed based on the Longest-Lost-Chain approach to recover the node’s lost group keys with the aid of its neighbors.AKMS-AgriIoT, a private blockchain-based system (IPA) for Intelligent Precision Agriculture, was recommended in this study [37]. To confirm and add the blocks created by the encrypted transactions and their accompanying signatures by the GSS to the private blockchain center, the cloud servers mine them. According to extensive security analysis and comparative study, the recommended AKMS-AgriIoT was also given. Table 1 presents a comparison between the existing literature and the proposed framework.Table 1
A comparison between existing literature and the proposed framework.
Article ref.Aerial platformHash function cryptographyBlockchain-basedSystem evaluated?Security frameworkContributionIssues[28]✔╳╳╳RPCA protocolLink between the GSS and cloud serversHigh-cost complex[30]✔╳✔╳Public keyABEM-POCRetrieve keyHigh cost[31]✔╳✔╳Private keyACSUD-IoDHigh-cost complex[32]✔✔✔╳Public key, OTP encryptionDecentralized securing communicationsNot able to authenticate in weak connections[33]✔╳╳╳Systematic keySDN and NFV-based fleetAuthentication in weak connections[34]✔╳╳╳Public keyBinary format, SENTINEL produces a flight session keyComplex, retrieve key, cost[36]✔╳╳╳Private keyLongest-Lost-Chain method, dynamic list certificatesComplex[37]✔╳✔╳Private keyAKMS-AgriIoT + AICloud server costProposed framework✔✔✔✔ECC asymmetric keySHA256 hashing + IPFS data using a smart contractComplex


## 3. Materials and Methods

### 3.1. Elliptic Curve Cryptographic Protocols (ECC)

ECC is a modern family of public-key cryptosystems based on the algebraic structures of elliptic curves over finite fields and the Elliptic Curve Discrete Logarithm Problem’s difficulty (ECDLP) [38–40]. ECC provides asymmetric cryptosystem features such as encryption, signatures, and key exchange. ECC is a logical successor to the RSA cryptosystem since it requires fewer keys and signatures to provide the same degree of security as RSA and allows for very fast key generation, key agreement, and signatures. In the ECC, the private keys are integers (typically 256-bit integers in the field size range of the curve). In ECC cryptography, key generation is as easy as dependably generating a random integer inside a given range, making it very quick. A valid ECC private key is an integer within the range.The ECC’s public keys are the EC points, which are pairs of integer coordinatesx, y that fall on the curve. Because of their unique properties, EC points may be reduced to only one coordinate plus one bit (odd or even). As a result, the compressed public key is a 257-bit integer, which is equivalent to a 256-bit ECC private key. An ECC public key is an example (corresponding to the above private key, encoded in the Ethereum format, as hex with prefix 02 or 03). The public key needs 33 bytes (66 hex digits) in this format, which may be lowered to roughly 257 bits.The PKC is a method of generating a pair of keys: public keys that are widely distributed and private keys that are only known by the authorized owner. This serves two purposes: authentication (the public key confirms that the message was sent by the owner of the private key) and encryption (the message can only be decoded by the owner of the associated private key). In this section, ECC has been used for PKC since it provides stronger security with shorter computation time than DSA and RSA. The purpose of Pseudocode1 is to generate public and private key pairs for authorized users while also sharing data from the smart contract. The computation time for key creation is the same as for symmetric cryptography, but it provides data security and authentication. In the next asymmetric key algorithm of our proposal, we uses private key and public key (private key to Pr key, public key to Pu) [41].Pseudocode 1: Generate ECC asymmetric Key exchange.
Input: Eq (a, b), G, qOutput: generate Pr key, Pu key1. Eq (a, b): The parameter of ECC that include a,b,q where q is a prime number and form of 2m2. G: specific point on curve whose order is big value ‘n’.3. generate UserA key and Pr key select nA; nA < n, where n is limitation of curve point.4. Calculate Pu key pA; pA = nA∗ G5. UserB key generate, and Pr key select nB; nB < n, where n is limit of curve point.6. Pu keys calculate pB; pB = nB∗ G7. UserA key calculate KA = nA∗ pB8. UserB key calculate KB = nB∗ pAAs shown in Pseudocode2, the UserA encrypt message ‘M’ by the UserB public key pB, so that only authorized UserB can decrypt the message. UserA encrypts message ‘M’ using the UserB public key PB, as described in Pseudocode 2, so that only authorized UserB can decode the message.Pseudocode 2: Encrypting data using ECC.
Next steps made by the UserA: -1. Suppose message be ‘M’2. Encoding the message ‘M’ into a point on the elliptic curve3. Let the point be Pm4. Choose a random + integer ‘K’ to encrypt the point5. Cm =K∗G∗Pm +KpB where G is the base point.In Pseudocode3 [41], the message was decrypted by UserB using the private key KB. Because of PKC’s secret key mechanism, the message’s originality cannot be tampered with.Pseudocode 3: Decrypting data using ECC.
The UserB recipient does next steps: -1. Multiplication between first point in the pair with UserB secret key2. Compute KB∗G∗nB3. subtraction it from second point in the pairPm +K∗pB - (K∗G∗nB)Pm +K∗pB - (K ∗ pB) =Pm, where [ nB∗G=pB]


### 3.2. Hash Function Cryptography

Several hash functions are widely used in different applications, including MD5, SHA-160, and SHA-256. The MD5 produces a 128-bit hash value, whereas the SHA-160 and SHA-256 produce a 160-bit and a 256-bit hash value, respectively. Some hash functions have demonstrated weaknesses throughout further research, though all are considered adequate for noncryptographic applications. For instance, vulnerabilities were discovered in MD5, and it is no longer recommended for cryptographic applications, but it is still used to validate file transfers and database partitioning [42]. Similarly, vulnerabilities were discovered in SHA-160, which is no longer recommended for cryptographic applications [43]. On the other hand, the SHA-256 is recommended by the National Institute of Standards and Technology (NIST) to use instead of MD5 or SHA-160 for cryptographic applications [44].SHA-256 (secured hashing, FIPS 182-2) is a 256-bit digest cryptographic algorithm. It is an MDC or a unique hash function (Manipulation Detection Code) [45]. A message is broken down into 512=16×32-bit blocks, with each block taking 64 rounds [46, 47]. The 32 initial bits of the fractions portions of the cube roots of the first 64 prime integers gives us the 64 binary characters Ki as shown in Figure 2.Figure 2
A hash function mechanism with length of 256 bits.


## 3.1. Elliptic Curve Cryptographic Protocols (ECC)

ECC is a modern family of public-key cryptosystems based on the algebraic structures of elliptic curves over finite fields and the Elliptic Curve Discrete Logarithm Problem’s difficulty (ECDLP) [38–40]. ECC provides asymmetric cryptosystem features such as encryption, signatures, and key exchange. ECC is a logical successor to the RSA cryptosystem since it requires fewer keys and signatures to provide the same degree of security as RSA and allows for very fast key generation, key agreement, and signatures. In the ECC, the private keys are integers (typically 256-bit integers in the field size range of the curve). In ECC cryptography, key generation is as easy as dependably generating a random integer inside a given range, making it very quick. A valid ECC private key is an integer within the range.The ECC’s public keys are the EC points, which are pairs of integer coordinatesx, y that fall on the curve. Because of their unique properties, EC points may be reduced to only one coordinate plus one bit (odd or even). As a result, the compressed public key is a 257-bit integer, which is equivalent to a 256-bit ECC private key. An ECC public key is an example (corresponding to the above private key, encoded in the Ethereum format, as hex with prefix 02 or 03). The public key needs 33 bytes (66 hex digits) in this format, which may be lowered to roughly 257 bits.The PKC is a method of generating a pair of keys: public keys that are widely distributed and private keys that are only known by the authorized owner. This serves two purposes: authentication (the public key confirms that the message was sent by the owner of the private key) and encryption (the message can only be decoded by the owner of the associated private key). In this section, ECC has been used for PKC since it provides stronger security with shorter computation time than DSA and RSA. The purpose of Pseudocode1 is to generate public and private key pairs for authorized users while also sharing data from the smart contract. The computation time for key creation is the same as for symmetric cryptography, but it provides data security and authentication. In the next asymmetric key algorithm of our proposal, we uses private key and public key (private key to Pr key, public key to Pu) [41].Pseudocode 1: Generate ECC asymmetric Key exchange.
Input: Eq (a, b), G, qOutput: generate Pr key, Pu key1. Eq (a, b): The parameter of ECC that include a,b,q where q is a prime number and form of 2m2. G: specific point on curve whose order is big value ‘n’.3. generate UserA key and Pr key select nA; nA < n, where n is limitation of curve point.4. Calculate Pu key pA; pA = nA∗ G5. UserB key generate, and Pr key select nB; nB < n, where n is limit of curve point.6. Pu keys calculate pB; pB = nB∗ G7. UserA key calculate KA = nA∗ pB8. UserB key calculate KB = nB∗ pAAs shown in Pseudocode2, the UserA encrypt message ‘M’ by the UserB public key pB, so that only authorized UserB can decrypt the message. UserA encrypts message ‘M’ using the UserB public key PB, as described in Pseudocode 2, so that only authorized UserB can decode the message.Pseudocode 2: Encrypting data using ECC.
Next steps made by the UserA: -1. Suppose message be ‘M’2. Encoding the message ‘M’ into a point on the elliptic curve3. Let the point be Pm4. Choose a random + integer ‘K’ to encrypt the point5. Cm =K∗G∗Pm +KpB where G is the base point.In Pseudocode3 [41], the message was decrypted by UserB using the private key KB. Because of PKC’s secret key mechanism, the message’s originality cannot be tampered with.Pseudocode 3: Decrypting data using ECC.
The UserB recipient does next steps: -1. Multiplication between first point in the pair with UserB secret key2. Compute KB∗G∗nB3. subtraction it from second point in the pairPm +K∗pB - (K∗G∗nB)Pm +K∗pB - (K ∗ pB) =Pm, where [ nB∗G=pB]


## 3.2. Hash Function Cryptography

Several hash functions are widely used in different applications, including MD5, SHA-160, and SHA-256. The MD5 produces a 128-bit hash value, whereas the SHA-160 and SHA-256 produce a 160-bit and a 256-bit hash value, respectively. Some hash functions have demonstrated weaknesses throughout further research, though all are considered adequate for noncryptographic applications. For instance, vulnerabilities were discovered in MD5, and it is no longer recommended for cryptographic applications, but it is still used to validate file transfers and database partitioning [42]. Similarly, vulnerabilities were discovered in SHA-160, which is no longer recommended for cryptographic applications [43]. On the other hand, the SHA-256 is recommended by the National Institute of Standards and Technology (NIST) to use instead of MD5 or SHA-160 for cryptographic applications [44].SHA-256 (secured hashing, FIPS 182-2) is a 256-bit digest cryptographic algorithm. It is an MDC or a unique hash function (Manipulation Detection Code) [45]. A message is broken down into 512=16×32-bit blocks, with each block taking 64 rounds [46, 47]. The 32 initial bits of the fractions portions of the cube roots of the first 64 prime integers gives us the 64 binary characters Ki as shown in Figure 2.Figure 2
A hash function mechanism with length of 256 bits.


## 4. The Proposed Framework

### 4.1. Framework Design

There are many different interpretations of security. Confidentiality, which prevents unauthorized release of information, integrity, which prevents illegal change or deleting data, and availability, which prevents unauthorized withhold of data, make up security [48].One of the most important aspects of any information system is data integrity. Protecting data from illegal alteration, deletion, or fabrication is known as data integrity. Managing an entity’s access and rights to certain corporate resources helps to guarantee that sensitive data and services are not misused, misappropriated, or stolen. Authorization is a method of restricting data access. It is the method through which a system determines what level of access a certain authorized user should have to the system’s secure resources. To establish a solid cryptographic authentication, the authentication technique we used here is an asymmetric key exchange with an ECC authentication algorithm and SHA-256 hashed data within a smart contract. Because the data is hashed using the proposed SHA-256 method before being stored inside a blockchain, this approach ensures data integrity benefits because users can compute the hash data each time, they want to retrieve hashed data.The proposed model consists of two parts on-chain components and off-chain components to guarantee data availability between users. The components of mentioned On-chain are a smart contract and blockchain. The Interplanetary File System (IPFS) (https://ipfs.io/) is a system that allows IPFS which is a peer-to-peer file-sharing system that authenticates and transports data using cryptographic hash functions.The primary goal of IPFS is to efficiently store large files. When storing private or secret data on the cloud, data confidentiality is critical. A data confidentiality, authentication, and access control might be solved by improving cloud reliability and trustworthiness so that we propose an on-chain components based blockchain and off-chain components based IPFS. It makes use of a distributed architecture-based file storage system in which each server may save a fraction of the complete data, resulting in a reliable file storage and sharing system. IPFS uses content addresses to name files. Signals, photos, and any other types of data can be saved on an IPFS server in a system context. Figure3 describes the transfer process between on-chain and off-chain components and presents the communication between user’s keys from different users to transmit read/write secured data procedures. An off-chain component is presented to minimize the cost of the model and guarantee the model privacy. To build off-chain storage to our proposal, an IPFS for key management data is presented to make a decentralized system more secured. The off-chain components The off-chain components is commonly used forfor data storage and to ease an increase the communication simplicity. The proposed EEC cryptographic algorithm is used for secure authentication process between sensors, and drones. All user’s data are stored in the IPFS data to let the model be integrated and lightweight as the blockchain cannot store a lot of data.Figure 3
A general diagram of the proposed framework.Then smart contract is created and stores all users’ cryptographic keys then connected with blockchain as on-chain components stage using Solidity Language for creating the proposed smart contract. Solidity is a high-level object-oriented language for creating smart contracts. Smart contracts are well-known software that able to control of how accounts behave in the Ethereum state.


### 4.2. Smart Contract

The system smart contract contains three main functions namelyregisterNewUser, requestData, and provideData. Table 2 provides a description of each function in the smart contract.Table 2
System’s smart contracts main functions.
#FunctionDescriptions1registerNewUserThis function is responsible for registering a new users in the system2requestDataThis function is responsible for requesting data from a specific user in the system3provideDataThis function is responsible for storing requested data


#### 4.2.1. The registerNewUser Function

Algorithm1 describes the process of registering new system users. This function is executed by the user passing the relevant information, including user wallet address, user public key, and role. Based on the user role, smart contracts store user information in the relevant on-chain storage. The smart contract then notifies the system admin, who is responsible for setting up the system, to validate users’ information through an off-chain process. After successful validation, the admin executes a specific smart contract function to approve the user registration request.Algorithm 1: registerNewUser.
Input: wallet, publicKey, roleOutput: response1 User⟵mapping2ifUserwallet.wallet==nullthen3  User.insert(wallet, [wallet, publicKey, role])4  response:successful5else6 response: revert smart contract state


#### 4.2.2. The registerNewUser Function

Algorithm2 describes the process of requesting data from a specific user in the system. The function utilizes a mapping data structure for efficient data storing and retrieval. The request information includes the request identification number, sensor wallet address, and drone wallet address. When request information is stored, the smart contract notifies the relevant user to process the request.Algorithm 2: : requestData
Input: id, semsorWallet, dronerWalletOutput: response1 Request⟵mapping2ifUsersensorWallet.role==SensorANDUserdronerWallet.role==dronerthen3  Request.insert(id,[sensorWallet, dronerWallet])4  response:successful5else6 response: revert smart contract state


#### 4.2.3. The provideData Function

Algorithm3 describes the process of providing requested data. To provide data for a specific request, the relevant user, the data owner, prepares the requested data and then executes this function, passing the request identification number and the data. When requested data is available, the smart contract notifies the relevant user to retrieve the data.Algorithm 3: provideData.
Input: id, sensorWallet, encryptedDataOutput: response1 Request⟵mapping2ifUsersensorWallet.role==SensorANDUserdronerWallet.role==dronerthen3  Request.insert(id, [encryptedData])4  response:successful5else6  response: revert smart contract state


## 4.1. Framework Design

There are many different interpretations of security. Confidentiality, which prevents unauthorized release of information, integrity, which prevents illegal change or deleting data, and availability, which prevents unauthorized withhold of data, make up security [48].One of the most important aspects of any information system is data integrity. Protecting data from illegal alteration, deletion, or fabrication is known as data integrity. Managing an entity’s access and rights to certain corporate resources helps to guarantee that sensitive data and services are not misused, misappropriated, or stolen. Authorization is a method of restricting data access. It is the method through which a system determines what level of access a certain authorized user should have to the system’s secure resources. To establish a solid cryptographic authentication, the authentication technique we used here is an asymmetric key exchange with an ECC authentication algorithm and SHA-256 hashed data within a smart contract. Because the data is hashed using the proposed SHA-256 method before being stored inside a blockchain, this approach ensures data integrity benefits because users can compute the hash data each time, they want to retrieve hashed data.The proposed model consists of two parts on-chain components and off-chain components to guarantee data availability between users. The components of mentioned On-chain are a smart contract and blockchain. The Interplanetary File System (IPFS) (https://ipfs.io/) is a system that allows IPFS which is a peer-to-peer file-sharing system that authenticates and transports data using cryptographic hash functions.The primary goal of IPFS is to efficiently store large files. When storing private or secret data on the cloud, data confidentiality is critical. A data confidentiality, authentication, and access control might be solved by improving cloud reliability and trustworthiness so that we propose an on-chain components based blockchain and off-chain components based IPFS. It makes use of a distributed architecture-based file storage system in which each server may save a fraction of the complete data, resulting in a reliable file storage and sharing system. IPFS uses content addresses to name files. Signals, photos, and any other types of data can be saved on an IPFS server in a system context. Figure3 describes the transfer process between on-chain and off-chain components and presents the communication between user’s keys from different users to transmit read/write secured data procedures. An off-chain component is presented to minimize the cost of the model and guarantee the model privacy. To build off-chain storage to our proposal, an IPFS for key management data is presented to make a decentralized system more secured. The off-chain components The off-chain components is commonly used forfor data storage and to ease an increase the communication simplicity. The proposed EEC cryptographic algorithm is used for secure authentication process between sensors, and drones. All user’s data are stored in the IPFS data to let the model be integrated and lightweight as the blockchain cannot store a lot of data.Figure 3
A general diagram of the proposed framework.Then smart contract is created and stores all users’ cryptographic keys then connected with blockchain as on-chain components stage using Solidity Language for creating the proposed smart contract. Solidity is a high-level object-oriented language for creating smart contracts. Smart contracts are well-known software that able to control of how accounts behave in the Ethereum state.


## 4.2. Smart Contract

The system smart contract contains three main functions namelyregisterNewUser, requestData, and provideData. Table 2 provides a description of each function in the smart contract.Table 2
System’s smart contracts main functions.
#FunctionDescriptions1registerNewUserThis function is responsible for registering a new users in the system2requestDataThis function is responsible for requesting data from a specific user in the system3provideDataThis function is responsible for storing requested data


### 4.2.1. The registerNewUser Function

Algorithm1 describes the process of registering new system users. This function is executed by the user passing the relevant information, including user wallet address, user public key, and role. Based on the user role, smart contracts store user information in the relevant on-chain storage. The smart contract then notifies the system admin, who is responsible for setting up the system, to validate users’ information through an off-chain process. After successful validation, the admin executes a specific smart contract function to approve the user registration request.Algorithm 1: registerNewUser.
Input: wallet, publicKey, roleOutput: response1 User⟵mapping2ifUserwallet.wallet==nullthen3  User.insert(wallet, [wallet, publicKey, role])4  response:successful5else6 response: revert smart contract state


### 4.2.2. The registerNewUser Function

Algorithm2 describes the process of requesting data from a specific user in the system. The function utilizes a mapping data structure for efficient data storing and retrieval. The request information includes the request identification number, sensor wallet address, and drone wallet address. When request information is stored, the smart contract notifies the relevant user to process the request.Algorithm 2: : requestData
Input: id, semsorWallet, dronerWalletOutput: response1 Request⟵mapping2ifUsersensorWallet.role==SensorANDUserdronerWallet.role==dronerthen3  Request.insert(id,[sensorWallet, dronerWallet])4  response:successful5else6 response: revert smart contract state


### 4.2.3. The provideData Function

Algorithm3 describes the process of providing requested data. To provide data for a specific request, the relevant user, the data owner, prepares the requested data and then executes this function, passing the request identification number and the data. When requested data is available, the smart contract notifies the relevant user to retrieve the data.Algorithm 3: provideData.
Input: id, sensorWallet, encryptedDataOutput: response1 Request⟵mapping2ifUsersensorWallet.role==SensorANDUserdronerWallet.role==dronerthen3  Request.insert(id, [encryptedData])4  response:successful5else6  response: revert smart contract state


## 4.2.1. The registerNewUser Function

Algorithm1 describes the process of registering new system users. This function is executed by the user passing the relevant information, including user wallet address, user public key, and role. Based on the user role, smart contracts store user information in the relevant on-chain storage. The smart contract then notifies the system admin, who is responsible for setting up the system, to validate users’ information through an off-chain process. After successful validation, the admin executes a specific smart contract function to approve the user registration request.Algorithm 1: registerNewUser.
Input: wallet, publicKey, roleOutput: response1 User⟵mapping2ifUserwallet.wallet==nullthen3  User.insert(wallet, [wallet, publicKey, role])4  response:successful5else6 response: revert smart contract state


## 4.2.2. The registerNewUser Function

Algorithm2 describes the process of requesting data from a specific user in the system. The function utilizes a mapping data structure for efficient data storing and retrieval. The request information includes the request identification number, sensor wallet address, and drone wallet address. When request information is stored, the smart contract notifies the relevant user to process the request.Algorithm 2: : requestData
Input: id, semsorWallet, dronerWalletOutput: response1 Request⟵mapping2ifUsersensorWallet.role==SensorANDUserdronerWallet.role==dronerthen3  Request.insert(id,[sensorWallet, dronerWallet])4  response:successful5else6 response: revert smart contract state


## 4.2.3. The provideData Function

Algorithm3 describes the process of providing requested data. To provide data for a specific request, the relevant user, the data owner, prepares the requested data and then executes this function, passing the request identification number and the data. When requested data is available, the smart contract notifies the relevant user to retrieve the data.Algorithm 3: provideData.
Input: id, sensorWallet, encryptedDataOutput: response1 Request⟵mapping2ifUsersensorWallet.role==SensorANDUserdronerWallet.role==dronerthen3  Request.insert(id, [encryptedData])4  response:successful5else6  response: revert smart contract state


## 5. Results

### 5.1. A Proof of Concept

We implemented a proof of concept to demonstrate the feasibility of the proposed framework. We used Hyperledger Besu (https://www.hyperledger.org/use/besu) to build a permissioned blockchain. The system smart contract was written using the Solidity programming language, where the Truffle framework (https://www.trufflesuite.com/truffle), an Ethereum smart contracts development tool, was used to test, compile, and deploy the system smart contract. In Figure 4, a screenshot of the system smart contract shows a screenshot of the system smart contract, whereas in Figure 5, the result of system smart contract testing shows the result of smart contract testing undertaken. Lastly, we utilized Node.js and IPFS to develop the off-chain components. The source code is available on Mendeley Data [49] under the CC BY 4.0 license.Figure 4
A screenshot of the system smart contract.Figure 5
The result of system smart contract testing.The high-level structure of the implemented proof of concept is shown in Figures6–8. All users in the network save their public keys in the smart contract and the read/write procedures for different user’s keys from drones and sensors as explained in Figure 4, for example, a user 1 who wants to send data to user 2 considering the next steps:
(i)
User 1, send data to user 2(a)
The data of the user 1 form is hashed using a hash function, which is passed to the hash value and then stored by smart contract in the blockchain(ii)
User 2 receives data(a)
The data is encrypted using user 2’s public key, which is read from user 2’s smart contract, and this data is then sent to user 2(b)
With user 2’s private key, the data is decrypted, and that data is then hashed into a new hash value(c)
Decision-making occurs when a match is made between two hash values: the hash value is saved in the blockchain and the new hash value. If the hash is matched, authentication occurs, and data is sentFigure 6
The high-level structure of the proof of concept.Figure 7
Thethroughput and latency results for Read operations.Figure 8
Thethroughput and latency results for Write operations.


### 5.2. Performance Evaluation

To evaluate the performance of proposed framework, we utilized an open-source benchmarking tool called Hyperledger Caliper (https://www.hyperledger.org/use/caliper). Table 3 shows the settings of the performance evaluation environment. Two main types of blockchain operations, Write and Read, were evaluated using four performance indicators, namely, Write Throughput, Read Throughput, Write Latency, and Read Latency [50, 51]. In this performance evaluation, we focused on the main smart contract functions that are shown in Table 4.Table 3
The settings of the performance evaluation environment.
FactorSettingNodesFour VMs running on Google cloud, where each VM has a 2 GHz 4-core Intel CPUPeer-to-peer networkHyperledger Besu v1.4.1, 1 validator node, 3 peer nodesConsensus protocolCliqueSmart contract programming language usedSolidityBenchmarking toolHyperledger Caliper v0.4.1Table 4
Main smart contracts functions of the system.
Main functionOperation typeregisterNewUserWriterequestDataWriteprovideDataWritegetUserPublicKeyReadgetUsersReadgetRequestsReadThe performance evaluation was performed in ten rounds with a hundred transactions per round to reduce the likelihood of errors due to network congestion and system overload. Tables5 and 6 summarize the performance evaluation settings used for the Write and Read operations, respectively.Table 5
The performance evaluation settings used for the Write operations.
Test number12345678910Functions under testWrite operationsWorker number1 workerTransaction number100 transactionsType of control rateFixed rateSend rate (tps)5101520253035404550Table 6
The performance evaluation settings used for the Read operations.
Test number12345678910Functions under testRead operationsWorker number1 workerTransaction number100 transactionsType of control rateFixed rateSend rate (tps)50100150200250300350400450500Table7 demonstrates the results of the throughput and latency for Read operations and the throughput and latency for Write operations, respectively. The results indicate an average throughput of 32.54 TPS and an average latency 1166 milliseconds for Read operations. Contrastingly, average Write throughput is 19.37 TPS, and the average Write latency is 2253 milliseconds. The experimental findings for the Read and Write operations are shown in Tables 7 and 8.Table 7
Experimental findings ofthroughput and latency for Read operations.
Test roundSend rate (tps)Average latency (ms)Throughput (TPS)150105023.9210092021.3315095023.24200102030.45250104033.76300106032.67350135040.88400180034.49450133045.710500114039.4Table 8
Experimental findings ofthroughput and latency for Write operations.
Test roundSend rate (tps)Average latency (ms)Throughput (WPS)1514204.821031809.5315326013.3420224017.7525250021.9630204022.1735196026.5840210022.8945171027.31050212027.8


### 5.3. Discussion

Blockchain technology has developed as a way to make distributed systems more secure so that we provide security to the network users confidential data over the cloud. Blockchains are digital ledgers that hold explicit and verifiable records of all transactions inside a system. The decentralized blockchain concept has shown to be a reliable technique for resolving trust difficulties in user authentication. As a result of this fact, the specifics of each transaction could be saved in order to ensure that the data transmission is secure. The major objective of this work is to guarantee that the system’s authentication is robust and safe against assaults, since each user has their own private and public keys, which were previously issued to them by the system and stored on the smart contract.To establish a solid cryptographic authentication, the technique uses an asymmetric key exchange with an ECC authentication algorithm and SHA-256 hashed data within a smart contract. The model is built on a private blockchain-based platform that ensures safe connection and secure data transmission through the cloud between sensors and drones in smart farming. This work supports our system by ensuring data integrity since data is hashed before being recorded in a blockchain, and users calculate the hash data each time they want to access hashed data.The proposed framework utilizes permissioned blockchain where only authorized users can access the system. System user interacts with the system using their wallet accounts which are pseudo-anonymous accounts; therefore, users’ privacy is preserved. In addition, multiple pseudo-anonymous accounts can be used by a single user; hence, user transactions cannot be tracked by an adversary. The use of on-chain/off-chain storage in the framework increases data confidentiality and integrity as sensitive data are stored securely off-chain and only the hash value of the data is submitted to the blockchain.The major goal of this work is to guarantee that the system’s authentication is stable and safe against assaults, since each user has their own private and public keys, which were previously issued by the system and stored on the smart contract, before registering and entering the system. To establish a solid cryptographic authentication, the work is based on an asymmetric key exchange within a smart contract utilizing an ECC authentication algorithm and SHA-256 hashed data. The system is built on a private blockchain-based platform that ensures safe connection and secure data transmission through the cloud between sensors and drones in smart farming. Because the data is hashed before being stored within a blockchain, this method protects data integrity, and users may calculate the hash data each time they want to access hashed data.


## 5.1. A Proof of Concept

We implemented a proof of concept to demonstrate the feasibility of the proposed framework. We used Hyperledger Besu (https://www.hyperledger.org/use/besu) to build a permissioned blockchain. The system smart contract was written using the Solidity programming language, where the Truffle framework (https://www.trufflesuite.com/truffle), an Ethereum smart contracts development tool, was used to test, compile, and deploy the system smart contract. In Figure 4, a screenshot of the system smart contract shows a screenshot of the system smart contract, whereas in Figure 5, the result of system smart contract testing shows the result of smart contract testing undertaken. Lastly, we utilized Node.js and IPFS to develop the off-chain components. The source code is available on Mendeley Data [49] under the CC BY 4.0 license.Figure 4
A screenshot of the system smart contract.Figure 5
The result of system smart contract testing.The high-level structure of the implemented proof of concept is shown in Figures6–8. All users in the network save their public keys in the smart contract and the read/write procedures for different user’s keys from drones and sensors as explained in Figure 4, for example, a user 1 who wants to send data to user 2 considering the next steps:
(i)
User 1, send data to user 2(a)
The data of the user 1 form is hashed using a hash function, which is passed to the hash value and then stored by smart contract in the blockchain(ii)
User 2 receives data(a)
The data is encrypted using user 2’s public key, which is read from user 2’s smart contract, and this data is then sent to user 2(b)
With user 2’s private key, the data is decrypted, and that data is then hashed into a new hash value(c)
Decision-making occurs when a match is made between two hash values: the hash value is saved in the blockchain and the new hash value. If the hash is matched, authentication occurs, and data is sentFigure 6
The high-level structure of the proof of concept.Figure 7
Thethroughput and latency results for Read operations.Figure 8
Thethroughput and latency results for Write operations.


## 5.2. Performance Evaluation

To evaluate the performance of proposed framework, we utilized an open-source benchmarking tool called Hyperledger Caliper (https://www.hyperledger.org/use/caliper). Table 3 shows the settings of the performance evaluation environment. Two main types of blockchain operations, Write and Read, were evaluated using four performance indicators, namely, Write Throughput, Read Throughput, Write Latency, and Read Latency [50, 51]. In this performance evaluation, we focused on the main smart contract functions that are shown in Table 4.Table 3
The settings of the performance evaluation environment.
FactorSettingNodesFour VMs running on Google cloud, where each VM has a 2 GHz 4-core Intel CPUPeer-to-peer networkHyperledger Besu v1.4.1, 1 validator node, 3 peer nodesConsensus protocolCliqueSmart contract programming language usedSolidityBenchmarking toolHyperledger Caliper v0.4.1Table 4
Main smart contracts functions of the system.
Main functionOperation typeregisterNewUserWriterequestDataWriteprovideDataWritegetUserPublicKeyReadgetUsersReadgetRequestsReadThe performance evaluation was performed in ten rounds with a hundred transactions per round to reduce the likelihood of errors due to network congestion and system overload. Tables5 and 6 summarize the performance evaluation settings used for the Write and Read operations, respectively.Table 5
The performance evaluation settings used for the Write operations.
Test number12345678910Functions under testWrite operationsWorker number1 workerTransaction number100 transactionsType of control rateFixed rateSend rate (tps)5101520253035404550Table 6
The performance evaluation settings used for the Read operations.
Test number12345678910Functions under testRead operationsWorker number1 workerTransaction number100 transactionsType of control rateFixed rateSend rate (tps)50100150200250300350400450500Table7 demonstrates the results of the throughput and latency for Read operations and the throughput and latency for Write operations, respectively. The results indicate an average throughput of 32.54 TPS and an average latency 1166 milliseconds for Read operations. Contrastingly, average Write throughput is 19.37 TPS, and the average Write latency is 2253 milliseconds. The experimental findings for the Read and Write operations are shown in Tables 7 and 8.Table 7
Experimental findings ofthroughput and latency for Read operations.
Test roundSend rate (tps)Average latency (ms)Throughput (TPS)150105023.9210092021.3315095023.24200102030.45250104033.76300106032.67350135040.88400180034.49450133045.710500114039.4Table 8
Experimental findings ofthroughput and latency for Write operations.
Test roundSend rate (tps)Average latency (ms)Throughput (WPS)1514204.821031809.5315326013.3420224017.7525250021.9630204022.1735196026.5840210022.8945171027.31050212027.8


## 5.3. Discussion

Blockchain technology has developed as a way to make distributed systems more secure so that we provide security to the network users confidential data over the cloud. Blockchains are digital ledgers that hold explicit and verifiable records of all transactions inside a system. The decentralized blockchain concept has shown to be a reliable technique for resolving trust difficulties in user authentication. As a result of this fact, the specifics of each transaction could be saved in order to ensure that the data transmission is secure. The major objective of this work is to guarantee that the system’s authentication is robust and safe against assaults, since each user has their own private and public keys, which were previously issued to them by the system and stored on the smart contract.To establish a solid cryptographic authentication, the technique uses an asymmetric key exchange with an ECC authentication algorithm and SHA-256 hashed data within a smart contract. The model is built on a private blockchain-based platform that ensures safe connection and secure data transmission through the cloud between sensors and drones in smart farming. This work supports our system by ensuring data integrity since data is hashed before being recorded in a blockchain, and users calculate the hash data each time they want to access hashed data.The proposed framework utilizes permissioned blockchain where only authorized users can access the system. System user interacts with the system using their wallet accounts which are pseudo-anonymous accounts; therefore, users’ privacy is preserved. In addition, multiple pseudo-anonymous accounts can be used by a single user; hence, user transactions cannot be tracked by an adversary. The use of on-chain/off-chain storage in the framework increases data confidentiality and integrity as sensitive data are stored securely off-chain and only the hash value of the data is submitted to the blockchain.The major goal of this work is to guarantee that the system’s authentication is stable and safe against assaults, since each user has their own private and public keys, which were previously issued by the system and stored on the smart contract, before registering and entering the system. To establish a solid cryptographic authentication, the work is based on an asymmetric key exchange within a smart contract utilizing an ECC authentication algorithm and SHA-256 hashed data. The system is built on a private blockchain-based platform that ensures safe connection and secure data transmission through the cloud between sensors and drones in smart farming. Because the data is hashed before being stored within a blockchain, this method protects data integrity, and users may calculate the hash data each time they want to access hashed data.


## 6. Conclusions

We proposed an asymmetric key cryptography blockchain as an on-chain component for this study, which requires storing data on permission blockchain as the most cost-effective way to keep data decentralized and guarantee model availability. We looked at smart contracts on the blockchain that can be utilized in the realm of the Internet of Things, as well as the benefits and challenges that they bring. We used Ethereum smart contracts, a decentralized and encrypted technology that allows devices to better trust one another and execute peer-to-peer authentication.The hashed data will simply be transmitted on the on-chain component. No one will be able to access the model’s private keys after they are set, which validates the model’s privacy.We used an Ethereum blockchain to test the performance of the proposed approach. Four virtual computers from the Google cloud are used to guarantee the newly added device's security needs while also achieving benefits such as reduced traffic overheads and typifying our solution's high level of intelligence and mobility. We believe that the blockchain solution is a step toward greater data security and privacy and that it has the potential to be employed in a wide range of IoT applications.This study has several limitations. In the proposed framework, verifying user identity is challenging due to the distributed and the openness nature of blockchain technology. As the proposed framework operates on a permissioned blockchain, the process of verifying user identity is performed by the system owner, who is responsible for setting up the blockchain and inviting users to join the system. This can be mitigated by integrating the system with identity management services such as self-sovereign identity [52–54], identity verification using blockchain [55], and noncustodial login solutions using blockchain [56]. The blockchain’s General Data Protection Regulation (GDPR) compliance is another limitation in this study [57–59]. Although utilizing permissioned blockchains might comply with GDPR requirements, determining whether blockchain completely complies with GDPR is challenging [60]. To avoid such limitation, GDPR compliance should be considered during designing the blockchain-based system [61, 62].Throughout this study, we described an approach on how to achieve trust among smart farming users. We now highlight some future research directions. Firstly, we will improve our work by incorporating an off-chain (IPFS)-based decentralized distributed data storage method to allow for speedy, low-cost, and reliable data access, hence, approving the model’s availability. Accessing data across users and networks in a faster, more secure, and network-effective manner is another advantage of using off-chain components. Secondly, a comparative analysis of the proofs of concept implemented with different blockchain frameworks and configurations will be conducted. In this study, the proofs of concept were implemented using the Ethereum blockchain, which was initially designed for developing DApps and services that are open to the public. Ethereum blockchain has several limitations in terms of performance and scalability, such as transaction latency, throughput, and execution time [63]. In future works, an empirical evaluation should be conducted to assess the performance of the proofs-of-concept design under a wide range of blockchain frameworks and configurations other than Ethereum such as Hyperledger Fabric and MultiChain. Finally, more research is required on the framework applicability to explore and assess the sustainability challenges faced by our proposed framework, including its limitations for real-world utilizing.



---

*Source: 4389729-2022-09-05.xml*