# Research on a Traceability Scheme for a Grain Supply Chain

Authors: MiaoLei Deng; Pan Feng
Journal: Journal of Sensors
 (2021)

---

## Abstract

The frequent occurrence of food safety accidents and the globalization of food import and export circulation make it very important to establish a food traceability system. Due to the bulk and low-value characteristics of grain, it is difficult to achieve traceability in a single unit like meat products; as grain has a longer supply chain, involving much more links and even more complicated factors, it is easy to cause information disconnection. In response to the above problems, this paper has done the following tasks: First, propose a RFID-based grain supply chain traceability model, which mainly describes the information flow and grain flow in the grain traceability system, and secondly, in combination with the GTIN coding standard in the GS1 system, a stage traceability code is set for each batch of grains at each link, providing a method for uniquely identifying the batch of grains at that link, to improve the accuracy of grain traceability. In addition, in order to enable consumers to inquire all the detailed information of the grain in the supply chain through a traceability code, the PRESENT algorithm and the format-preserving algorithm are used to encrypt the traceability codes of each link and generate a final traceability code. Finally, a security and performance analysis of the proposed traceability scheme was carried out. The results show that the proposed scheme is safe and effective, ensuring the safety and traceability of the traceability system of the grain supply chain.


---

## Body

## 1. Introduction

The current situation of global food production makes consumers pay more and more attention to the safety of food and the traceability of the food supply chain. Although countries and regions around the world have adopted many strict measures on food control, food safety incidents on the global level are still frequent [1–3]. The most illustrative point is that the New York Times has articles on the topic of “food safety” every month [4]. Achieving traceability in the food supply chain can ensure the safety and quality of food and increase consumer confidence. In the related research so far, food traceability and identification methods are mainly divided into three categories: physical methods, biological methods, and chemical methods. Among them, physical methods mainly refer to near-infrared spectroscopy technology and RFID technology [5, 6]. The chemical method is to select and analyze the characteristic factors that can characterize geographic information and then use chemometric methods to analyze the food to identify the origin of the food [7–10]. Mainly used for agricultural products such as rice and vegetables, biological methods are mainly suitable for the traceability of livestock meat products, through DNA sequence detection or iris feature technology [11–14] to achieve traceability. Among them, the system based on RFID technology to achieve traceability is the most extensive. For meat products, an electronic ear tag is usually assigned to a single animal. The RFID tag records relevant information of the animal, including information about vaccinations, birthplace, growth, and other relevant environmental information. For fresh foods such as vegetables and fruits, it is generally only necessary to record the origin information in the tag [15, 16]. However, grain has the characteristics of bulk and low value, and during the process from planting to sale, it needs to go through many links such as storage, transportation, and processing, and the containers that hold the grain in each link are frequently changed. Based on the above reasons, the problem of information disconnection in the supply chain of grain is prone to occur, which ultimately leads to low traceability accuracy and difficulty in traceability. Most of the existing grain traceability systems only pay attention to the information of the planting process, mainly because it is difficult to accurately locate the batch information of the grain to be traced. Therefore, to realize the effective traceability of grain, the traceability code must be used to correspond the information flow of grain in the production and circulation process with the grain flow. The traceability code is used as the information carrier to realize batch positioning and improve the accuracy of grain traceability, which is beneficial to the construction of grain traceability system. In the existing related research, Yang et al., [17, 18] through the analysis of fruit and vegetable logistics and the study of coding standards, proposed a coding method combining product coding and process coding and a geographic coordinate-based agricultural product traceability coding scheme. Zheng et al. [19] design the traceability code based on the UCC/EAN-128 encoding rules for cereal and oil products. Qu et al. [20] use a combination of location code, plot code, production date, production batch, and check code to design the traceability code. Li et al. [21] used an improved AES algorithm that outputs encrypted decimal numbers of equal length to implement an aquatic product traceability code encryption algorithm; Zheng et al. [22] designed a traceability code for agricultural products based on the GS1 coding system but did not design the final traceability code.Comprehensive analysis of existing traceability code coding schemes, there are problems such as long length, poor versatility, weak encryption, or even no encryption. This paper takes grain as the research object, proposes a grain traceability model based on RFID technology, and designs stage traceability codes for each link of the supply chain based on the GTIN coding standard in the GS1 system to achieve precise positioning to each link. In addition, the improved PRESENT algorithm and format-preserving algorithm are used to generate a final traceability code. The safety and performance analysis of the traceability code scheme for the grain supply chain at the end of this paper shows that the proposed scheme is both safe and effective.


## 2. Grain Supply Chain Traceability Model

