DESIGN TRACEABILITY FOR INDONESIA AGRICULTURAL SUPPLY CHAIN BASED ON BLOCKCHAIN (CASE STUDY IN CHILLI COMMODITIES)

to using the blockchain and intelligent contracts to monitor and traceability operations across the Our proposed solutions transaction records, performance, and security enhancements that are highly integral, accurate, and stable. The approach suggested focuses on using intelligent agreements to monitor and manage all communications and transactions between all actors in the supply chain's ecosystem. All transactions are registered in the immutable blockchain lead with connections to a decentralized system (IPFS), ensuring the ecosystem is safe, confident, reliable and booming for everyone's high degree of transparency and traceability. design, diagrams, interactions, sequences, and algorithms for implementation. how our solutions can track and track the supply chain of red chilli. However, the features and dimensions provided are applicable to ensure the reliable and decentralized traceability of agricultural goods. Challenges remain concerning scalability, identity verification, confidentiality, and We and develop to some these critical in future plans. We proposed payment solution-where and using through smart contracts after successful

The price of red Chilli is thought to impact wholesale price formation [3] significantly. This is because wholesalers, through their network, have the convenience of obtaining information on the supply and demand situation [4]. Distribution of red chilli sales at the farm level there is many branches of the supply chain. On the market side, it is empirically assumed that the market structure of agricultural products, especially horticultural commodities, tends to be monopolistic, so that farmers, as producers, always have a relatively weak negotiation strategy [5]. The things mentioned above are caused by a lack of transparency in production, production stocks, and consumers' needs, which describes the actual conditions. This is a commodity price game between wholesalers and intermediaries so that farmers and consumers are the victims [6]. Consumers are currently interested in improving their food quality, which has led to increased labelling and packaging processes by food and agricultural producers who want to add quality value [7]. The key to the scheme's operation is labelling each unit of goods traded, whether raw material or finished product, with a unique identifier (ID). Technology is part of agricultural development to increase farmers' productivity and income [8]. In the sense that it is more advanced or innovative, technological change is one of the absolute conditions that must be met to develop the red chilli production system. Internet user penetration is one of the factors that contribute to the adoption of technology [9]. The popularity of online users in Indonesia has affected various industries to reap the benefits of the information revolution on the Internet, including agribusiness. Some experts say that the Internet can improve performance in the agribusiness sector, including by saving time due to availability of information [10], creating additional markets for inputs and outputs [11], and increasing competitiveness [12], [13].
Meanwhile [14] added that the agribusiness sector has the potential to apply technology that refers to the use of the Internet for markets, the purchase and sale of goods and services, the exchange of information, and the creation and maintenance of web-based relationships between users [15][16] [17]. This also opens up opportunities for farmers to interact directly with consumers, both at the retail and domestic level. Besides, the development of online transport facilities, such as Go-Jek and Grab, can realize this concept without depending on the availability of unique means of the expedition to deliver goods ordered to the consumer.
Blockchain is an alternative that promises a solution and can be applied to different industries. This solution aims to ensure the distribution of information and data tracking integrity by storing it in a transparent spreadsheet, as requested by consumers [18]. Traceability is one way to increase transparency, and supply chain issues could be better measured and understood, ultimately seeking to improve the economic and social impact of the supply 507 chain [19]. Blockchain provides an information transparency system that is reflected in its Distributed Ledger Technology. Another advantage is that all stakeholders will continue to exchange information in the supply chain, where there is transparency in information, and it is almost impossible to manipulate information on transactions that have taken place. Misinformation on the condition of red chillies on the market can therefore be avoided.

