Agricultural product traceability system and method based on block chain

The two-stage data chain framework and assembly line integration with IoT and alliance chain enhance the efficiency and adaptability of blockchain traceability systems for Tibetan fungus, ensuring secure and consumer-specific traceability.

CN119205141APending Publication Date: 2024-12-27DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411233594.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Existing blockchain-based agricultural product traceability systems face inefficiencies due to 'one step and one chain' data chaining, redundant on-chain data storage, lack of consumer-specific information display, and incompatibility with the production process of high-value-added products like Tibetan fungus, leading to reduced production efficiency and consumer distrust.

Method used

A two-stage data chain framework with IoT database and enterprise system integration, one-to-one traceable data storage, and an assembly line functional layer adapted to the packaging process, combined with an alliance chain platform for secure data sharing and verification mechanisms using light and dark codes.

Benefits of technology

Enhances production efficiency, adapts to the specific production process of Tibetan fungus, ensures data security and transparency, and builds consumer trust through accurate and consumer-specific traceability information display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119205141A_ABST
    Figure CN119205141A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of traceability, in particular to an agricultural product traceability system and method based on a block chain. In order to solve the problems that a traceability agricultural product block chain system often cannot adapt to the production process of Tibetan fungus, and severe inconvenience is brought to production of enterprises due to direct introduction, the system comprises an Internet of Things facility acquisition layer, a traceability information chain lower storage layer, an alliance chain service layer, an assembly line function layer and a man-machine interaction layer. The problems that in an existing block chain traceability system, a large amount of time for agricultural products is consumed in repeated chaining and waiting for system consensus, the production efficiency of enterprises is reduced, and chaining information display of the current block chain traceability system is fixed and difficult to meet consumer requirements are effectively solved. The system is perfectly matched with an actual Tibetan fungus production line, and the requirement of enterprises for production efficiency is met. And on the other hand, the non-tampering property of the data can be ensured, the safety, transparency and sharing of the data are realized, the abuse of the package is prevented, and the consumer trust is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of traceability technology, and more specifically to a blockchain-based agricultural product traceability system and method. Background Art

[0002] High-quality agricultural products, such as Tibetan fungus, have long faced problems such as high added value but low brand recognition. Some merchants use ordinary fungus to impersonate Linzhi Tibetan fungus to obtain illegal high profits, deceiving consumers while damaging local brands and causing huge economic losses to local businesses and people.

[0003] Although the existing technologies have provided some corresponding solutions to the above problems, namely, using the traceability agricultural product blockchain system. However, the on-chain method has not been actually applied to the traceability system for specific products, so there is no blockchain-based fungus traceability system designed for the fungus packaging line. However, most of them adopt the "one step and one chain" data chain method, which leads to a lot of time spent on repeated chaining and waiting for system consensus in the entire life cycle of agricultural product production, reducing the production efficiency of enterprises. Some existing traceability agricultural product blockchain systems also have the problem of storing the production information of the entire batch of products on the chain, resulting in redundant on-chain data, and ignoring the differences between individual products. In addition, the traceability agricultural product blockchain system is relatively simple in displaying on-chain information, and does not take into account the psychological preferences of different consumers in different regions, which will not maximize the advantages of blockchain technology in enhancing consumer trust and bringing added value to products. Finally, the traceability agricultural product blockchain system is often unable to adapt to the production process of Tibetan fungus, and direct introduction will bring serious inconvenience to the production of enterprises. Summary of the invention

[0004] The present invention provides a blockchain-based agricultural product traceability system and method, with the purpose of tracing the information of the entire life cycle of high-value-added agricultural products such as Tibetan fungus, which have a long growth cycle and an artificial cultivation model, based on blockchain technology, while ensuring the practicality and ease of use of the system during the traceability process.

[0005] The above purpose is achieved through the following technical solutions:

[0006] The beneficial effects of the blockchain-based agricultural product traceability system and method of the present invention are:

