An Anti-Counterfeit and Traceable Management System for Brand Clothing with Hyperledger Fabric Framework

: Counterfeit products are internationally regarded as “the world’s second greatest public health hazards after drugs”. Counterfeiters produce counterfeit brand clothing and then sell them to consumers through unofﬁcial channels; thus, consumers spend a lot of money without getting the value they deserve. With the rise of e-shopping, the safety and security of branded clothing supply chains are also under threat. Counterfeit branded apparel manufacturers generate proﬁts while genuine manufacturers suffer, which ultimately violates the interests of the public. This study proposes a traceable anti-counterfeit management system for branded clothing based on Hyperledger Fabric technology. This system can achieve full traceability of the production information of branded clothing. It uses the unique characteristics of blockchain, such as being unforgeable, traceable, open, and transparent, and collectively ‘maintaining’, to record the speciﬁc production processes of the brand clothing, and ensure the authenticity and legitimacy of the production information of brand clothing. The end-user can self-verify the product’s authenticity by sharing the product’s details on the immutable framework. It solves problems surrounding information asymmetry, opaque supply chain data, and easy falsiﬁcation in the production process of branded clothing in traditional branded clothing supply chains.


Background
Branded clothing is favored by consumers, and is a target for counterfeiters who profit illegally. Regarding a brand-name product, especially an international brand, one must focus on the quality of the product, as well as the production, management, and use of legal methods to defend the interests and honor of the brand against counterfeiting. The situation is global, with up to 5% of EU imports being counterfeit [1]. Counterfeiting rings not only operate formulaically, to sell counterfeit products, they also exploit the transmission effects of the internet, to dump counterfeit goods through informal channels. Although social media networks are not the primary venues for commerce, such platforms are powerful tools for marketing products. They can drive sales to online stores with little or no regulation. The most extensive online platforms-YouTube, Facebook, WhatsApp, WeChat, Instagram, and TikTok-have billions of active users, and just as many potential customers. Studies have shown that almost one-fifth of the content posted on social media Table 1. Comparison with existing anti-counterfeiting traceability methods.

Authors
Year Objective Technologies

Merits Demerits
Alzahrani et al. [7] 2018 The combination of blockchain technology and NFC technology in the internet of things is used to prevent counterfeiting of fake product technologies.
Blockchain and consensus protocol.
Blockchain technology is used to solve the disadvantages brought by centralized management and to crack down on fake and shoddy products.
No specific data flow frameworks are proposed.
Zhu et al. [8] 2020 Blockchain technology is used for anti-counterfeiting traceability of the drug supply chain.
Ensure the integrity of drug information management and a high level of privacy protection.
Encryption and decryption methods need improvement.
Bullón Pérez et al. [9] 2020 Ensure the transparency of the supply chain, the authenticity, reliability, and integrity of clothing, and the effectiveness of the retail end product.
Blockchain and hash functions.
Use a private and open blockchain to track products. Blockchain participants are proposed for each production stage.
The specific process of clothing production is not put forward.
Blockchain and near-field communication.
A secure and immutable scientific data provenance tracking and management platform with provenance records.
Lack of connection with actual cases for discussion.
Agrawal et al. [11] 2021 Investigates and proposes a blockchain-based traceability framework for traceability in the multitier textile and clothing supply chain.
Blockchain and smart contract.
The internet of things technology and blockchain technology are combined to carry out anti-counterfeiting traceability of clothing.
The specific flow of data are not reflected.
Alzahrani et al. [7] similarly expressed that traditional supply chains have a single point of processing, storage, and failure problems in regard to anti-counterfeiting traceability through a centralized authority. Therefore, the technology of 'block supply chain' is proposed, which is a new decentralized supply chain that uses blockchain and communication technology to detect counterfeit attacks. However, the processes of some data are not well expressed. The framework proposed by Zhu et al. [8] for anti-counterfeit traceability of pharmaceuticals based on blockchain is also worth learning, which can ensure the transparency and openness of the pharmaceutical supply chain; the smart contract-based access control policy model is about preventing the drug information from being changed or disclosed at the nodes of the blockchain. The security of the framework would go further if the privacy of the data were enhanced. Bullón Pérez [9] present an updated traceability scheme and proposal for the apparel industry for ready-to-wear apparel, tracking suppliers and customers throughout the logistics chain. However, less specific data flow frameworks make this aspect unconvincing. Yiu et al. [10] present a feasible mechanism for developing a product orientation and traceability ecosystem using blockchain technology, mainly through a series of security and threat analyses, mainly for Near Field Communication (NFC) enabled anti-counterfeiting systems to identification. There is a lack of discussion in conjunction with physical objects. Agrawal et al. [11] presented a specific case study using blockchain technology to verify and track the supply chain of off-the-shelf apparel. However, it is difficult for buyers to self-verify the transaction information on the blockchain, as they lack some IoT technology. The methods proposed above are all dedicated toward product anti-counterfeit traceability, but the current anti-counterfeit traceability methods still have some problems for buyers and supply chain participants. For buyers, currently proposed anti-counterfeit traceability methods do not provide a platform for anti-counterfeit inquiries and an arbitration mechanism. For supply chain participants, the current problem is that it is difficult to effectively manage the supply chain, find the source of the problem, and there is the lack of an arbitration mechanism to maintain the supply chain. In this paper, we propose an anti-counterfeit and traceable management system for brand clothing with the Hyperledger Fabric framework. This paper involves a cryptographic mechanism to encrypt the data, which further ensure the security of the data. It also combines the internet of things and blockchain technologies to trace the supply chain information of the production and sales process of branded clothing in real-time. The characteristics of blockchain are used to ensure the transparency and traceability of data in the supply chain. The proposed scheme ensures the correct transmission of data.
The paper is written in the following structure. Section 2 focuses on the relevant techniques used in our proposed scheme. Section 3 presents our specific proposal and the detailed process. In Section 4, we perform a security analysis and a discussion of the relevant features of the scheme. Section 5 gives a discussion of computational costs, communication performance, and comparisons. Finally, in Section 6, we present a summary of our scheme.