The grain supply chain involves five links: planting, storage, transportation, processing, and sales. At the planting stage, an RFID tag is allocated to each batch of grain, and the traceability code at each link stage is written into the RFID tag, which is circulated in the supply chain along with the grain. To prevent tampering in any link, all the participants in the supply chain link jointly maintain a central database. Participants in the link can share all the information. All the links must upload their stage traceability codes to the central database. The model is shown below:Figure1 shows the flow of grain and information of the supply chain. During the planting stage, grain is coded in units of fields. During the storage and transportation stages, the grains are coded in units of warehouses and transport vehicles; the processing link is divided into two stages. Processing stage I is similar to the previous link and is coded in the workshop. In processing stage II, the final traceability code and related information are printed on the outer packaging of the product in the form of a QR code. In the sales stage, consumers can use the final traceability code to query the product information by scanning the QR code on the outer packaging of the product.Figure 1
The grain supply chain traceability model.


## 3. Stage Traceability Code

Many links exist in the grain supply chain. A stage traceability code must be able to uniquely locate a certain batch of grain at a certain link, such that the relevant status information of the grain at the corresponding link corresponds to the stage traceability code on a one-to-one bases. These codes are stored in a central database.


### 3.1. Stage Traceability Code Coding Scheme

GS1 (Globe standard 1) is an organization established by the United States Uniform Code Committee in 1973. The organization has a system of global identification standards. To achieve code universality, GS1 issues a 14-digit pure global trade item code (GTIN-14) that used to encode various supply chain stages. To facilitate identification and expansion, the structure of the traceability code at each stage of the design is similar, including key information such as the base and the person in charge and is a 38-dight decimal number. The specific coding structure is shown in Figures2–5.Figure 2
Planting coding structure.Figure 3
Storage coding structure.Figure 4
Transport coding structure.Figure 5
Processing stage I coding structure.Stage traceability code of planting link = AI (01) + packaging identifier + planting base identifier + food type identifier + check digit + AI (10) + field number + planting date + harvesting date + AI (99) + responsible person code. During the planting process, the grain is numbered in batches in field units. For example, field 001 is planted on January 2, 2019, and harvested on October 15. For example, the grain code supervised by person in charge 002 is (01) 1 6902591 10102 8 (10) 001 190102191015 (99) 002.The stage traceability code for storage links = AI (01) + packaging identifier + granary base identifier + food type identifier + check digit + AI (10) + warehouse number + inbound date + outbound date + AI (99) + responsible person code. Similar to the planting link, the storage links are numbered in warehouse units. For example, the stage code for a batch of grain entering the warehouse on October 20, 2019, is as follows: (01) 1 6972325 10102 5 (10) 028 191020200115 (99) 105.The stage traceability code for transport links = AI (01) + packaging identifier + transport base identifier + food type identifier + check digit + AI (10) + vehicle number + transport start and end dates + AI (99) + responsible person code. The transport link is numbered in transport vehicles units. For example, the stage code of the grain transported by the No. 205 vehicle from January 16, 2020, to January 20, 2020, is (01) 1 6922807 10102 9 (10) 205 200116200120 (99) 322.The stage traceability code for processing link I = AI (01) + packaging identifier + processing base identifier + food type identifier + check digit + AI (10) + warehouse number + date of entry + date of shipment + AI (99) + responsible person code. Processing link I is numbered in the workshop units. For example, a batch of grain stage codes processed by workshop No. 114 supervised by the person in charge No. 922 is (01) 1 6972163 10102 7 (10) 114 200120200425 (99) 922.


### 3.2. Explanation of Code Coding Scheme

#### 3.2.1. Application Identifier (AI)

Additional information refers to the manufacturing attribute information associated with some products, such as production date and batch number. Each item of additional information has a corresponding application identifier that identifies the meaning of the data and the format of the additional information. In addition, neither the additional information nor its application identifier can be used alone. It can only be used as subsidiary information of the main information, GTIN-14 and must be used in series with GTIN-14. One code can reference multiple additional information items. The application identifier consists of 2-4 digits. Whose meanings in the coding structure of each stage as shown in Figures2–5 are shown in Table 1:Table 1
Values and meanings of AI.
AIMeaning01Global trade item number10Batch number99Company internal informationThe GTIN corresponding to the application identifier “01” includes GTIN-8, GTIN-12, GTIN-13, and GTIN-14. The batch number data corresponding to the application identifier “10” can be alphanumeric characters and can have variable lengths (up to 20 digits). Taking the planting stage as an example, the field number, planting date, and harvesting date are recorded as the batch number consist of 15 digits: 001 190102191015. The data corresponding to the application identifier “91-99” can be encoded using any internal company information technique and have variable length with a maximum of 90 digits. All the links in this paper use the number 99 as the code identifier of the person in charge.The packaging identifier can distinguish between different packaging levels, different packaging types, and different packaging quantities. The number of packaging instructions ranges from 1 to 8, and in the coding scheme in this articleN1=1, which is the smallest unit.