[0007] 1. Through the system architecture of the "two-stage data chain framework", the cultivation information, picking information, and pre-packaging preparation information of the fungus are stored in the IoT database and the enterprise information system before packaging, and the traceability information is chained once using the traceability information chaining module of the assembly line function layer during packaging. Positioning the chaining stage at the time of packaging effectively solves the problem that a large amount of time is spent on repeated chaining and waiting for system consensus in the existing blockchain traceability system, which reduces the production efficiency of enterprises.

[0008] 2. Through the traceability information storage layer of the "one-to-one traceable data storage method with primary and foreign key association" and the front-end and back-end linkage method for selecting and filtering the traceability information when uploading to the chain, the data storage and query problems under the two-stage data chain-up framework are realized. In addition, it also effectively solves the problem that the current blockchain traceability system has a fixed chain information display that is difficult to meet consumer needs.

[0009] 3. Through the assembly line functional layer that is closely integrated with the actual packaging assembly line, the system is perfectly adapted to the actual Tibetan fungus production line, meeting the company's requirements for production efficiency and increasing the company's willingness to use the system.

[0010] 4. The alliance chain platform of the Tibetan fungus supply chain has realized the sharing of traceability information as the core, and at the same time can implement the supervision function of the Tibetan fungus supply chain traceability alliance to ensure the non-tamperability of the data and realize the security, transparency and sharing of the Tibetan fungus data throughout its life cycle.

[0011] 5. A corresponding mechanism between light and dark codes on the traceability Tibetan wood ear packaging has been implemented. After scanning the traceability QR code, the internal secret code is input to verify whether the packaging corresponds to the actual object, and then to verify whether the traceability information corresponds to the actual object, which prevents packaging abuse and enhances consumer trust. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 This is a schematic diagram of the overall architecture of the alliance chain of the fungus traceability system based on blockchain;

[0013] Figure 2 This is a schematic diagram of the organizational structure of the fungus traceability system based on blockchain;

[0014] Figure 3 This is a schematic diagram of the architecture of the fungus traceability system based on blockchain;

[0015] Figure 4 This is a schematic diagram of the entire life cycle of Tibetan fungus;

[0016] Figure 5 It is a schematic diagram of the human-computer interaction process;

[0017] Figure 6 It is a schematic diagram of packaging line process design and line layout;

[0018] Figure 7 It is a schematic diagram of the clear and secret code verification mechanism. DETAILED DESCRIPTION

[0019] A blockchain-based agricultural product traceability system includes an Internet of Things facility collection layer, a traceability information off-chain storage layer, an alliance chain service layer, a pipeline function layer, and a human-computer interaction layer.

[0020] Among them, the IoT facility collection layer obtains all traceability information in the cultivation stage, that is, before packaging, the cultivation information, picking information, and pre-packaging preparation information of agricultural products are stored in the IoT database and enterprise information system, realizing the digital collection of data information in the agricultural product cultivation and pre-packaging stages based on the IoT;

[0021] Specifically, information collection equipment is used, including temperature sensors, humidity sensors, light sensors, GPS sensors, and cameras. Each greenhouse and culture medium location is numbered, and the Internet of Things technology and information collection equipment are used to monitor and periodically collect the surrounding environmental parameters and growth information of agricultural products in each culture medium location from the beginning of agricultural products cultivation in the greenhouse, using Internet of Things technology, equipment, and information collection equipment, including but not limited to temperature, humidity, light, carbon dioxide concentration, and photos of crop growth. In addition, identity recognition or reading and writing devices such as RFID and smart cards are used to realize the collection of other digital information. Finally, the corresponding data is realized in the enterprise Internet of Things database.

[0022] Among them, the traceability information off-chain storage layer uses API to connect to the Internet of Things database through the TCP protocol, and stores all the traceability information to be displayed in the enterprise information system database.

[0023] Specifically, the enterprise information system database uses MySQL database, and the collected information is filtered and stored in it. In the subsequent collection and packaging process, the "primary and foreign key association" storage mode is adopted to form a table connection structure of greenhouse number, culture medium number, purchase tray number, primary tray number, and secondary tray number.