Literature Review:-
Some literature shows how blockchain implementation for banking, finance, and other industries continues to grow, but the literature on agricultural implementation is still limited and has just begun to gain prominence. Tian [20] proposes to use the blockchain and the Internet of Things to trace the food supply chain. Previously, Tian [21] The benefits and limitations of RFID and blockchain to trace the supply chain of agricultural food have been discussed. Caro et al. [22] discussed a traceability system based on blockchain alternative that incorporates data along the value chain provided by AgriBlockIoT. To track products from farm to fork, they develop use cases and compare the implementations of Ethereum and Hyperledger. Lin et al. [23] reviewed the blockchain concept for Agri-ICT systems and presented ICT agriculture systems on the blockchain technology-based model. Some of the most recent examples of the pilot blockchain implementation in the supply chains for agricultural facilitated in Australia using Ethereum via Agri-digital [24].
To conclude that DLT has significant potential for achieving sustainable development goals, several authors have identified technical challenges and implementation barriers. Mao and Dianhui [25] present smart contracts for effective management in the agricultural supply chain to introduce a blockchain-based credit evaluation system. Galves et al. [26] Reviewed the challenges and potential uses of blockchain in the agricultural supply chain to ensure traceability and authenticity. Mao et al. [27] Propose an approach to a consortium blockchain for an effective agricultural trading system. They propose an improved practical algorithm for Byzantine fault tolerance to optimize buyers' trading portfolios in the agricultural supply chain. A case study in China's Shandong province validated their proposed agricultural trading system using a blockchain consortium. [27]. An approach to measuring soybean quality using blockchain and smart contracts is presented by Lucena et al. [28]. They present a real-life implementation solution that results in an additional 15 per cent free genetic engineering (GM) assessment to export soybean grain from an exporter in Brazil [28]. By transferring farming assets such as livestock, crops, and products to small-scale agriculture, the implementation of blockchain-based solutions can also facilitate value transfer [29]. The blockchain system is also being implemented to increase transparency and automate processes in the agricultural sector [30]. The challenges of implementing blockchain-based traceability solutions in the milk industry were studied by Holmberg and Aquist [31].
It is evident from the above that there is a growing interest in adopting blockchain to improve information security, transparency, and authentication of various measures for the supply chain of agricultural commodities. In most of the literature, blockchain's conceptual implementation in agricultural supply chains at risk of failure within a specific framework or implementation approach is discussed.

Chilli Traceability Based On Blockchain
We proposed a solution that uses the blockchain and smart contracts based on Ethereum platform to track, track, and perform red chilli supply chain transactions. The solutions try to eliminate the need for a central authority and provide records for supply chain management and security transactions with impeccable credentials, quality, and reliability.

Overview of System
Ethereum smart contracts have the potency in changing agricultural products' security into such an embedded system, which improves the safety of the delivery to the end customer. We propose the framework and solution to concentrate on using autonomously executed contracts on the public platform. Thousands of nodes for mining distributed globally will execute functions and smart contract code, and all mining nodes agree to the result of execution. The blockchain network made up by the mining nodes. Each time computing engine that is collecting, validating, and executing transactions may be a mining node. The nodes also store in a ledger the transactions' results are replicated and synchronized by all mining nodes.
In the form of function calls on the blockchain, smart contracts would obtain transactions and trace elements to allow participating subjects to continually monitor, track, and receive appropriate notifications if rules are broken. Therefore, it ultimately aims to repair circumstances optimally and respond to different infractions in the supply 508 chain. To be specific, our solution would be to focus on the red chilli supply chain in this issue. An overview of the system solution is illustrated in Fig. 2. As shown in the figure, seed companies, farmers, wheat farmer groups, red chilli processors, Gapoktan, customers, end customers, and blockchains with EVM that perform smart contracts are the main participating subjects. Additionally, each participant might have an Ethereum account in a blockchain, with a unique EthereumAddress (EA) that identifies that participant uniquely. An account consists of an EA with a private and public key used to signing and validating each transaction's cryptographic and digital data integrity, and each transaction would be associated with a particular account.

Design of the System
Each participant has a smart contract function, affiliation, and communication. We have four participants, and their functions are classified as follows:

Seed Companies
A seed company produces some seeds identified by the Indonesian National Standard identifier (SNI) per product sold to farmers or groups of farmers. To preserve quality, seed companies act as strong allies as they make it easier for farmers to gain access to cultivating materials in the form of seeds, fertilizers, and other nutrients that encourage agricultural output.