#### 3.2.2. Base Identifier

The manufacturer identification code is used as the base code. If the base code does not include a manufacturer identification code, a unique base identification code is assigned to the base code by the traceability system.


#### 3.2.3. Grain Type Identification Code

This paper divides grain types into the following five categories; the identification codes for each type are shown in Table2:Table 2
Grain type identification code.
Grain typeRiceWheatTuber cropsCoarse cerealsDry legume grainsCode1010210103101041010510106


#### 3.2.4. Check Digit

The check digit is used to check the correctness of the coding. The calculation of the check digit follows the standard check code calculation method specified by GS1.


#### 3.2.5. Batch Number

As mentioned above, the field number, planting date, and harvesting date are recorded as batch numbers in the coding structure proposed in this paper. Taking the planting stage as an example, the field number is 001, the planting date is 190102, and the harvesting date is 191015; thus, the number is 001 190102191015.


#### 3.2.6. Responsible Person Code

The responsible person is the person in charge of this batch of grain at this stage, responsible for maintaining supervision. When a safety problem occurs, the blame falls on the responsible person.


## 3.1. Stage Traceability Code Coding Scheme

GS1 (Globe standard 1) is an organization established by the United States Uniform Code Committee in 1973. The organization has a system of global identification standards. To achieve code universality, GS1 issues a 14-digit pure global trade item code (GTIN-14) that used to encode various supply chain stages. To facilitate identification and expansion, the structure of the traceability code at each stage of the design is similar, including key information such as the base and the person in charge and is a 38-dight decimal number. The specific coding structure is shown in Figures2–5.Figure 2
Planting coding structure.Figure 3
Storage coding structure.Figure 4
Transport coding structure.Figure 5
Processing stage I coding structure.Stage traceability code of planting link = AI (01) + packaging identifier + planting base identifier + food type identifier + check digit + AI (10) + field number + planting date + harvesting date + AI (99) + responsible person code. During the planting process, the grain is numbered in batches in field units. For example, field 001 is planted on January 2, 2019, and harvested on October 15. For example, the grain code supervised by person in charge 002 is (01) 1 6902591 10102 8 (10) 001 190102191015 (99) 002.The stage traceability code for storage links = AI (01) + packaging identifier + granary base identifier + food type identifier + check digit + AI (10) + warehouse number + inbound date + outbound date + AI (99) + responsible person code. Similar to the planting link, the storage links are numbered in warehouse units. For example, the stage code for a batch of grain entering the warehouse on October 20, 2019, is as follows: (01) 1 6972325 10102 5 (10) 028 191020200115 (99) 105.The stage traceability code for transport links = AI (01) + packaging identifier + transport base identifier + food type identifier + check digit + AI (10) + vehicle number + transport start and end dates + AI (99) + responsible person code. The transport link is numbered in transport vehicles units. For example, the stage code of the grain transported by the No. 205 vehicle from January 16, 2020, to January 20, 2020, is (01) 1 6922807 10102 9 (10) 205 200116200120 (99) 322.The stage traceability code for processing link I = AI (01) + packaging identifier + processing base identifier + food type identifier + check digit + AI (10) + warehouse number + date of entry + date of shipment + AI (99) + responsible person code. Processing link I is numbered in the workshop units. For example, a batch of grain stage codes processed by workshop No. 114 supervised by the person in charge No. 922 is (01) 1 6972163 10102 7 (10) 114 200120200425 (99) 922.


## 3.2. Explanation of Code Coding Scheme

### 3.2.1. Application Identifier (AI)

Additional information refers to the manufacturing attribute information associated with some products, such as production date and batch number. Each item of additional information has a corresponding application identifier that identifies the meaning of the data and the format of the additional information. In addition, neither the additional information nor its application identifier can be used alone. It can only be used as subsidiary information of the main information, GTIN-14 and must be used in series with GTIN-14. One code can reference multiple additional information items. The application identifier consists of 2-4 digits. Whose meanings in the coding structure of each stage as shown in Figures2–5 are shown in Table 1:Table 1
Values and meanings of AI.
AIMeaning01Global trade item number10Batch number99Company internal informationThe GTIN corresponding to the application identifier “01” includes GTIN-8, GTIN-12, GTIN-13, and GTIN-14. The batch number data corresponding to the application identifier “10” can be alphanumeric characters and can have variable lengths (up to 20 digits). Taking the planting stage as an example, the field number, planting date, and harvesting date are recorded as the batch number consist of 15 digits: 001 190102191015. The data corresponding to the application identifier “91-99” can be encoded using any internal company information technique and have variable length with a maximum of 90 digits. All the links in this paper use the number 99 as the code identifier of the person in charge.The packaging identifier can distinguish between different packaging levels, different packaging types, and different packaging quantities. The number of packaging instructions ranges from 1 to 8, and in the coding scheme in this articleN1=1, which is the smallest unit.


