Abstract
Agricultural Food Supply chain management has arisen as an area of day-to-day importance for the agricultural food sector, since stakeholders involved in the execution of decision-making processes. Quality less agricultural products are added to the market in day-to-day life which leads to usage of chemicals in the production process. These leads to the major issues that gives the impact on agricultural product’s quality as well as overall well-being of the consumers. Devices are needed to identify the quality of the food products which are highly demanded due to the lack of transparency in the recent processes. Henceforth Blockchain technology is evolving as a decentralized and secure infrastructure which could replace involvement of a third party to verify the transactions inside the system. The purpose of the proposed work is to implement a Blockchain based solution i.e. constructing a Decentralized Application (DApp) using Hyperledger Fabric framework to verify the food quality and the cause of the agricultural supply chain. A private permissioned Blockchain concept is chosen instead of a public Blockchain in the proposed work to ensure transparency and secure transaction by consenting any person to access the network. Smart contract chain code was instantiated for the deployment of Blockchain network. All the performers who are involved in the supply chain must be able to interact with the system to achieve the transparency. Transaction and queries related to a food product are validated by peers of the Blockchain network. A Barcode & QR code-based scanning mechanism is used to indicate the customer’s satisfaction with their products. Transactions without third party gives Farmer’s reputation for their products. A unique DApp mechanism is used to identify each product within the food supply chain. Thus, the proposed system has been implemented as a prototype and validated using smart contracts.
Introduction
Blockchain is an advanced technology and it has the potential to modify the facilities by providing trust in distributed networks for food supply chain applications. Blockchain-assisted applications improve information sharing between partners through food supply chain without losing confidentiality and security. The implementation of blockchain-based applications in the food supply chain could lead to significant benefits in terms of food traceability, transparency and authenticity. It is to perceive that Blockchain-enabled food supply chain approaches integrated with Internet of Things (IoT) will improve communication of messages among the nodes in network in a secure manner. Blockchain follows Decentralized Ledger Technology (DLT) to store the data, for a distributed environment. There are many devices deployed worldwide to handle data storage and retrieval using IoT because the IoT devices has the ability to manage them. The proposed system will be well suited for decentralized distributed access system for IoT supported Blockchain.
Food supply chain (FSC) in global and markets have led to a substantial rise in product and information flows among countries [1]. Food supply chain in earlier days is characterized by integrating supply chain partners to ensure efficiency, in reduction of transaction, operational costs and satisfying consumer needs for food quality and food safety [2]. Hence, Food supply chain partners are supposed to improve the transparency of food supply chains, to enhance the exchange of trusted information, and improve the traceability of agricultural food products from farms through to retailers [3–5]. Likewise, the food traceability and transparency are a serious owe to multiple disgraces occurring in global food supply chain. Therefore, the necessity of traceability requires that all the food components are traceable to its source [6]. On the other hand, customers’ requirements are product specific attributes such as quality, safety, authenticity, traceability, provenance and conditions of production and supply [7, 8]. Cloud computing platforms are applied for data storage for food products, and the access to the information for retailers and consumers are achieved through internet or QR code scanner by using a mobile device [9].
Blockchain has grown as global admiration in the supply chain management and logistics communal behind cryptocurrencies, due to its ability to increase transparency, for ensuring the tamperproof transactions and trust between stakeholders [9]. The integration of blockchain technology with the food supply chain has recently started to arise through subsequent research, due to its extensive demand for exploring its abilities for food supply chain. The food health and food safety challenges has brought into considerations for the stakeholders to ensure for good environments [10]. The following section discusses the literature review of various authors, and the section 3 describes about the blockchain consensus algorithm i.e smart contracts for blockchain applications of agricultural food supply chain. The section 4 describes about the traceability and using blockchain technology for food supply chain. The section 5 describes about how the decentralized application i.e Dapp is utilized for digital transactions using blockchain technology among the farmers and customers. Finally, section 6 describes about the conclusion of the proposed system using blockchain technology.
Literature review
The authors presented key themes using blockchain [11]. The proposed model is evaluated based on a set of predefined Key Performance Indicators (KPIs) [12]. The security and privacy of blockchains remain to be unique when deploying blockchain in different applications. Thus, the authors presented a complete overview of blockchain security and privacy [13]. In paper [14] the authors used Hyperledger Fabric, for tracing a food quality. It keeps the records of transactions that are safe and secure. There is no centralized authority. The paper focused on exploring the existing food industry for food traceability [15]. The authors proposed bubbles of trust decentralized system, for ensuring identification and authentication of IoT devices. It also provides the data integrity and availability [16]. In the paper, the authors presented key aspects related for the implementation and testing of the overall system that can be applied to supply chain. The Smart contracts were written in Solidity language and tested using Remix IDE environment, and the code has been made publicly available for academic, research and practice community [16]. This paper proposed lightweight IoT information sharing security framework based on blockchain technology. Distributed data storage and tamper-proof of data inside the blockchain, are improved by the practical Byzantine fault-tolerant (PBFT) mechanism consensus algorithm [17]. The authors provide an state-of-the-art solution for achieving food traceability, transparency, safety and security [11].
Traceability chain algorithm shows the basis for a transaction in collecting the data in a supply chain are analyzed by the authors [13]. The authors reviewed about the traceability-driven food supply chain management using the Internet of Things (IoT) for collecting real-time information about food products [14]. In paper [18] the authors focused on the effect of blockchain in near future supply chain management systems. Table 1. describes the merits of using blockchain technology in food supply chain.
Food supply chain using blockchain technology
Food supply chain using blockchain technology
Coin-oriented blockchains makes it possible to transfer money all over the world in a decentralized way. For example, such blockchain include Bitcoin, Bitcoin Cash, Litecoin, Monero, and Ripple. Disintermediation is a process, where fund transfer can be made without the need of intermediaries using Blockchain Technology. Thus, elimination of intermediaries is the ultimate goal of decentralization used in Blockchain technology. A smart contract is a script that runs and interacts with the blockchain that hosts it to store data in the blockchain. These platforms enable the construction of Decentralized Applications (DApps) capable of interacting with these contracts to provide functionality to users. These include Ethereum, NEO, Hyperledger, Lisk and Ark.
Components of decentralization used in blockchain
The various components of decentralization used in blockchain technology are described in the Figure 1.
Blockchain
In Blockchain, data is stored in the blocks distributed across the network. Hash tables are used for sharing of files to store the information among the peer-peer network
Communication of Messages
The communication of messages is required for the network to send and receive the messages without any interruption
Data storage
Data is stored in the blockchain network using cloud database like MongoDB