[0024] It is further explained that the traceability information storage layer of the "one-to-one traceable data storage method with primary and foreign key association" spans two databases, namely the Internet of Things database and the enterprise information system database. The relevant information of the agricultural product cultivation stage is obtained by filtering and sorting the huge data of the Internet of Things during information transmission, and the greenhouse number and culture medium number are used as the primary key, and the purchase pallet number is used as the foreign key for storage. It is then connected to the primary pallet number, and then the primary pallet number is connected to the secondary pallet number, and the secondary pallet number is connected to the product barcode, so as to realize the traceable storage of data throughout the life cycle.

[0025] Among them, the alliance chain service layer uses the open source FISCO BCOS platform to build an alliance chain. The alliance chain architecture includes three members and three groups; the three groups are the fungus industry chain group, which includes upstream fungus cultivation enterprises and downstream fungus processing enterprises; the fungus cultivation supervision group, which includes regulatory agencies and upstream fungus cultivation enterprises; and the fungus packaging and sales supervision group, which includes regulatory agencies and downstream fungus processing enterprises. The smart contract is written in Solidity language to realize the corresponding functions to be realized in the present invention. In addition, this layer also uses the alliance chain management function of the platform, granting members corresponding permissions including node management, user management, smart contract management, group management, and on-chain data management, and requires each member to configure 2 nodes, one consensus node and one observation node.

[0026] Among them, the assembly line function layer, through in-depth investigation of the fungus product packaging stage, the present invention designs an assembly line function that is closely integrated with the fungus packaging assembly line according to the minimum action principle and optimal beat calculation of the assembly line workers. In the back end, the Springboot framework is used, the back end program is written in Java language, and hardware devices such as printers are called to realize product barcode generation and printing, double code binding and secret code generation, one-time chaining of traceability information, and generation of clear code and printing of clear and secret codes. Relying on the agricultural product packaging assembly line, it provides functions adapted to it.

[0027] To further explain, the packaging assembly line actually has three processes. Since the third process is the sealing of the packaging can, which does not interact with the system, there are only two display interfaces corresponding to the system, corresponding to process one and process two respectively. Display interface one is the product barcode input box and the secondary pallet code input box, and the corresponding functions are dual code binding and secret code generation; display interface two is the product barcode input box and the dual code preview area, and the corresponding functions are the one-time chaining of traceability information, the generation of clear codes, and the printing of clear and secret codes; barcode generation and printing are performed by the administrator on the corresponding interface before the assembly line starts.

[0028] Among them, the human-computer interaction layer has four types of members, namely packaging line managers, line workers, consumers and supply chain members, among which supply chain members include regulatory enterprises, upstream agricultural product cultivation enterprises, and downstream agricultural product processing enterprises. Use Html, Css and other front-end languages ​​to build interfaces including database initialization, traceability information selection and filtering, barcode generation and printing, and enterprise information system data query functions, and provide traceability information display and secret code verification functions after consumers scan the QR code to access the corresponding URL. The H5 interface on the mobile phone side. The alliance chain member interaction interface uses the FISCO BCOS platform interface, which can realize node, member, user management, smart contract call, upload, modification, and chain data query functions. This provides interactive interfaces and interfaces for packaging line managers, consumers and supply chain members.

[0029] To further explain, the front-end and back-end linkage method for selecting and filtering the traceability information when uploading to the chain is as follows: all fields of the traceability information are displayed on the front-end interface of the pipeline function layer and a check box is provided. The corresponding Boolean variable is obtained based on whether it is checked and transmitted to the back-end server. The back-end server first calls the alliance chain smart contract through the SDK to obtain all the traceability information, and then transmits the traceability fields set to 1 and the corresponding information to the H5 interface of the consumer's mobile phone based on the obtained Boolean variable list. At the same time, the H5 interface will hide the page display box corresponding to the unsent field.

[0030] The above system is particularly suitable for application in Tibetan fungus traceability, that is, the agricultural product is Tibetan fungus.