### 3.2.2. Base Identifier

The manufacturer identification code is used as the base code. If the base code does not include a manufacturer identification code, a unique base identification code is assigned to the base code by the traceability system.


### 3.2.3. Grain Type Identification Code

This paper divides grain types into the following five categories; the identification codes for each type are shown in Table2:Table 2
Grain type identification code.
Grain typeRiceWheatTuber cropsCoarse cerealsDry legume grainsCode1010210103101041010510106


### 3.2.4. Check Digit

The check digit is used to check the correctness of the coding. The calculation of the check digit follows the standard check code calculation method specified by GS1.


### 3.2.5. Batch Number

As mentioned above, the field number, planting date, and harvesting date are recorded as batch numbers in the coding structure proposed in this paper. Taking the planting stage as an example, the field number is 001, the planting date is 190102, and the harvesting date is 191015; thus, the number is 001 190102191015.


### 3.2.6. Responsible Person Code

The responsible person is the person in charge of this batch of grain at this stage, responsible for maintaining supervision. When a safety problem occurs, the blame falls on the responsible person.


## 3.2.1. Application Identifier (AI)

Additional information refers to the manufacturing attribute information associated with some products, such as production date and batch number. Each item of additional information has a corresponding application identifier that identifies the meaning of the data and the format of the additional information. In addition, neither the additional information nor its application identifier can be used alone. It can only be used as subsidiary information of the main information, GTIN-14 and must be used in series with GTIN-14. One code can reference multiple additional information items. The application identifier consists of 2-4 digits. Whose meanings in the coding structure of each stage as shown in Figures2–5 are shown in Table 1:Table 1
Values and meanings of AI.
AIMeaning01Global trade item number10Batch number99Company internal informationThe GTIN corresponding to the application identifier “01” includes GTIN-8, GTIN-12, GTIN-13, and GTIN-14. The batch number data corresponding to the application identifier “10” can be alphanumeric characters and can have variable lengths (up to 20 digits). Taking the planting stage as an example, the field number, planting date, and harvesting date are recorded as the batch number consist of 15 digits: 001 190102191015. The data corresponding to the application identifier “91-99” can be encoded using any internal company information technique and have variable length with a maximum of 90 digits. All the links in this paper use the number 99 as the code identifier of the person in charge.The packaging identifier can distinguish between different packaging levels, different packaging types, and different packaging quantities. The number of packaging instructions ranges from 1 to 8, and in the coding scheme in this articleN1=1, which is the smallest unit.


## 3.2.2. Base Identifier

The manufacturer identification code is used as the base code. If the base code does not include a manufacturer identification code, a unique base identification code is assigned to the base code by the traceability system.


## 3.2.3. Grain Type Identification Code

This paper divides grain types into the following five categories; the identification codes for each type are shown in Table2:Table 2
Grain type identification code.
Grain typeRiceWheatTuber cropsCoarse cerealsDry legume grainsCode1010210103101041010510106


## 3.2.4. Check Digit

The check digit is used to check the correctness of the coding. The calculation of the check digit follows the standard check code calculation method specified by GS1.


## 3.2.5. Batch Number

As mentioned above, the field number, planting date, and harvesting date are recorded as batch numbers in the coding structure proposed in this paper. Taking the planting stage as an example, the field number is 001, the planting date is 190102, and the harvesting date is 191015; thus, the number is 001 190102191015.


## 3.2.6. Responsible Person Code

The responsible person is the person in charge of this batch of grain at this stage, responsible for maintaining supervision. When a safety problem occurs, the blame falls on the responsible person.


## 4. Final Traceability Code

The final traceability code is used by consumers to perform queries to retrieve traceability information. The final traceability code is obtained by extracting, integrating, and encrypting the traceability code from each link stage. The final traceability code is calculated from the stage traceability codes, so a change to a traceability code at any stage will cause the final traceability code to change.


### 4.1. The PRESENT Encryption Algorithm

