# IoT with BlockChain: A Futuristic Approach in Agriculture and Food Supply Chain

Authors: Sabir Awan; Sheeraz Ahmed; Fasee Ullah; Asif Nawaz; Atif Khan; M. Irfan Uddin; Abdullah Alharbi; Wael Alosaimi; Hashem Alyami
Journal: Wireless Communications and Mobile Computing
 (2021)

---

## Abstract

Agricultural food production is projected to be 70% higher by 2050 than it is today, with the world population rising to more than 9 billion, 34% higher than it is now. The farmers have been forced to produce more with the same resources. This pressure means that optimizing productivity is one of the main objectives of the producers but also in a sustainable way. Not only does agriculture face a decline in production, but it has also had to face limitations in data collection, storing, securing, and sharing, climate change, increases in input prices, traditional food supply chain systems where there is no direct connection between the farmer and the buyer, and limitations on energy use. Existing IoT-based agriculture systems have a centralized format and operate in isolation, leaving room for unresolved issues and major concerns, including data security, manipulation, and single failure points. This paper proposes a futuristic IoT with a blockchain model to meet these challenges. Further, this paper also proposes and novel energy-efficient clustering IoT-based agriculture protocol for lower energy consumption and network stability and compares its results with its counterpart low-energy adoptive clustering hierarchy (LEACH) protocol. The simulation results show that the proposed protocol network stability is 23% higher as compared to LEACH as first node of LEACH dies at 168 rounds while IoT-based agriculture first node dies after 463 rounds. Similarly, IoT-based agriculture protocol energy consumption is 68% lower than that of LEACH. The proposed protocol also extends the network life to more rounds and demonstrates an increase of 112%.


---

## Body

## 1. Introduction

The United Nations Population Division expects the world population, currently 7.8 billion (2020), to reach 10.9 billion after the end of the 21st century [1]. Due to rapid population growth, there is a high pressure on agriculture to increase food production sustainably. Food distribution and consumption simultaneously promote human well-being and preserves scarce natural resources. As a result, policymakers, development agencies, civil society organizations, and private enterprises have shown interest in investigating the role of the food and farm markets in supporting sustainable development for people and the world [2]. Agriculture is experiencing drastic changes and is facing numerous environmental and social problems. Many farmers are still depending on traditional farming practices and having no direct access to the market, and it has proven difficult to balance the demands on limited natural resources such as land and water. Both changes in diets and consumer preferences and the fact of climate change contribute to the complexity of providing high-quality food to the end-user. Sustainable food and agricultural production cannot be accomplished by the conventional agriculture systems that have led to substantial deforestation, water scarcity, or soil erosion. Thus, advanced systems must be used which conserve and reinforce the basis of natural resources and increase production. A phase of transition to “holistic” methods is like smart agriculture [3]. Smart agriculture is an approach that guides agricultural field supervision in the era of climate change. The idea of smart agriculture was first introduced in 2009 and revived through the involvement and input of many stakeholders involved in design and implementation. In response to the debate on agricultural policy on climate change and sustainable development work, the main features of the smart agriculture approach have been developed. [4]. Smart agriculture aims to provide universally applicable systems for climate change management and agricultural food security. Smart agriculture uses advanced technologies such as the Internet of Things (IoT), big data, and cloud computing to monitor the field environment, analyze crop growth, and provide information to the farmer for decision-making. An information-based management cycle for smart agriculture is presented in Figure 1. [5].Figure 1
Information-based management cycle for smart agriculture.


### 1.1. Internet of Things (IoT)

The Internet of Things (IoT) is a cutting-edge computing and networking technology that reflects the future. Smart computing will be focused on the Internet of Things in the future. IoT is now playing a significant role in the transformation of existing technologies from the home to the workplace [6]. IoT technology is used to link computers or nodes to networks for the sharing of information and communication [7]. The Internet of Things (IoT) has the potential to link billions of devices (smart objects). These smart objects can gather data and interact with other systems over the internet. IoT has evolved into a next generation technology with several agricultural applications [8].


### 1.2. Internet of Things in Smart Agriculture

In the field of smart agriculture IoT provides a wide range of applications such as soil and plant tracking, crop growth observation, and selection, assistance for irrigation assessment, and monitoring of the agriculture environment. In smart agriculture Internet of Things (IoT) technology is applied in diagnostics and control. To optimize agriculture, the implementation of IoT in the field has increased the productivity and effectiveness of farmers. It may help to determine field variables such as soil quality and plant biomass. It can also be used to test and monitor variables including temperature, soil moisture, and crop diseases. Besides, IoT can be used to track crop growth and yield influencing factors. Farmers can also figure out which crops are most suited for which conditions and can rotate crop accordingly [9]. IoT applications support farmers during crop planting, irrigation, crop processing, harvesting and postharvest, crop storage and transportation, and many other benefits in agricultural IoT systems. Soil moisture sensors, humidity sensors, leaf moisture sensors, solar radiation sensors, infrared light sensors, and rainfall predictors are among the field sensors used in IoT-based systems. In IoT scenarios, sensors can be installed in a variety of locations, including greenhouses, seed banks, cold rooms, agricultural machinery, transportation systems, and livestock, and the data collected can be processed in the cloud for monitoring and control [10].


### 1.3. Food Supply Chain Management

Food supply chain management is a process that explains how food from an agricultural field ends up on our tables. Supply chain management deals with production, refining, delivery, selling consumption, and disposal [11]. The process of the supply chain is summarized in Figure 2. In developing countries, the food supply chain faces several challenges, such as the need for confidence among stakeholders which often correlated with their credibility and traceability required by the end-users, and the difficulty of managing risks, delays, or disruptions is often occurred due to insufficient or lacking information [12]. Blockchain technology is one of the best ways to meet these challenges [13].Figure 2
Agricultural food supply chain process.


### 1.4. Blockchain Technology

Blockchain is a distributed database where data can be recorded and shared via a decentralized computing network while also providing security and privacy. And if the data is spread, only the owner who has the private key can make transactions. The other machines or computers on the network serve as validators. It safely records transactions between nodes in a public ledger without the need for a trusted third party [14]. In a centralized cloud approach where an asset or object is owned, it is either held under the control of the owner or through a trusted intermediary or a centralized authority such as a bank. A centralized computing system always has a single server for several clients, the server has higher resources than its client systems, and all processes are made through a single server which now has become a traditional approach [15]. Blockchain records transactions in block units, and every block includes the hash of the block history, hash of the current block, date, other details, and transactions for the block. When a sender node makes a transaction, it distributes it to the other nodes on the network. The receiving nodes verify the transaction and have proof of work. The node that succeeds in the proof of work will broadcast it to all the other nodes and connect the block to the chain. The transaction shall contain the public key of the recipient and shall be signed by the sender. Therefore, any other node will verify the validity of the transaction. Each block includes a hash of the previous block, which means that each block is connected to each other [16]. The key characteristics of blockchain are shown in Figure 3 [17].Figure 3
Key Characteristics of Blockchain Technology.Because of its unique characteristics, blockchain may be an evolutionary next step in the food supply chain also to add accountability to the supply chain system by exchanging accurate data between supply chain stakeholders. After the integration of IoT with blockchain, the overall visibility of food products across the supply chain will become a reality. The major advantages of blockchain and IoT in the food supply chain are real-time monitoring and sensing of original food items from the origin which identify major bottlenecks. As in the agricultural sector, farmers use chemical fertilizers, insecticides, and other materials to increase crop production, especially vegetable growers often use harmful pesticides to spray vegetables to improve their profitability, and consumers buy the same vegetables to eat which is a major health hazard. Secondly, food frauds and data alternation are also big challenges for supply chain stakeholders.


### 1.5. Blockchain in Food Supply Chain

