Research on the whole chain traceability system of dairy products based on consortium blockchain

Dairy products are one of the indispensable foods in people's life. However, reports about the quality and safety of dairy products often appear. In this paper, a dairy product quality and safety traceability system based on consortium blockchain is proposed by using block chain technology. In addition, the traceability link in the dairy supply chain is defined, and the basic framework and traceability bar code of the traceability system are designed. The system guarantees the integrity and security of the traceability information from the technical level, and provides the dairy traceability service for the government, enterprises and consumers.


Introduction
Dairy products, as a special category of agricultural products, have a long industrial chain and involve many subjects. It is formed by the cooperation of the farming industry, processing industry, logistics industry, sales industry and other market entities, involving multiple interests. Research in developed countries on the traceability system of dairy products is relatively early than developing country. Domestic government departments have done a lot of work in dairy quality supervision through improving laws and regulations, but the scope of application of traceability system is very limited, and there is no unified standard for the content of traceability code. Moreover, although some enterprises have established their own information management system, their information are processed separately and the information sharing mechanism is far from enough. The problems lead to the asymmetry of traceability information, and it is a huge challenge in completing the traceability of the whole industrial chain. Blockchain is a distributed database, which can avoid illegal deletion, falsification and tampering of data and realize information sharing. Therefore, this paper proposes a dairy traceability system based on consortium blockchain. It can trace the whole chain of dairy products and solve data security problems.

Blockchain technology
Blockchain is an Internet-based distributed ledger technology that is a data chain connected by an infinite number of data blocks. As an emerging technology, blockchain technology uses computer programs to record transactions at each node, and stores information data to each node with timestamps, digital encryption and other technologies, thus, forming a distributed ledger that can be searched permanently and cannot be tampered with.
According to the degree of openness, blockchain can be divided into three categories: public chain, private chain and consortium chain. Consortium chain has the characteristics of partial decentralization, and the transaction speed and throughput are between the public chain and the private chain. It is a blockchain with an identity access mechanism, where a node must be authenticated to join a chain, usually with a certification body issuing a certificate for the node. Compared with the traditional blockchain, the consortium chain has the characteristics of partial decentralization, strong controllability, and fast transaction speed. The traceability of dairy products through the consortium chain can not only realize the traceability of the whole process of the industrial chain, but also ensure the reliability and security of data.

Determination of link module
Dairy industry chain is very long. The upstream mainly focuses on feed farming and dairy farming, with two modes of self-owned pasture and cooperative pasture at present. The downstream mainly focuses on dairy processing and sales. At present, most existing dairy traceability systems in China start from raw milk processing, but in fact, a complete dairy industry chain should start form dairy farming. This paper determined the business process of dairy supply chain through investigation and analysis, as shown in Figure 1. As can be seen from the above figure, the key points of dairy supply chain traceability include five parts: dairy farming, raw milk production, dairy processing, storage and distribution, and sales. The occurrence of dairy safety problems may only come from a certain link of the risk source, but it directly affects the final output of the whole dairy supply chain. In particular, dairy products are a kind of perishable food, so they require low temperatures for storage and transportation. In circulation, the degree of deterioration is not only related to time, but also to the environment in each transportation and storage link, such as temperature, humidity, and disinfection records. According to the sequence of dairy supply chain processes, the key information of each link is sorted out, and the results are shown in Figure 2.