[0031] A blockchain-based agricultural product traceability method, implemented using the above system, includes the following steps:

[0032] S1.1. Collection of growth data of agricultural products: Use IoT devices and information collection equipment to collect relevant information in the greenhouse during the growth stage of agricultural products. The specific data needs to reflect the final quality of the agricultural products. Therefore, the data selected are the periodic growth temperature, humidity, light, carbon dioxide concentration, environment, culture medium, regular growth photos of agricultural products, and the content of elements such as nitrogen, phosphorus and potassium in the soil. The collection method is automatic timed collection by IoT devices, and the relevant information is bound to the greenhouse number and culture medium number.

[0033] S1.2, Collection of data related to the picking of agricultural products: This step is carried out during the picking stage of agricultural products. The collected data needs to accurately correspond to the growth information to achieve subsequent information traceability. Therefore, the specific data collected are greenhouse number, culture medium number, location in the culture medium shed, picker number, collection time, etc. The collection method is that when the pickers pick the agricultural products, the timestamp of the picking is automatically obtained and recorded in the IoT database.

[0034] If the agricultural product is Tibetan fungus, during the fungus collection stage, the staff will first check the maturity of the fungus. Generally speaking, when the fungus begins to curl at the edges, the color is darker and the texture is harder, it means that it is mature and can be picked. After that, clean and disinfect your hands and equipment to prevent contamination. Then use a handheld wireless reader to record your work number, greenhouse number and culture medium number. When picking, the staff uses scissors or a knife to gently cut along the root of the fungus and cut the fungus off the culture medium. Avoid pulling hard to prevent damage to the fungus or the culture medium. Then put the picked fungus into a clean basket and make a preliminary classification according to size and quality. Then record and store the data, including information such as picking date, picking quantity, quality, etc., and upload it to the Internet of Things database. Finally, the picked fungus is sold to downstream companies or dried and refrigerated.

[0035] S1.3, Data collection before agricultural product packaging: It is carried out before agricultural product packaging. The collected data needs to reflect the assembly line environment in the packaging stage and record the unique identification information. Therefore, the data selected are the purchase pallet number of agricultural products, the first-level pallet number, the second-level pallet number of agricultural products, the assembly line worker number information, the packaging assembly line workshop environment picture, and the packaging time. The collection method is to enter the number information through the reading and writing device before packaging, automatically obtain the current timestamp, and take pictures of the assembly line workshop camera.

[0036] S2.1, interface acquisition and filtering of IoT database information: connect with the IoT database interface through the TCP protocol to obtain all traceability information of the agricultural product cultivation stage in the IoT database; then analyze and process the traceability information of the cultivation stage: first, obtain the cultivation stage information corresponding to the agricultural products of different culture media according to the greenhouse number and culture medium number, then average the periodic IoT collection information such as temperature, humidity, light and other information according to a fixed time length and select a typical agricultural product growth photo at the end of each time length to complete the information filtering, GPS information takes the mean value of the entire time length, and culture medium element information obtains the number of abnormal values, time and duration according to the specified growth conditions of agricultural products, and finally stores the filtered IoT database information and the corresponding number and purchase tray number in the enterprise information system database;

[0037] S2.2, storage of pre-packaging stage information: This step stores all the collected data of the pre-packaging stage of agricultural products in the enterprise information system database, using the "primary and foreign key association" storage mode to form a table connection structure of "greenhouse number-culture medium number-purchase tray number-first-level tray number-second-level tray number", and stores other collected information as fields other than the primary and foreign keys;

