Implementation of a Supply chain Management System Blockchain-Based in Red Onion Farming

In red onion farming there have a problem of price fluctuations which result in an uneven and less transparent distribution of red onions yields. Thus, affecting both consumers and producers. To answer these problems, we designed a system to maintain and store red onion harvest data for farmers, collectors, distributors, and retailers in the form of a blockchain-based supply chain system. Supply chain management in red onion farming is beneficial for cost control, increased efficiency, product availability, product tracking, and increased profits. This system can maintain the validity of transactions in the supply chain of red onion farming with a private blockchain with Hyperledger Fabric. Then the data on the blockchain system will be displayed through the Hyperledger Explorer website. From the research and testing of the system, this system can help the red onion farming to maintain the validity of transactions in the supply chain management.


Introduction
One of the superior agricultural commodities in Indonesia, namely red onion. Red onion is a spice vegetable that is consumed by everyone in the world [1]. Red onion has been cultivated intensively by farmers. Indonesian farmers have long been trying to make red onion farming a part of one of the leading commodities in the intensively managed vegetable sector. The existence of the red onion commodity has made a major contribution to improving the economy of farming communities so that this commodity is widely used as a source of income for red onion cultivation entrepreneurs, which are almost entirely spread across all provinces in Indonesia [2]. Even though there are quite a large number of enthusiasts to become red onion farmers, various technical and economic constraints in its utilization still exist.
One of the studies by V. Sudha, R. Kalaiselvi, and P. Shanmugasundaram, discussed the problems of farmers in India caused by very poor Supply Chain Management because there was no system that could track the status of goods at various stages of transportation. This research provides a system solution with blockchain-based technology to achieve transparency about the status of goods. By storing the details on the blockchain, the entire process is visible to both farmers and those involved in transportation. And the immutable annals of history will remain forever [3].
In the era of the industrial revolution 4.0 which was marked by an intelligent system. Industry 4.0 has become a buzzword that describes the trend towards digitalization and automation of manufacturing. It allows products, machines, components, individuals, and systems to create a smart network so that it can integrate cyber-physical systems to act quickly by linking information and physical memory to the smart network for faster and more effective service environments [4]. Supply chain era 4.0 aims to make people closer to farmers or in terms of agribusiness.
Blockchain is one of the results of technology 4.0, the blockchain system can be interpreted as a distributed ledger or ledger that can track all activities on the blockchain system, every record of this activity is an activity that has been approved. Through the application of blockchain to the supply chain, it can simplify the supply chain network, build trust between stakeholders and the supply chain. With this, the authors built a supply chain system to manage harvest data on red onion farming in 7 districts in Central Java Province (Brebes, Tegal, Demak, Pati, Boyolali, Temanggung, and Kendal). Supply Chain Management is divided into several nodes, namely producers, distributors, stores and final customers. This supply chain system consists of farmers, collectors, distributors, and retailers/retailers.
The purpose of this study is to design a supply chain and maintain security on red onion agricultural harvest data in 7 districts and document transactions that occur in the supply chain. Supply chain management in red onion farming is beneficial for cost control, increased efficiency, product availability, product tracking, and increased profits. In this research, the blockchain system is private. Then to implement the blockchain system using the Hyperledger Fabric framework to build a private blockchain system. And as a dashboard display for the blockchain system it uses the open source Hyperledger Explorer.

Data Collection
This data collection was carried out using several methods that were viewed directly from the location, by observing red onion farming in 7 districts in Central Java, including Brebes, Tegal, Pati, Demak, Boyolali, Kendal, and Temanggung Regencies. in the data collection process used several methods, there is: a. interview method, data collection was carried out by way of direct interviews with farmers, collectors, distributors, and retailers/traders regarding red onion farming related to the problem the author is researching to obtain objective data. b. observation method, the observation method used is observation of the subject, such as activity from farmers, collectors, distributor, and retailer. c. literature study method, this method is theoretical studies, references and scientific literature related to red onion, supply chain management, and blockchain.