Design of traceability code
Different from other food categories, dairy products are classified into many and complex categories. Taking sterilized milk as an example, the whole chain traceability code of dairy products is defined as follows: Unified social credit code + product code + origin code + batch code + single product code.
The unified social credit code applies the Code Rules for Unified Social Credit Codes of Legal Persons and Other Organizations (GB32100 --2015). The product code applies the Sterilized Milk Standard (GB/T 25190 --2010). If the number of digits is less than 4 digits, the number 0 is applied to fill the blank digit. And the origin code applies the Code for Administrative Division of the People's Republic of China (GB/T2260 --2007). The batch code usually consists of the information production date, shift number, equipment number and production plan. Single product code adopts random serial number. The specific structure of traceability code is shown in Table 1. Taking sterilized milk as an example, the unified social credit code of a dairy enterprise in Shandong Province is "91371482MA3CKGGG91", the product code is "2200", the origin code is"371482", the production date is "April 11, 2021", the employee shift number is "A", the processing equipment number is "B", the production plant code is "JJ", and the random product code is "5189". Sterilized milk product traceability code for "91371482MA3CKGGG91220037148220210411ABJJ5189". In order to facilitate later users to query through Decentralized applications (DAPP), the traceable Quick response (QR)code is generated synchronously. The traceability data will be stored on the chain in JSON format. The user will input the traceability code in the system and call the attributes and specific values of the commodity traceability information through the smart contract. The corresponding relationship between attribute code and attribute value is shown in Table 2.

Architecture design
The traceability system studied in this paper adopts consortium blockchain structure. which mainly includes acquisition layer, data layer, network layer, consensus layer, contract layer and application layer. The specific architecture is shown in Figure 3. Acquisition layer: The data of dairy farmers, production and processing factories, logistics companies, wholesale markets and retailers are collected through the data interface in this layer.
Data layer: Through the distributed storage of the manually entered data information and the data information collected in the embedded environment, the layer will take effect after being stamped with a time stamp and digital signature. Once the block is formed, it cannot be tampered with.
Network layer: The network layer includes the rules for authentication, node access, and the rules for the transmission of blockchain stored information over the network.
Consensus layer: In this layer, each node on the chain verifies the algorithm of information on the chain and ensures the consistency of information in the process of dairy product quality and safety traceability. Consensus mechanism enhances each participant's trust in the data stored in the blockchain.
Contract layer: It is usually composed of algorithms, scripts and smart contracts. After the nodes in the blockchain perform some operations, if they meet the preset conditions or rules, the smart contract will be executed automatically.
Application layer: It mainly has the functions of data acquisition, query and display. Each member can directly query data information through portal, APP and application interface.

Case analysis
This paper selects a dairy enterprise in Yucheng City of Shandong Province as the research object. The enterprise has a complete industrial chain from dairy farming to dairy sales. According to the overall pattern of local dairy production and combined with the technical characteristics of blockchain, this paper established a complete dairy traceability system According to the functional requirements of the whole dairy supply chain, the wholechain dairy traceability system of the company is divided into breeding function module, production function module, processing function module, logistics function module, storage function module, sales function module and supervision function module. Each business entities should be registered when entering the system. The registration information mainly includes business information, contact information, mailing address, relevant qualification documents and so on. The supervision function module shall verify and register the qualification of the enterprises involved, and stipulate the punishment mechanism. The traceability scheme is shown in Figure 4. First, the individual nodes of farming enterprises, processing enterprises, logistics companies，retailers and wholesale market provide specific information through a data interface. The smart contract provides constraint rules, and only the data meeting the rules can be linked. In order to ensure the integrity of the data, the data provider also needs to sign the data. Then, the data is sent to the validation node. The expression reaches a consensus after meeting the predetermined validation requirements, and the data is stored in the ledger in the form of blocks. Finally, relying on the actual implementation environment, the query of block data can be completed by scanning two-dimensional code and other methods.
In this manner, the system can realize "traceability to come, traceable to go" of dairy products. Consumers to obtain information about dairy products and improve their trust. while manufacturers and supervision departments can timely recall and processing dairy products when they find quality problems.

Conclusion
Based on the research of blockchain technology and dairy industry traceability status, combined with practical application, this paper puts forward dairy traceability system based on consortium chain. On the one hand, the system can prevent the data of key nodes from being tampered with and forged, and realize data exchange and sharing. On the other hand, it can track the whole dairy industry chain, with high safety and security. It has strong practicability and broad application prospect.