ChainApparel: A Trustworthy Blockchain and IoT-Based Traceability Framework for Apparel Industry 4.0

Trustworthiness and product traceability are essential factors in the apparel industry 4.0 for establishing successful business relationships among stakeholders such as customers, manufacturers, suppliers, and consumers. Each stakeholder has implemented different technology-based systems to record and track product transactions. However, these systems work in silos, and there is no intra-system communication, leading to a lack of complete supply chain traceability for all apparel stakeholders. Moreover, apparel stakeholders are reluctant to share their business information with business competitors; thus, they involve third-party auditors to ensure the quality of the final product. Furthermore, the apparel manufacturing industry faces challenges with counterfeit products, making it difficult for consumers to determine the authenticity of the products. Therefore, in this paper, a trustworthy apparel product traceability framework called ChainApparel is developed using the Internet of Things (IoT) and blockchain to address these challenges of authenticity and traceability of apparel products. Specifically, multiple smart contracts are designed and developed for registration, process execution, audit, fault, and product traceability to authorize, validate, and trace every business transaction among the apparel stakeholders. Further, the real-time performance analysis of ChainApparel is carried out regarding transaction throughput and latency by deploying the compute nodes at different geographical locations using Hyperledger Fabric. The results conclude that ChainApparel accomplished significant performance under diverse workloads while ensuring complete traceability along the complex supply chain of the apparel industry. Thus, the ChainApparel framework helps make the apparel product more trustworthy and transparent in the market while safeguarding trust among the industry stakeholders.


Introduction
Product traceability is a critical practice that ensures product quality for all stakeholders to promote trust throughout the supply chain.It has been widely adopted in the apparel industry as it enables the customers, manufacturers, suppliers, and consumers to track the production processes to ensure the quality standards are met and the product is safe to wear.It helps manufacturers to identify and address production issues, as well as to ensure that their products meet customers' expectations.The manufacturer record and trace the material received from suppliers and the internal production processes [1].When the manufacturer gets a product complaint, they trace the product through their internal system to determine the stage and cause of the issue and take necessary corrective action if required.After the shipment of the product, traceability helps in the suitability and audibility process by providing a deep insight into the supply chain, confirming that the product is manufactured according to the customer's requirements.Finally, it enables the consumers to trace the final product by scanning the product tag to get information regarding the origin, material, and brand to ensure the genuineness of the product.In this way, traceability builds trust among stakeholders and provides a broader view of the supply chain.
Besides the advantages of traceability, like supply chain visibility in the apparel industry, many problems that break the traceability chain among the stakeholders still need to be solved [2].The first problem with the product traceability chain is the lack of an integrated platform that all stakeholders can use to track and record product transactions.At present, each stakeholder has developed in-house systems with different features and complexities that cannot communicate with each other, failing to provide complete traceability of the final product.The second problem is the reluctance of stakeholders to share their business information on these unreliable and untrustworthy systems.As a result, to ensure the quality of products and services, the customer appoints third-party auditors for rigorous inspection of the final product.The auditor provides an outside, unbiased opinion on the process and product quality.Hence, the customer must bear the additional cost of appointing an external auditor.Finally, the consumer is still determining whether he is buying a branded product or its counterfeit.Due to these problems, a lack of trust develops among all stakeholders.
Blockchain technology can potentially resolve the above-highlighted problems of the apparel manufacturing industry 4.0.Integrated with the IoT, blockchain and smart contracts provide a possible solution to apparel stakeholders.The data is collected, processed, and recorded into the blockchain using IoT devices.At the same time, smart contracts provide a secure and immutable framework to apply business terms and conditions in apparel transactions.Blockchain and IoTbased traceability systems have become increasingly popular due to their decentralization and data tamper resistance capabilities.In a decentralized blockchain network, individuals do not need to have knowledge or trust in each other.Each member in the network holds an identical copy of the data in the form of a distributed ledger.If any member's ledger is tampered with or corrupted, it will be rejected by most members in the network [3].Thus, it could solve many of the shortcomings of traditional traceability systems.
Previous studies have explored the potential of blockchain in various aspects of supply chains.The authors in [4] highlight the research gaps and current trends in blockchain technology in the fashion and textile industry.It emphasizes the lack of transparency and traceability in supply chains and how it affects the industry's ability to combat counterfeit markets.Similarly, reference [5] proposed a blockchain-based textile supply chain traceability framework, which provides a transparent and shared information platform for all supply chain members.In the textile and apparel sector, the authors [6] highlighted the use of blockchain technology varies based on traceability objectives and the supply chain positioning of the lead players involved in a blockchain initiative.Moreover, the IoT blockchainbased product traceability system proposed by [7] facilitates manufacturers and customers to track items throughout production.Agrawal et al. [8] developed a blockchain supply chain framework for the traceability of apparel and clothing supply chains to facilitate the customers for product authentication.This traceability case study is used to enhance the Life Cycle Assessment of the apparel products and accurately determine the value of the specific traceability data.The previous studies on blockchain applications in various industries mainly consisted of descriptive case studies, with only a few implementations with different scopes of work.However, this framework has specifically been deployed in the apparel industry.Hence, designing, deploying, and testing a decentralized, trustworthy blockchain and IoT-enabled complete apparel product traceability framework is necessary to facilitate all business stakeholders.Therefore, in this paper, a trustworthy blockchain and IoT-based traceability framework, i.e., ChainApparel, is designed and deployed to facilitate the apparel industry's stakeholders, i.e., customers, manufacturers, suppliers, and consumers working at different geographical locations.Multiple smart contracts, i.e., manufacturer and supplier registration, process execution, audit trace, fault trace and product trace are designed to automate the execution of mutual consents of the entire apparel process so that all participants are immediately sure of the outcome without any intermediary's involvement or time loss.The process execution smart contract helps the manufacturer to find out which process (fabric cutting, stitching, quality, and packing) is running on which garment.The fault trace smart contract is executed when the manufacturer receives a faulty product from the customer.This smart contract helps the manufacturer to trace back the product manufacturing processes and pinpoint at which step the problem occurred and who had performed this task.Next, the audit trace smart contract is developed to ensure the quality and compliance of the product.Finally, the trace product smart contract helps the consumers to trace the product's originality by scanning the quick response (QR) code.Further, the entire blockchain network performance is evaluated regarding transaction send rate, latency, and throughput across different geographical locations.Thus, this framework helps provide reliable traceability of apparel products among heterogeneous business systems and increases supply chain visibility for stakeholders without third-party assistance.
The rest of the paper is organized as follows.Section 2 provides a review of the literature.The ChainApparel process flow model is presented in Section 3. Section 4 describes the ChainApparel deployment.In Section 5, the ChainApparel performance analysis is performed.Finally, Section 6 concludes the paper.