[0038] The agricultural product is an embodiment of Tibetan fungus: In the upstream and downstream transportation stage of fungus, the upstream cultivation enterprise sells a large amount of fungus to the downstream packaging enterprise. During the handover process, the downstream processing enterprise uses the API to connect to the Internet of Things database of the upstream enterprise through the TCP protocol to obtain all the traceability information of the cultivation stage authorized by the upstream enterprise. After that, the downstream enterprise filters the collected traceability information on the back-end server. The specific processing flow includes averaging the temperature, humidity, light, carbon dioxide concentration and other information according to a fixed time and selecting a typical fungus growth photo at the end of each time to complete the information filtering. The GPS location information takes the mean value of the entire time, and the culture medium element information obtains the number of abnormal values, time and duration according to the specified growth conditions of the fungus. Finally, all the traceability information of the cultivation stage is stored in the MySQL database of the enterprise information system according to the storage method of the greenhouse number and culture medium number as the primary key, the acquisition tray number as the foreign key, and other fields as other traceability information. In addition, in addition to the information transmission of the off-chain database led by downstream enterprises, upstream enterprises need to calculate the hash value of the transmitted information, and then upload the greenhouse and culture medium number and the hash calculated by the corresponding IoT data to the alliance chain service layer. The purpose of this step is to ensure the authenticity of the upstream enterprise data, ensure that the traceability information content of the entire life cycle is recorded on the chain, and prevent downstream enterprises from tampering with the acquired data, thereby achieving trust among members.

[0039] S3, a consortium chain service platform based on FISCO BIOS, has three consortium chain members, namely regulatory agencies, upstream agricultural product cultivation enterprises, and downstream agricultural product processing enterprises. The platform's functional services include smart contract services, node authorization and management, and member and user management.

[0040] To further explain, smart contract services include storage-type smart contracts and query-type smart contracts. The workflow of storage-type smart contracts is: first verify the permissions of the current user. After the permissions are verified, the on-chain data blocks required for the on-chain information are obtained and dynamically submitted as a whole on the blockchain. The request for on-chaining is then submitted to the blockchain using the Practical Byzantine (PBFT) consensus protocol for consensus on the on-chain request. Finally, after the consensus is passed, the participants each package the transaction into a block and update the world state ledger. The workflow of query-type smart contracts is: first verify the permissions of the current user. After the permissions are verified, the query is performed in the NoSQL database that acts as the world ledger according to the parameters submitted during the query. Finally, the detailed information obtained by the query is returned.

[0041] Further explained, the node authorization and management service functions include: node management of the alliance chain, including the addition and deletion of nodes, the allocation of functions to different nodes, and the correspondence between members and nodes within the alliance chain.

[0042] To further explain, the member and user management service functions include: issuing certificates to each participant of the alliance chain to ensure the legitimacy of the alliance participants; assigning roles to members to achieve permission management within the platform; generating corresponding users for different members within the alliance, and adding, modifying, querying and deleting users.

[0043] The platform has three channels, the on-chain traceability information channel, the agricultural product cultivation supervision channel and the agricultural product packaging and sales supervision channel; the on-chain traceability information channel includes three members, the agricultural product cultivation supervision channel includes regulatory agencies and upstream agricultural product cultivation enterprises, and the agricultural product packaging and sales supervision channel includes regulatory agencies and downstream agricultural product processing enterprises.

[0044] S4.1. Product barcode generation and printing: Automatically generate batch codes for each packaged fungus product. The quantity can be controlled by the staff and the barcode printer prints it all at once. The string generation rule for the product barcode is "enterprise number + agricultural product number + generation timestamp + serial number", which ensures the uniqueness of the product barcode;

[0045] S4.2, Dual code binding and secret code generation: Automatically generate secret codes. The staff scans the product barcode and the secondary pallet code with a scanner to bind the two in the database. After binding, the system automatically generates a secret code, and the secret code generation rule is a random 10-digit string of alphanumeric characters. When the secret code is generated, the system automatically binds it to the product barcode.

[0046] S4.3. One-time uploading of traceability information to the chain: First, the assembly line worker scans the product barcode, and then the enterprise information system obtains all traceability information based on the product barcode through the "primary and foreign key association" method. Then, the traceability information is filtered according to the on-chain information filtering rules before the system is used. Finally, the filtered traceability information is uploaded to the chain by calling the FISCO BIOS alliance chain API and using the on-chain storage smart contract;