Blockchain
Blockchain is an important concept of Bitcoin, which is essentially a distributed database [12]. It has the characteristics of high reliability and high confidentiality and has good prospects in regard to effectively solving the trust problem between the two parties [13]. As the underlying technology of Bitcoin, blockchain is a string of data blocks generated using cryptographic methods of correlation, each containing information about a batch of Bitcoin network transactions, used to verify the validity of its information and to generate the next block. Blockchain technology has the following five characteristics: (1) characteristic distributed database; (2) uniqueness-each record is a timestamp and cannot be tampered; (3) transparency of data; (4) irreversibility of records; and (5) traceability. The application of blockchain technology in a supply chain and logistics is widely recognized as it records and stores all transaction information of stakeholders in the supply chain in a tamper-evident manner. It makes supply chain information more transparent and the receipt of information more symmetrical. Blockchain may significantly impact supply chain management, its relationships, and governance structures [14].

Hyperledger Fabric
Hyperledger Fabric (Hyperledger Architecture) is an open-source project launched by the Linux Foundation in 2015 to advance blockchain digital technology and transaction validation, with investments in industry giants, including finance, manufacturing, logistics shipping, and security consulting [15]. Hyperledger Fabric builds on the foundation of public chains to create an efficient, low-cost operating model, known as the federated chain model. Areas of application include, but are not limited to, dispute resolution, trade logistics, foreign exchange netting, food safety, contract management, diamond provenance, reward point management, low liquidity securities trading and settlements, identity management, and settlements via digital currencies [16]. Compared to the previous Ethereum platform, Hyperledger Fabric addresses performance scalability and privacy issues through fine-grained access control. Compared with Hyperledger Sawtooth, Hyperledger Fabric establishes the concept of the channel, which provides more comprehensive data protection and can better resist attacks from attackers. It is clear that Hyperledger Fabric allows fine-grained control over consistency, which improves performance, scalability, and privacy [17]. The introduction of the channel in Hyperledger Fabric plays a very good role in data privacy protection [18]. One of the frameworks of Hyperledger Fabric is shown in Figure 1. issues through fine-grained access control. Compared with Hyperledger Sawtooth, Hyperledger Fabric establishes the concept of the channel, which provides more comprehensive data protection and can better resist attacks from attackers. It is clear that Hyperledger Fabric allows fine-grained control over consistency, which improves performance, scalability, and privacy [17]. The introduction of the channel in Hyperledger Fabric plays a very good role in data privacy protection [18]. One of the frameworks of Hyperledger Fabric is shown in Figure 1.  From Figure 1, we can see that the Hyperledger Fabric framework consists of four main parts: the application, the peer node, the order (ordering service node), and the certificate authority (CA) node.
Application: the Hyperledger Fabric provides an APP platform for clients to allow people or departments involved in the supply chain to more easily interface to the transactions within the blockchain. The initiation of transactions is done through the Software Development Kit (SDK), the SDK version is Fabric Node SDK 1.4. All communication messages need to contain signatures, and the signature certificates and public and private keys are obtained through the CA node. The client submits a transaction proposal to the endorsing node (endorser) and obtains the endorsed transactions from the endorser node. After collecting enough transactions, it broadcasts them to the sorting service node.
Peer node: the peer node is the main body involved in the transaction, which can represent each member involved in the chain, and is responsible for the execution of the smart contract in the consensus link. It contains various types of nodes; the main participating transaction nodes are the endorser node and committer node. The peer node also stores the ledger data and the chain code. After receiving a transaction proposal from the client, the endorsing node verifies the transaction signature, simulates the transaction's execution, performs a signature endorsement on the result, and then sends the validated transaction to the order. The endorsing nodes are dynamic roles and are bound to specific chain codes that specify which nodes must complete a valid transaction endorsement. The peer node is the endorsing node only when the client initiates a transaction endorsement request to the peer node; otherwise, the peer node is just an ordinary committer node. It is only responsible for verifying the transaction.
Order: the primary function is to sort the transactions to ensure data consistency on each peer node. Order sorts transactions according to consensus algorithms and broadcasts the sorted transactions into the blockchain. The peer node updates the transactions to the ledger after passing the transaction information broadcasts by the order node to ensure data integrity. After receiving the sorted transaction information of the order node, From Figure 1, we can see that the Hyperledger Fabric framework consists of four main parts: the application, the peer node, the order (ordering service node), and the certificate authority (CA) node.
Application: the Hyperledger Fabric provides an APP platform for clients to allow people or departments involved in the supply chain to more easily interface to the transactions within the blockchain. The initiation of transactions is done through the Software Development Kit (SDK), the SDK version is Fabric Node SDK 1.4. All communication messages need to contain signatures, and the signature certificates and public and private keys are obtained through the CA node. The client submits a transaction proposal to the endorsing node (endorser) and obtains the endorsed transactions from the endorser node. After collecting enough transactions, it broadcasts them to the sorting service node.
Peer node: the peer node is the main body involved in the transaction, which can represent each member involved in the chain, and is responsible for the execution of the smart contract in the consensus link. It contains various types of nodes; the main participating transaction nodes are the endorser node and committer node. The peer node also stores the ledger data and the chain code. After receiving a transaction proposal from the client, the endorsing node verifies the transaction signature, simulates the transaction's execution, performs a signature endorsement on the result, and then sends the validated transaction to the order. The endorsing nodes are dynamic roles and are bound to specific chain codes that specify which nodes must complete a valid transaction endorsement. The peer node is the endorsing node only when the client initiates a transaction endorsement request to the peer node; otherwise, the peer node is just an ordinary committer node. It is only responsible for verifying the transaction.
Order: the primary function is to sort the transactions to ensure data consistency on each peer node. Order sorts transactions according to consensus algorithms and broadcasts the sorted transactions into the blockchain. The peer node updates the transactions to the ledger after passing the transaction information broadcasts by the order node to ensure data integrity. After receiving the sorted transaction information of the order node, the peer node will upload its data to the blockchain network and update the data in the blockchain network.
CA node: the peer node is responsible for authorizing and authenticating all nodes that join the blockchain, including the upper layer clients. Each of them has its certificate issued for Identification in the transaction process. For the Hyperledger Fabric blockchain framework, there are high requirements for authentication, from which, CA nodes play the role of authorizing users and signing transmissions. Peer nodes use digital certificates issued by CA for authentication, encrypting data transmission, authorizing users, managing user certificates, and other features to ensure data security in the blockchain network.

