Keywords

1 Introduction

Thanks to the developing technology in the past years, improvements have also been made in the field of supply chain. The supply chain is a network service that involves production, processing, and delivery of goods to the customer. At the end of this process, a quality problem may arise in the goods offered to the customer and it is extremely difficult to identify the source of the problem in traditional supply chain systems. Recently, with the improvement of living standards, food safety has become important for people. the Mad Bee Disease outbreak in the United Kingdom in 1996, Bird Flu in Hong Kong in 1997, Swine Encephalitis in 1998, Screed Disease in South East Asia, Europe, SARS scandal in Hong Kong in 2001, Sanlu milk scandal in China in 2008 caused people worry about safety of food. People even worry that there may be hormones, chemical additives in all foods. These incidents revealed that there are problems in food production and supply chain processes [1]. After the food scandals, consumers became more interested in data within the supply chain and began to demand better quality foods. In addition, governments attach great importance to the monitoring of food products. The Food Law [2], enacted by the European Union in 2002, stipulates the need for a comprehensive monitoring system to provide timely and accurate information to consumers. The Food Safety Law [3], which has been implemented by China in 2009, requires food manufacturers and businesses to establish a product tracking system for food safety. For these reasons, it has become important and mandatory for supply chains to follow the entire process, from the production of food to the delivery to the customer.

Today, data on processes such as production, food processing, and distribution in traditional agri-food supply chains are stored paper-based or in special databases. This situation causes serious difficulties. Some of these include [4]: (i) Data stored in private and central databases may be manipulated and may cause trust issues among stakeholders. (ii) The supply chain may become inoperable as a result of a single point of failure. (iii) Centralized databases vulnerable to attacks by hackers may be destroyed or confidential data may be stolen. (iv) High costs may occur if a third party is included for data verification and monitoring. To overcome these problems, studies involving distributed databases and cryptography have been carried out over several decades. Among them, blockchain has come to the fore with its services in response to trust problems [4].

In blockchain technology, many advanced computing and cryptographic techniques have been integrated into the distributed data structure to achieve a digital trust system in an untrusted environment [5]. Thanks to its distributed, unchangeable and transparent structure, the blockchain can create an environment of trust among the actors in the supply chain. With smart contracts running within the blockchain, many transactions such as asset transfer, data exchange, and data monitoring can be automated. There are concerns over the deterioration and alteration of the data obtained from IoT devices in the current agricultural food supply chains in the central data structures. Thanks to the integration of IoT devices into the blockchain, it is possible to manage data collection and data monitoring in a transparent and distributed manner.

2 Blockchain

Blockchain technology was first introduced by an author called as Nakamoto, whose actual existence is unclear [6]. The blockchain, which became known with crypto coins in the early days, pioneered solutions that made life easier in different areas thanks to its features in the following years. Blockchain technology has revolutionized distributed applications with the opportunities it offers due to its nature. Many definitions of blockchain have been made by researchers. Some of them are as follows; Beck described the blockchain as a database that enables secure, consistent and transparent transactions between many participants in a computer network [7]. Reyna et al. defined blockchain as a data structure in which the reliability of the data transactions performed is provided by stakeholders in the network [8]. According to Zheng et al., transactions approved by the participating nodes are stored in blocks on the blockchain and new blocks are created as new data is added. Blockchain has been expressed in this way as a growing data book [5]. From a technical point of view, blockchain can be defined as a combination of decentralized consensus methods, cryptographic algorithms, and a distributed, transparent and immutable database. We can list the advantages of blockchain technology as follows [9]:

  • Distributed structure: Stakeholders do not have to rely on a central authority or third-party applications.

  • Transparency: Nodes in the network can view the actions of other nodes.

  • Autonomous Operation: The blockchain network does not have an owner, if any node goes off, the chain/the network will continue to run.

  • Resistance to attacks: A lot of computational power is required to -attack compromise mechanisms such as Proof of Work (PoW).

  • Error traceability: Error points in the blockchain can be detected.

  • Immutability of historical data: It is not possible to change or delete a data in the blockchain.