System Development Method
In this research using the waterfall method as a system development method. The waterfall method is one of the application development models and is included in the Software Development Life Cycle (SDLC).
a. Requirement are obtained through discussions with supervisors and a lso the team to determine the flow of the system, and limitations in application design.
b. Design, at this stage is to determine hardware and software specifications in the overall program architecture definition. c. Implementation, the system is built with the Javascript and Golang programming languages to build a blockchain system. While Docker Swarm, Filezilla, EC2 AWS, and Postman as supporting tools in developing Private Blockchain systems with Hyperledger Fabric. Then to display the system interface using Hyperledger Explorer. This stage will be explained in the results & discussion section. d. Integration & Testing, tests carried out relate to logic, process or program flow, program functionality. System testing aims to see whether the system that has been made is in accordance with the original purpose of manufacture and is feasible to use. At this system testing stage, System testing uses Black Box Testing. e. Maintenance, at this stage further development will be carried out related to blockchain-based supply chains so that transactions (smart contracts) can be carried out using the wallet feature on the blockchain system. The development of this system will be reviewed further in the next research.

Literature Study
In making this research the author refers to several scientific works with the general topic of blockchain as a theoretical basis. Several studies related to the blockchain system and Hyperledger fabric to support this research in several aspects. In the research that the author designed, namely a blockchain system with Hyperledger Fabric in order to obtain satisfactory results. In the following, the authors include several research journals that are references related to this research.
Teguh Prasetyo Utomo's research in 2021 explains in detail the implementation of blockchain technology. This research explains the application of blockchain technology to library systems, as a security system and guarantees the authenticity of information in databases in libraries [5]. This research is very helpful in providing more detailed references to the blockchain system that the author will build.
The research by Razi Iqbal and Talal Ashraf Butt suggests that the use of blockchain technology in supply chain management in the agriculture sector provides many benefits for farmers, consumers, and the entire agricultural industry. These benefits include increasing transparency of data information and also helping to improve efficiency and profitability in agricultural business by facilitating the management and control of production and logistics [6].
The research by Dian Ardifah Iswari, Yandra Arkeman, and Muslich in 2020, this research examines supply chains based on blockchain systems. This study describes system design and system design for supply chain design in cocoa based on the blockchain system [7]. This paper helps the author to provide an overview of the blockchain technology to be built.
The research belonging to Ajay Kumar Shrestha and Julita Vassileva namely, User Acceptance of Usable Blockchain-Based Research Data Sharing System: An Extended TAM-Based Study. In this study discusses the application of the TAM method to the blockchain system using a search base Data Sharing system [8]. This paper provides an overview to the author regarding technical knowledge of the blockchain system.
The research by Kumutha K., Dr. S. Jayalakshimi, and Dr. P. Sripriya namely, Data Security Mechanism of Hyperledger Fabric in 2022. This paper introduces the blockchain system, Hyperledger Fabric, and data security mechanisms [9]. In this paper blockchain technology is introduced and information about blockchain in this paper becomes a theoretical reference for blockchain systems that will be built for research.
From the journals and research that we already studied; we can summarize several findings as follows:

Blockchain
Blockchain is a technology that can be used in data processing, blockchain technology has a decentralized concept with characteristics of being transparent and secure [10]. Blockchain is a collection of blocks that contain transaction data that are interrelated (chain) and sequential with each other. It is a form of distributed database which contains transactions stored in a block of data. Each block has a unique hash that is generated from the contents of the block itself. Each block stores the hash of the previous block thus forming a chain that is stored at each node in the Peer-to-peer network [11]. The Blockchain database works on a global network of many nodes (volunteer nodes), so no one controls the data and the network. All transactions are recorded, can be easily accessed and transparent. The principle of blockchain technology is analogous to a ledger.
The blockchain is analogous to a distributed ledger having all this information (amount, party, transaction time and other relevant information), and then doing it online, then distributed copying this information only to all the computers in the system. Therefore, unique copies of this information exist in multiple locations. This is done so that the information can then be received by each party that is part of this system. The goal is to ensure the security and authenticity of this information, this is the advantage of the blockchain system technology. Blockchain consists of three main components, namely blocks, chains, and networks (network): Block: a list of recorded transactions in the general ledger during certain time. The size, period, and triggers for each block differ from network to other network blockchains. Not all blockchains record and secure all transactions as such main goal. However, every blockchain records the movement of transactions or tokens. The transaction process here is the process of recording data. Specifies the value to that block which is later it will be used as a reference for interpreting the data recorded in the block [12].
In the blockchain system, a block consists of three elements, namely data, the hash of the block, and the hash of the previous block. To be connected to the chain, each block has its own cryptographic hash as well as the hash of the previous block. The hash contains an identical alphanumeric number which is calculated based on the block's data, the timestamp, as well as the hash of the previous block. Blockchain database stores data in a grouped structure. Each data group stores some specific information. Once entered, each block will be linked to the previous block and the blocks that follow it, thus forming a series of blockchain systems. A block that has been entered into a series that functions as a permanent data record, the data in that block cannot be changed or deleted.

Figure 1 Blockchain System Works Flow
The application of security (sharing security) in maintaining data security makes blockchain one of the technologies with a fairly good level of security. With this system the possibility of data to be hacked is reduced [13]. Blockchain is grouped into two types, there are Public Blockchain and Private Blockchain. Public Blockchain is a ledger or distributed ledger of all transactions, so that data on the blockchain cannot be tampered with by users. When transactions occur on the blockchain network, blocks are formed. The blocks cannot be added to the blockchain until participating organizations have validated the block. The length of this verification process also varies, it can be real time or it can take longer based on the number of members of the organization and several other factors. The approvals required to validate the blockchain system are implemented to ensure that the security, privacy, and integrity of the blockchain system are maintained.
In Private Blockchain, the owner of the blockchain system has significant influence over its design and subsequent operation. In this case, if you want to become a node, you must get permission from the Blockchain regulator (owner). Only genuine members are allowed to This is because the block is connected to the block before and after it. Small changes to a block will cause changes to all blocks in the series. c. Replicate/Peer to Peer Network: Blockchain uses a decentralized network which is often called a public ledger. In this system, each node/participant has a unique copy of every transaction that takes place on the blockchain network. d. Transparency: All system users can see every transaction. e. Secure: Blockchain systems have no central authority, which means that data is stored identically across multiple computers. In order to hack, a hacker has to hack every node in every network simultaneously. f. Smart Contracts: This smart contract is a code of agreement between two people in the Blockchain network that contains specific terms. Transactions will only occur if these special conditions are met between two nodes without involving third party intervention. This is possible because the entire smart contract process is carried out automatically in the blockchain system.

Hyperledger Fabric
Hyperledger Fabric is an enterprise-grade open sources platform that is maintained by IBM and Linux Foundation. Unlike Bitcoin and Ethereum, Hyperledger Fabric does not have any cryptocurrency, where the access to the network is restricted to the network members only, and not anyone can join the network [14]. Hyperledger Fabric is used to build blockchain systems that are permissioned (private). The use of Hyperledger Fabric has advantages in writing smart contracts to the process of installing these smart contracts into the blockchain network that is being built. Implement the execute-order-validate architecture in Hyperledger Fabric transaction flows. a. Execution phase In the execution phase, the client sends a transaction proposal that has been signed by the system, to be executed by peer endorsers. The transaction proposal has a group of input parameters that will be used by the smart contact. The simulation process of executing transaction proposals for each endorser with a world state, without changing the stored value. Each peer endorser can generate a transaction response that contains a key -value that can be changed (writeset) and a key-value that can be read (readset). The transaction response (response transaction) is given a signature (endorsement) and then returned to the client. The client collects endorsements until they comply with the endorsement policy. All endorsements have the same writeset and readset. After the endorsement policy has been fulfilled, the client can make transactions and collect them from orderers. b. Ordering Phase In the ordering stage, namely, orderers use the order of all transactions that have been collected by the client and stored in the block. In a block, the number and size of transactions (BatchSize) are configured in parameters, and the block waiting time (BatchTimeout). Due to the large number of transactions collected by the client at different times or simultaneously, the transactions cannot be sorted by the time they arrive at the orderers. Transactions collected at the same time will be two different blocks.
c. Validation Phase In the validation phase, orderers carry out the process of broadcasting blocks to peers who are already connected. Then the peer gossip protocol to other peers to send blocks. There are three stages for the peer to validate all transactions in the received block, there are: 1) Checking the endorsement policy in a parallel manner. If the endorsement cannot match, then the transaction will be invalid, 2) Checking conflicts on read-write sequentially. If the readset version and the key version are not the same as the world state, then the transaction is invalid, 3) Updating the distributed ledger on approved transactions will update the world state, and other valid and invalid transactions will be stored on the blockchain.