Elliptic Curve Digital Signature Algorithm (ECDSA)
Scott Vanstone first proposed the elliptic curve signature algorithm (ECDSA) in 1992 [19]. The security of the elliptic curve crypto signature regime is based on the intractability of the elliptic curve discrete logarithm problem. The elliptic curve discrete logarithm problem is far more complex than the discrete logarithm problem, and elliptic curve cryptosystems have higher cryptographic strength. This brings the benefits of smaller computational parameters, shorter keys, faster operations, and shorter signatures. Elliptic curve ciphers are therefore particularly suitable for applications where processing power, storage space, bandwidth, and power consumption are limited.
We can analyze how ECDSA works by simulating the signing and verification of messages M between user A and user B using ECDSA. User A first sets the elliptic curve parameters y 2 = (x 3 + ax + b)modp, its corresponding key pair (d A , Q A ), d A is the private key of user A, Q A is the public key of user A. User A can compute the public key from the private key Q A = d A G, where G is the parameter point in the ECDSA elliptic curve.
User A generates a random number k based on the ECDSA algorithm, uses points G to calculate the public key (x, y) = kG.

2.
User A calculates the hash value of the message M: h = H(M).

3.
User A calculates the eigenvalues of an elliptic curve (r, s), of which r = xmodn, s = k −1 (h + rd)modn (k −1 is the multiplicative inverse of the modulus of k).

4.
(r, s) is the digital signature of user A. User A sends the elliptic curve parameters D = (p, a, b, G, n, h) and User A's public key Q A to User B for verification of the correctness of the signature.
Validation process: 1. User B calculates the hash value of the message M: h .

3.
The calculation (x , y ) = u 1 G + u 2 Q A , if x = rmodn then the signature is validated.

Smart Contract
Blockchain is a global decentralized distributed database ledger, and smart contracts are software programs executed in a decentralized manner based on blockchain technology [20]. Blockchain technology can achieve collaboration and trust between multiple enterprise entities through smart contracts, thereby expanding the scope and depth of mutual cooperation between parties [21]. An event-driven, stateful program runs on top of the blockchain system and can hold and process digital assets on the blockchain ledger. The development of blockchain technology provides an excellent operating basis for smart contracts, which can play an important role in the blockchain. Smart contracts guarantee important features of blockchain technology: data cannot be deleted or modified, only added, ensuring traceability of history, while the cost of doing malicious acts will be high, as its malicious acts will be recorded forever.
Smart contracts based on blockchain technology can bring into play the advantages of smart contracts, in terms of cost efficiency, and avoid the interference of malicious acts in the normal execution of contracts. The smart contract is written into the blockchain in digital form. The characteristics of blockchain technology guarantee that the whole process of storage, reading, and execution is transparent, traceable, and unchangeable. At the same time, a state machine system is built by the consensus algorithm that comes with the blockchain, which enables smart contracts to operate efficiently.

BAN Logic
BAN logic, introduced by Burrows, Abadi, and Needham, is a cognitive logic for analyzing security protocols. It models the knowledge of topics in a protocol at a level of abstraction [22]. Specifically, BAN logic helps users determine whether the information exchanged is trustworthy, resistant to eavesdropping, or both. BAN logic begins in situations where information is vulnerable to tampering during the exchange period. Typical BAN logic includes: (1) verifying the source of the message; (2) verifying the 'freshness' of the message; (3) verifying the credibility of the source.

Threat Model
In related works, we conducted a brief review of previous research and identified problems and shortcomings that some research currently has. As a result, we compiled some possible threat patterns usually caused by security issues and vulnerabilities in the system. The security of the blockchain is also relative and, therefore, this system is potentially risky.

1.
Mutual authentication: the current internet environment is due to the network nature of blockchain. Participants need to authenticate with each other to determine whether they are receiving correct and secure messages. This feature comes about precisely because of the decentralized blockchain network. This also allows the communication between the two in the blockchain network to be secure and guaranteed.

2.
Data integrity: when using the system for transactions, all data present in the system must be processed in an integrated manner. The system must ensure the integrity of the data when conducting transactions and the system must ensure that the data cannot be tampered with by anyone when it is transmitted and stored.

3.
Non-repudiation: the transactions in the blockchain network are transmitted and stored through the chain code; therefore, to perform anti-counterfeiting and traceability verification, all transactions must be verified by an ECDSA digital signature to ensure the non-repudiation of the data. The deployment of the chain code ensures that the data have a non-repudiation effect and it makes the information more secure.

4.
Known attack problems: blockchain networks are also subject to attacks by illegal nodes and illegal persons, which contain different types of attacks.
(1). Man-in-the-middle attacks: in a blockchain network, when the sender communicates with the receiver, an attacker performs a man-in-the-middle attack by intercepting messages during the communication process. The specific process is: the attacker intercepts the message sent by the sender to the receiver and tampers with the message content. The attacker sends the altered message to the receiver instead of the sender to perform the man-in-the-middle attack. (2).
Replay attack: an attacker will resend the data obtained after eavesdropping on the sender to the receiver untouched. The attacker does not need to know the exact meaning of the data, but only know what the data do to attack the receiver, by sending the data again without knowing its content.