Decentralization used in blockchain technology.
The Blockchain carries out smart contracts, as demonstrated by Ethereum. Ethereum and Hyperledger enable business logic with the requirement for smart contracts. Solidity is a programming language for writing smart contracts for blockchains based on Ethereum whereas Hyperledger contracts are written in channel code. The scripts in Bitcoin were a predecessor of the concept. A smart contract works like a trusted distributed app and derives its security from the blockchain and the underlying consensus amongst peers. A Blockchain system for distributed ledger technology is shown in Fig 2.

Blockchain technology for smart contracts.
The proposed system is implemented using the smart contract i.e. Hyperledger Fabric, an open source blockchain platform that goes beyond existing limits. Fabric is one of the Hyperledger [14] projects sponsored by the Linux Foundation [15]. The Hyperledger fabric use cases include, but are not confined to areas such as dispute settlement, trade logistics, food safety, and contract management [16].
Hyperledger was founded by Linux Foundation and was established in the year 2017. It is an open-sour platform for industry enterprise solutions. The other enterprise Blockchains include R3 Corda, Ripple, Quorum etc. These blockchains provide higher throughput, lower latency and often less consensus protocols than Ethereum. Hyperledger fabric uses Proof of Byzantine Fault Tolerance (PBFT) method to reach the consensus. Ethereum uses combination of Go Language and python, while Hyperledger uses combination of Node.js and Java Script. Consequently, the Fabric is known for first distributed operating system for permissioned blockchains (e.g., Go, Java, Node.js).
Execution phase: Creating genesis block

End execution of build your first network.
Fabric is written in Node js language and a blockchain starts with a primary block called the genesis block. If the chain is backtracked from a given block, it will reach the genesis block, to prove that the entire blockchain is genuine and valid. The genesis block is often statically encoded in a public or permissionless blockchain. The first participant creates genesis block in the case of the permitted blockchain. The Fig 3: depicts the structure of genesis block and the process of adding new blocks to the chain.

Structure of genesis block.