PRESENT is an ultralightweight symmetric block cipher algorithm based on the SPN structure design. Bogdanov et al. [23] were the first to propose the PRESENT algorithm which has excellent performance in hardware implementations and a concise round function design. PRESENT consists of 31 rounds, and its encryption process consists of three parts: an XOR operation, a linear bitwise permutation, and a nonlinear substitution layer. The nonlinear layer uses a single 4-bit S-box S, which is applied 16 times in parallel in each round. The block length is 64 bits, and two key lengths (80 and 128 bits) are supported. The key length of the PRESENT algorithm used in this paper is 80 bits. The algorithm description is shown in Figure 6:Figure 6
PRESENT algorithm description diagram.The S-box is the only nonlinear transformation component in the PRESENT algorithm. Therefore, maintaining the security of the S-box is crucial to the PRESENT algorithm. The security of the S-box is crucial to the algorithm. However, Chen et al. [24] and Liu et al. [25] pointed out through analysis that the S-box of the PRESENT algorithm was unable to effectively resist differential analysis; Wang et al. [26] used a combination of inverse mapping on the finite field and affine transformation to construct a new S-box, analyzed it, and revealed that the new S-box was improved with regard to many safety performance indicators. The improved S-box used in this paper is shown in Table 3:Table 3
Improved S-box.
Input0123456789ABCDEFOutput7FC681D9A4B32E05


### 4.2. Format-Preserving Encryption Algorithm

Similar to the AES algorithm, the PRESENT algorithm performs encryption in the form of binary digits. For ease of presentation, the output format encrypted by the PRESENT algorithm is hexadecimal in this paper. However, the format of the encrypted result is chaotic and is not a decimal number that is easy to identify. In 2019, Liu et al. [27] proposed a format-preserving encryption algorithm. Although this algorithm uses the PRESENT algorithm for encryption, it uses only the encryption result size to generate a 10-digit permutation table. However, adding plain text and key correspondences individually, and then, performing a modulo operation achieves format preservation. Therefore, this paper improves the encryption scheme proposed in [27]; the modulo operation is performed, and the resulting 16-digit decimal number is used as the final traceability code.


### 4.3. Coding Scheme of Final Traceability Code

The process to generate the final traceability code is as follows:(1)
Extract 16 digits from the traceability code at each stageTaking the planting stage as an example, take its 7 digits of planting base code +6 digits of harvest date code +3 digits of person in charge.(2)
Use the PRESENT algorithm for encryptionBecause the key length is 80 bits, the extracted 16-digit traceability code +4 digits of the transaction time is used as the encryption key.(3)
Encryption using the format-preserving encryption algorithmFor ease of description, the relevant notations used for are defined in Table4.Table 4
Notations used in the encryption process.
NotationDescriptionF0Stage traceability code after extraction during planting (16 digits) + time of the transactions (4 digits)F1Stage traceability code after extraction during storage (16 digits)F2Stage traceability code after extraction during transportation (16 digits) + time of the transactions (4 digits)F3Stage traceability code after extraction during processing I (16 digits) + time of the transactions (4 digits)E (p, k)Encryption operation withp as plain text and k as keyT0T0=EF1,F0T1T1=ET0,F2T2T2=ET1,F3KOne-time secret dynamic keyCFinal traceability codeThe final traceability code generation process is shown in Figure7.Figure 7
The final traceability code generation process.As shown in the figure above, the final traceability code generation process must be encrypted by three times PRESENT algorithms and one time format-preserving algorithm. It is worth mentioning that this process involves the transaction time and dynamic key of each link. For the transaction time, the transaction time between each pair of links is written into the tag by the latter link. The random performance of this transaction time effectively prevents counterfeiting, and a dynamic key is generated by the processing link, which further strengthens the security of the algorithm.


## 4.1. The PRESENT Encryption Algorithm

PRESENT is an ultralightweight symmetric block cipher algorithm based on the SPN structure design. Bogdanov et al. [23] were the first to propose the PRESENT algorithm which has excellent performance in hardware implementations and a concise round function design. PRESENT consists of 31 rounds, and its encryption process consists of three parts: an XOR operation, a linear bitwise permutation, and a nonlinear substitution layer. The nonlinear layer uses a single 4-bit S-box S, which is applied 16 times in parallel in each round. The block length is 64 bits, and two key lengths (80 and 128 bits) are supported. The key length of the PRESENT algorithm used in this paper is 80 bits. The algorithm description is shown in Figure 6:Figure 6
PRESENT algorithm description diagram.The S-box is the only nonlinear transformation component in the PRESENT algorithm. Therefore, maintaining the security of the S-box is crucial to the PRESENT algorithm. The security of the S-box is crucial to the algorithm. However, Chen et al. [24] and Liu et al. [25] pointed out through analysis that the S-box of the PRESENT algorithm was unable to effectively resist differential analysis; Wang et al. [26] used a combination of inverse mapping on the finite field and affine transformation to construct a new S-box, analyzed it, and revealed that the new S-box was improved with regard to many safety performance indicators. The improved S-box used in this paper is shown in Table 3:Table 3
Improved S-box.
Input0123456789ABCDEFOutput7FC681D9A4B32E05


## 4.2. Format-Preserving Encryption Algorithm