System Architecture
For the process of clothing production, from the time a company decides to start producing clothing to the time the finished garment appears. It goes through the following stages. The supply chain flow of brand clothing is shown in Figure 2-brand company (BC), material supplier (MS), manufacturer (MF), retailer (R) form the alliance chain. The alliance chain, together with the customer (CU) and third party (TP), will form a Hyperledger Fabricbased brand clothing anti-counterfeiting management system. The system framework is shown in Figure 2.

1.
Brand company (BC): the brand clothing company. This role manages and determines the design and production of clothing. The production of brand clothing requires a license from the company. The supply chain only works when the brand clothing company decides to produce the clothing.

2.
Material supplier (MS): this role provides the raw materials for the production of clothing products. The BC will first send the production license of the clothing and the transaction information of all types of orders to MS, which will provide the raw materials according to the orders and keep a record of the origin of the raw materials. 3.
Manufacturer (MF): first, the MF receives the raw materials and order information from the MS. The MF is then responsible for processing the raw materials into garments. MF will inlay the unique identification code on each garment. Each piece of clothing corresponds to a unique identification code. Domestic and foreign customers can scan the identification code through the client interface to enter the blockchain network to query the information of the brand clothing. 4.
Retailer (R): the retailer will receive the garments from the manufacturer, confirm the order information, return it to the MF, and sell the garments to the customer, and then upload the transaction information to the blockchain.

5.
Customer (CU): the customer can use the mobile app or scan the code to see all of the information about the product. Moreover, the CU could inspect the entire production process of a finished product. 6.
Blockchain center (BCC): a Hyperledger Fabric-based blockchain framework that detects the legitimacy of participants. Moreover, it will record various information uploaded to the blockchain by participants. 7.
Third Party (TP): all transactions can be accessed by linking to the blockchain network, regardless of whether the clothing is at the design stage, the raw material supply stage, the clothing design stage, or the retail stage. All information can be accessed to detect counterfeit or illegal branded products.

System Architecture
For the process of clothing production, from the time a company decides to start producing clothing to the time the finished garment appears. It goes through the following stages. The supply chain flow of brand clothing is shown in Figure 2-brand company (BC), material supplier (MS), manufacturer (MF), retailer (R) form the alliance chain. The alliance chain, together with the customer (CU) and third party (TP), will form a Hyperledger Fabric-based brand clothing anti-counterfeiting management system. The system framework is shown in Figure 2. 1. Brand company (BC): the brand clothing company. This role manages and determines the design and production of clothing. The production of brand clothing requires a license from the company. The supply chain only works when the brand clothing company decides to produce the clothing. 2. Material supplier (MS): this role provides the raw materials for the production of clothing products. The BC will first send the production license of the clothing and the transaction information of all types of orders to MS, which will provide the raw materials according to the orders and keep a record of the origin of the raw materials. There are the seven 'actors' from the supply chain flow framework for a Hyperledger Fabric-based anti-counterfeit management system for traceable brand clothing. The specific process is shown in Sequence Figure 3. The specific steps are: Step 1. This step is the registration phase for each role in the system. All participants in the clothing brand company (BC), material supplier (MS), manufacturer (MF), retailer (R), customer (CU), and third party (TP) need to be authenticated at the CA node in the blockchain network. After passing authentication, the roles can exchange information through the channel.
Step 2. When the BC wants to produce clothes, the BC first sends the production certificate, raw material order, and the production plan to the MS. The MS confirms the production information and starts to collect the raw material, and the MS sends a response message to BC when it is finished. BC uploads the relevant information to the blockchain center through the sorting node and updates the local ledger after ensuring the ordering information is correct.
Step 3. When the MS prepares raw materials for garment production, it will send the raw materials and production information to the MF, which will compare the production information with the raw materials received in reality to ensure the legitimacy of the data, and send a response message to the MS. When the MF processes the raw materials into garments, it will mark a unique identification code on each garment, and the CU can check the information of the garments on the blockchain, according to the identification code.
Step 4. The R will send the order to the MF, which will confirm the order from the R, provide the garment based on the order information, upload the confirmed order information to the blockchain center, and then send the garment and certificate to the R. After confirming that the garment information is the same as the order, the R will return the confirmed information to MF.
Step 5. The CU can purchase brand clothing through the R. After the R determines the transaction information applied by the CU, it will upload the transaction information to the blockchain center. At this point, the whole supply chain ends, and all data will be operated on the chain at various stages, and the integrity of the data will be guaranteed. Step 6. The CU can use the identification code on the garment to join the blockchain network with an app or client to check the garment's production process and raw material information. If the CU finds out that he/she has purchased a counterfeit garment, he/she can submit an arbitration application with a third party.
Step 7. The third party will go to the blockchain center to examine the information based on the arbitration request provided by the CU for each transaction and operation in the supply chain, and check whether the name-brand clothing is correct or not in the supply chain during the process. The legitimacy and validity of the brand clothing can be verified by examining the signature information of each department.

Hyperledger Fabric Detailed Transaction Information Flow
The transaction process in the Hyperledger Fabric-based blockchain framework is shown in Figure 4, which shows in detail how two companies in the supply chain interact with each other. If Company A and Company B interact for necessary information in the supply chain, Company A and Company B will each form an organization (as Organization A and Organization B). They will also register through a certificate authority (CA) node, which will return their corresponding public and private keys and digital identity credentials. Company A and Company B then create their respective Organization (Org), which will contain various nodes (endorser node, committer node, anchor node, and leader node), collectively known as peer nodes. Each peer node in an organization can deploy one or more chain codes and will store a copy of the ledger in the channel. The order node sorts and packages the transactions and information interactions generated in the channel, and uploads transaction information to the Blockchain Center. At this point, Company A and Company B can conduct transactions and information interactions in the Hyperledger Fabric network framework.