Hyperledger Explorer
Hyperledger Explorer is a tool for displaying Web applications used to view or query transactions, wallets, and other information stored in blockchain systems. Hyperledger explorer is also used in discovering and understanding machine-readable data stored as encrypted ledger entries. In addition to the functionality of the Hyperledger explorer, this tool can also provide visualizations in the form of intuitive graphs, charts and tables. The Database Layer, in Hyperledger Explorer uses the PostgreSQL database to contain information about blocks, transactions, channels, etc.

Result and Discussion
The results and discussion section will discuss the process of implementing Supply Chain Management System based Blockchain in Red Onion Farming using the Hyperledger Fabric framework and using Hyperledger Explorer to provide an easy-to-use and informative display as explained below.

Figure 4 Hyperledger Fabric Architecture
From Figure 4, The picture above is an architectural design of the hyperledger fabric blockchain system which consists of 4 nodes namely farmers, collectors, distributors, and retailers which have several components which will be explained below: a. Ledger has two parts consisting of, world state and blockchain. b. Smart contracts are programs run by applications to create and store ledger transactions. c. Nodes consist of three types that form a network, there are clients, peers, and orderers. d. The Membership Service Provider (MSP) has the function of authenticating transactions, verifying transaction integrity, signing endorsements, validating endorsements, by storing all identities on the required nodes. e. Peer-to-Peer state transfer updates to peers who have joined. The Blockchain system using Hyperledger Fabric has several features which will be depicted in the following use case diagram. The definition of actors from the figure 4 and figure 5 use case of a blockchain-based red onion agricultural harvest data recording system can be seen in Table 1. Meanwhile, to see the use case definition can be seen in Table 2. From the Figure 5, the das hboard on Hyperledger Explorer can be see by everbody (admin & user). Table 1 Actor Definition Actor Definition Admin Actors who have access rights to CRUD red onion farming harvest data via postman and through terminals (Virtual Machines), and view red onion farming data. User Actor who have access rights to view the Hyperledger Explorer dashboard.

Hyperledger Explorer Explorer
As shown in the figure 6, the system has features including Register User, Create Asset, Read Asset, Transfer Asset, Update Asset, Delete Asset, and Get All Assets. From the above use case diagram, the implementation is carried out to realize the design using the following software Windows 10 Operating System, Visual Studio Code, Filezilla, Docker Swarm, Postman, Command Prompt, and EC2 Amazon Web Services, Google Chrome. To create the blockchain network, programming languages were used which consist of 81% shell script, 10.1% Golang, and 8.9% Javascript. In the blockchain network, the ledger or the distributed ledger technology uses the CouchDB database.
The development stage of the Blockchain system using the private Hyperledger Fabric. The first step that can be taken is to install Prerequesites on each virtual machine. This is done to ensure that the machine (virtual machine) used already has the prerequisites installed on the system. The systems installed on the virtual machine include: 1) Docker Engine dan Docker Compose, 2) Docker Swarm, 3) NodeJS and NPM, 4) Go version gol.18.7, 5) Git.
Each transaction is defined in a program that can be executed by each peer called a smart contract [15]. Smart contracts on Hyperledger Fabric are defined in the chaincode, the chaincode will be called by every application that will interact with the ledger. Chaincode is most often called when the application interacts with the database ledger and also the world state. Chaincode can be written using the Java, Go, and NodeJS programming languages. At this stage, the author uses the Go programming language to build smart contracts on chaincode. And using Docker Swarm, Docker Swarm is designed using two virtual machines. Each as Swarm Manager and Swarm Worker [16].
In Hyperledger Fabric there are smart contracts defined in chaincode. Chaincode can be written using the Java, Go, and NodeJS programming languages. At this stage, the author uses the Go programming language to build smart contracts on chaincode. The smart contract in this study contains transactions feature, including:

Create Asset
Create asset functions to enter data in accordance with a predefined asset structure. Figure 7 fuction "create asset" using postman 2. Transfer Asset Transfer asset functions to move data from one organization to another. This transaction uses the id to retrieve database information and change the ownership name data in the database, so that this transaction can move to the intended organization.

User Interface using Hyperledger Explorer
The results of creating a blockchain network certainly require a user interface display that is used to monitor all transactions on the blockchain networks so we use the help of hyperledger explorer to display transactions on the network Web applications with Hyperledger explorer are developed using the latest technologies, such as ReactJS, Google material UI, and web-sockets.

Figure 9 Hyperledger Explorer Dashboard
System testing aims to see whether the system that has been made is in accordance with the original purpose of manufacture and is feasible to use. At this system testing stage, the author will use the Black Box methods as a method for testing the system in this research.

Testing Result
Tests carried out relate to logic, process or program flow, program functionality. System testing aims to see whether the system that has been made is in accordance with the original purpose of manufacture and is feasible to use. At this system testing stage, System testing uses Black Box Testing. From the results of black box testing, it shows that the running system is appropriate. This is shown from the testing of each existing feature, it was found that the Register User, Create Asset, Read Asset, Transfer Asset, Update Asset, Delete Asset, and Get All Assets features were able to run well. So that the system is fit for purpose and is expected to help in the red onion supply chain management.

Discussion
One of the studies from Dian Ardifah Iswari, Yandra Arkeman, and Muslich entitled Analysis and Design of Blockchain-Based Cocoa Supply Chains. This research discusses the development of a blockchain-based supply chain system. This blockchain system is used by every member of the supply chain (farmers, farmer leaders, factory processors, retai lers, and consumers). The system in this research is used to facilitate the flow of information in the cocoa supply chain, to facilitate the documentation of all activities, to facilitate the calculation of the total price of cocoa, and to facilitate the payment process. However, this study has several weaknesses, namely the low ability of stakeholders to use the new system, stakeholders do not have email or cellphones, and uneven internet access. While the advantages and disadvantages of the research "Implementation of a Supply Chain Management System Blockchain-Based in Red Onion Farming", that is: Table 4 Deficiency and Transcendency of "Implementation of a Supply Chain Management System Blockchain-Based in Red Onion Farming" Research Deficiency Transcendency System development does not cover the aspects of network scalability and security at the web server level Building trust between stakeholders and the supply chain The developed system only focuses on the asset creation and asset transfer features Facilitate the documentation of transactions between stakeholders Based on table 4, this system requires further investigation on security at the web server level, due to the limited resources of the researchers. Thus, in the next research, security level will be explored thoroughly. From the hyperledger explorer, we can summarize that our Supply chain management in red onion farming is beneficial for cost control, increased defficiency, product availability, product tracking, and increased profits.

Conclusion
Based on the results of the research that has been done, it has been concluded that the application of the Blockchain system using the Hyperledger Fabric framework has been successfully implemented with the development method. With this research, it is hoped that farmers, collectors, distributors, and retailers will carry out red onion distribution activities in 7 districts (Demak, Boyolali, Temanggung, Pati, Kendal, Brebes, and Tegal). And it can also make it easier for admins to manage users and resources used. This research was tested using the Black Box Testing method. From the results of this research, further development will be carried out related to blockchain-based supply chains by adding a transaction function (smart contrac t) using the wallet feature on the blockchain system. The development of this system will be reviewed further in further research.