[0047] S4.4. Generation of plain code and printing of plain and dark codes: The URL for querying traceability information is stored in the traceability QR code. After previewing the plain and dark codes on the UI interface, the assembly line workers can print both codes with one click. There is no pop-up window when printing, and the two codes are printed simultaneously by two printers, realizing highly automated assembly line operation;

[0048] In the example of the agricultural product being Tibetan fungus, the processing enterprise grades the fungus several times after purchasing it. In this example implementation, the fungus is graded twice. First, the worker scans the label codes of the purchase tray and the first-level tray, and the label codes of the first-level tray and the second-level tray in the system grading interface to achieve the binding between the trays. Since different tray numbers are fixed to carry the fungus of the specified category, the grading information of the fungus will also be automatically stored in the enterprise information system database during the binding process.

[0049] In the packaging stage, the packaging line is used to package the fungus. The interaction process between the staff and the system is as follows: Figure 5 As shown, the packaging line layout is as follows Figure 6 As shown. The administrator first selects the traceability information to be displayed in the traceability information selection interface and generates and prints the corresponding number of product barcodes according to the production plan for the day in the barcode generation and printing interface. After that, the No. 1 assembly line worker (two people) puts the empty packaging can on the table, pastes the batch code on the outside of the packaging can, scans the secondary pallet code with a scanner in the dual code binding interface, scans the product barcode with a scanner, and puts the specified number of fungus into the packaging can. In this process, the traceability system will automatically generate a secret code and use the product batch code as the primary key, and bind the secret code, secondary pallet code and product batch code in the database; the No. 2 assembly line worker (one person) scans the product barcode with a scanner in the product barcode input and dual code display interface, waits for two printers to print the traceability two-dimensional clear code and secret code, pastes the traceability two-dimensional clear code on the outside of the packaging can, and puts the secret code into the packaging can. In this process, the system obtains all data related to the fungus packaging product through the product barcode using the "primary and foreign key association" query method, and selects and filters the data. Then, the API interface is called to upload the filtered traceability information to the chain, and it is recorded in a single block of the blockchain distributed ledger at one time. In particular, for images, the information uploaded to the chain is the hash value calculated by it, in order to reduce the time consumption and storage burden on the chain. Finally, the obtained traceability URL is displayed in the form of a QR code and a barcode in the form of a barcode on the front-end interface and the printer driver is automatically called (in this example, Deli DL-720 series thermal barcode label printer and Deli DL-730 series thermal QR code label printer are selected in the specific implementation) to print them respectively; the No. 3 assembly line worker (one person) seals the package and places the sealed packaging can on the packaging machine for packaging. This process does not interact with the system.

[0050] S5, the human-computer interaction layer provides interfaces and interfaces for related member roles to interact with the system. This layer is oriented to four types of members, namely, packaging line managers, line workers, consumers and supply chain members, among which the supply chain members include regulatory enterprises, upstream fungus cultivation enterprises, and downstream fungus processing enterprises;

[0051] Depending on the type of member users, the system provides different functions according to the specific business needs of member users: for graded workers, the system provides a graded interface; for packaging line administrators, the system provides an administrator interface, including a one-click database initialization function interface, a traceability information selection and filtering function interface, a product barcode generation and printing function interface, and an enterprise information system data query interface; for assembly line workers, the system provides an assembly line interaction interface in actual production; for consumers, the system provides an H5 traceability information display interface and a secret code verification function; for supply chain members, the system provides node, member, and user management functions of the alliance chain platform, the call, upload, and modification functions of smart contracts, and the query function of alliance chain data and related historical data;

[0052] Example of agricultural products being Tibetan fungus: After receiving the traceable Tibetan fungus products, consumers can scan the QR code on the outside of the packaging can. After scanning, the system will display the H5 traceability interface on the mobile phone. The interface displays the traceability information selected by the administrator during the packaging stage, including fungus growth temperature, fungus growth humidity, fungus growth pictures, fungus growth location, collector employee number, etc. After that, consumers can open the packaging can to take out the secret code, and enter the secret code on the corresponding interface on the front end. If the secret code verification is successful, it means that the packaging is consistent with the actual product, that is, the traceability information corresponds to the actual product. The verification mechanism of the clear and secret codes is as follows: Figure 7 shown.