Hyperledger Fabric Detailed Transaction Information Flow
The transaction process in the Hyperledger Fabric-based blockchain framework is shown in Figure 4, which shows in detail how two companies in the supply chain interact with each other. If Company A and Company B interact for necessary information in the supply chain, Company A and Company B will each form an organization (as Organization A and Organization B). They will also register through a certificate authority (CA) node, which will return their corresponding public and private keys and digital identity credentials. Company A and Company B then create their respective Organization (Org), which will contain various nodes (endorser node, committer node, anchor node, and leader node), collectively known as peer nodes. Each peer node in an organization can deploy one or more chain codes and will store a copy of the ledger in the channel. The order node sorts and packages the transactions and information interactions generated in the channel, and uploads transaction information to the Blockchain Center. At this point, Company A and Company B can conduct transactions and information interactions in the Hyperledger Fabric network framework.

Hyperledger Fabric Detailed Transaction Information Flow
The transaction process in the Hyperledger Fabric-based blockchain framework is shown in Figure 4, which shows in detail how two companies in the supply chain interact with each other. If Company A and Company B interact for necessary information in the supply chain, Company A and Company B will each form an organization (as Organization A and Organization B). They will also register through a certificate authority (CA) node, which will return their corresponding public and private keys and digital identity credentials. Company A and Company B then create their respective Organization (Org), which will contain various nodes (endorser node, committer node, anchor node, and leader node), collectively known as peer nodes. Each peer node in an organization can deploy one or more chain codes and will store a copy of the ledger in the channel. The order node sorts and packages the transactions and information interactions generated in the channel, and uploads transaction information to the Blockchain Center. At this point, Company A and Company B can conduct transactions and information interactions in the Hyperledger Fabric network framework.  Suppose that Organization A and Organization B want to interact with each other. In that case, firstly, Organization A and Organization B register with the CA node of each organization through the client of each organization, and the CA node returns the authentication certificate, public key, and private key to verify the validity of their identities. Organization A encrypts the transaction information with the distributed public key and uploads the encrypted information to the blockchain through the order node via the peer node. Organization B receives the transaction information uploaded to the blockchain by Organization A through the channel and triggers the chain code to update the local blockchain ledger for data storage. In the overall framework, the information interaction between two different functions is mainly done through channels.

Initialization Phase
During the initialization phase, each company with different roles forms an organization. Figure 5 represents the basic chain code structure in the Hyperledger Fabric network architecture that we designed. The left side of the structure stores the information of designer apparel, and the right side shows the structure and enumeration of role types of the roles participating in the supply chain. When a designer apparel product is manufactured in the supply chain, each detail is appended to the chain code structure through the roles involved in the supply chain. Suppose that Organization A and Organization B want to interact with each other. In that case, firstly, Organization A and Organization B register with the CA node of each organization through the client of each organization, and the CA node returns the authentication certificate, public key, and private key to verify the validity of their identities. Organization A encrypts the transaction information with the distributed public key and uploads the encrypted information to the blockchain through the order node via the peer node. Organization B receives the transaction information uploaded to the blockchain by Organization A through the channel and triggers the chain code to update the local blockchain ledger for data storage. In the overall framework, the information interaction between two different functions is mainly done through channels.

Initialization Phase
During the initialization phase, each company with different roles forms an organization. Figure 5 represents the basic chain code structure in the Hyperledger Fabric network architecture that we designed. The left side of the structure stores the information of designer apparel, and the right side shows the structure and enumeration of role types of the roles participating in the supply chain. When a designer apparel product is manufactured in the supply chain, each detail is appended to the chain code structure through the roles involved in the supply chain.

Registration Phase
All nodes that want to join the Hyperledger Fabric blockchain network, including the BC, MS, MF, R, CU, and TH, need to register with the certificate authority (CA) node in the Blockchain Center, and will be given a corresponding public and private key. We use 'Roles X' to represent all arbitrary roles in the blockchain system; Figure 6 represents the flowchart of the registration phase.
Step 1. The name ID X is generated for all roles (Roles X) participating in the anti-counterfeit and traceable management system. The generated ID X is then sent through the application to the CA nodes in the blockchain network for registration and verification, for the legitimacy of their identities.
Step 2. The CA node in the blockchain network generates the private key k X based on the system role and calculate the public key Q X : After verifying the registration of all system roles, the chain code Algorithm 1 is triggered. The CA node sends the generated (ID X , d X , Q X ) to Roles X.
Step 3. The role in the system receives its signature message parameter (ID X , d X , Q X ) and stores it. the Blockchain Center, and will be given a corresponding public and private key. We use 'Roles X' to represent all arbitrary roles in the blockchain system; Figure 6 represents the flowchart of the registration phase. Step 1. The name X ID is generated for all roles (Roles X) participating in the anti-counterfeit and traceable management system. The generated X ID is then sent through the application to the CA nodes in the blockchain network for registration and verification, for the legitimacy of their identities.
Step 2. The CA node in the blockchain network generates the private key X k based on the system role and calculate the public key X Q : After verifying the registration of all system roles, the chain code Algorithm 1 is triggered. The CA node sends the generated ( , , )