Customer buy product view.
In recent days, agricultural supply chain model depicts the processes happening between the producer and the consumer. The farmers and consumers trust a system managed by the supply chain intermediaries. A new model for the agricultural food supply chain that integrates distributed ledger technology in Blockchain and IoT technology to streamline the information sharing across the network. Therefore, access to a trust of information is enabled by all the stakeholders in the food supply chain [17]. Thus, a transparent supply chain can achieve more efficiency using Blockchain Technology. Within the proposed system, data like product quality, and other logistical details are passed on to the blockchain ledger. Once the food product has been confirmed topurchase at the consumer end, the electronic notification may initiate smart contract blockchain to perform contract payment for the products. A farmer using a mobile app can trace the process of how the food product is categorized to reach at the consumer end. The details of data about the food products are collected and stored on the Blockchain network. The data collected is an on-chain data and can be used by the end consumer using the Mobile DApp, to ensure the information regarding the quality of the product and its location and the information about the validation period. The Fig 4 describes about the traceability using blockchain technology for agricultural food supply chain. The farmer yield food products from the producer, then the food products are processed to wholesaler and retailers through distribution. The end customer buys the food products by scanning through QR code. Herewith, all the data are brought into blockchain network. Hence the traceability is achieved through blockchain technology.

Traceability using blockchain technology.
The farmer need not go for lending processes for their initial investments. The consumers could provide the fund through digital transactions with zero interest and without any third party. Even small-scale farmers can trade their products and yield a better beneficial. A resourceful supply chain will have authorization about immutable chains. Moreover, the end customers can choose exact farmers for precise products. The farmers can build trustworthiness over the customer based on the product quality and type of farming, which could lead to better safety and security. The lower-level end consumers also benefitted upon their needs to fund for the food products. Organic farming is made transparent through quality control analyst. The immutable distributed ledger technology achieves transparency and reduces the data fraudulence. Thus the smart contracts can have a better impact between farmers and consumers if there are differences due to weather or other circumstances.
Blockchain transactions
All the communication among the smart contracts is called transactions. Data from the transactions is made transparent and tamper-proof using the smart contracts. In this system, the quality status is stored in its smart contract and refreshed once a transaction is confirmed. Hence security and transparency are achieved after the verification and validation of the transactions. Concurrently, all the Fabric network nodes are refreshed and monitored when state changes. The Hyperledger Fabric network is worldwide accessible and makes it possible to execute transactions in near real time.
Transactions flow in food supply chain
In the proposed system, the customized DApp describes the transaction flow between producer and customer in the Blockchain Network. For each product it contains the Barcode and QR code assortment and its assortment are going to be pass through an API server. When the customer reads the product information through Barcode and QR code scanner, and if the customer gets satisfied with the product’s quality after analysis, then the customer, will proceed to buy the product from the specified farmer/producer. Once the buying process gets completed, next process is the fund transaction made by the customer to the farmer. Herewith, the Blockchain transactions has been initiated and made without any intermediary i.e., no third parties are added between the transactions. Hence, the traceability is achieved through hashing technique of Blockchain, where SHA 256 hashing technique is applied. The Fig. 5. describes the transactions flow in the food supply chain.

Blockchain transaction flow.
The flowchart from the Fig. 6. shows the system architecture of Agricultural-Food supply chain taking place between a farmer and customer. The DApp is developed using Node.js language which is an open-source server environment. Though it is an open-source platform, the users can develop any number of mobile applications. It runs on various platforms such as windows, Linux, Unix and Mac OS. Node.js uses javascript on the server side. The api.js from the server-side program works based on 4 HTTP methods on request such as Get, Post, Put, and Delete. Servers are providing APIs, to connect with database and store the data. The front end used in the proposed system is ionic framework. Scripts are written using node.js language. An express application is used which is intended for routing. The backend used in the proposed system is MongoDB, which is an open-source cloud database. All the components together provided the data security for the proposed decentralized application. The Fig. 7. shows the server-side architecture of the DApp utilized in the proposed work.

Flowchart for food supply chain with blockchain.