One of the important services offered by blockchain technology is smart contract. Smart contract is a transaction protocol that executes the conditions for the occurrence of a series of events on the blockchain [10]. In other words, smart contracts consist of transparent, immutable pieces of software code that are stored within the blockchain network and run when triggered. Smart contract ensures that the agreements between the parties are carried out in an electronic environment in a transparent and secure manner. Many blockchain systems offer smart contract services with support for different software languages. For example, it is possible to create smart contract with the Solidity software language on Ethereum system. Thanks to smart contracts, useful studies have been carried out in many different fields. Some of the features of smart contracts are:

  • Smart contracts promise to replace the traditional contracts used today, thanks to their distributed and secure structure being independent from the central authority.

  • Smart contracts are transparent and unchangeable pieces of software code that are machine-readable and running on the blockchain network.

  • Once created, smart contracts run automatically without the need for monitoring.

The blockchain consists of interconnected blocks that increase according to the size of the transactions made. A block contains information such as values of the previous block, time stamp, block version, and transaction counter, as shown in Fig. 1. By connecting the blocks together, a chain similar to the blockchain structure shown in Fig. 2 is formed.

Fig. 1
figure 1

Block structure

Fig. 2
figure 2

Blockchain structure

Existing blockchain systems are classified into three categories: Public Blockchain, Private Blockchain, and Consortium Blockchain [11]. The Public blockchain provides an open platform that allows anyone or any institution to participate, add records, and mine. There are no restrictions on such blockchains, and therefore they are called unauthorized blockchains. Blockchain structures managed by one or more groups that allow data sharing and exchange between participants are called Private blockchains. A stakeholder’s participation and access to the network become available according to the rules set by the group that manages the network. Consortium blockchain can be defined as a partially private and authorized blockchain in which a predetermined group of stakeholders is involved as decision makers in block validation and consortium processes instead of a single organization. These stakeholders manage who will participate in such networks and who can mine. Examining the studies in the literature, it is seen that private blockchain is usually used in the solutions presented.

3 Blockhain Solutions for Agro-Food Chain

The introduction of IoT devices in agricultural activities has provided many conveniences in areas such as planting, irrigation, data collection, data monitoring, transportation, and paved the way for smart agriculture. Friha et al. conducted a study on the use of IoT devices in smart agricultural applications [12]. In this study, survey studies conducted in recent years have been evaluated according to criteria. In one section of this study, 14 survey studies on the use of IoT devices in agricultural activities were examined. One of the evaluation criteria of these studies is the state of working on blockchain. Looking at the evaluation results, it was stated that only two of the 14 questionnaires focused on blockchain technology. It is seen that these two surveys were conducted in 2020. Again, in this study, the literature review about the applications developed on the use of IoT devices in agricultural activities is included. In this review study, recent studies to monitor, control, warn plants and animals, manage disease and damage, monitor the supply chain, reduce waste and pollution, and save money and time are examined. It is determined that only two of the 18 applications examined work on the blockchain. In a different part of this study, studies on the use of IoT devices in the agricultural supply chain are evaluated. Examining 17 studies, it is seen that 10 of them were blockchain-based. In this review study conducted by IoT devices on smart farming applications, it was stated that blockchain-based applications are rare among the studies on smart agriculture. Small number of these blockchain-based applications have also been developed in recent years, as it is expected in the field of supply chain, the abundance of blockchain-based works draws attention. It is thought that the number of blockchain-based supply chain and other smart agriculture efforts may increase as a result of the development and widespread use of blockchain technology.

The study conducted by Lin et al. included a comprehensive literature review of blockchain-based agricultural applications [4]. In this study, 24 applied blockchain-based agricultural applications were examined. These include applications that track the process from the production stage of foods such as meat, fish, vegetables, and eggs to the consumer using RFID and IoT devices, smart agricultural applications such as irrigation, storage, and time estimation, and financial applications where digital payment, insurance, and credit transactions are made. Considering the implementation issues, it is seen that most of the work done is on the supply chain and monitoring. In this literature study, the blockchain system used for each study examined is also included. Analyzing the blockchain systems used, it is seen that Hyperledger fabric and Ethereum-based applications are in the majority. In addition, there are few applications developed with MultiChain and Quorum systems. Considering the date of the studies, it is seen that the majority of the studies have been carried out in last 2 years. It is expected that the number of studies to be carried out in this field will increase in the future, as this is an area of interest to researchers and companies.