Clothing Design Phase
This phase is the clothing design phase, and the main players involved are the brand company (BC) and material supplier (MS). The flowchart is shown in Figure 7, and the related chain code is shown in Algorithms 2 and 3. Step 1. When the BC wants to produce branded clothes, the MS needs to be provided with information on the raw materials required for the production of branded clothes as well as product information. The BC randomly selects a random number k 1 and generates a message containing a list of C_ID: The BC calculates its hash value and executes the "Sign" algorithm used to generate the signature (r BC1 , s BC1 ); The "Sign" algorithm is shown in Algorithm 2: Its generated encrypted messages is encrypted by the MS public key: Then BC executes the chain code function "BrandCompany", and the algorithm is shown in Algorithm 3. Send the message (ID BC , ID MS , C BC1 , (r BC1 , s BC1 )) to the MS. Step 2. The MS receives the above message at a time T 2 and first decrypts the message with its private key: Subsequently, MS verifies the validity of the timestamp: The MS then uses "Verify" in Algorithm 2 to compute the hash value to verify the message: If the signature is valid, MS executes the chain code function "MaterialSupplier" with the algorithm shown in Algorithm 3. The MS will provide raw material and update the local ledger based on the transaction information in the encrypted message List < C_ID >. The MS randomly selects a random number k 2 for generating the response message: The MS calculates its hash value and executes the "Sign" algorithm in Algorithm 2 to generate the signature (r MS1 , s MS1 ): Its generated encrypted messages are encrypted by the BC's public key: Send the response message (ID MS , ID BC , C MS1 , (r MS1 , s MS1 )) to the BC. Step 3. The BC receives the response message and first decrypts the message with the private key: The validity of the timestamp is then confirmed by comparing: The BC verifies the message by computing the hash value of "Verify" in Algorithm 2: If the signature is valid, the BC updates the response message from the MS to its book, and the BC executes the chain code function "BrandCompany" with the algorithm shown in Algorithm 3.    After the above three steps, the clothing design phase is complete. Moreover, the raw material quantity and designer clothing design details should be updated in the account book.

Clothing Production Phase
This phase is the clothing production phase; the main players involved are the material supplier (MS) and manufacturer (MF). The flowchart is shown in Figure 8, and the related chain code is shown in Algorithm 4.  Step 1. The MS provides raw materials for branded apparel to the MF for manufacturing branded clothing based on production information provided by the BC, and the MS needs to provide raw material information and production information for branded clothing to the MF. The MF produces clothes based on raw materials received in real life. The MS randomly selects a random number k 3 and generates a message containing a list of C_ID: The MS calculates its hash value and executes the "Sign" algorithm in Algorithm 2 to generate the signature (r MS2 , s MS2 ): Its generated encrypted messages are encrypted by the MF's public key: Then, the MS executes the chain code function "MaterialSupplier"; the algorithm is shown in Algorithm 4. Send the production-related information of the branded clothing to MF (ID MS , ID MF , C MS2 , (r MS2 , s MS2 )).
Step 2. The MF receives the above message and first decrypts the message with its private key: Subsequently, the MF checks the validity of the timestamp: The MF then verifies the message by calculating the hash value with "Verify" in Algorithm 2: If the signature is valid, the MS updates the local ledger with the transaction information in the encrypted message List < C_ID >. The MF executes the chain code function "Manufacturer" with the algorithm shown in Algorithm 4. After the manufacturing of the designer clothes is completed, the MF sends a response message to the MS. The MF randomly selects a random number k 4 for generating the response message: The MF calculates its hash value and executes the "Sign" algorithm in Algorithm 2 to generate the signature (r MF1 , s MF1 ): Its generated encrypted messages are encrypted by the MS public key: Send the response message (ID MF , ID MS , C MF1 , (r MF1 , s MF1 )) to the MS. Step 3. The MS receives the response message and first decrypts the message with the private key: The validity of the timestamp is then confirmed by calculating: The MS verifies the message by calculating the hash value of "Verify" in Algorithm 2: If the signature is valid, the MS updates the MF's response message to its book, and the MS executes the chain code function "MaterialSupplier" with the algorithm shown in Algorithm 4.
After the above three steps, the clothing production phase is complete. The information of the produced branded clothing in the ledger should be updated. Symmetry 2021, 13, x FOR PEER REVIEW 16 of 32

Clothing Distribution Phase
This phase is the clothing production phase; the main players involved are manufacturer (MF) and the retailer (R). The flowchart is shown in Figure 9, and the related chain code is shown in Algorithm 5.

Manufacturer(MF)
Choose a random number 5 x y k G r x n = =   Step 1. The MF processes and manufactures the raw materials based on the raw material and production information provided by the MS, and sends the manufactured branded clothes to retailers for sale. The MF needs to provide branded clothing products and information on the production of branded clothing to the R. The R sells branded clothes based on the received in real life. MF randomly selects a random number k 5 and generates a message containing a list of C_ID.
The MF calculates its hash value and executes the "Sign" algorithm in Algorithm 2 to generate the signature (r MF2 , s MF2 ): Its generated encrypted messages are encrypted by the R's public key: Then, the MF executes the chain code function "Manufacturer"; the algorithm is shown in Algorithm 5. Send the information (ID MF , ID R , C MF2 , (r MF2 , s MF2 )) related to the production of brander clothes to the R. Step 2. The R receives the above message and first decrypts the message with its private key: The R will then check the validity of the timestamp: Then, the R verifies the message by calculating the hash value with "Verify" in Algorithm 2: If the signature is valid, the R updates the local ledger based on the transaction information in the encrypted message List < C_ID >. The R executes the chain code function "Retailer" with the algorithm shown in Algorithm 5. After the retailer receives the branded clothes products from the manufacturer, the R sends a response message to the MF. The R randomly selects a random number k 6 for generating the response message: The R calculates its hash value and executes the "Sign" algorithm in Algorithm 2 to generate the signature (r R1 , s R1 ): Its generated encrypted messages is encrypted by the MF's public key: Send the response message (ID R , ID MF , C R1 , (r R1 , s R1 )) to the MF.
Step 3. The MF receives the response message and first decrypts the message with the private key: Then to confirm the validity of the timestamp: The MF verifies the message by calculating the hash value of "Verify" in Algorithm 2: If the signature is valid, the MF updates the response message from the R to its book, and the MF performs the chain code function "Manufacturer" to the chain and updates the book information; the algorithm is shown in Algorithm 5.
After the above three steps, the clothing distribution phase is complete. The information of the designer apparel received by the retailer in the ledger should be updated.