Farmers
Seed companies with a standard identifier traceable to seed pools and companies involved in sales transactions, crop cultivation, and the creation of smart contracts buy seed from farmers. Farmers monitor and record their planting population, growth detailing and storing them as pics or JPEG files in a decentralized file system. IPFS (InterPlanetary File System), in which multiple peers or nodes store files with high integrity and resilience, can be a popular decentralized file system [32]. Hashes of file content are stored in the smart contract only.

Gapoktan
Gapoktan is a participant in distributing commodities and red chilli products to consumers, both household, retail, and industrial consumers. Gapoktan also acts as a red chilli commodity processor, buys red chilli commodities from group farmers, does sorting, and changes red chillies that do not meet the desired standards then processed into final products without the need for further treatment or processing, and providing appropriate packaging. marketing needs and traceability systems to be developed.

Consumer
Consumers buy commodities and red chilli products from Gapoktan, usually in packs with traceable identifiers. The standard identifier maintains a hierarchical relationship that allows traceability. This section can be categorized as household consumers, large consumers (stalls, restaurants), retailers, and industry.
To ensure safe tracking of products used Ethereum smart contracts involving all participants in the process, as shown in Figure 2, the seed company produces red chilli seeds, and details of seed growth, viability, and quality are maintained. A standard identifier such as a serial or similar Global Trade Identification Number (GTIN) containing a specific company prefix is used to identify Red Chilli seeds sold by seed companies.
Using standard identifiers allows for digital connectivity and tracks potential transactions related to products and processes between subjects involved in agricultural supply chains. Farmers buy seeds from seed companies and do agriculture. Plant growth details are recorded in a decentralized file system via IPFS by farmers at appropriate time intervals. The image of plant growth is timestamped, and the IPFS hash is stored in the smart contract.
After checking factors involved such as temperature, humidity, and weather, which cause a quality change in the storage time, farmers save red chilli yields because heat and humidity cause quality degradation, contributing to loss of production [33]. The red chilli commodity is then processed jointly by Gapoktan, which involves sorting, quality analysis, processing red chillies that do not meet new sales into derivative products, and finally preparing ready-tosell product packaging. Gapoktan collaborates with transportation businesses to send products to potential buyers. Gapoktan is a direct contact point for the red chilli commodity and the processing percentage for prospective buyers [34]. An entity-relationship diagram that shows in Fig. 3 explains the smart contract's features and properties and the connection between the parties involved and the smart contract. The key to implementing smart contracts is metadata and relationships like that. All data is digitally signed on the blockchain, which is associated with a 510 particular participant. This means that the participant who uploads the image, in this case, the farmer who uploaded the JPEG file, is The undisputed proprietor of the action and is liable for JPEG images or files that are inaccurate or fraudulent. Blockchain can be programmed in an automated manner through smart contracts to punish farmers for acting dishonestly.