Similar to the AES algorithm, the PRESENT algorithm performs encryption in the form of binary digits. For ease of presentation, the output format encrypted by the PRESENT algorithm is hexadecimal in this paper. However, the format of the encrypted result is chaotic and is not a decimal number that is easy to identify. In 2019, Liu et al. [27] proposed a format-preserving encryption algorithm. Although this algorithm uses the PRESENT algorithm for encryption, it uses only the encryption result size to generate a 10-digit permutation table. However, adding plain text and key correspondences individually, and then, performing a modulo operation achieves format preservation. Therefore, this paper improves the encryption scheme proposed in [27]; the modulo operation is performed, and the resulting 16-digit decimal number is used as the final traceability code.


## 4.3. Coding Scheme of Final Traceability Code

The process to generate the final traceability code is as follows:(1)
Extract 16 digits from the traceability code at each stageTaking the planting stage as an example, take its 7 digits of planting base code +6 digits of harvest date code +3 digits of person in charge.(2)
Use the PRESENT algorithm for encryptionBecause the key length is 80 bits, the extracted 16-digit traceability code +4 digits of the transaction time is used as the encryption key.(3)
Encryption using the format-preserving encryption algorithmFor ease of description, the relevant notations used for are defined in Table4.Table 4
Notations used in the encryption process.
NotationDescriptionF0Stage traceability code after extraction during planting (16 digits) + time of the transactions (4 digits)F1Stage traceability code after extraction during storage (16 digits)F2Stage traceability code after extraction during transportation (16 digits) + time of the transactions (4 digits)F3Stage traceability code after extraction during processing I (16 digits) + time of the transactions (4 digits)E (p, k)Encryption operation withp as plain text and k as keyT0T0=EF1,F0T1T1=ET0,F2T2T2=ET1,F3KOne-time secret dynamic keyCFinal traceability codeThe final traceability code generation process is shown in Figure7.Figure 7
The final traceability code generation process.As shown in the figure above, the final traceability code generation process must be encrypted by three times PRESENT algorithms and one time format-preserving algorithm. It is worth mentioning that this process involves the transaction time and dynamic key of each link. For the transaction time, the transaction time between each pair of links is written into the tag by the latter link. The random performance of this transaction time effectively prevents counterfeiting, and a dynamic key is generated by the processing link, which further strengthens the security of the algorithm.


## 5. Example

### 5.1. Extracting the Stage Traceability Code

Sixteen digits need to be extracted from the 38-digit stage traceability code, and these 16 digits must be able to uniquely locate a certain batch of grain at a certain stage. Again taking the planting stage as an example, we use 7 digits of the planting base code +3 digits of the responsible person identification code. The 16 digits after each link extraction are shown in Table5:Table 5
16-digit stage traceability code after extraction.
LinkStage traceability code after extractionPlanting stage6902591 191015 002Storage stage6972325 200115 105Transport stage6922807 200120 322Processing stage I6972163 200425 922


### 5.2. Encryption Using the PRESENT Algorithm

Taking the planting and storage stage transactions as an example, if the two-stage transaction time is 12 : 25, thenF0=69025911910150021225, and so on, F2=69228072001203221005 and F3=69721632004259221515.The encryption result after applying the PRESENT algorithm three times is as follows:(1)T0=EF1,F0=E6972325200115105,69025911910150021225=BA73E22132B8049C,T1=ET0,F2=EBA73E22132B8049C,69228072001023221005=FB307794C422D82,T2=ET1,F3=EFB3071794C422D82,69721632001029221515=C4BF100D5963FA9D.


### 5.3. Encryption Using the Format-Preserving Encryption Algorithm

If the dynamic keyK=23B86620C325B1AD, we add the PRESENT encryption result T2, and the dynamic key K in a one-to-one correspondence and apply the modulo operation:
(2)12+2%10=44+3%10=711+11%10=216+8%10=4,1+6%10=70+6%10=60+2%10=213+0%10=3,5+12%10=79+3%10=26+2%10=83+5%10=8,16+11%10=710+1%10=19+10%10=913+13%10=6.Therefore, the final traceability codeC=4724762372887196. The decryption process involves subtracting the one-to-one correspondence between C and K; then, the modulo operation can obtain T2, to which the PRESENT decryption algorithm is then applied three times.


## 5.1. Extracting the Stage Traceability Code

Sixteen digits need to be extracted from the 38-digit stage traceability code, and these 16 digits must be able to uniquely locate a certain batch of grain at a certain stage. Again taking the planting stage as an example, we use 7 digits of the planting base code +3 digits of the responsible person identification code. The 16 digits after each link extraction are shown in Table5:Table 5
16-digit stage traceability code after extraction.
LinkStage traceability code after extractionPlanting stage6902591 191015 002Storage stage6972325 200115 105Transport stage6922807 200120 322Processing stage I6972163 200425 922