Claims

1. A blockchain-based agricultural product traceability system, characterized by: include: The IoT facility collection layer is used to obtain all traceability information during the cultivation stage; The traceability information off-chain storage layer is used to store all traceability information to be displayed in the enterprise information system database; Alliance chain service layer, an alliance chain service platform based on FISCO BIOS, whose members include regulatory enterprises, upstream agricultural product cultivation enterprises and downstream agricultural product processing enterprises. The alliance chain service platform functional services include smart contract services, node authorization and management, and member and user management; The assembly line function layer includes product barcode generation and printing, dual-code binding and secret code generation, clear code generation and clear and secret code printing, and one-time chaining of traceability information; The human-computer interaction layer provides interfaces and interfaces for relevant member roles to interact with the system.

2. The agricultural product traceability system based on blockchain according to claim 1 is characterized in that: All traceability information in the cultivation stage includes the cultivation information, picking information, and pre-packaging preparation information of agricultural products in the pre-packaging stage.

3. The agricultural product traceability system based on blockchain according to claim 1 is characterized in that the Internet of Things The facility collection layer deploys IoT devices, including temperature sensors, humidity sensors, light sensors, GPS sensors and cameras, to collect traceability information, number each greenhouse and culture medium location, and then store the information collected by the IoT devices under the corresponding number in the IoT database.

4. The agricultural product traceability system based on blockchain according to claim 1 is characterized in that: The storage layer under the traceability information chain uses API to connect to the Internet of Things database through the TCP protocol to obtain all traceability information in the cultivation stage. The enterprise information system database uses the MySQL database, and the collected information is stored in it after filtering and processing. In the subsequent collection and packaging process, the "primary and foreign key association" storage mode is adopted to form a table connection structure of greenhouse number, culture medium number, purchase pallet number, primary pallet number, and secondary pallet number.

5. The agricultural product traceability system based on blockchain according to claim 1 is characterized in that: The alliance chain service layer uses the open source FISCO BCOS platform to build the alliance chain. The alliance chain architecture includes three members and three groups. The three groups are the fungus industry chain groups, which include upstream fungus cultivation enterprises and downstream fungus processing enterprises; The Fungus Cultivation Regulatory Group, which includes regulatory agencies and upstream Fungus cultivation companies; As well as the fungus packaging and sales supervision group, it includes regulatory agencies and downstream fungus processing companies. The alliance chain service layer uses the platform's own alliance chain management function to grant members corresponding permissions including node management, user management, smart contract management, group management, and on-chain data management, and requires each member to configure 2 nodes, one consensus node and one observation node.

6. The agricultural product traceability system based on blockchain according to claim 1 is characterized in that: The pipeline function layer uses the Springboot framework at the back end, uses Java language to write backend programs, and calls hardware devices such as printers.

7. The agricultural product traceability system based on blockchain according to claim 1 is characterized in that: The human-computer interaction layer uses Html and Css front-end languages ​​to build interfaces for database initialization, traceability information selection and filtering, barcode generation and printing, and enterprise information system data query. It also provides traceability information display and secret code verification functions on mobile phones after consumers scan the QR code to access the corresponding URL. The alliance chain member interaction interface uses the FISCO BCOS platform interface to implement node, member, and user management, as well as smart contract calling, uploading, and modification, as well as on-chain data query.

8. The blockchain-based agricultural product traceability system according to claims 1 to 7 is characterized in that: Applied to the traceability of information on the entire life cycle of Tibetan fungus.

9. A blockchain-based agricultural product traceability method, characterized by: S1.