Some of the current blockchain-based studies on the supply chain and traceability of agricultural foods are.

A blockchain-based system was proposed by Caro et al. to monitor the supply chain of agricultural foods [13]. This system, called AgriBlockIoT, is based on monitoring agricultural food with IoT devices in all processes such as production, transportation, and transferring data to the blockchain of these devices. In this system, the importance of using IoT devices in all processes of the agricultural food supply chain has been emphasized. It is stated that IoT devices can be used for seed tracking with QR codes, agricultural area tracking with cameras, product development tracking with photos, collection of data on water and chemicals in the soil with sensors, transportation and packaging data with GPS sensors. Data collection and sharing were done through smart contracts, so that necessary warnings were received in case of inconsistency, such as between the amount of seed and the product obtained. The proposed system was developed on Ethereum and Hyperledger environments and the performance of these two environments was compared.

Yang et al. proposed a blockchain-based secure traceability system for vegetables and fruits [14]. In this study, the traceability of agricultural products is divided into four phases as production, processing, transportation, and sales. The production phase includes planting, irrigation, and fertilization. The processing phase includes weighing, packaging, production environment information, inserting product information, barcode, and key information. In the transportation and sales phases, products are traced by IoT devices. It is ensured that the data related to these processes are managed digitally and that the data sources in the supply chain become a participant on the blockchain. In this way, with a complete monitoring system, a trusted environment has been created where customers can query the products. It is stated that, thanks to this system, security and judicial units can make the necessary examinations regarding the quality or health problems that may arise and responsible person can be easily identified. As the number of participants on the blockchain increases, the size and query times of the data kept in the chain also increase. A participant in the blockchain can also access all the data in the chain. In this study, “database + blockchain” solution is proposed to solve this problem. In this solution, a data belonging to the product is added to the local database, and the encrypted form and hash code of this data are kept in the blockchain. Keeping the data encrypted in this way and verifying an issue when necessary is done with smart contracts. The application and evaluation results of the solution presented in this study are also included. Hyperledger fabric as the blockchain system, Go as the smart contract language, Linux and Docker support for the blockchain environment, CouchDB as the local database and C # ASP.NET MVC and Java Script for application development are chosen. With the application developed, all processes of fruits and vegetables from production to sales can be traced. The performance of the developed application is evaluated with the Hyperledger Caliper tool and information is given about the times of adding data to the blockchain and reading data. Finally, it is included in the comparison of traditional monitoring systems with blockchain-based monitoring systems.

Shahid et al. proposed a complete supply chain system for agricultural foods [15]. In this study, the authors handle all tracking, distribution, and payment tasks from manufacturing to the customer. These tasks are managed transparently and automatically with smart contracts. In addition, comments and scoring information about the participants such as farmers, logistics, and retailers are kept and an evaluation score is calculated for the participants. This score is offered to customers as an important criterion for subsequent purchases. In this study, as in many similar studies, the files of data such as sensor information and production pictures are kept on the central file server in order to alleviate the data load on the blockchain and the encrypted key information required for the verification of these data is kept on the blockchain. Creating the encrypted keys of the files and then verifying them are also carried out with smart contracts. In the proposed system, the farmer, the transporter, the retailer, and the customer are participating in the blockchain. The farmer transfers the sensor data and production pictures of the agricultural foods to the transporter with a single key data, then the retailer pays the price of the products selected from the transporter in cryptocurrency and gains access to the production data. In this way, the end user can access the production data of the food he intends to buy. These transactions between the participants are carried out automatically with smart contracts. In the smart contracts made in these transactions, a certain amount of deposit is received from the parties and this deposit can be used when the physical exchange is completed. In the event of any mishaps, the depository of the offending party is blocked as a penalty. After these exchanges are made within the supply chain, the parties can add comments and point information about each other. This information is used to form the evaluation score of the relevant participant and is considered as an important criterion for the selection of the relevant company for future purchases. The proposed system has been simulated in the Ethereum environment. In the study, information about the technologies used in the simulated environment is provided as well. The simulation results include the duration of operations such as product registration, data, verification, evaluation, and the amount of “gas” required for these tasks.