Review of Literature
As globalization brings further geographical dispersion to production and distribution networks, tracing products, tracking production processes, and reducing exposure to various risks become increasingly difficult.Blockchain technology has the potential to address these challenges as it provides accurate and transparent product traceability that helps to develop trust among consumers and manufacturers regarding visibility, transparency, and compliance.However, it is challenging to integrate a blockchain into the geographically diverse supply chain ecosystem due to its complexity, interoperability, and performance issues among multiple stakeholders.Therefore, in this section, we have explored the literature on deploying the blockchain, smart contracts, and IoT in the apparel and other manufacturing industries regarding product traceability and interoperability.
Over the past few years, blockchain-based supply chain traceability research has gathered significant interest in the textile and other manufacturing sectors like chemical, food, pharmaceutical, construction, agriculture, etc.For example, in the supply chain industry, authors [9] integrated a blockchain-based solution with the existing system to enhance traceability, supply chain visibility, transparency, and quality in producing the final product.Hader et al. [10] suggested a novel blockchain-based framework for tracing complex textile supply chains.This framework provided an information platform for stakeholders to achieve traceability and transparency with real-time information sharing.The authors in [11] suggested a traceability architecture for the clothing manufacturing industry.The proposed architecture combines blockchain technology and conventional radio-frequency identification (RFID) to address end-to-end product traceability throughout manufacturing.
Similarly, in other manufacturing industries, the authors in [12] presented a blockchain-based solution for pharmaceutical product traceability.This work includes a pharmaceutical blockchain that involves a manufacturer, wholesaler, retailer, and consumer with drug registration rights exclusive to manufacturers.The paper highlights the traceability of drug ownership transfer and the validation of its origin.Similarly, the author created a decentralized tracking and tracing system using smart contracts and Ethereum blockchain technology to ensure security [13], transparency, and trust in the shipment process of medical products [14].This approach reduces errors and eliminates fraud, reduces delays, minimizes human interaction, improves efficiency and accuracy, improves inventory management, and minimizes cost.The [15] explored the traceability of agriculture products by using IoT, smart contracts, and blockchain in pre-harvest and post-harvest scenarios.They used IoT devices to collect data from the field and store it in the blockchain.Smart contracts were designed to control the interaction among all participating partners.The model ensured the tracking of agricultural products from farm to retail.
Besides, Wang et al. [16] proposed a blockchain-based product tracing system where smart contracts permanently record product transfer history in a distributed ledger.It creates a traceable chain back to the product's origin.The authors in [17] contributed by developing a blockchain framework for the food industry.Their work examined the suitability of blockchain technology in determining key challenges like traceability, accountability, performance, and trust in the industry.Similarly, in [18], the authors proposed an Ethereum smart contracts framework that integrates technologies to automate and digitize the agricultural food supply chain.Moreover, reference [19] investigated the potential of a blockchain-based solution that combines IoT and long-range (LoRa) technology to decentralize the food delivery system and enhance the food delivery process through sensor tracking.Furthermore, the authors propose a framework that utilizes consortium chains and smart contracts [20] to monitor and record workflows in agricultural food supply chains.The goal is to establish traceability and transparency in supply chains, eliminating information silos between enterprises and reducing the reliance on central agencies and intermediaries.The aim is to enhance the integrity, reliability, and security of the transaction record.There is substantial scope for strengthening the supply chain through end-to-end traceability, product delivery speed, coordination, and information sharing.Blockchain technology can serve as a potent tool in addressing these concerns [21].Despite this, current research is primarily theoretical, with little work on the practical implementation of the blockchain and IoT in the supply chain.Thus, there is a need to design and develop a blockchain-based traceability system that can build trust among the apparel industry stakeholders located at diverse geographical locations in real-time.
Another problem in the apparel industry supply chain is that all business stakeholders work in silos [22].They have developed stand-alone systems to monitor product transactions, limiting full supply chain traceability to all stakeholders.Moreover, stakeholders hesitate to share their business information due to their lack of trust.Therefore, an industrial blockchain-based platform for exchanging information, services, and tracking the product was discussed in [23].These customized blockchain information systems automatically process heterogeneous data from multiple sources.Smart contracts are developed to enable transaction execution and track product flow through the manufacturing process.It helped companies provide immediate decision-making and support to improve the quality of their products and services while ensuring traceability among stakeholders [24].
Further, blockchain interoperability enables secure state transitions and allows users to run cross-chain decentralized applications [25].It involves exchanging information between two or more heterogeneous blockchain platforms.Furthermore, this concept of interoperability can be extended to intra-blockchain interoperability, allowing smart contracts designed by different designers and organizations to interact within the same distributed ledger [26].Similarly, Yadav et al. [27] proposed a blockchain and IoT interoperability application to ensure data integrity.The business logic, user access policies, and rules were defined through smart contracts to enhance the productivity of the application.However, the proposed system did not test the interoperability function with different IoT frameworks.Integrating technologies like RFID, QR codes, and near-field communication (NFC) with the blockchain makes it possible to create an interoperable system that provides higher security and traceability in any industry [28].
Thus, the current literature review focuses on blockchain adoption, design, and architecture to make track and trace products [29] across the supply chain.However, limited work on interoperability information and performance scalability is available while using blockchain and IoT for product traceability across diverse geographical locations.Moreover, most literature theoretically discussed blockchain product traceability in different industries without real-time deployment.Therefore, there is a need to design and develop a trustworthy blockchain and IoT-based traceability framework that help apparel stakeholders by providing deep stitch-to-wear supply chain visibility while testing its performance regarding read/write rate, throughput, and latency across different geographical locations.