User Authentication Phase
After a consumer receives the branded clothing item, to verify the legitimacy of his/her branded clothes, the consumer can connect to the blockchain hub via an application to query the information about the apparel, to confirm the correctness of the apparel. The process is shown in Figure 10.
Step 1. Customers use the application to search for consumption information, such as the number of the designer apparel (C_ID), the designer apparel company logo, the manufacturer logo, and the purchase time stamp.
Step 2. The client can call the GetHistoryForKey () method of the ChaincodeStubInterface interface to query its history. Its chain code algorithm is shown in Algorithm 6 to query the ledger. Step 3. If the C_ID provided by the client is legitimate and valid, then the blockchain center will return the ledger information associated with it. If the C_ID provided cannot be queried in the blockchain center's ledger, we could confirm it is an illegally counterfeited brand-name clothing item.
Step 4. The APP program displays the results of the chain code, in which consumers can get the legitimacy and production information of the branded clothing products to confirm whether they are buying the legal and correct goods. Step 1. Customers use the application to search for consumption information, such as the number of the designer apparel (C_ID), the designer apparel company logo, the manufacturer logo, and the purchase time stamp.
Step 2. The client can call the GetHistoryForKey () method of the ChaincodeStubInterface interface to query its history. Its chain code algorithm is shown in Algorithm 6 to query the ledger. Step 3. If the C_ID provided by the client is legitimate and valid, then the blockchain center will return the ledger information associated with it. If the C_ID provided cannot be queried in the blockchain center's ledger, we could confirm it is an illegally counterfeited brand-name clothing item.

Arbitration Phase
In fact, when any of the actors involved in the supply chain have doubts about the authenticity of the designer apparel, they can arbitrate the system's legitimacy through a third party arbiter. Among the arbiters are the four supply chain sectors of the federated chain and the consumer. The third party validates the arbitration requests of its actors; the third party validation phase is shown in Figure 11.
Step 1. All participants provide information, such as the number (C_ID) and signature message of the designer apparel to the third party to query and verify the legitimacy of the designer apparel.
Step 2. The third party sends a request with the participant's signature information and C_ID to the blockchain center via its C_ID.
Step 3. The blockchain center verifies the legitimacy of its signature and returns a list of its corresponding messages if it is legitimate.
Step 4. The third party checks the signature and the steps are:

•
The third party will first collect signatures and data.

•
Check the signature of the retailer (R), and if the R's signature is illegal, determine that the R falsified the record.

•
If the signature of the retailer (R) is legal, the signature of the manufacturer (MF) is examined, and if the MF's signature is illegal, the MF is judged to have falsified the record.  Step 1. All participants provide information, such as the number (C_ID) and signature message of the designer apparel to the third party to query and verify the legitimacy of the designer apparel.
Step 2. The third party sends a request with the participant's signature information and C_ID to the blockchain center via its C_ID.

Mutual Authentication
In the mutual authentication phase, we use BAN logic for mutual authentication between two participants, where we first list the relevant symbols of BAN logic, as follows: P|≡ X P believes X (belief rule) P X P sees X (seeing rule) P| ∼ X P once said X (message meaning rule) P|⇒ X P has jurisdiction over X (jurisdiction rule) #(X) The message X is new (freshness rule) The message X is encrypted by a key K P x ↔ Q P and Q use a shared key x to communicate We take user A and user B as an example in this phase. We mainly use BAN logic to make the authentication between company A and company B. The objectives of the authentication analysis are shown below.
According to the BAN logic authentication algorithm, the following ideal form is generated: We present the following assumptions to analyze the proposed program: User B authenticates User A By M1 and the seeing rule, we can derive: By A2 and the freshness rule, we can derive: User B authenticates User A By M2 and the seeing rule, we can derive: By A3 and the freshness rule, we can derive: By (Statement 9) and the message meaning rule, we can derive: By (Statement 10), (Statement 11) and the nonce verification rule, we can derive:

Data Integrity
In this study, we used the Elliptic Curve Encryption Algorithm (ECDSA) to sign the message transmission between participants, to ensure the integrity and 'tamper proofness' of the message transmission process. We use the clothing design phase as an example; when the designer apparel company wants to send a message to the raw material provider for information interaction, the designer apparel company generates the ECDSA signed value (r BC1 , s BC1 ). The branded clothing company sends its public key Q BC , digital signature (r BC1 , s BC1 ), and a message C BC1 encrypted with the manufacturer's public key to the manufacturer. An external attacker cannot obtain the manufacturer's private key because it is not available. Thus, it is impossible to attack the data after it has undergone ECDSA signing. The manufacturer receives the message C BC1 and decrypts it with its private key. Calculation: Determine if the data are complete by comparing whether x BC1 and r BC1 modn are equal.
From the above description, we can see that this study uses the ECDSA signature technique to ensure the integrity of the data during transmission effectively.

Non-Repudiation
Since each stage requires signature verification by ECDSA, we can achieve the problem of data non-repudiation by verifying ECDSA. Since each data transmission requires the signature of its private key, the receiver also needs the public key for verification. The receiver will not reject the content of the message sent by the sender after verifying the correctness and legitimacy of the message. Table 2 shows the non-repudiation in each stage. The man-in-the-middle attack means that, after the sender of a transaction comes through the blockchain to send a transaction, the receiver has not confirmed it as yet. By modifying the data in the transaction, the attacker can change the data in the transaction into a new transaction. This can make the transaction received by the receiver different from the one sent by the sender. In severe cases, the transaction will be considered illegitimate and will not be validated. We prevent man-in-the-middle attacks by adding encryption and decryption mechanisms to the communication protocol. These encryptions and decryptions are shown in the following equations. Equations (5), (6), (13), (14), (21), (22), (29), (30), (37), (38), (45) and (46). For example, in the clothing design phase, when the designer apparel company wants to send a message to the raw material provider for information interaction, the BC encrypts it using the public key of the MS, and the MS decrypts it after receiving the encrypted message with the private key of the MS. The related equation is: Scenario: the attacker eavesdrops or tampers with the message sent by the sender and then changes the content of the message before sending it to the receiver.
Analysis: the sender encrypts the message with the public key of the receiver, and the receiver can only decrypt the message if it has its associated private key. The attacker cannot decrypt the message because it does not have the receiver's private key and, thus, cannot tamper with the message to perform a man-in-the-middle attack.