Wang et al. [4] and Salah et al. [16] also provided solutions for the safe and transparent monitoring and management of agricultural foods from the farmer to the customer with smart contracts. Vanany et al. proposed a similar blockchain-based supply chain against the difficulties of tracking halal food [17].

There are many studies in the literature similar to mention above. These studies are generally based on the distribution and tracking of data in the entire supply chain, from production to the customer, as distributed and unchangeable. Recently, IoT devices, which have become widespread rapidly, are very useful for monitoring agricultural foods. Saving the data obtained from these devices directly on the blockchain provides a safe and transparent environment for the participants in the supply chain. Keeping all the data produced in the supply chain distributed on the blockchain can cause a large amount of data to accumulate in all stakeholders and increase query times. In addition, this distributed structure causes some private data of the participants to be shared with all stakeholders. In parallel with the developments in blockchain, studies in the field of supply chain have been carried out on keeping data in cloud environment or central file servers and keeping hash codes and encrypted key values in blockchain, which prove the accuracy and immutability of this data. In most of the work done, the exchange of products in the supply chain and data verification processes were carried out automatically with smart contracts.

3.1 Real-Life Applications

In addition to the solution proposals presented in the literature in this field, it is possible to find real-life applications. Motta et al. conducted a study on real-world applications built on the blockchain-based agricultural food supply chain [18]. Some of these applications include:

Tuna Tracking and Certification (Provenance)

An application named Provenance has been developed in Indonesia in cooperation with NGO Humanity United and International Pole and Line Foundation to monitor the caught tuna until it reaches the customer. When the fisherman catches tuna, he must register the QR code or RFID information placed on the fish by SMS. The factory and the customer can now monitor this fish, which was recorded in the blockchain. In this way, it is ensured that the customer questioned the fish he wants to buy and identifies the fish that was not known where they were caught [19].

Olive Oil Tracking (Ambrosus)

In France, a tracking system has been developed to track olives from the fields to the warehouses and from there to the packaging factory and retailer. Unlike the existing tracking systems, Ambrosius enables the tracking of olives with RFID technology using the “hardware-in-place” method. The exchange of olives has also been done through smart contracts on Ethereum [20].

Celeia Dairy (OriginTrail)

OriginTrail ensures that data such as images and sensor information are kept distributed on the Ethereum blockchain in the dairy supply chain operated by many companies, instead of being kept separately in each company and the transactions are verified through consensus transactions [21].

Pork Meat Traceability (Te-Food)

Te-Food application has been developed to follow the process of pork from production to the customer. With this application, the farmer registers the pigs associated with RFID and QR code to the blockchain with his smartphone. Later, it is ensured that the trucks used for transportation can also be monitored with RFID. Slaughter of pigs in the truck arriving at the slaughterhouse and quality control by the veterinarians are identified with a QR code. In this solution, the token technology is used for exchanges between companies and product comments made by the user. The system was launched in South Vietnam at the beginning of 2017 and more than 6,000 companies have been trained to use it. It has been reported that 25 thousands chickens and 2 million eggs are monitored daily on Te-Food, which has been used for chicken and egg tracking since September 2017 [22].

After the recent food scandals, Walmart followed pork in China and mango in America using the Hyperledger-based supply chain monitoring system offered by IBM in 2016. With this method, presented as a “farm to table” approach by Wallmart, products can be followed transparently. Food safety has been increased and the amount of waste has been reduced [23].

4 Proposed Solution