Sequencing Diagrams
Each entity has an EthereumAddress (EA) and took part in the smart contract by executing functions. For a situation in which a farmer generates a smart contract, Fig. 4 describes a sequence activity. The farmer purchases seeds from the seed company, following the offline agreement between the farmer and the seed company, and the SeedsRequestedByFarmer procedure is implemented and made available to all active participants (i.e., farmers and seed companies).
They were selling Seeds () which includes attributes such as SeedCompanyEthereumAddress (EA SeedCompany), Farmer's Ethereum Address (EA Farmer), Quantity, LotAttributes, etc. The seed company performs its function. The growers update plant growth details to the file system via IPFS at regular points in time. In IPFS, the farmer saves the crop image and stores the IPFS hash in the smart contract.
Until the harvest stage, the update plant growth continues, with images of the plants recorded at frequent intervals. The GrowthImage () update function records plant growth, as shown in Figure 4. The smart contract stores the IPFS hash every time an image is uploaded to IPFS, and CropGrowthImageUpdated reporting is shared among all active subjects.
There is an offline agreement between farmers and Gapoktan to determine the harvest time, transportation method from the land to Gapoktan, and how to store the harvest when the plants are ready to be harvested. Details about humidity, the weight of the goods stored in storage, and the storage length in storage are given to farmers. Red chillies were agreed upon and sold by farmers to be stored in a storage. The buyChilli () and sellToGapoktan () functions performed by Gapoktan and Farmer are shown in Figure 4, respectively. A message sequence diagram in which Gapoktan purchases chilli products stored at Gapoktan is shown in Figure 5. Bypassing parameters such as the Ethereum Processor (EA Processor) address from Gapoktan (Gapoktan EA), Quantity, Quality and DateOfPurchase, the buyChilli() function is carried out by Gapoktan. The sellChilliToCustomer() function is executed when the ChilliRequestedByGapoktan is activated by the related Gapoktan function. ChilliSoldToGapoktan data is distributed on the network together with Gapoktan's EA and Customer, Quantity, and DateOfSales parameters. The Gapoktan company then also carries out operations to sell finished goods. The buyProductFromGapoktan () function carried out by interested customers is shown in Figure 5. The farmer activates the function sellProductToGapoktan() with function parameters consisting of the Ethereum processing red chilli, Gapoktan, the number sold, and the sale date. The ProductSoldToCustomer events are activated at a specific point to notifying actively interaction of the subjects (i.e., Gapoktan and Customers). A message sequence diagram in which Gapoktan and consumers collaborate on smart contracts is shown in Figure  6. In turn, Gapoktan interacts with customers interested in selling goods and becomes distributors requesting Gapoktan products in limited quantities. The consumer runs the buyProductFromGapoktan() function, as shown in Figure 6, and the ProductRequestedByCustomer function is activated. The sellProductToCustomer() function is operated by Gapoktan, and the ProductSoldToCustomer event notifies all attendees of the sale of goods. By executing the buyProductFromCustomer () function, the end customer purchases a product from a local retailer, and a smart contract triggers the EndProductRequestedByCustomer event. Finally, by executing the selling end product  Res. 9(09), 505-515 512 () function, the retailer sells the product to the end customer. Smart contracts, with EndProductSold events, distribute product sales information.

Traceable Functionality
In the red chilli supply chain, the advantage of using smart contracts to use traceable functionality is making it accessible to all participants with a non-associated supply chain authority.
Starting with the seed sales transaction between seed companies and farmers, to the following stage, where the total of red chilli production sold between subsequent subjects is recorded, and all transactions can be verified. The volume of red chillies sold between participants under agreed conditions, for instance, cannot be altered. Moreover, red chilli goods with different quality criteria can not be mixed for sale because all stakeholders know the total volume. It is not very easy to monitor agricultural land and plant growth, whereas the approach presented in which farmers periodically upload photos of plants and soil conditions via IPFS provides digital records that can be used to validate agreed conditions.
Besides, continuous quality compliance monitoring is ensured by using traceable identifiers per batch and the ability to track all transactions between stakeholders accordingly. It is also possible to monitor the quality and condition of shipping using IoT-enabled packaging equipped with sensors, cameras, GPS trackers, and 4G communications. During the shipping process, these sensors can operate continuously and send notifications about the state of the plants, products, and goods being shipped. With blockchain, such information and notifications, without intermediaries, can not be changed or manipulated and are immediately accessible and accessible to all stakeholders in a trusted and decentralized manner. With this, it is possible to add additional attributes to address the physical location of the product or stakeholder location that can be tracked using a standard identifier such as a global location identifier or by geotagging a stakeholder location that can be sent or integrated on the packaging by a GPS sensor mounted inside a shipping or storage container.
There is a possibility that stakeholders may cheat or be able to transact and record incorrect data; it should be noted. In this case, with validated attribution to the origin of the data, the blockchain records such data (i.e., real stakeholders). If the data captured is not correct at a later stage, all participants can attribute the data to certain actors or stakeholders with 100 per cent certainty.