Replay Attack
To prevent replay attacks, we add information, such as timestamps, when verifying messages. The timestamp needs to be verified in each data transmission phase, and the verification process is shown in the following equations. Equations (7), (15), (23), (31), (39) and (47). For example, in the clothing design phase, when the designer apparel company wants to send a message to the raw material provider for information interaction, the designer apparel company will add a timestamp to the message when sending the message, where the timestamp is unique. BC adds the timestamp to the message M. Then, the message is encrypted and MS de-crypts it after receiving the encrypted message. The validity of the timestamp is then checked. The relevant equation is: Scenario: after the attacker eavesdrops on the message sent by the sender, the attacker sends the same message to the receiver to perform a replay attack.
Analysis: the receiver decrypts the received encrypted message to get the unique timestamp in the message and then subtracts the timestamp from the current time, and if the timestamp is invalid, it is determined to be a replay attack.

Privacy Protection
For data privacy protection at the ledger level, Hyperledger Fabric invokes the concept of a channel. The role of a channel isolates the scope of data flow in the blockchain network, and members of organizations not within the channel have no access to data within the channel. Within the same Hyperledger Fabric federation network, participants can create multiple different channels according to their business needs, thus ensuring that data flows only within a specific organization. The introduction of channels greatly protects the privacy of data. The participants authenticate and register by sending them ID X to the CA node. If the CA verifies the legitimacy of the participant, it will return its corresponding public-private key (d X , Q X ).
Scenario: Non-supply chain participants want to access information in the supply chain for illegal access to information.
Analysis: Non-supply chain participants cannot join the channel by authenticating with CA nodes, as they cannot join the channel. Therefore, the data in the channel cannot be accessed. Thus, the privacy of information is protected.

Traceability and Tamper-Proof
After the information of famous brand clothing is uploaded to the blockchain, the information about famous brand clothing in the ledger will be kept in the blockchain forever and cannot be tampered with. All the production process and transaction information related to brand clothing will be tracked throughout the process. For example, in the clothing design phase, when the brand company wants to send a message to the raw material provider for information interaction, we can compare and verify if the blockchain data between BC and MS is legitimate if we want to verify and track it. The equation is: Scenario: the customer found a manufacturing flaw in the brand clothing, but could not identify where the error had occurred.
Analysis: use the traceability and immutability in blockchain to verify and compare information in blockchain to ensure that it is traceable.

Communication Analysis
In Table 3, we analyze the communication efficiency of the system. Communication efficiency analysis includes the registration phase, clothing design phase, clothing production phase, and clothing distribution phase. Due to the different communication environments, we will discuss 3G, 4G, and 5G separately. The maximum transmission speed of 3G is 6 Mbps, 4G is 100 Mbps, and the maximum transmission speed of 5G is 20 Gbps. By analyzing the communication protocol, we assume that the identity information (ID) requires 144 bits, the cryptographic message requires at least 512 bits, and the signed message requires 1024 bits. Let us take the clothing distribution phase as an example. The MF sends two IDs, a signed message and an encrypted message. The encrypted message includes two IDs and timestamps and two others. The total size is 2 × 144 bits + 1 × 1024 bits + 2 × 144 bits + 1 × 80 bits + 2 × 320 bits = 2320 bits. The response message sent by the MS consists of two IDs, a signature message, and an encrypted message. The encrypted message includes two IDs, a timestamp, and four others. Total size is 2 × 144 bits + 1 × 1024 bits + 2 × 144 bits + 1 × 80 bits + 4 × 320 bits = 2980 bits. The clothing distribution phase total is 2320 bits + 2980 bits = 5300 bits. We can conclude that the transmission of all messages in 3G requires 883 µs; in 4G, it costs 53 µs; while in 5G, it only costs 0.265 µs.

Computation Cost
In this study, we analyze the calculated costs. In each phase, each participant needs to perform asymmetric encryption and decryption using ECDSA. This includes a series of calculations, such as calculating hash functions, addition, subtraction, multiplication, and division as the basis for calculating cost calculations. We compare the computational costs of each phase in Table 4 for the effective perception of computational costs. Table 4. Calculated cost comparison.

Blockchain Architecture Comparison
There are many blockchain architectures on the market (it is an evolving technology). From the earliest bitcoin, Ethereum, to the present Hyperledger Fabric. Each blockchain architecture has its own characteristics. Table 5 presents a comparison of the main architectures in blockchain. Through the comparison table above, we can easily see that Hyperledger Fabric is more suitable for the application of the federation chain. Hyperledger Fabric has high TPS and supports smart contract deployment. Hyperledger Fabric is the most appropriate blockchain architecture for our proposed framework.

Comparison
In Table 6, we compare our previous solution with the one proposed in this paper. The focus of our proposed solution is to create traceable anti-counterfeit management of branded clothing. The non-repudiation, privacy, and integrity of the information are guaranteed in all aspects. For security during the process of information transmission, we also make a guarantee of information security by referring to cryptography. We further improved the anti-counterfeit traceability technology by learning from previous solutions. Table 6. Comparison of the tobacco products logistics system.

Authors
Year We made some comparisons with previous studies, absorbed the advantages, and made improvements. We put forward a complete system framework and continued the characteristics of blockchain technology. Compared with previous studies, we added security analysis to the framework to discuss whether data are secure or not. It is not hard to see how well we have implemented data privacy and traceability, and used digital signature technology to secure communications in the supply chain. Combined with internet of things radio frequency technology, customers can easily query the production information of brand clothing for anti-counterfeiting traceability.