The previous sections covered current studies and real-world applications of the use of blockchain technology in the supply chain of agri-food. Considering the studies conducted, it is obvious that each study brings different solutions to different problems. In this study, an ideal system proposal is provided in which innovative solutions presented in existing studies are included. The general structure of the proposed system is shown in Fig. 3.

Fig. 3
figure 3

General structure of the proposed system

In most of the studies conducted in this area, it is stated that agricultural food should be traced from “farm to customer” in the supply chain. For this, the use of IoT devices in agricultural areas is very important. Figure 4 shows an agricultural area proposal in which IoT devices are used for the proposed system.

Fig. 4
figure 4

Proposed agricultural area

In order to monitor agricultural food in the supply chain, it is important to monitor the transportation and factory process as well as agricultural areas. It is thought that the ideal method to solve this problem is to use IoT devices and blockchain technology together. For this, the products identified with RFID and QR code in the agricultural field should be taken to the factory environment by carriers equipped with RFID, GPS, and thermometer devices. Operations such as cutting and packaging in the factory must be monitored by responsible people and recorded with a camera. Then, the products obtained can be traced to the market shelves by associating them with RFID or QR codes. Figure 5 shows an example of how foods can be traced in the transport and factory process.

Fig. 5
figure 5

Tracking of food transportation and factory processes with IoT devices

Information was given about an ideal structure, agricultural area, transportation, and factory processes to monitor agricultural foods in the supply chain above, sample figures were also shown. The proposed structure should have the following features;

  • The farmer, transformer, factory, supermarket and the customer, who are participating in the supply chain, should know that all data of a product is stored in a distributed, transparent and unchangeable manner in the process from production to the market shelf. An environment of trust should be created. For this, the system must be developed on a blockchain basis.

  • The use of IoT devices in agriculture is a great innovation. But ensuring the reliability of the data obtained from these devices is another important issue. For this, IoT devices such as RFID, camera, moisture meter, sensors that measure the chemical status of the soil, and GPS used during transportation should be directly connected to the blockchain.

  • Purchases between supply chain participants should be made with smart contracts. In this way, both the process will be automated and inconsistent operations can be prevented. For example, if too many products are obtained from an agricultural area than usual and delivered to the shipper, the system can block this purchase by issuing a warning.

  • It should be ensured that the products are tracked by means of technologies such as RFID and QR codes during the exchange between participants. For example, when a cow arrives at the slaughterhouse with RFID, it should be ensured that the meat is slaughtered under the supervision of the camera and the veterinarian and the meat obtained is associated with the animal slaughtered with the QR code.

  • Each participant of the supply chain will also work as a node of the established blockchain. Since the amount of data recorded in the supply chain will increase over time, storing all of this data distributed over the nodes will cause too much disk need and private data of the participants to be included in the entire supply chain. This causes a scalability and data security issue. To prevent this, an application developed for participants should ensure that the full data of the products are uploaded to the server located in the cloud. The hash code and private encrypted key information of the file in the cloud should then be saved to the blockchain network.

  • An application must be developed for data management and data validation between blockchain and cloud database. Thanks to this application, all participants will be able to access the exact data they want with the hash code and encrypted key in the blockchain. In addition, customers should have access to all data related to a product through a web interface available in this application.

The general structure and main features of the system proposed above are given. The proposed system has been designed taking into account the current needs and the latest technological developments in this field. It is thought that this recommendation will be a useful guide for future studies.

5 Conclusion

Due to the rapidly developing technology, the usage routines and expectations of the customers are changing. Today, distributed and transparent structures are emerging as an alternative to central structures in many areas. The emerging food scandals and the desire to access quality products have created the need for access to all data of food products starting from the production environment. Thanks to the blockchain structure and features, it is thought that it can make important contributions to the supply chain of agricultural products as in many areas.

This study is based on blockchain-based solutions for tracking agricultural products in the supply chain. In this context, the current situation was evaluated and it was stated that food products should be monitored. General information about blockchain and smart contracts, which are new technologies, is given. Current studies in the literature and real-world applications in this field are mentioned. Finally, an ideal system has been proposed in which different solutions presented in the current studies are presented together.