Implementation Framework
We describe the algorithms in this section that determine the working principle of our blockchain-based approach proposed. Farmers make smart contracts, as discussed earlier. The farmer then agrees with one of the listed seed companies on the purchase terms (offline). Algorithm 1 describes the process that regulates seed companies' sales to farmers. Once the contract's initial status is determined, the smart contract will verify that the farmer requesting it is registered and that the seed price has been 513 paid. If the scenario succeeds, the contract status will change to SeedRequestSubmitted, the status of the farmer will change to WaitForSeeds, and the status of the seed company will change to AgreeToSell. The contract notified all active participants in the chain of a change of status; otherwise, the contract's status and other active participants would be restored to their original status, and the transaction would be terminated.

Figure 7:-Algorithm chilli processor buys chilli from framer
Algorithm 2 describes the sale of red chillies to Gapoktan. Gapoktan stores and stores farmers' crops. Key factors include moisture content, batch number, date of purchase, and shipment date. This is the stage of BuyFromGapoktan's contract status. The red chilli processing status is ChilliRequested, and the red chilli status is ChilliBoughtFromFarmer.
The contract must examine two conditions stated in the Algorithm 2: when the requested red chilli processor is a registered participant, and the second-when the red chilli sale is approved, and the purchase is paid. If these conditions are fulfilled, the contract status would be changed to ChilliRequestAgreed. The processor status would be changed to WaitForChilliFromGapoktan, the Gapoktan status would be changed to SellChilliToProcessor, and all active participants will receive a message about selling red chillies to the processor. In other cases, the contract status would be changed to ChilliRequestFailed, and the processor status would be changed to RequestFailure, the Gapoktan status would be changed to CancelRequestOfProcessor.

514
The finished product then sold by Gapoktan. Next, it describes the system and participant status where retailers buy Gapoktan products. Product manufacturing date, sales amount, and purchase date are some of the important parameters to check. In Algorithm 3, Gapoktan and retailers will be identified by their Ethereum address and contract status. The contract status at this stage is Product-SoldToGapoktan, and Gapoktan's status is ProductReceived-FromProcessor. ReadyToPurchase reseller status. The contract inhibits access only to authorized retailers and checks for completion of the sale and payment. The contract performs the transaction where Gapoktan sends products to the retailer. Here, Sale_Request_Agreed_Success and Gapoktan status changes to Product_Sold_To_Customer, and Product_Delivered_Successful changes to customer status. A notification message was sent to the contract status of the retailer for successful product deliveries. Otherwise, for the failure scenario, the contract status changes to Sale_Request_Denied, Gapoktan status becomes Request_Failed, and customer status changes to Product_Delivery_Failure and all participants receive a failure notification message.
Ready_To_Buy's initial customer status. Contract status and customer are both SaleRequestAgreedSuccess and Product_Delivered_Successful. Here, the smart contract limits access only to registered customers to make purchases. The critical parameters for product tracking are the Ethereum_Customer_ Address, Purchase_Date, Sales_ID, and Product_ID. After successful product price payment, the contract status changes to Product_Sold_To_Customer, customer status changes to Product_Sale_Successful, and customer status changes to Successful_Purchase. The contract status changes to Sale_Of_Product_Denied, the customer status changes to Product_Sale_Failure, and the customer status changes to Failed_Purchase if the payment is incorrect. The contract notifies all network parties of a failed sale event.

Conclusion:-
This article proposed a sensible framework for a solution that leverages blockchain and smart contracts in tracking, recording and eliminating intermediaries for the traceability of red chilli in the supply chain. We presented aspects of the system framework, design, diagrams, interactions, sequences, and algorithms for implementation. We show how our solutions can track and track the supply chain of red chilli. However, the features and dimensions provided are generally applicable to ensure the reliable and decentralized traceability of agricultural goods. Challenges remain concerning scalability, governance, identity verification, confidentiality, standards and legislation. We plan to address and develop solutions to some of these critical challenges in future research plans. We would integrate into our proposed automated payment solution-where parties are automatically and centrally paid using cryptocurrency through smart contracts after successful physical delivery.