## 5.2. Encryption Using the PRESENT Algorithm

Taking the planting and storage stage transactions as an example, if the two-stage transaction time is 12 : 25, thenF0=69025911910150021225, and so on, F2=69228072001203221005 and F3=69721632004259221515.The encryption result after applying the PRESENT algorithm three times is as follows:(1)T0=EF1,F0=E6972325200115105,69025911910150021225=BA73E22132B8049C,T1=ET0,F2=EBA73E22132B8049C,69228072001023221005=FB307794C422D82,T2=ET1,F3=EFB3071794C422D82,69721632001029221515=C4BF100D5963FA9D.


## 5.3. Encryption Using the Format-Preserving Encryption Algorithm

If the dynamic keyK=23B86620C325B1AD, we add the PRESENT encryption result T2, and the dynamic key K in a one-to-one correspondence and apply the modulo operation:
(2)12+2%10=44+3%10=711+11%10=216+8%10=4,1+6%10=70+6%10=60+2%10=213+0%10=3,5+12%10=79+3%10=26+2%10=83+5%10=8,16+11%10=710+1%10=19+10%10=913+13%10=6.Therefore, the final traceability codeC=4724762372887196. The decryption process involves subtracting the one-to-one correspondence between C and K; then, the modulo operation can obtain T2, to which the PRESENT decryption algorithm is then applied three times.


## 6. Security Analysis

As mentioned above, in the grain supply chain model designed in this paper, the stage codes assigned to each batch of grain at each stage are recorded in the database. The stage code is displayed only in each link of the supply chain and is used primarily to indicate the source information of the grain to the participants in the supply chain. The final traceability code is used for consumer inquiries and should be encrypted and protected from batch forgery. Therefore, the security analysis focuses mainly on the illegal addition of stage codes and batch forgery of the final traceability code.


### 6.1. Illegal Addition of Stage Codes by Internal Links

Regarding the stage codes, if a certain internal link wants to incorporate unqualified grains into a certain batch of grain, that batch must be assigned a stage traceability code. However, the number of stage codes that can be generated for each batch of grain is certain. Therefore, it is not feasible for internal links to add a stage code for illegal grain batches to mix them into qualified products.


### 6.2. Forging the Final Traceability Code

In addition, because the final traceability code is consumer-oriented and open, most of the existing traceability codes are long, weak, or even unencrypted. Therefore, even if a one-time traceability code is used, because no encryption exists, it is easy for an illegal manufacturer to crack the coding rules for the traceability codes. Then, the traceability codes can be forged in batches, which can result in large losses. The final traceability code generation formula designed in this paper is as follows:(3)C=E2E1E1E1F1,F0,F2,F3,K.It can be seen from the above formula that the final traceability code is generated through three times PRESENT algorithms and one time format-preserving encryption algorithm. Moreover, the S-box of the PRESENT algorithm used in this paper is improved, with a higher encryption strength. This approach is sufficiently robust to prevent external cracking by external illegal manufacturers.If the internal link of the supply chain attempts to forge the final code in batches, because each link writes the stage code for this link in the RFID tag, the information available for each link when operating with this batch of grain is shown in Table6.Table 6
Information available in each link.
LinkInformation known at each stage (including speculative)Planting stageF0Storage stageF0F1Transport stageF0F1F2Processing stage IF0F1F2F3KAs shown in Table6, the information known in each of the three links of planting, storage, and transportation is not sufficient to generate the legal final traceability code. Only processing stage I possesses all the information needed to generate the final traceability code but that processing stage is at the final manufacturer. In addition, if processing stage I attempts to forge the grain source, an unqualified grain forgery source will be used to generate the final code so that if a food security problem exists, the responsibility will appear to shift to the other links. However, due to the existence of a central database, all the legal final traceability codes must have legal stage codes that are recognizable by the other links. Therefore, processing stage I also cannot forge food sources.In summary, the grain supply chain traceability plan designed in this paper can prevent illegal mixing of unqualified grains in various internal links and can effectively prevent bulk forgeries of final traceability codes by illegal manufacturers.


## 6.1. Illegal Addition of Stage Codes by Internal Links

Regarding the stage codes, if a certain internal link wants to incorporate unqualified grains into a certain batch of grain, that batch must be assigned a stage traceability code. However, the number of stage codes that can be generated for each batch of grain is certain. Therefore, it is not feasible for internal links to add a stage code for illegal grain batches to mix them into qualified products.


## 6.2. Forging the Final Traceability Code