Proposed ChainApparel Process Flow Model
This section discusses the ChainApparel process flow model among the stakeholders, i.e., customer, manufacturer, supplier, and consumer, as shown in Fig. 1.The process layers link the stakeholders to establish their inter-business communication starting from placing the purchase order to the delivery of the finished product to the consumer.In the following, each inputs and outputs layers respective to their smart contracts are discussed in detail.

Customer Layer
The customer issued a purchase order to the manufacturer to develop a garment product.If the manufacturer accepts the purchase order, the customer and manufacturer sign an agreement against the specific purchase order.Next, the signed agreement is activated on the blockchain as a registration smart contract to establish the consensus between the customer and the manufacturer to initiate the business process regarding the purchase order, as shown in Algorithms 1 and 2 display the Supplier record 10: endif

Manufacturer Layer
The manufacturer accepts the customer's purchase order and purchases product accessories/raw materials from the approved suppliers.Next, the manufacturer starts its internal product development processes, like fabric cutting, stitching, quality, and packing, through a blockchain process execution smart contract, as shown in Algorithm 3. Every worker performs their specific task on product development.The IoT-enabled devices are installed in the production area.When the worker starts the process, these IoT-enabled devices fetch the worker's information, process information, and record it into the blockchain, as shown in Algorithm 3. The final product is shipped with an internal traceable process and QR codes.The customer verifies the final product through the audit trace smart contract, as stated in Algorithm 4. This smart contract helps the customer by ensuring that the product is developed as per provided standard operating procedures (SOPs)/purchase orders and that the raw material is sourced from the approved vendors.Alert Message "Product does not exist" 13: endif Similarly, when the manufacturer received the faulty product, he entered the process code into the ChainApparel fault trace smart contract, as shown in Algorithm 5. Upon entering the code, the manufacturer received detailed product information like employee code, cutting, stitching, quality, and packing.This smart contract helps the manufacturer to identify which process is made by whom.Moreover, this information is also helpful for the manufacturer to determine the inspection person who made the final product ready to ship.Alert Message "Product Code Not Found" 13: endif