Server-side architecture of DApp.
The nodes were routed on one hardware machines inside the local network. Each machine had 1 CPU (4 cores at 3.6 GHz with hyperthreading) and 4 GB RAM. The Operating system used were Ubuntu 18.04 LTS for all the nodes connected to each other with a 1 Gbps switch.
Preliminary results
The preliminary results were obtained for the above said blockchain consortium with two peers, in the network. The blockchain initially generates all of the certificates and keys for our various network entities, the genesis block is used to bootstrap the ordering service, and a collection of configuration transactions required to configure a Channel. To obtain the transactions, the blockchain needs the Genesis Block as the prerequisites. The Fig. 8. shows the creation of genesis block to build the first network. The Fig.9. describes the end execution of genesis block creation in order to write the chain code for the smart contracts.

Channel creation for the genesis block.
The Section 5.3 describes the results obtained through Blockchain Peer network creation which means creation of Genesis Block to the Blockchain. Following are the implementation results which is chain coded in Node js and is executed through visual studio code. Two DApps i.e., decentralized mobile apps are deployed for the food supply chain applications. A Farmer App contains farmer details like, farmer name, email id, password, product details like whether the product is organic, date of manufacturing of the product, expiry date of the product. A Customer App contains customer details like customer name, password. The credentials of the farmer and customer are stored in the Mongo database.
The food supply chain for traceability system which is implemented in the proposed system mainly relies on Blockchain technology for the production, processing, warehousing, and the end consumer. Thus, the food supply chain is reliable and authentic In addition to Blockchain, there are other technologies which is also utilized in this traceability system, such as Global Positioning System (GPS), and Geo Fencing Sensor (GFS). In the DApps proposed, GPS is used together with Blockchain to track the farmer and customer location for the purpose of security. GFS is used to find more farmers within certain range along with GPS system and this information are stored and updated in Blockchain ledger, which helps the customer to meet their requirements. All these features allow a new traceability system to effectively ensure food safety and quality.
DApps for the agri-food supply chain
Farmer Dapp
The Figs. 11 depicts the farmer login page of the DApp. The farmer has to add all the credentials including, farmer name, email id, phone number and password for authentication. Once the farmer login gets updated, then the farmer can add necessary details about the product which includes, add product, view product, Balance details, and notification menu. This can be visualized from the Fig. 12. which is given below. The Fig. 13. shows the details of the products updated by the farmer for the customer view in order to make buy and sell process between the farmer and customer.

Farmer login.

Farmer profile view.

Farmer view.

Products view.
The Fig. 14. describes the Customer DApp which describes the customer login profile for authentication and the Fig. 15. describes search of products and the farmer. To achieve more traceability, Geo Fencing Sensor is needed to locate the near by farmers when the customer wishes to buy products in near location. This is shown in Fig. 16. When the customer satisfaction is reached, then the customer would like to buy for the products an order placed electronic notification is sent to the farmer. The farmer will come to know about the orders and deliver the products in order to achieve transparent occurences.

Customer profile view.

Customer products view.

GFS view for customers.
The Blockchain transaction view is obtained through Fig. 18. where Barcode & QR code Reader is utilized for Blockchain transactions. Each product is given a unique ID which comprises of 24-bit alphanumerical hash key. The unique ID is generated when a new product is added to the Blockchain block. An administrator will validate the transactions by providing approval for the transfer of fund from customer to farmer. Herewith, Blockchain verification & validation is achieved in order to obtain transparent transactions. Thus, it results in creating a transparent, fault-tolerance, immutable and auditable records which can be used for Food traceability. The following Fig. 19. shows auditable records of transactions, where all the transactions are updated using Hash key values, and thus Blockchain data are stored using previous hash and current hash values. Thereby Blockchain is confined with Food Supply Chain.

QR code & bar code reader from administrator.

Fund transfer transaction using blockchain.
In this proposed work, the Hyperledger fabric is implemented using Blockchain technology for agricultural food supply chain application and is integrated along with the IoT devices. Thus, it results in the creation of transparent, immutable and verifiable records which can be used for food traceability. Blockchain is a promising technology towards a seamless food supply chain, whereas lack of cryptocurrency, farmers reputation in exposing blockchain, and customer’s secure trading which hamper its popularity among farmers and food supply systems. Therefore, the technology needs to be persisted for a successful enterprise resource planning, warehousing management and manufacturing execution systems. The near future will discuss how these challenges could be addressed by administrative sectors, in order to establish blockchain technology as a secure, reliable and transparent way to ensure food safety and integrity.
Copyright
Authors submitting a manuscript do so in the understanding that they have read and agreed to the terms of the IOS Press Author Copyright Agreement posted in the ‘Authors Corner’ on www.iospress.nl.