In addition, because the final traceability code is consumer-oriented and open, most of the existing traceability codes are long, weak, or even unencrypted. Therefore, even if a one-time traceability code is used, because no encryption exists, it is easy for an illegal manufacturer to crack the coding rules for the traceability codes. Then, the traceability codes can be forged in batches, which can result in large losses. The final traceability code generation formula designed in this paper is as follows:(3)C=E2E1E1E1F1,F0,F2,F3,K.It can be seen from the above formula that the final traceability code is generated through three times PRESENT algorithms and one time format-preserving encryption algorithm. Moreover, the S-box of the PRESENT algorithm used in this paper is improved, with a higher encryption strength. This approach is sufficiently robust to prevent external cracking by external illegal manufacturers.If the internal link of the supply chain attempts to forge the final code in batches, because each link writes the stage code for this link in the RFID tag, the information available for each link when operating with this batch of grain is shown in Table6.Table 6
Information available in each link.
LinkInformation known at each stage (including speculative)Planting stageF0Storage stageF0F1Transport stageF0F1F2Processing stage IF0F1F2F3KAs shown in Table6, the information known in each of the three links of planting, storage, and transportation is not sufficient to generate the legal final traceability code. Only processing stage I possesses all the information needed to generate the final traceability code but that processing stage is at the final manufacturer. In addition, if processing stage I attempts to forge the grain source, an unqualified grain forgery source will be used to generate the final code so that if a food security problem exists, the responsibility will appear to shift to the other links. However, due to the existence of a central database, all the legal final traceability codes must have legal stage codes that are recognizable by the other links. Therefore, processing stage I also cannot forge food sources.In summary, the grain supply chain traceability plan designed in this paper can prevent illegal mixing of unqualified grains in various internal links and can effectively prevent bulk forgeries of final traceability codes by illegal manufacturers.


## 7. Performance Analysis

The generation process of the final traceability code of this paper mainly uses the PRESENT algorithm, which is a lightweight block encryption algorithm. The pseudo code is described as follows:This paper tested the process of generating the final traceability code, and its running time is shown in the following Table7:Table 7
The running time of the encryption process of the final traceability code.
Number of runsRunning time (ms)AVG (ms)10057857776686.610005760605763615961685760.310000606608677585598712625662613610629.610000061806403630365346458644163026365635163766371.3As shown in the above table, the final traceability code generation process was performed 10 times of encryption 100 times, 1000 times, 10000 times, and 100000 times. It can be calculated that it takes approximately 0.63 milliseconds to generate a final traceability code.Table8 lists the PRESENT algorithm and DES, AES, and HIGHT algorithm performance comparison.Table 8
Comparison of PRESENT algorithm and other algorithms.
CipherKey bitsBlock bitsCycles per blockLogic process (μm)Area (GE)PRESENT-808064320.181570AES-12812812810320.353400DES56641440.182309HIGHT1286410.253048It can be clearly seen from the above table that the PRESENT algorithm is an ultralightweight cryptographic algorithm with low power consumption and is suitable for resource-constrained food supply chain environments.


## 8. Conclusions and Prospects

This paper mainly completes the following three aspects of work: designing a grain traceability model, designing a set of stage traceability code coding schemes, and designing a final traceability code encryption scheme. Each batch of grain and its corresponding RFID tag are circulated through the supply chain to solve the problem of information disconnection. In addition, we analyzed the performance and security of the proposed coding scheme. Among them, the designed stage traceability code holds the key information of each link in 38 decimal digits, meeting the traceability code requirements for versatility, ease of use, simplicity, and scalability. The resulting 16-bit final traceability code is both short and has strong encryption that can effectively prevent the traceability code forgeries by external illegal manufacturers or even internal participants.In recent years, blockchain technology has attracted attention from various fields due to its decentralized and nontamperable features. These features make blockchain technology well able to meet the requirements of food traceability for the authenticity and traceability of information in the supply chain. In 2019, Azzi et al. [28] analyzed the advantages and challenges brought by the introduction of blockchain into the supply chain field and proposed relevant theories for establishing an efficient supply chain based on blockchain technology; Creydt et al. [29] pointed out that the combination of blockchain technology and the Internet of Things can completely change the field of food industry; Feng [30] first proposed the combination of blockchain and RFID technology for traceability of agricultural product supply chains and analyzed the advantages and disadvantages of such a traceability system. Mondal et al. [31] used an identity verification protocol based on object proofs to achieve a complete food supply chain traceability architecture by integrating RFID sensors at the physical layer and integrating blockchain technology at the network layer. Blockchain technology has great development potential in the field of food traceability. Therefore, in future-related research, we can use RFID tags, sensors, and many other Internet of Things devices to scan and track food information, use a reasonable coding scheme for unit identification, and use blockchain technology to record food information of the supply chain, in order to realize the traceability of bulk products such as grain in the supply chain.



---

*Source: 8860487-2021-01-18.xml*