1. Collection of growth data of agricultural products: Use IoT devices and information collection equipment to collect relevant information in the greenhouse during the growth stage of agricultural products. The relevant information selected is the periodic growth temperature, humidity, light, carbon dioxide concentration, environment, culture medium, regular growth photos of agricultural products, and the content of elements such as nitrogen, phosphorus and potassium in the soil. The collection method is automatic timed collection by IoT devices, and the relevant information is bound to the greenhouse number and culture medium number; S1.2, collection of data related to the harvesting of agricultural products: This step is carried out during the harvesting stage of agricultural products. The collected data needs to accurately correspond to the growth information to achieve subsequent information traceability. Therefore, the specific data collected are greenhouse number, culture medium number, location in the culture medium shed, picker number and collection time; S1.3, Data collection before agricultural product packaging: This is carried out before agricultural product packaging. The collected data needs to reflect the assembly line environment during the packaging stage and record unique identification information. The data selected include the purchase pallet number of agricultural products, the first-level pallet number, the second-level pallet number of agricultural products, the assembly line worker number information, the packaging line workshop environment picture, and the packaging time; S2.

1. Interface acquisition and filtering of IoT database information: Connect with the IoT database interface through the TCP protocol to obtain all traceability information of the agricultural product cultivation stage in the IoT database; then analyze and process the traceability information of the cultivation stage: first, obtain the cultivation stage information corresponding to the agricultural products of different culture media according to the greenhouse number and culture medium number; secondly, average the periodic IoT collection information such as temperature, humidity, light and other information according to a fixed time length and select a typical agricultural product growth photo at the end of each time length to complete the information filtering; the GPS information takes the mean value of the entire time length; the culture medium element information obtains the number, time and duration of abnormal values ​​according to the specified growth conditions of the agricultural products; finally, store the filtered IoT database information and the corresponding number, as well as the purchase pallet number in the enterprise information system database; S2.2, storage of pre-packaging information: This step stores all the collected data of agricultural products before packaging in the enterprise information system database, using the "primary and foreign key association" storage mode to form a table connection structure of "greenhouse number-culture medium number-purchase tray number-first-level tray number-second-level tray number", and stores other collected information as fields other than the primary and foreign keys; S3, a consortium chain service platform based on FISCO BIOS. The consortium chain of this platform has three members, namely regulatory agencies, upstream agricultural product cultivation enterprises, and downstream agricultural product processing enterprises. The platform's functional services include smart contract services, node authorization and management, and member and user management; S4.

1. Product barcode generation and printing: Automatically generate batch codes for each packaged fungus product. The quantity can be controlled by the staff and printed at one time by the barcode printer. The string generation rule of the product barcode is "enterprise number + agricultural product number + generation timestamp + serial number"; S4.2, Dual code binding and secret code generation: Automatically generate secret codes. The staff scans the product barcode and the secondary pallet code with a scanner to bind the two in the database. After binding, the system automatically generates a secret code, and the secret code generation rule is a random 10-digit string of alphanumeric characters. When the secret code is generated, the system automatically binds it to the product barcode. S4.

3. One-time uploading of traceability information to the chain: First, the assembly line worker scans the product barcode, and then the enterprise information system obtains all traceability information based on the product barcode through the "primary and foreign key association" method. Then, the traceability information is filtered according to the on-chain information filtering rules before the system is used. Finally, the filtered traceability information is uploaded to the chain by calling the FISCO BIOS alliance chain API and using the on-chain storage smart contract; S4.

4. Generation of plain code and printing of plain and dark codes: The URL for querying traceability information is stored in the traceability QR code. After previewing the plain and dark codes on the UI interface, the assembly line workers can print both codes with one click. S5. The human-computer interaction layer provides interfaces and interfaces for relevant member roles to interact with the system. This layer is aimed at four types of members, namely packaging line managers, assembly line workers, consumers and supply chain members. The supply chain members include regulatory enterprises, upstream wood ear cultivation enterprises, and downstream wood ear processing enterprises.

10. The agricultural product traceability method based on blockchain according to claim 9 is characterized in that: Applied to the traceability of information on the entire life cycle of Tibetan fungus.