Blockchain is an emerging technology for the agriculture sector, applying blockchain to the agricultural supply chain provides a digital database that monitors, tracks records, and processes digital and physical resources. Blockchain allows greater traceability and higher quality transactions. This technology can manage and integrate all procedures and dealings in real-time across the agricultural supply chain. Every transaction treated in a distributed manner may contain product-specific attributes and transactions that will be added by players in the supply chain. The supply chain players can recognize and investigate the association of products along with all stages of the supply chain and zoological technology practices (fertilizers, feed, and veterinary services [18]. The blockchain stores invariant records that are transparent and digitally accessible to all users in the supply chain; this technology has the potential to produce massive efficiency gains for each actor. The blockchain offers a forum for traceability in the agricultural supply chain, allowing end-users to monitor product from origins and ensure their authenticity. Figure 4 illustrates the benefits of using blockchain in the food supply chain. The ability to monitor a product’s movements allows for legal liability for infringement on the product’s authenticity, making regulation easier to regulate. The blockchain keeps the mechanism and the data connected at all times [19].Figure 4
Advantages of Blockchain Technology in Food Supply Chain.


### 1.6. IoT Integration with the Blockchain

Industry 4.0 has shown that the Internet of Things is a fundamental technology and a key player in the digital revolution. In different network topologies, IoT is expected to depend more on sensing devices, a wide range of data, and more connected devices. As a result, it must be referred to as the Internet of Things 2.0. The Internet of Things 2.0 is now transitioning away from sensors and data technology and toward actionable intelligence technology [20]. IoT becomes more efficient when it is combined with cloud computing, artificial intelligence, and machine learning [21]. Integration of blockchain technology with IoT is another significant contribution to the digital transformation of various domains. By integrating with IoT, blockchain is projected to add $176 billion to the global economy by 2025 and $3 trillion by 2030 [22]. Figure 5 depicts the most important blockchain and IoT predictions for 2030.Figure 5
Blockchain and IoT prediction by 2030.In the present world, the problem of health and food safety is deteriorating day by day because a proper food traceability system is not available. The biggest reason for food-borne disease is contamination which is hard to track in the conventional food supply chain because the mechanism is not visible [23]. However, IoT with a blockchain system will fix the problem by creating a distributed system and eliminating the third party participating in the system at the same time. Consumers have questions about the nature of the food products they purchase and the sources of the product they buy in the conventional supply chain. The key point here is to create customer interest, which is difficult to do as the system is not open. By building customer confidence, IoT and blockchain technology could eradicate these issues. Each product has a digital identity in this framework, which stores information from the point of origin up to the end of the retailer [24]. IoT with blockchain can provide a more transparent and connected system.


### 1.7. Communication Protocols

Communication protocols have been commonly used in various types of networks to improve communication efficiency. The LoRaWAN protocol was created to migrate data from sensor nodes and the IoT network platform that introduced the LoRaWAN backend service to the cloud for data sharing. In terms of integrating with other IoT systems and introducing new services, the planned framework was scalable and versatile. It is also horizontally scalable, which means it can improve efficiency by replicating new server occurrences [25]. Heizelmann created the low-energy adaptive wireless sensor network routing LEACH protocol, which was the first hierarchical cluster-based routing protocol for a wireless sensor network. The protocol nodes had been distributed across clusters, and each cluster had its head (CH). Member nodes of cluster sensory data share them via their selected CHs with the base station. Smart agriculture has been able to ensure that it not only meets the general needs of crops but also anticipates their specific needs, taking into account a variety of environmental factors. The challenge is to accurately predict potential crop losses to take appropriate measures. IoT nodes enable efficient routing protocols to obtain data and share information with farmers [26].


## 1.1. Internet of Things (IoT)

The Internet of Things (IoT) is a cutting-edge computing and networking technology that reflects the future. Smart computing will be focused on the Internet of Things in the future. IoT is now playing a significant role in the transformation of existing technologies from the home to the workplace [6]. IoT technology is used to link computers or nodes to networks for the sharing of information and communication [7]. The Internet of Things (IoT) has the potential to link billions of devices (smart objects). These smart objects can gather data and interact with other systems over the internet. IoT has evolved into a next generation technology with several agricultural applications [8].


## 1.2. Internet of Things in Smart Agriculture

In the field of smart agriculture IoT provides a wide range of applications such as soil and plant tracking, crop growth observation, and selection, assistance for irrigation assessment, and monitoring of the agriculture environment. In smart agriculture Internet of Things (IoT) technology is applied in diagnostics and control. To optimize agriculture, the implementation of IoT in the field has increased the productivity and effectiveness of farmers. It may help to determine field variables such as soil quality and plant biomass. It can also be used to test and monitor variables including temperature, soil moisture, and crop diseases. Besides, IoT can be used to track crop growth and yield influencing factors. Farmers can also figure out which crops are most suited for which conditions and can rotate crop accordingly [9]. IoT applications support farmers during crop planting, irrigation, crop processing, harvesting and postharvest, crop storage and transportation, and many other benefits in agricultural IoT systems. Soil moisture sensors, humidity sensors, leaf moisture sensors, solar radiation sensors, infrared light sensors, and rainfall predictors are among the field sensors used in IoT-based systems. In IoT scenarios, sensors can be installed in a variety of locations, including greenhouses, seed banks, cold rooms, agricultural machinery, transportation systems, and livestock, and the data collected can be processed in the cloud for monitoring and control [10].


## 1.3. Food Supply Chain Management

Food supply chain management is a process that explains how food from an agricultural field ends up on our tables. Supply chain management deals with production, refining, delivery, selling consumption, and disposal [11]. The process of the supply chain is summarized in Figure 2. In developing countries, the food supply chain faces several challenges, such as the need for confidence among stakeholders which often correlated with their credibility and traceability required by the end-users, and the difficulty of managing risks, delays, or disruptions is often occurred due to insufficient or lacking information [12]. Blockchain technology is one of the best ways to meet these challenges [13].Figure 2
Agricultural food supply chain process.


## 1.4. Blockchain Technology

Blockchain is a distributed database where data can be recorded and shared via a decentralized computing network while also providing security and privacy. And if the data is spread, only the owner who has the private key can make transactions. The other machines or computers on the network serve as validators. It safely records transactions between nodes in a public ledger without the need for a trusted third party [14]. In a centralized cloud approach where an asset or object is owned, it is either held under the control of the owner or through a trusted intermediary or a centralized authority such as a bank. A centralized computing system always has a single server for several clients, the server has higher resources than its client systems, and all processes are made through a single server which now has become a traditional approach [15]. Blockchain records transactions in block units, and every block includes the hash of the block history, hash of the current block, date, other details, and transactions for the block. When a sender node makes a transaction, it distributes it to the other nodes on the network. The receiving nodes verify the transaction and have proof of work. The node that succeeds in the proof of work will broadcast it to all the other nodes and connect the block to the chain. The transaction shall contain the public key of the recipient and shall be signed by the sender. Therefore, any other node will verify the validity of the transaction. Each block includes a hash of the previous block, which means that each block is connected to each other [16]. The key characteristics of blockchain are shown in Figure 3 [17].Figure 3
Key Characteristics of Blockchain Technology.Because of its unique characteristics, blockchain may be an evolutionary next step in the food supply chain also to add accountability to the supply chain system by exchanging accurate data between supply chain stakeholders. After the integration of IoT with blockchain, the overall visibility of food products across the supply chain will become a reality. The major advantages of blockchain and IoT in the food supply chain are real-time monitoring and sensing of original food items from the origin which identify major bottlenecks. As in the agricultural sector, farmers use chemical fertilizers, insecticides, and other materials to increase crop production, especially vegetable growers often use harmful pesticides to spray vegetables to improve their profitability, and consumers buy the same vegetables to eat which is a major health hazard. Secondly, food frauds and data alternation are also big challenges for supply chain stakeholders.


## 1.5. Blockchain in Food Supply Chain

Blockchain is an emerging technology for the agriculture sector, applying blockchain to the agricultural supply chain provides a digital database that monitors, tracks records, and processes digital and physical resources. Blockchain allows greater traceability and higher quality transactions. This technology can manage and integrate all procedures and dealings in real-time across the agricultural supply chain. Every transaction treated in a distributed manner may contain product-specific attributes and transactions that will be added by players in the supply chain. The supply chain players can recognize and investigate the association of products along with all stages of the supply chain and zoological technology practices (fertilizers, feed, and veterinary services [18]. The blockchain stores invariant records that are transparent and digitally accessible to all users in the supply chain; this technology has the potential to produce massive efficiency gains for each actor. The blockchain offers a forum for traceability in the agricultural supply chain, allowing end-users to monitor product from origins and ensure their authenticity. Figure 4 illustrates the benefits of using blockchain in the food supply chain. The ability to monitor a product’s movements allows for legal liability for infringement on the product’s authenticity, making regulation easier to regulate. The blockchain keeps the mechanism and the data connected at all times [19].Figure 4
Advantages of Blockchain Technology in Food Supply Chain.


## 1.6. IoT Integration with the Blockchain

Industry 4.0 has shown that the Internet of Things is a fundamental technology and a key player in the digital revolution. In different network topologies, IoT is expected to depend more on sensing devices, a wide range of data, and more connected devices. As a result, it must be referred to as the Internet of Things 2.0. The Internet of Things 2.0 is now transitioning away from sensors and data technology and toward actionable intelligence technology [20]. IoT becomes more efficient when it is combined with cloud computing, artificial intelligence, and machine learning [21]. Integration of blockchain technology with IoT is another significant contribution to the digital transformation of various domains. By integrating with IoT, blockchain is projected to add $176 billion to the global economy by 2025 and $3 trillion by 2030 [22]. Figure 5 depicts the most important blockchain and IoT predictions for 2030.Figure 5
Blockchain and IoT prediction by 2030.In the present world, the problem of health and food safety is deteriorating day by day because a proper food traceability system is not available. The biggest reason for food-borne disease is contamination which is hard to track in the conventional food supply chain because the mechanism is not visible [23]. However, IoT with a blockchain system will fix the problem by creating a distributed system and eliminating the third party participating in the system at the same time. Consumers have questions about the nature of the food products they purchase and the sources of the product they buy in the conventional supply chain. The key point here is to create customer interest, which is difficult to do as the system is not open. By building customer confidence, IoT and blockchain technology could eradicate these issues. Each product has a digital identity in this framework, which stores information from the point of origin up to the end of the retailer [24]. IoT with blockchain can provide a more transparent and connected system.


## 1.7. Communication Protocols

Communication protocols have been commonly used in various types of networks to improve communication efficiency. The LoRaWAN protocol was created to migrate data from sensor nodes and the IoT network platform that introduced the LoRaWAN backend service to the cloud for data sharing. In terms of integrating with other IoT systems and introducing new services, the planned framework was scalable and versatile. It is also horizontally scalable, which means it can improve efficiency by replicating new server occurrences [25]. Heizelmann created the low-energy adaptive wireless sensor network routing LEACH protocol, which was the first hierarchical cluster-based routing protocol for a wireless sensor network. The protocol nodes had been distributed across clusters, and each cluster had its head (CH). Member nodes of cluster sensory data share them via their selected CHs with the base station. Smart agriculture has been able to ensure that it not only meets the general needs of crops but also anticipates their specific needs, taking into account a variety of environmental factors. The challenge is to accurately predict potential crop losses to take appropriate measures. IoT nodes enable efficient routing protocols to obtain data and share information with farmers [26].


## 2. Literature Review

This section provides a thorough review of the related literature.


### 2.1. Review on IoT in Smart Agriculture

In paper [26], the authors proposed a smart agriculture system to provide information on soil, water supply, and the general state of the field to farmers. The objective of the proposed system was to make agriculture and irrigation more efficient and to make it easier for farmers to take appropriate decisions to increase agricultural production. The use of IoT networks to monitor environmental factors and the combination of this information with a user-specific web service enables farmers to make effective use of their knowledge to obtain the best results from their agriculture. In paper [27], researchers have developed an IoT-based agriculture data analysis system using IoT devices such as environmental field real-time monitoring sensors. The field observation was collected and transferred to the farmers through a web-based application with the help of a node and a Wi-Fi module. The system consists of sensors such as a soil moisture sensor and an ultrasonic sensor. The system has a low cost but uses high energy. The authors of the paper [28] used IoT to build a smart agriculture system for Indian farmers. Farmers in India have begun to commit suicide as a result of low agricultural output. To address this problem, an IoT-based smart agriculture system was created that uses a variety of sensors to monitor pests and soil moisture. Crop distribution companies were also involved in providing high-quality seeds to farmers to boost yields. The system architecture, on the other hand, is extremely durable, but it comes at a high price.Researchers explored the potential benefits of using smart agriculture technologies such as smart soil and air sensors in paper [29], to assist farmers by covering the initial installation costs and providing smart farming advice through the integrated use of heterogeneous information sources. The work helped farmers in growing their ecological footprint by providing opportunities for innovation targeting and climate change adaptation options. The authors of the paper [30] used sophisticated Internet of Thing (IoT) agricultural applications to make accurate measurements, using sensor data from 60 scientific papers published between 2016 and 2018. Previous research has shown the importance of smart agriculture in water, grain, livestock, and irrigation management. When it came to sensor data collection, the best results were obtained when calculating temperature and humidity. Sensors for soil moisture and soil reaction are also available.


### 2.2. Review on Blockchain in the Supply Chain

Researchers in the paper [31] proposed a theoretical model to investigate the impact of blockchain on operational supply chain transparency and collaboration by establishing rapid trust between key partners involved in disaster relief supply chains. Collaboration enables stakeholders to work together, leads to productive and efficient real-time information exchange between partners, and provides many benefits such as increased transparency, flexibility, and reduced lead–time, as well as helping to improve supply chain resilience. The authors of the paper [32] suggested blockchain adoption as a way to improve the entire supply chain, from safe, accurate, and open transactions to increasing supply chain participants’ trust and efficiency by exchanging all transactions and related information across the entire network. The authors of [14] focused on weakening supply chain resilience in the era of information asymmetry, which occurs when one of the supply chain’s members has significantly more product information than the others. They admitted that data inaccuracies or discrepancies might lead to incorrect decisions and an increase in technological risks including cybercrime, hacking, and theft, both of which could harm the company’s credibility. One of these solutions, according to the writers, is establishing “confidence” among supply chain participants using a decentralized information sharing framework based on blockchain technology.


### 2.3. Motivation

In terms of technology, although the literature in smart agriculture using IoT is very rich, there is still a gap for improvement, whereas the use of blockchain technology in the food supply system literature is very limited. Besides, no solid research papers are published yet using a combination of IoT and blockchain technology for agriculture and food supply systems for addressing the information reliability issues. Most of the solutions are ad hoc-based or work separately. Limitations in the existing literature motivated us to develop a futuristic smart model based on smart technologies to meet the requirements of all stakeholders involved in agriculture and food supply chain by using IoT with blockchain technology through which traceability management can be applied through the food supply chain and addresses the main centralized format challenge that is asymmetric, opaque, and monopolistic. These limitations have driven us to build a distributed, efficient, and safe system to enhance crop production, ensure the end-to-end traceability of food products, and stop food fraud in the supply chain. The goal would be to develop a distributed and automatic agriculture food supply chain traceability model that enables various quality levels to be implemented based on consumer needs. The model that not only uses transaction data but also smart contract and enables end-to-end traceability and data security.


## 2.1. Review on IoT in Smart Agriculture

In paper [26], the authors proposed a smart agriculture system to provide information on soil, water supply, and the general state of the field to farmers. The objective of the proposed system was to make agriculture and irrigation more efficient and to make it easier for farmers to take appropriate decisions to increase agricultural production. The use of IoT networks to monitor environmental factors and the combination of this information with a user-specific web service enables farmers to make effective use of their knowledge to obtain the best results from their agriculture. In paper [27], researchers have developed an IoT-based agriculture data analysis system using IoT devices such as environmental field real-time monitoring sensors. The field observation was collected and transferred to the farmers through a web-based application with the help of a node and a Wi-Fi module. The system consists of sensors such as a soil moisture sensor and an ultrasonic sensor. The system has a low cost but uses high energy. The authors of the paper [28] used IoT to build a smart agriculture system for Indian farmers. Farmers in India have begun to commit suicide as a result of low agricultural output. To address this problem, an IoT-based smart agriculture system was created that uses a variety of sensors to monitor pests and soil moisture. Crop distribution companies were also involved in providing high-quality seeds to farmers to boost yields. The system architecture, on the other hand, is extremely durable, but it comes at a high price.Researchers explored the potential benefits of using smart agriculture technologies such as smart soil and air sensors in paper [29], to assist farmers by covering the initial installation costs and providing smart farming advice through the integrated use of heterogeneous information sources. The work helped farmers in growing their ecological footprint by providing opportunities for innovation targeting and climate change adaptation options. The authors of the paper [30] used sophisticated Internet of Thing (IoT) agricultural applications to make accurate measurements, using sensor data from 60 scientific papers published between 2016 and 2018. Previous research has shown the importance of smart agriculture in water, grain, livestock, and irrigation management. When it came to sensor data collection, the best results were obtained when calculating temperature and humidity. Sensors for soil moisture and soil reaction are also available.


## 2.2. Review on Blockchain in the Supply Chain

Researchers in the paper [31] proposed a theoretical model to investigate the impact of blockchain on operational supply chain transparency and collaboration by establishing rapid trust between key partners involved in disaster relief supply chains. Collaboration enables stakeholders to work together, leads to productive and efficient real-time information exchange between partners, and provides many benefits such as increased transparency, flexibility, and reduced lead–time, as well as helping to improve supply chain resilience. The authors of the paper [32] suggested blockchain adoption as a way to improve the entire supply chain, from safe, accurate, and open transactions to increasing supply chain participants’ trust and efficiency by exchanging all transactions and related information across the entire network. The authors of [14] focused on weakening supply chain resilience in the era of information asymmetry, which occurs when one of the supply chain’s members has significantly more product information than the others. They admitted that data inaccuracies or discrepancies might lead to incorrect decisions and an increase in technological risks including cybercrime, hacking, and theft, both of which could harm the company’s credibility. One of these solutions, according to the writers, is establishing “confidence” among supply chain participants using a decentralized information sharing framework based on blockchain technology.


## 2.3. Motivation

In terms of technology, although the literature in smart agriculture using IoT is very rich, there is still a gap for improvement, whereas the use of blockchain technology in the food supply system literature is very limited. Besides, no solid research papers are published yet using a combination of IoT and blockchain technology for agriculture and food supply systems for addressing the information reliability issues. Most of the solutions are ad hoc-based or work separately. Limitations in the existing literature motivated us to develop a futuristic smart model based on smart technologies to meet the requirements of all stakeholders involved in agriculture and food supply chain by using IoT with blockchain technology through which traceability management can be applied through the food supply chain and addresses the main centralized format challenge that is asymmetric, opaque, and monopolistic. These limitations have driven us to build a distributed, efficient, and safe system to enhance crop production, ensure the end-to-end traceability of food products, and stop food fraud in the supply chain. The goal would be to develop a distributed and automatic agriculture food supply chain traceability model that enables various quality levels to be implemented based on consumer needs. The model that not only uses transaction data but also smart contract and enables end-to-end traceability and data security.


## 3. Materials and Methods

This section presents the smart model architecture and smart model protocol design.


### 3.1. Smart Model Architecture

As shown in Figure6, a futuristic smart model for agricultural environmental monitoring and food supply chain consists of three layers: physical data layer, logical data layer, and web interface layer. This type of layered approach allows for scalable, extendable, and efficient framework implementation. In the physical data layer, a variety of IoT nodes are used to track the farm environment and crop growth. IoT nodes collect data from the cluster farm and send it to the base station via IoT gateway and wireless router, which then sends it to the database. A GPRS router is integrated into a single central board device that serves as a remote Radio Frequency Gateway (RFG) for wireless telemetry. To achieve effective control management and synchronization of two relatively unrelated data sources, data collection through IoT nodes for soil parameters and IoT crop monitoring information, the RFG gateway acts as a coordinator between two separate data streams and supports remote access, allowing for complete remote control of devices in the cluster farm. The logical data layer in an SQL database server stores the data obtained from the cluster farm. The SQL server, as a more intermediate layer, covers the complexity of multiple physical layer devices and allows database server data validation. Raw data is stored in the SQL database, which is then extracted to a local file system.Figure 6
IoT and blockchain smart model.Energy is the core part of every network, and energy conservation is one of the key objectives of this research. To reduce energy consumption, this research proposed an IoT-based agriculture protocol that can be divided into three phases: IoT nodes, IoT cluster head, and sink. IoT nodes gathered data and transferred it to CH in the first phase, CH broadcasted information to sink in the second phase, and sink transferred data to the base station in the third phase. This research work implements an RFG server using a robust ultra-low-power Single Board Chip to seamlessly combine a variety of devices in the cluster farm (SBC TS-7260). The monitoring system switches between active and sleep mode automatically. The optional battery backup module supports the SBC sleep mode, which also operates with a built-in uninterrupted power supply (UPS). Different devices in the cluster farm are normally equipped with an RS232 serial port. Wireless routers are switched off during the system’s sleep cycle to conserve electricity. SQL server obtains data by either pull or pushes operations. In a pull method, SQL server connects to the data source regularly and extracts the data. In a push operation, this server opens a port through which data can be passed through the data source. This design allows the server to adapt to different data source types with ease. The data was sent to the SQL server. The data manager may also require the RFG server to recollect data and retransfer data packets that were omitted. For each new data source, a new data manager is included with limited modifications to the database and web visualization layers, improving extensibility. Specific IoT identification codes link the nodes and observations. As a consequence, once they are linked to the database, the web application layer will recognize them right away. This design allows for flexible model development and web interface design. It also allows for data conversion to IoT networks, allowing for data sharing and interoperability between IoT devices through web services.


### 3.2. BlockChain Integration with IoT in the Smart Model

Exclusive blockchain characteristics will combine agricultural and food supply chain processes into a single smart system to ensure that consumers receive healthy food. Figure7 shows a functional overview of the blockchain.Figure 7
Blockchain-based food supply chain.The role of stakeholders in the overall system is also discussed. The research used blockchain smart contracts to exchange data between mining nodes in the system. All business transactions are recorded in the shared ledger by mining nodes, and smart contracts receive all transactions in the blockchain in the form of function calls and generate activities, as well as providing access to parties involved in the transaction to exchange control track and receive alerts in the event of a violation. Finally, smart contracts help to maintain the best conditions and respond to food supply chain misappropriations.


#### 3.2.1. Seed Seller

Seed sellers, also known as seed vendors, organize and produce a wide range of seeds before selling them to farmers. They are obligated to sell high-quality seeds to growers to produce a high-quality crop. The seed seller uses blockchain to store information about seed germination and chemical composition, which all stakeholders can access and share. Seeds are stamped with a unique number, similar to serialized Global Trade Identification Numbers, that allows all parties to be electronically identified and track products in the seed trade.


#### 3.2.2. Farmer

A farmer is someone who buys high-quality seeds and plants them. The farmer is responsible for recording information about fertilizers use and plant growth data in the form of MPEG files in the IPFS, where different nodes keep the data with high reliability throughout the entire process from planting to harvesting. Farmers can also use blockchain to communicate with crop buyers and sell their crops without relying on middlemen, who often get profit by mediating between sellers and buyers.


#### 3.2.3. Crop Buyer

Crop buyer is a company that buys crop or a grain from a farmer and sells it to a processor.


#### 3.2.4. Processor

The processor buys grain that does a moisture analysis to convert the raw grain to the final product. The processor is responsible for all operations in the blockchain where other players in the supply chain have access to this information.


#### 3.2.5. Crop Storage

The storing of crops or grains is an important and unavoidable part of the crop production process and supply chain process. In warehouse, grains or crops are stored, and information is recorded in the blockchain where supply chain stakeholders can view and exchange this information.


#### 3.2.6. Distributor

Distributors have a business arrangement with the suppliers or producers. Many distributors maintain exclusive purchasing agreements which limit or allow distributors to cover a certain area through the number of participants. The distributor is the producer’s exclusive point of contact with prospective purchasers of those products. Distributors, though, seldom sell the goods of the manufacturer directly to the retailer. Distributors tend to work with wholesale agents who may buy large quantities of one commodity regardless of the very large quantity of one commodity they have on hand or can purchase from the manufacturer. The distributor is responsible for registering all food product information in the blockchain.


#### 3.2.7. Retailer

Retailers are profit-making companies that directly sell products to consumers. Retailers search for products that suit their market objectives and find vendors at the most advantageous prices to make a profit. Generally, small quantities of an item can be ordered from a distributor by a retailer. In this setup, the retailer orders goods in batches of traceable identifiers which make it easy for the customer to verify product life cycle records.


#### 3.2.8. Customer

The customer is the final user of the food product who purchases the food product from the retailer. This research smart model provides full access to the customer to trace production information from the origin to the sale point. In this setup, all supply chain stakeholders are bound to digitally sign blockchain smart contracts and to record information fairly and in case of dishonest blockchain automatically configure the incident into smart contracts to fine the concerned party. Another option is to install cameras in the field to automatically capture and transfer images to the blockchain for preaudit. The advantage of using product traceability technology in the food supply chain is the availability of reliable and real-time information to all stakeholders.


### 3.3. IoT-Based Agriculture Protocol for the Smart Model

IoT nodes are ideal for cluster farms because they consume less energy than WSN and can be further reduced through an efficient clustering protocol. Therefore, this research proposed a new clustering protocol IoT-based agriculture, as shown in Figure8, based on the LEACH protocol, to reduce energy consumption and extend network life.Figure 8
IoT-based agriculture clustering protocol.


#### 3.3.1. Assumption for Simulation

Assumptions for simulation are given below.(i)
IoT nodes are installed on a cluster farm randomly(ii)
IoT nodes send hello messages to the base station with local information(iii)
The initial number of clusters is calculated by taking the optimal values to vary with the node density before the node starts to expire, and the smaller clusters become larger clusters(iv)
The base station and sink are installed outside the cluster farm as presented in Figure9Figure 9
IoT-based agriculture cluster farm and data transmission.


#### 3.3.2. Initialization Phase

A cluster farm with a total area of500×500 m2 was chosen and distributed into clusters, with 100 IoT nodes placed in each cluster at random. The IoT nodes were chosen based on their capabilities, such as soil moisture monitoring, temperature monitoring, and crop disease tracking. Nodes in clusters are distributed in such a way that one cluster node does not communicate with other cluster nodes, but only with the cluster heads of their respective clusters. Each cluster’s CH is in charge of sharing sensed data with the BS via the sink node. To achieve a satisfactory SNR, a widely used LEACH “First Order Radio Model” is used to transmit a small message over a distance of d.


#### 3.3.3. LEACH First Order Radio Model

As shown in Figure10 and Table 1, the first order radio model dissipates Eelec=50nJ/bit to run the transmitter or receiver circuit system and Eamp=100pJ/bit/m2 for the transmit amplifier to achieve a satisfactory signal-to-noise ratio. These parameters are slightly better than the existing radio system second assumption that was an energy loss due to channel transmission. To transmit an m-bit message over a distance of d using a radio model, the radio dissipates as follows:
(1)ETxm,d=ETx−elecm+ETx−ampm,d,(2)ETxm,d=Eelec×m+∈amp×m×d2,and to get this message, the radio expands
(3)ERxm=Eelec×m.Figure 10
First order radio model.Table 1
Radio characteristics.
OperationsEnergy dissipatedTransmitter electronicsETx−elec50 nJ/bitReceiver electronicsERx−elecETx−elec=ERx−elec=EelecTransmit amplifier Eamp100 pJ/bit/m2With those parameters, transferring or receiving a packet is not a low-cost method; so, protocols must strive to reduce not only transmission distances but also the number of transmission and receiving operations per message.


#### 3.3.4. Clustering Mechanism

IoT nodes are divided into groups in a cluster farm, and these groups are known as clusters; each cluster is represented byG and has a head node. Each cluster’s nodes sense data and send it to a single head node; they do not communicate with other head nodes.(1) Cluster Head (CH) Selection. The CH is responsible for collecting data from member nodes and transmitting aggregated data to the base station, it requires a lot of energy to do so, and the transmission process must be boosted with high power amplification. Two parameters are considered in the CH selection process: the history of nodes acting as CH and the optimal percentage of a node. The generation of a random number is used to make each node decision (between 0 and 1). The node will be selected as CH if the generated random number is threshold (Tn) for that round.The following formula is used to calculate the threshold (Tn):
(4)Tn=P1−Pxrmod1/Pn∈G0otherwise.In equation (4), p represents the percentage of CH, r represents the number of rounds, and G represents the set of nodes that were not selected as CH in the previous 1/p rounds. Every node in the cluster has a 1/p chance of being a CH in each round in this situation. When a node is chosen as CH, it sends an advertisement message to its nearby nodes, inviting them to be CH. The advertisement message is accepted by the member nodes, and they enter the CH.(2) Data Transmission. Following CH selection, the data transmission schedule kicks off, with member nodes sending data to their assigned CH during their designated transmission time. Low-energy transmission was required for this type of transmission. Before transmission time is allocated, the member node can be turned off to save energy. The CH must keep the receiver to receive the full data and then combine all of the data into a single signal before transmitting it to the base station via a sink node.(3) Routing Phase. The way to pick a traffic route in a network is routing. The IoT agricultural network is comprised of numerous modes of communication and protocols in the long and short range, which form the backbone for these networks to gather information and exchange this data with the farmers for review and decision-making. The IoT-based agriculture protocol has three levels of data routing in the first stage member node sense data and transfer it to their CHs, while in the second stage, the CHs accumulate and transfer data to the nearest sink, and in the third and last stage, sink sends this data into the base station. In such data communication, the function of the sink minimizes CH’s energy consumption and reduces packet losses, especially for long haul communication. Figure 8 demonstrates the full data routing method.(4) Setup Phase. For the first round, CHs are generated using the standard LEACH algorithm, and the cluster heads are chosen using equation (4). After transferring data, each node in the network consumes a specific amount of energy, and each node has consumed a different amount of energy. The distance between the sending and receiving nodes, denoted by “d,” is an important factor in power consumption. As a result, the CH is chosen for the next round using an improved equation, as shown below.
(5)Tn=fx=P1−Prmod1/P×EresidualEinitialmoptforallЄ⩝G.In above equation (5), Eresidual represents the node remaining energy, and Einitial is the initial energy assigned. Thus, mopt could be written as optimal number of clusters.
(6)mopt=EfsEampd42m−1E0−mEDA.In the above equation (6), themopt is the optimal number of clusters, X is the diameter of the network, whereas E0 is the node initial energy. For data transmission, this research extended the first order radio model specified in equation (2) to compute the energy consumption
(7)ETX=fx=m×Eelec+Efs×d2d<dom×Eelec+Eamp×d4d≥do,wheredo presents distance threshold while Eelec and Efs are denoted as energy dissipation with 50 nJ/bit and 10 pJ/bit/m2 accordingly. m represents the packet size, and Eamp is the multipath model of transmitter amplifier with 0.0013 pJ/bit/m4. Thus, ERX can be determined as it represents the receiving energy
(8)ERX=m×Eelec.Because all nodes in the farm were deployed at random with the same initial energy, the sink node is deployed without energy constraints outside of the cluster farm, and nodes are informed of its location. In the first round, nodes report their location to the sink based on their signal strength. Those nodes that were chosen as grid heads (GH) begin performing their GH role and cease their previous role of data sensing during this process. Cluster heads are chosen as nodes with a high residual energy and a short Euclidean distance to sink and GH. The Euclidean distance between any two nodesa and b in the next two dimensions is calculated as follows:
(9)da,b=x2−x1+y2−y1,Min∑r=1r=maxWEconsumedr⩝rЄR.WEconsumed is calculated using equation by (6).In the above equation,WEconsumed is the amount of energy consumed in each round, and do denotes the distance between two nodes. The consumption of energy is assumed as ETX and ERX, and their parameters can be determined by using (2) and (3). To meet the objective mentioned in (5), this research divides the total node energy into different equivalent parts and presented as “EL” and can be calculated from (7)
(10)EL=EoTL.In the equation (10), EL stands for energy level, Eo stands for initial static node, and TL stands for total energy, which is dependent on the amount of energy consumed by each node as well as network density and packet size. The relationship between EL and TL is inverse. When the TL value is low, the EL value is high. The node in the cluster farm performs the role of CH until the values of EL do not reduce the residual energy, at which point, a termination of CH selection message is sent to all nodes, and a new process for CH selection begins. Only those nodes that are supposed to transfer data remain active in this mechanism to reduce energy consumption. When member nodes finish their data sensing process, CH begins to collect data from all member nodes, aggregate the data to remove any duplication, combine data into a single signal to save bandwidth, and transmit data in a single hop to the sink, where it is then transferred to the base station. The flowchart is shown in Figure 11, and the algorithm for the entire process is shown below.Algorithm 1: The proposed scheme.
1. Initialization of IoT2. Calculate residual energy (R.E) of each node (ni … nn)3. Clustering Mechanism4. If (R.E ni == Max (R.E)) ThenCH=niElseCluster_Member= niGoTo Step 25. Control Packet broadcasting6. Data transferring from Cluster_Member7. Data transferring from Cluster_Member to CH/GH8. If (R.E ni <threshold) Thenni !=CHCluster_Member=niGoTo Step 2ElseTransfer aggregated data to nearest sink Si9. Transferring data from Si to BS10. ENDFigure 11
Workflow chart of CH mechanism.


## 3.1. Smart Model Architecture

As shown in Figure6, a futuristic smart model for agricultural environmental monitoring and food supply chain consists of three layers: physical data layer, logical data layer, and web interface layer. This type of layered approach allows for scalable, extendable, and efficient framework implementation. In the physical data layer, a variety of IoT nodes are used to track the farm environment and crop growth. IoT nodes collect data from the cluster farm and send it to the base station via IoT gateway and wireless router, which then sends it to the database. A GPRS router is integrated into a single central board device that serves as a remote Radio Frequency Gateway (RFG) for wireless telemetry. To achieve effective control management and synchronization of two relatively unrelated data sources, data collection through IoT nodes for soil parameters and IoT crop monitoring information, the RFG gateway acts as a coordinator between two separate data streams and supports remote access, allowing for complete remote control of devices in the cluster farm. The logical data layer in an SQL database server stores the data obtained from the cluster farm. The SQL server, as a more intermediate layer, covers the complexity of multiple physical layer devices and allows database server data validation. Raw data is stored in the SQL database, which is then extracted to a local file system.Figure 6
IoT and blockchain smart model.Energy is the core part of every network, and energy conservation is one of the key objectives of this research. To reduce energy consumption, this research proposed an IoT-based agriculture protocol that can be divided into three phases: IoT nodes, IoT cluster head, and sink. IoT nodes gathered data and transferred it to CH in the first phase, CH broadcasted information to sink in the second phase, and sink transferred data to the base station in the third phase. This research work implements an RFG server using a robust ultra-low-power Single Board Chip to seamlessly combine a variety of devices in the cluster farm (SBC TS-7260). The monitoring system switches between active and sleep mode automatically. The optional battery backup module supports the SBC sleep mode, which also operates with a built-in uninterrupted power supply (UPS). Different devices in the cluster farm are normally equipped with an RS232 serial port. Wireless routers are switched off during the system’s sleep cycle to conserve electricity. SQL server obtains data by either pull or pushes operations. In a pull method, SQL server connects to the data source regularly and extracts the data. In a push operation, this server opens a port through which data can be passed through the data source. This design allows the server to adapt to different data source types with ease. The data was sent to the SQL server. The data manager may also require the RFG server to recollect data and retransfer data packets that were omitted. For each new data source, a new data manager is included with limited modifications to the database and web visualization layers, improving extensibility. Specific IoT identification codes link the nodes and observations. As a consequence, once they are linked to the database, the web application layer will recognize them right away. This design allows for flexible model development and web interface design. It also allows for data conversion to IoT networks, allowing for data sharing and interoperability between IoT devices through web services.


## 3.2. BlockChain Integration with IoT in the Smart Model

Exclusive blockchain characteristics will combine agricultural and food supply chain processes into a single smart system to ensure that consumers receive healthy food. Figure7 shows a functional overview of the blockchain.Figure 7
Blockchain-based food supply chain.The role of stakeholders in the overall system is also discussed. The research used blockchain smart contracts to exchange data between mining nodes in the system. All business transactions are recorded in the shared ledger by mining nodes, and smart contracts receive all transactions in the blockchain in the form of function calls and generate activities, as well as providing access to parties involved in the transaction to exchange control track and receive alerts in the event of a violation. Finally, smart contracts help to maintain the best conditions and respond to food supply chain misappropriations.


### 3.2.1. Seed Seller

Seed sellers, also known as seed vendors, organize and produce a wide range of seeds before selling them to farmers. They are obligated to sell high-quality seeds to growers to produce a high-quality crop. The seed seller uses blockchain to store information about seed germination and chemical composition, which all stakeholders can access and share. Seeds are stamped with a unique number, similar to serialized Global Trade Identification Numbers, that allows all parties to be electronically identified and track products in the seed trade.


### 3.2.2. Farmer

A farmer is someone who buys high-quality seeds and plants them. The farmer is responsible for recording information about fertilizers use and plant growth data in the form of MPEG files in the IPFS, where different nodes keep the data with high reliability throughout the entire process from planting to harvesting. Farmers can also use blockchain to communicate with crop buyers and sell their crops without relying on middlemen, who often get profit by mediating between sellers and buyers.


### 3.2.3. Crop Buyer

Crop buyer is a company that buys crop or a grain from a farmer and sells it to a processor.


### 3.2.4. Processor

The processor buys grain that does a moisture analysis to convert the raw grain to the final product. The processor is responsible for all operations in the blockchain where other players in the supply chain have access to this information.


### 3.2.5. Crop Storage

The storing of crops or grains is an important and unavoidable part of the crop production process and supply chain process. In warehouse, grains or crops are stored, and information is recorded in the blockchain where supply chain stakeholders can view and exchange this information.


### 3.2.6. Distributor

Distributors have a business arrangement with the suppliers or producers. Many distributors maintain exclusive purchasing agreements which limit or allow distributors to cover a certain area through the number of participants. The distributor is the producer’s exclusive point of contact with prospective purchasers of those products. Distributors, though, seldom sell the goods of the manufacturer directly to the retailer. Distributors tend to work with wholesale agents who may buy large quantities of one commodity regardless of the very large quantity of one commodity they have on hand or can purchase from the manufacturer. The distributor is responsible for registering all food product information in the blockchain.


### 3.2.7. Retailer

Retailers are profit-making companies that directly sell products to consumers. Retailers search for products that suit their market objectives and find vendors at the most advantageous prices to make a profit. Generally, small quantities of an item can be ordered from a distributor by a retailer. In this setup, the retailer orders goods in batches of traceable identifiers which make it easy for the customer to verify product life cycle records.


### 3.2.8. Customer

The customer is the final user of the food product who purchases the food product from the retailer. This research smart model provides full access to the customer to trace production information from the origin to the sale point. In this setup, all supply chain stakeholders are bound to digitally sign blockchain smart contracts and to record information fairly and in case of dishonest blockchain automatically configure the incident into smart contracts to fine the concerned party. Another option is to install cameras in the field to automatically capture and transfer images to the blockchain for preaudit. The advantage of using product traceability technology in the food supply chain is the availability of reliable and real-time information to all stakeholders.


## 3.2.1. Seed Seller

Seed sellers, also known as seed vendors, organize and produce a wide range of seeds before selling them to farmers. They are obligated to sell high-quality seeds to growers to produce a high-quality crop. The seed seller uses blockchain to store information about seed germination and chemical composition, which all stakeholders can access and share. Seeds are stamped with a unique number, similar to serialized Global Trade Identification Numbers, that allows all parties to be electronically identified and track products in the seed trade.


## 3.2.2. Farmer

A farmer is someone who buys high-quality seeds and plants them. The farmer is responsible for recording information about fertilizers use and plant growth data in the form of MPEG files in the IPFS, where different nodes keep the data with high reliability throughout the entire process from planting to harvesting. Farmers can also use blockchain to communicate with crop buyers and sell their crops without relying on middlemen, who often get profit by mediating between sellers and buyers.


## 3.2.3. Crop Buyer

Crop buyer is a company that buys crop or a grain from a farmer and sells it to a processor.


## 3.2.4. Processor

The processor buys grain that does a moisture analysis to convert the raw grain to the final product. The processor is responsible for all operations in the blockchain where other players in the supply chain have access to this information.


## 3.2.5. Crop Storage

The storing of crops or grains is an important and unavoidable part of the crop production process and supply chain process. In warehouse, grains or crops are stored, and information is recorded in the blockchain where supply chain stakeholders can view and exchange this information.


## 3.2.6. Distributor

Distributors have a business arrangement with the suppliers or producers. Many distributors maintain exclusive purchasing agreements which limit or allow distributors to cover a certain area through the number of participants. The distributor is the producer’s exclusive point of contact with prospective purchasers of those products. Distributors, though, seldom sell the goods of the manufacturer directly to the retailer. Distributors tend to work with wholesale agents who may buy large quantities of one commodity regardless of the very large quantity of one commodity they have on hand or can purchase from the manufacturer. The distributor is responsible for registering all food product information in the blockchain.


## 3.2.7. Retailer

Retailers are profit-making companies that directly sell products to consumers. Retailers search for products that suit their market objectives and find vendors at the most advantageous prices to make a profit. Generally, small quantities of an item can be ordered from a distributor by a retailer. In this setup, the retailer orders goods in batches of traceable identifiers which make it easy for the customer to verify product life cycle records.


## 3.2.8. Customer

The customer is the final user of the food product who purchases the food product from the retailer. This research smart model provides full access to the customer to trace production information from the origin to the sale point. In this setup, all supply chain stakeholders are bound to digitally sign blockchain smart contracts and to record information fairly and in case of dishonest blockchain automatically configure the incident into smart contracts to fine the concerned party. Another option is to install cameras in the field to automatically capture and transfer images to the blockchain for preaudit. The advantage of using product traceability technology in the food supply chain is the availability of reliable and real-time information to all stakeholders.


## 3.3. IoT-Based Agriculture Protocol for the Smart Model

IoT nodes are ideal for cluster farms because they consume less energy than WSN and can be further reduced through an efficient clustering protocol. Therefore, this research proposed a new clustering protocol IoT-based agriculture, as shown in Figure8, based on the LEACH protocol, to reduce energy consumption and extend network life.Figure 8
IoT-based agriculture clustering protocol.


### 3.3.1. Assumption for Simulation

Assumptions for simulation are given below.(i)
IoT nodes are installed on a cluster farm randomly(ii)
IoT nodes send hello messages to the base station with local information(iii)
The initial number of clusters is calculated by taking the optimal values to vary with the node density before the node starts to expire, and the smaller clusters become larger clusters(iv)
The base station and sink are installed outside the cluster farm as presented in Figure9Figure 9
IoT-based agriculture cluster farm and data transmission.


### 3.3.2. Initialization Phase

A cluster farm with a total area of500×500 m2 was chosen and distributed into clusters, with 100 IoT nodes placed in each cluster at random. The IoT nodes were chosen based on their capabilities, such as soil moisture monitoring, temperature monitoring, and crop disease tracking. Nodes in clusters are distributed in such a way that one cluster node does not communicate with other cluster nodes, but only with the cluster heads of their respective clusters. Each cluster’s CH is in charge of sharing sensed data with the BS via the sink node. To achieve a satisfactory SNR, a widely used LEACH “First Order Radio Model” is used to transmit a small message over a distance of d.


### 3.3.3. LEACH First Order Radio Model

As shown in Figure10 and Table 1, the first order radio model dissipates Eelec=50nJ/bit to run the transmitter or receiver circuit system and Eamp=100pJ/bit/m2 for the transmit amplifier to achieve a satisfactory signal-to-noise ratio. These parameters are slightly better than the existing radio system second assumption that was an energy loss due to channel transmission. To transmit an m-bit message over a distance of d using a radio model, the radio dissipates as follows:
(1)ETxm,d=ETx−elecm+ETx−ampm,d,(2)ETxm,d=Eelec×m+∈amp×m×d2,and to get this message, the radio expands
(3)ERxm=Eelec×m.Figure 10
First order radio model.Table 1
Radio characteristics.
OperationsEnergy dissipatedTransmitter electronicsETx−elec50 nJ/bitReceiver electronicsERx−elecETx−elec=ERx−elec=EelecTransmit amplifier Eamp100 pJ/bit/m2With those parameters, transferring or receiving a packet is not a low-cost method; so, protocols must strive to reduce not only transmission distances but also the number of transmission and receiving operations per message.


### 3.3.4. Clustering Mechanism

IoT nodes are divided into groups in a cluster farm, and these groups are known as clusters; each cluster is represented byG and has a head node. Each cluster’s nodes sense data and send it to a single head node; they do not communicate with other head nodes.(1) Cluster Head (CH) Selection. The CH is responsible for collecting data from member nodes and transmitting aggregated data to the base station, it requires a lot of energy to do so, and the transmission process must be boosted with high power amplification. Two parameters are considered in the CH selection process: the history of nodes acting as CH and the optimal percentage of a node. The generation of a random number is used to make each node decision (between 0 and 1). The node will be selected as CH if the generated random number is threshold (Tn) for that round.The following formula is used to calculate the threshold (Tn):
(4)Tn=P1−Pxrmod1/Pn∈G0otherwise.In equation (4), p represents the percentage of CH, r represents the number of rounds, and G represents the set of nodes that were not selected as CH in the previous 1/p rounds. Every node in the cluster has a 1/p chance of being a CH in each round in this situation. When a node is chosen as CH, it sends an advertisement message to its nearby nodes, inviting them to be CH. The advertisement message is accepted by the member nodes, and they enter the CH.(2) Data Transmission. Following CH selection, the data transmission schedule kicks off, with member nodes sending data to their assigned CH during their designated transmission time. Low-energy transmission was required for this type of transmission. Before transmission time is allocated, the member node can be turned off to save energy. The CH must keep the receiver to receive the full data and then combine all of the data into a single signal before transmitting it to the base station via a sink node.(3) Routing Phase. The way to pick a traffic route in a network is routing. The IoT agricultural network is comprised of numerous modes of communication and protocols in the long and short range, which form the backbone for these networks to gather information and exchange this data with the farmers for review and decision-making. The IoT-based agriculture protocol has three levels of data routing in the first stage member node sense data and transfer it to their CHs, while in the second stage, the CHs accumulate and transfer data to the nearest sink, and in the third and last stage, sink sends this data into the base station. In such data communication, the function of the sink minimizes CH’s energy consumption and reduces packet losses, especially for long haul communication. Figure 8 demonstrates the full data routing method.(4) Setup Phase. For the first round, CHs are generated using the standard LEACH algorithm, and the cluster heads are chosen using equation (4). After transferring data, each node in the network consumes a specific amount of energy, and each node has consumed a different amount of energy. The distance between the sending and receiving nodes, denoted by “d,” is an important factor in power consumption. As a result, the CH is chosen for the next round using an improved equation, as shown below.
(5)Tn=fx=P1−Prmod1/P×EresidualEinitialmoptforallЄ⩝G.In above equation (5), Eresidual represents the node remaining energy, and Einitial is the initial energy assigned. Thus, mopt could be written as optimal number of clusters.
(6)mopt=EfsEampd42m−1E0−mEDA.In the above equation (6), themopt is the optimal number of clusters, X is the diameter of the network, whereas E0 is the node initial energy. For data transmission, this research extended the first order radio model specified in equation (2) to compute the energy consumption
(7)ETX=fx=m×Eelec+Efs×d2d<dom×Eelec+Eamp×d4d≥do,wheredo presents distance threshold while Eelec and Efs are denoted as energy dissipation with 50 nJ/bit and 10 pJ/bit/m2 accordingly. m represents the packet size, and Eamp is the multipath model of transmitter amplifier with 0.0013 pJ/bit/m4. Thus, ERX can be determined as it represents the receiving energy
(8)ERX=m×Eelec.Because all nodes in the farm were deployed at random with the same initial energy, the sink node is deployed without energy constraints outside of the cluster farm, and nodes are informed of its location. In the first round, nodes report their location to the sink based on their signal strength. Those nodes that were chosen as grid heads (GH) begin performing their GH role and cease their previous role of data sensing during this process. Cluster heads are chosen as nodes with a high residual energy and a short Euclidean distance to sink and GH. The Euclidean distance between any two nodesa and b in the next two dimensions is calculated as follows:
(9)da,b=x2−x1+y2−y1,Min∑r=1r=maxWEconsumedr⩝rЄR.WEconsumed is calculated using equation by (6).In the above equation,WEconsumed is the amount of energy consumed in each round, and do denotes the distance between two nodes. The consumption of energy is assumed as ETX and ERX, and their parameters can be determined by using (2) and (3). To meet the objective mentioned in (5), this research divides the total node energy into different equivalent parts and presented as “EL” and can be calculated from (7)
(10)EL=EoTL.In the equation (10), EL stands for energy level, Eo stands for initial static node, and TL stands for total energy, which is dependent on the amount of energy consumed by each node as well as network density and packet size. The relationship between EL and TL is inverse. When the TL value is low, the EL value is high. The node in the cluster farm performs the role of CH until the values of EL do not reduce the residual energy, at which point, a termination of CH selection message is sent to all nodes, and a new process for CH selection begins. Only those nodes that are supposed to transfer data remain active in this mechanism to reduce energy consumption. When member nodes finish their data sensing process, CH begins to collect data from all member nodes, aggregate the data to remove any duplication, combine data into a single signal to save bandwidth, and transmit data in a single hop to the sink, where it is then transferred to the base station. The flowchart is shown in Figure 11, and the algorithm for the entire process is shown below.Algorithm 1: The proposed scheme.
1. Initialization of IoT2. Calculate residual energy (R.E) of each node (ni … nn)3. Clustering Mechanism4. If (R.E ni == Max (R.E)) ThenCH=niElseCluster_Member= niGoTo Step 25. Control Packet broadcasting6. Data transferring from Cluster_Member7. Data transferring from Cluster_Member to CH/GH8. If (R.E ni <threshold) Thenni !=CHCluster_Member=niGoTo Step 2ElseTransfer aggregated data to nearest sink Si9. Transferring data from Si to BS10. ENDFigure 11
Workflow chart of CH mechanism.


## 3.3.1. Assumption for Simulation

Assumptions for simulation are given below.(i)
IoT nodes are installed on a cluster farm randomly(ii)
IoT nodes send hello messages to the base station with local information(iii)
The initial number of clusters is calculated by taking the optimal values to vary with the node density before the node starts to expire, and the smaller clusters become larger clusters(iv)
The base station and sink are installed outside the cluster farm as presented in Figure9Figure 9
IoT-based agriculture cluster farm and data transmission.


## 3.3.2. Initialization Phase

A cluster farm with a total area of500×500 m2 was chosen and distributed into clusters, with 100 IoT nodes placed in each cluster at random. The IoT nodes were chosen based on their capabilities, such as soil moisture monitoring, temperature monitoring, and crop disease tracking. Nodes in clusters are distributed in such a way that one cluster node does not communicate with other cluster nodes, but only with the cluster heads of their respective clusters. Each cluster’s CH is in charge of sharing sensed data with the BS via the sink node. To achieve a satisfactory SNR, a widely used LEACH “First Order Radio Model” is used to transmit a small message over a distance of d.


## 3.3.3. LEACH First Order Radio Model

As shown in Figure10 and Table 1, the first order radio model dissipates Eelec=50nJ/bit to run the transmitter or receiver circuit system and Eamp=100pJ/bit/m2 for the transmit amplifier to achieve a satisfactory signal-to-noise ratio. These parameters are slightly better than the existing radio system second assumption that was an energy loss due to channel transmission. To transmit an m-bit message over a distance of d using a radio model, the radio dissipates as follows:
(1)ETxm,d=ETx−elecm+ETx−ampm,d,(2)ETxm,d=Eelec×m+∈amp×m×d2,and to get this message, the radio expands
(3)ERxm=Eelec×m.Figure 10
First order radio model.Table 1
Radio characteristics.
OperationsEnergy dissipatedTransmitter electronicsETx−elec50 nJ/bitReceiver electronicsERx−elecETx−elec=ERx−elec=EelecTransmit amplifier Eamp100 pJ/bit/m2With those parameters, transferring or receiving a packet is not a low-cost method; so, protocols must strive to reduce not only transmission distances but also the number of transmission and receiving operations per message.


## 3.3.4. Clustering Mechanism

IoT nodes are divided into groups in a cluster farm, and these groups are known as clusters; each cluster is represented byG and has a head node. Each cluster’s nodes sense data and send it to a single head node; they do not communicate with other head nodes.(1) Cluster Head (CH) Selection. The CH is responsible for collecting data from member nodes and transmitting aggregated data to the base station, it requires a lot of energy to do so, and the transmission process must be boosted with high power amplification. Two parameters are considered in the CH selection process: the history of nodes acting as CH and the optimal percentage of a node. The generation of a random number is used to make each node decision (between 0 and 1). The node will be selected as CH if the generated random number is threshold (Tn) for that round.The following formula is used to calculate the threshold (Tn):
(4)Tn=P1−Pxrmod1/Pn∈G0otherwise.In equation (4), p represents the percentage of CH, r represents the number of rounds, and G represents the set of nodes that were not selected as CH in the previous 1/p rounds. Every node in the cluster has a 1/p chance of being a CH in each round in this situation. When a node is chosen as CH, it sends an advertisement message to its nearby nodes, inviting them to be CH. The advertisement message is accepted by the member nodes, and they enter the CH.(2) Data Transmission. Following CH selection, the data transmission schedule kicks off, with member nodes sending data to their assigned CH during their designated transmission time. Low-energy transmission was required for this type of transmission. Before transmission time is allocated, the member node can be turned off to save energy. The CH must keep the receiver to receive the full data and then combine all of the data into a single signal before transmitting it to the base station via a sink node.(3) Routing Phase. The way to pick a traffic route in a network is routing. The IoT agricultural network is comprised of numerous modes of communication and protocols in the long and short range, which form the backbone for these networks to gather information and exchange this data with the farmers for review and decision-making. The IoT-based agriculture protocol has three levels of data routing in the first stage member node sense data and transfer it to their CHs, while in the second stage, the CHs accumulate and transfer data to the nearest sink, and in the third and last stage, sink sends this data into the base station. In such data communication, the function of the sink minimizes CH’s energy consumption and reduces packet losses, especially for long haul communication. Figure 8 demonstrates the full data routing method.(4) Setup Phase. For the first round, CHs are generated using the standard LEACH algorithm, and the cluster heads are chosen using equation (4). After transferring data, each node in the network consumes a specific amount of energy, and each node has consumed a different amount of energy. The distance between the sending and receiving nodes, denoted by “d,” is an important factor in power consumption. As a result, the CH is chosen for the next round using an improved equation, as shown below.
(5)Tn=fx=P1−Prmod1/P×EresidualEinitialmoptforallЄ⩝G.In above equation (5), Eresidual represents the node remaining energy, and Einitial is the initial energy assigned. Thus, mopt could be written as optimal number of clusters.
(6)mopt=EfsEampd42m−1E0−mEDA.In the above equation (6), themopt is the optimal number of clusters, X is the diameter of the network, whereas E0 is the node initial energy. For data transmission, this research extended the first order radio model specified in equation (2) to compute the energy consumption
(7)ETX=fx=m×Eelec+Efs×d2d<dom×Eelec+Eamp×d4d≥do,wheredo presents distance threshold while Eelec and Efs are denoted as energy dissipation with 50 nJ/bit and 10 pJ/bit/m2 accordingly. m represents the packet size, and Eamp is the multipath model of transmitter amplifier with 0.0013 pJ/bit/m4. Thus, ERX can be determined as it represents the receiving energy
(8)ERX=m×Eelec.Because all nodes in the farm were deployed at random with the same initial energy, the sink node is deployed without energy constraints outside of the cluster farm, and nodes are informed of its location. In the first round, nodes report their location to the sink based on their signal strength. Those nodes that were chosen as grid heads (GH) begin performing their GH role and cease their previous role of data sensing during this process. Cluster heads are chosen as nodes with a high residual energy and a short Euclidean distance to sink and GH. The Euclidean distance between any two nodesa and b in the next two dimensions is calculated as follows:
(9)da,b=x2−x1+y2−y1,Min∑r=1r=maxWEconsumedr⩝rЄR.WEconsumed is calculated using equation by (6).In the above equation,WEconsumed is the amount of energy consumed in each round, and do denotes the distance between two nodes. The consumption of energy is assumed as ETX and ERX, and their parameters can be determined by using (2) and (3). To meet the objective mentioned in (5), this research divides the total node energy into different equivalent parts and presented as “EL” and can be calculated from (7)
(10)EL=EoTL.In the equation (10), EL stands for energy level, Eo stands for initial static node, and TL stands for total energy, which is dependent on the amount of energy consumed by each node as well as network density and packet size. The relationship between EL and TL is inverse. When the TL value is low, the EL value is high. The node in the cluster farm performs the role of CH until the values of EL do not reduce the residual energy, at which point, a termination of CH selection message is sent to all nodes, and a new process for CH selection begins. Only those nodes that are supposed to transfer data remain active in this mechanism to reduce energy consumption. When member nodes finish their data sensing process, CH begins to collect data from all member nodes, aggregate the data to remove any duplication, combine data into a single signal to save bandwidth, and transmit data in a single hop to the sink, where it is then transferred to the base station. The flowchart is shown in Figure 11, and the algorithm for the entire process is shown below.Algorithm 1: The proposed scheme.
1. Initialization of IoT2. Calculate residual energy (R.E) of each node (ni … nn)3. Clustering Mechanism4. If (R.E ni == Max (R.E)) ThenCH=niElseCluster_Member= niGoTo Step 25. Control Packet broadcasting6. Data transferring from Cluster_Member7. Data transferring from Cluster_Member to CH/GH8. If (R.E ni <threshold) Thenni !=CHCluster_Member=niGoTo Step 2ElseTransfer aggregated data to nearest sink Si9. Transferring data from Si to BS10. ENDFigure 11
Workflow chart of CH mechanism.


## 4. Simulation Results and Discussion

To test the efficiency of our proposed IoT-based agriculture protocol, the MATLAB simulation is compared with the current LEACH protocol. IoT nodes were installed randomly in each simulated technique in the simulation of 5000 rounds. In the farm of500×500m2, all active IoT nodes transfer data to their respective cluster heads, and cluster heads transfer data to the base station via sink node. The simulation results are presented below.


### 4.1. Network Stability Period

The time it takes for the first node to die is known as the network stability period. Figure12 depicts the LEACH network stability period and the proposed IoT-based agriculture protocol. LEACH has a shorter stability period than the proposed protocol. The reason for the improvement is that data is only transferred in the proposed protocol when there is a difference between previously taken data and current data. The results show that the LEACH first node dies after 168 rounds, while the proposed protocol first node dies after 463 rounds, indicating that the IoT-based agriculture protocol is 23% more efficient in terms of network stability.Figure 12
Network stability period of LEACH and IoT-based agriculture protocol.


### 4.2. Energy Consumption

The energy consumed by the nodes during data transmission is referred to as energy consumption. Figure13 shows the simulation results for both protocols. The energy consumption of the nodes in the IoT-based agriculture protocol is 68 percent lower than that of LEACH, which can extend network life.Figure 13
Energy consumption of LEACH and IoT-based agriculture.


### 4.3. Network Life

The network’s life is determined by the time it takes to finish the energy at the first node. Figure14 depicts the efficiency of LEACH’s network life and IoT-based agriculture. LEACH assumes that CHs dissipate the same amount of energy for each round, resulting in unsuccessful CH selection and a reduction in network life, whereas the IoT-based protocol selects CHs based on the residual energy of the nodes and the optimal number of clusters, resulting in a 112 percent increase in network life.Figure 14
Network life of LEACH and IoT-based agriculture.


## 4.1. Network Stability Period

The time it takes for the first node to die is known as the network stability period. Figure12 depicts the LEACH network stability period and the proposed IoT-based agriculture protocol. LEACH has a shorter stability period than the proposed protocol. The reason for the improvement is that data is only transferred in the proposed protocol when there is a difference between previously taken data and current data. The results show that the LEACH first node dies after 168 rounds, while the proposed protocol first node dies after 463 rounds, indicating that the IoT-based agriculture protocol is 23% more efficient in terms of network stability.Figure 12
Network stability period of LEACH and IoT-based agriculture protocol.


## 4.2. Energy Consumption

The energy consumed by the nodes during data transmission is referred to as energy consumption. Figure13 shows the simulation results for both protocols. The energy consumption of the nodes in the IoT-based agriculture protocol is 68 percent lower than that of LEACH, which can extend network life.Figure 13
Energy consumption of LEACH and IoT-based agriculture.


## 4.3. Network Life

The network’s life is determined by the time it takes to finish the energy at the first node. Figure14 depicts the efficiency of LEACH’s network life and IoT-based agriculture. LEACH assumes that CHs dissipate the same amount of energy for each round, resulting in unsuccessful CH selection and a reduction in network life, whereas the IoT-based protocol selects CHs based on the residual energy of the nodes and the optimal number of clusters, resulting in a 112 percent increase in network life.Figure 14
Network life of LEACH and IoT-based agriculture.


## 5. Conclusions

The use of blockchain in the food supply chain has yielded various benefits, including the potential to expand and step towards the distributed network, as well as the ability to build a trustless environment for all processes. Despite the trustless existence of blockchain, it is difficult to completely establish trust between the agricultural product seller and buyer. Current blockchain-based food supply chain systems focus solely on the supply chain, with no choice to track food products back to their source to ensure product quality, while existing IoT-based agriculture systems are often isolated, with roles restricted to agriculture environment monitoring and farmers unable to directly communicate with market buyers. In this paper, we have provided complete solution for agriculture and food supply chain by integrating IoT with the blockchain. In addition, we have developed an energy efficient routing protocol for the proposed system to extend system life by reducing energy consumption. A novel approach has been applied in this research and developed a futuristic smart model for agriculture and the food supply chain, which offers an innovative way for farmers to acquire information on crops. IoT can provide farmers with information on crop yields, soil temperature, pest infestation, and soil quality that is essential for high crop production and provides precise data that can be used to improve farming techniques. Crop tracking can be performed effectively to track crop growth and record growth information. Another unique aspect of the smart model is blockchain, which offers real-time updates on the safety status of food items to all actors of the supply chain, significantly eliminates the vulnerability of centralized information networks, and makes them secure, more widely available, more accessible, and more interactive. The smart model will greatly boost the efficiency and reliability of the food supply chain, which will inevitably increase food safety and regain customer trust in the food industry.



---

*Source: 5580179-2021-06-23.xml*