Supplier Layer
The suppliers receive a purchase order from the manufacturer and issue product raw materials through the blockchain process execution smart contract as defined in Algorithm 3.

Consumer Layer
ChainApparel facilitates the consumer to trace the product before purchase.The consumers trace the product with the help of a product trace smart contract by scanning a QR code, as shown in Algorithm 6.This QR code retrieves product information like brand name, product name, and origin from the blockchain network.This smart contract makes sure to the consumer that the product is genuine.In this section, we discussed a trustworthy, decentralized, immutable, tamper-proof, and transparent ChainApparel deployment using blockchain and IoT, which builds trust among the stakeholders.We deployed a private blockchain with four different distributed nodes in a local apparel manufacturing industry.These nodes are located worldwide, as shown in Fig. 2.

Figure 2: Stakeholders at different geographic locations
ChainApparel is implemented in an Ubuntu environment with Intel(R) Core™ i7-1065G7 CPU, 16 GB RAM, 500 GB SSD, and 1 Gbps bandwidth.The production environment is designed and implemented using the Docker v20.10.12 environment for container virtualization.The Hyperledger fabric default database CouchDB is used to hold all transactions.The smart contracts are written in the Go language and managed through the Composer Command Line interface (CLI).The hypertext transfer protocol secure (HTTPS) protocol is used for communication between the blockchain network.Table 1 summarizes the resources used for the deployment of the ChainApparel.The blockchain environment is deployed on a single machine for each business stakeholder at different geographic locations.All the stakeholders access the ChainApparel using HTTPS protocol.In this environment, all the business stakeholders like customers, manufacturers, suppliers, and consumers are working as org1, org2, org3, and org4, as shown in Fig. 3.Each org has peer nodes of the ChainApparel and authorizing certificates (CA).Each CA is dedicated to a single organization; consequently, no organization can create and manage certificates from any other organization's CA.It helps to ensure that the system's security is always maintained.
The ChainApparel forms are designed using React.js.In ChainApparel, the customer placed the order with the manufacturer Fig. 4 per the agreed business logic developed between the customer and the manufacturer.
When the order is placed, the customer inputs the product description and material information into ChainApparel.The manufacturer has options to accept or declines the established order.If the manufacturer agrees with the order from the customer, a pop-up message appears, and the order is saved in the blockchain, as shown in Figs.5a and 5b.Simultaneously, the manufacturer and supplier registration process is initiated on the blockchain as described in Algorithms 1 and 2; otherwise, the manufacturer presses the decline button to cancel the order.The manufacturer starts its internal processes on the accepted purchase order.As the garments move through the production line, each worker performs a specific task, tracked and recorded by the IoT-enabled devices.The IoT devices are used for employee information who conducts the entire process on the particular purchase order and process information.This process helps the management to track the progress of the production line.It ensures that each process is integrated and workers' productivity is monitored at any time through a blockchain query.Each worker scans their employee card through an IoT device before starting the process, i.e., cutting, stitching, quality, and packing.The IoT device fetches the employee information and records it into the blockchain using Algorithm 3.This procedure helps the manufacturer to trace the worker's information when receiving the faulty product.The manufacturer can also check the in-progress order list by clicking the in-progress button on the ChainApparel menu.The final product ships to the customer with an internal traceable process and QR codes.The customer verifies the final product by following the audit trail smart contract, as demonstrated in Algorithm 4. This smart contract confirms that the item is produced in compliance with the purchase order and that the source materials are procured from authorized suppliers.Upon receiving the defective item from the customer, the manufacturer inputs the internal process code into ChainApparel, as demonstrated in Algorithm 5.They obtained in-depth product data such as employee code, cutting, stitching, quality, and packaging.This smart contract identifies the role of the individual in the process.
Finally, the developed product is tracked by clicking the tracking option, as shown in Fig. 6.The final garment labels are read using a QR code, which enables the apparel stakeholders to track the final product information using Algorithm 6.It provides insights into the manufacturing process and origin of the clothes.Moreover, this figure also displays a complete blockchain featuring transactions and blocks data chronologically.It helps the apparel stakeholders to track the product status and record the employee who has performed the task on said PO.Moreover, it builds trust among stakeholders, provides a broader view of product traceability, and ensures that no one changes the collected data.
Each ChainApparel submitted transaction which can be visualized using Hyperledger Explorer, as shown in Fig. 7.This section describes the performance analysis of the ChainApparel using an open-source tool, i.e., Hyperledger Caliper [30].This tool allows the performance analysis of the entire blockchain network of ChainApparel deployed on a node with fixed parameters, as mentioned in Table 1.The performance analysis includes the write/read transaction send rate, write/read transaction throughput, and maximum, minimum, and average transaction latency per second.The successful write transactions send rate shown in Fig. 8a indicates that the execution time varies depending on the number of transactions.It also shows that the send rate per second is saturated when the transaction exceeds 400.The successful read transaction execution time per second is shown in Fig. 8b.It directs that the send transactions per second (TPS) constantly increases to 1600 transactions.The saturation started when transactions exceeded 1600.Latency refers to the overall duration required for a transaction to be processed from when the proposal request is submitted until it is verified on the ledger and accessible on the network.The latency values are analyzed depending on the number of transactions in a block ranging from 100 to 6500.Latency values for different transactions are analyzed at fixed transaction arrival rates, as shown in Fig. 10a.In this case, the average latency of some transactions increases slightly due to the increased number of transactions.It also signifies a correlation between the executed transactions and writes latency at 400 transactions.There is no correlation when transactions exceed 400.Moreover, the average response of the system rate increases with the number of transactions.In read transaction latency, as shown in Fig. 10b, there is no connection among maximum, minimum, and average latency while the transaction exceeds 400.It rationalizes that the submitted time for transactions less than 400 is excellent on a single node.These results conclude that ChainApparel's product traceability system based on blockchain and IoT provides stakeholders with a high throughput and low latency under diverse workloads while the blockchain nodes are at distinct geographical locations.2. Theoretical comparison and real-time performance analysis under diverse workloads conclude that ChainApparel is robust while ensuring the authenticity and traceability of the supply chain among the stakeholders.This paper uses IoT and blockchain to design and develop a trustworthy apparel traceability framework, i.e., ChainApparel.The framework provides a deep insight into the complex supply chain of the apparel industry to ensure product authenticity and traceability to all stakeholders.For this, smart contracts at each step of the supply chain are designed and developed to validate and store every business transaction among the stakeholders of the apparel industry on the blockchain.Later, this enables the stakeholders to trace the product at every step of the supply chain while ensuring the trustworthiness of the finished product without the need for third-party audits.The proposed ChainApparel is practically implemented in the apparel industry using Hyperledger Fabric.The performance of the entire framework is evaluated using various performance metrics across different geographical locations.The results conclude the framework's robustness while ensuring trust and traceability among the stakeholders, including the consumer of the final product.
Since the evolution of blockchain in the industry is still in its early stages, the proposed framework has limitations in terms of scalability and interoperability.Therefore, future work will include an interoperability framework enabling stakeholders to share business transactions seamlessly across different blockchain deployments.

Figure 4 :
Figure 4: Customer placed an order to the manufacturer

Figure 8 :
Figure 8: Write and read transaction send rates

Table 2 :
Comparison with other blockchain traceability systems