Agricultural product traceability system and method based on blockchain distributed trusted transmission mechanism
By leveraging the distributed and trusted transmission mechanism of blockchain, the problems of centralized servers being easily tampered with and having single points of failure are solved, thereby ensuring the reliability and security of agricultural product traceability information, guaranteeing the authenticity of data and the stability of the system, and reducing regulatory costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NONGAN INFORMATION TECHNOLOGY (BEIJING) CO LTD
- Filing Date
- 2026-02-26
- Publication Date
- 2026-05-29
AI Technical Summary
Existing agricultural product traceability systems based on centralized servers suffer from problems such as data tampering and single points of failure, and lack effective data verification mechanisms, resulting in insufficient reliability and security of traceability information.
The system employs a distributed and trusted blockchain transmission mechanism to acquire agricultural product traceability information and generate signed data packets through information collection devices. It utilizes the decentralized storage and verification mechanism of blockchain nodes to ensure the authenticity and immutability of the data, and generates visual web pages through the application presentation layer to display the information.
It improves the reliability and security of agricultural product traceability information, avoids system paralysis caused by single point of failure, realizes the openness, transparency and full traceability of traceability information, and reduces the cost of agricultural product supervision.
Smart Images

Figure CN122114958A_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed herein relate to the field of blockchain technology, and specifically to an agricultural product traceability system and method based on a blockchain-based distributed trusted transmission mechanism. Background Technology
[0002] As consumers become increasingly concerned about food safety, establishing a complete traceability system for agricultural products "from farm to table" has become extremely urgent. Currently, the common method for tracing agricultural products is a QR code traceability system based on a centralized server. After assigning a QR code to agricultural products, supply chain staff and consumers can interact with the server by scanning the code to upload or query product traceability information.
[0003] However, when using the above methods, a common technical problem is that if the centralized server malfunctions or the data is tampered with, it can easily affect the entire system. In addition, the data transmission between each node in the supply chain and the server is often point-to-point, lacking an effective data verification mechanism, making it difficult to ensure the authenticity of the data, thereby reducing the reliability and security of traceability information. Summary of the Invention
[0004] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0005] Some embodiments of this disclosure propose an agricultural product traceability system and method based on a blockchain-based distributed trusted transmission mechanism to address the technical problems mentioned in the background section above.
[0006] In a first aspect, some embodiments of this disclosure provide an agricultural product traceability system based on a blockchain distributed trusted transmission mechanism. The system includes: a data perception layer, configured to: acquire agricultural product traceability information through an information collection device; generate a signed data packet based on the agricultural product traceability information and a preset terminal private key; and transmit the signed data packet to a network transmission layer; a network transmission layer, configured to: broadcast the signed data packet to each blockchain node in the blockchain node set included in the blockchain service layer; a blockchain service layer, configured to: perform on-chain storage of the signed data packet through each blockchain node in the included blockchain node set to obtain on-chain stored data; send the corresponding on-chain stored data to an application presentation layer based on the agricultural product number of the received data request; and an application presentation layer, configured to: parse the query request in response to receiving a query request to generate an agricultural product number, and initiate a data request to the blockchain service layer based on the agricultural product number; generate a visual webpage based on the received on-chain stored data, and return the visual webpage to the target terminal browser.
[0007] Secondly, some embodiments of this disclosure provide a method for agricultural product traceability based on a blockchain distributed trusted transmission mechanism. The method includes: a data perception layer acquiring agricultural product traceability information through an information collection device; the data perception layer generating a signed data packet based on the agricultural product traceability information and a preset terminal private key, and transmitting the signed data packet to a network transmission layer; the network transmission layer broadcasting the received signed data packet to each blockchain node in a blockchain node set included in the blockchain service layer; each blockchain node in the blockchain node set storing the signed data packet on-chain to obtain on-chain stored data; in response to an application presentation layer receiving a query request initiated by a user, the application presentation layer parsing the query request to generate an agricultural product number, and initiating a data request to the blockchain service layer based on the agricultural product number; the blockchain service layer sending the corresponding on-chain stored data to the application presentation layer based on the received agricultural product number in the data request; and the application presentation layer generating a visual webpage based on the received on-chain stored data, and returning the visual webpage to a target terminal browser.
[0008] Thirdly, some embodiments of this disclosure provide an information collection device, including: an acquisition unit configured to acquire agricultural product traceability information; and a generation unit configured to generate a signed data packet based on the agricultural product traceability information and a preset terminal private key, and to transmit the signed data packet to the network transport layer.
[0009] Fourthly, some embodiments of this disclosure provide a blockchain node device, including: an on-chain storage unit configured to store signed data packets on-chain to obtain on-chain stored data; and a sending unit configured to send the corresponding on-chain stored data to the application presentation layer according to the agricultural product number requested by the received data.
[0010] The various embodiments of this disclosure have the following beneficial effects: the reliability and security of agricultural product traceability information are improved through the agricultural product traceability system based on the blockchain distributed trusted transmission mechanism of some embodiments of this disclosure. Specifically, the reason for the reduced reliability and security of agricultural product traceability information is that when the centralized server malfunctions or the data is tampered with, it can easily affect the entire system. In addition, the data transmission between each node in the supply chain and the server is often point-to-point, lacking an effective data verification mechanism, making it difficult to ensure the authenticity of the data. Based on this, the agricultural product traceability system based on the blockchain distributed trusted transmission mechanism of some embodiments of this disclosure firstly, the data perception layer is configured to: acquire agricultural product traceability information through an information collection device. Based on the above agricultural product traceability information and a preset terminal private key, a signature data packet is generated, and the above signature data packet is transmitted to the network transmission layer. Thus, key information in each link of production, processing, logistics, etc., can be encrypted and uploaded to the chain from the source, avoiding the problem of data being easily tampered with in centralized systems, and ensuring the authenticity and non-repudiation of traceability information. Secondly, the network transmission layer is configured to: broadcast the above signature data packet to each blockchain node in the blockchain node set included in the blockchain service layer. Simultaneously, the blockchain service layer is configured to store the aforementioned signed data packets on-chain through various blockchain nodes in the included blockchain node set, resulting in on-chain stored data. The blockchain service layer is decentralized; traceability data is jointly verified and stored by multiple nodes. This not only ensures data security but also ensures the entire traceability system continues to operate normally even if some nodes fail or go offline, avoiding the risk of system paralysis due to single points of failure and greatly improving system stability. Based on the agricultural product number of the received data request, the corresponding on-chain stored data is sent to the application presentation layer. The application presentation layer is configured to: respond to received query requests, parse the query requests to generate agricultural product numbers, and initiate data requests to the blockchain service layer based on these agricultural product numbers; generate visual web pages based on the received on-chain stored data, and return these visual web pages to the target terminal browser. All participants (producers, regulators, consumers, etc.) can access on-chain data through the application presentation layer, achieving transparency and full traceability of traceability information. In the event of a security issue, the problematic link and responsible party can be quickly and accurately located, reducing the cost of agricultural product supervision. Attached Figure Description
[0011] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.
[0012] Figure 1 This is a schematic diagram of the structure of some embodiments of the agricultural product traceability system based on the blockchain distributed trusted transmission mechanism according to this disclosure; Figure 2 This is a flowchart of some embodiments of the agricultural product traceability method based on the blockchain distributed trusted transmission mechanism disclosed herein; Figure 3 These are schematic diagrams illustrating the structure of some embodiments of the information acquisition device according to this disclosure; Figure 4 This is a schematic diagram of the structure of some embodiments of the blockchain node device according to the present disclosure. Detailed Implementation
[0013] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0014] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0015] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0016] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0017] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0018] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0019] Figure 1 The diagram shows a structural schematic of some embodiments of an agricultural product traceability system based on a blockchain-based distributed trusted transmission mechanism according to this disclosure. Figure 1 It includes a data perception layer 1, a network transmission layer 2, a blockchain service layer 3, and an application presentation layer 4.
[0020] In some embodiments, the data awareness layer 1 described above can be configured to perform the following processes: First, information collection devices are used to obtain traceability information for agricultural products.
[0021] In some embodiments, the data sensing layer 1 can acquire agricultural product traceability information through the information acquisition device 11. The information acquisition device can be a computing device used to acquire agricultural product traceability information. The hardware structure of the information acquisition device may include: a processor, a memory, a data acquisition module, a network communication module, and a human-computer interaction module (e.g., a touch screen, a keyboard, etc.). The data acquisition module can integrate various sensors, including but not limited to: a camera, a temperature sensor, a humidity sensor, a GPS positioning module, and an RFID reader / writer.
[0022] As an example, an agricultural product supply chain can include planting, processing, and logistics stages. The traceability information for these agricultural products can be source information, processing information, or logistics information. Source information can include product ID, land information, seed variety information, sowing date, fertilization records, and pesticide usage records. The product ID can be a unique identifier for the product. Processing information can include product ID, operator, processing time, quality inspection report, processing temperature, processing humidity, and packaging QR code. Logistics information can include product ID, logistics personnel, logistics route, logistics temperature, and logistics humidity.
[0023] Information collection devices can be deployed at each stage of the agricultural product supply chain. The data acquisition module of these devices can include at least one sensor. The sensors configured for the information collection devices differ depending on the stage. For example, in the planting stage, the devices can be equipped with soil moisture sensors, soil pH sensors, and water quality monitoring devices. In the processing stage, the devices can be equipped with temperature sensors and humidity sensors. In the logistics stage, the devices can be equipped with RFID readers, GPS devices, temperature sensors, and humidity sensors.
[0024] During the planting stage, after collecting information on the source of agricultural products, the information collection device can display this information as agricultural product traceability information through a human-computer interaction module. Optionally, vegetable growers can also use the human-computer interaction module to review and improve information such as agricultural product number, planting land information, seed variety, sowing date, fertilization records, and pesticide use records.
[0025] During the processing stage, the information collection device can automatically acquire agricultural product processing information during cleaning and packaging. For example, it can collect the water temperature for cleaning agricultural products using a temperature sensor and the water quality for cleaning using a water quality testing device. This processing information can then be used as traceability information and displayed through the human-computer interaction model. Simultaneously, operators can use the human-computer interaction module to complete tasks such as filling out forms and uploading quality inspection reports. Optionally, the data sensing layer can generate a unique packaging QR code for each agricultural product. This QR code can correspond one-to-one with the agricultural product's serial number. Staff can then affix this QR code to the agricultural product's packaging.
[0026] During the logistics phase, information collection devices can be deployed on vehicles and at each warehouse along the transportation route, and these devices can integrate RFID readers and environmental sensors. Each time agricultural products enter, leave, or are transported, the RFID reader in the information collection device automatically reads the RFID tag on the packaging to obtain the agricultural product's number. The temperature and humidity sensors in the information collection device continuously collect the temperature and humidity information of the agricultural products, thereby generating agricultural product logistics information. This agricultural product logistics information can then be used as agricultural product traceability information and displayed through the aforementioned human-computer interaction model. Optionally, logistics personnel can complete tasks such as filling out forms through the human-computer interaction module.
[0027] In practice, when obtaining traceability information for agricultural products during the processing stage, a common technical challenge is the reliance on manual component testing and visual inspection. This process is highly subjective, prone to errors, and some processing plants may tamper with quality inspection results, leading to food fraud risks. Therefore, the following solution is proposed.
[0028] Optionally, the data sensing layer 1 mentioned above may acquire agricultural product traceability information through an information collection device, which may include the following steps: The first step involves collecting multi-source data on agricultural products through various IoT devices configured in the information collection device. These IoT devices may include near-infrared spectral sensors (NIRS), industrial cameras, etc. These IoT devices can communicate with the information collection device. The multi-source data on agricultural products may include: agricultural product identification numbers, spectral data, and images.
[0029] The second step involves performing spectral component detection on the agricultural product spectral data included in the aforementioned multi-source agricultural product dataset, based on a pre-set spectral component detection model, to obtain the component detection results. This spectral component detection model can be a pre-trained random forest model. In practice, firstly, labeled sample spectral datasets can be collected. Each sample spectral data in this dataset can include a quality inspection compliance label or a quality inspection non-compliance label. Then, the random forest model can be trained using the sample spectral dataset to obtain a pre-trained random forest model, which serves as the spectral component detection model. Next, the target wavelength band can be extracted from the aforementioned agricultural product spectral data to obtain target spectral data, which serves as preprocessed agricultural product spectral data. The target wavelength band can be 1200-1500 nm. Finally, the preprocessed agricultural product spectral data is input into the aforementioned spectral component detection model to obtain the component detection results. These results can indicate whether pesticide residues exceed the standard or not.
[0030] As an example, when the aforementioned agricultural product is cabbage, a cabbage spectral dataset with pesticide residue tags can be pre-obtained. Then, each cabbage spectral data point in the dataset can be used as input to a random forest model, and the corresponding pesticide residue tags can be used as the expected output of the random forest model. This allows for training the random forest model, resulting in a pre-trained model. This pre-trained random forest model can then be used as a spectral component detection model.
[0031] The third step involves detecting appearance defects in the agricultural product images included in the aforementioned multi-source agricultural product dataset based on a pre-defined appearance defect detection model, thereby obtaining the appearance defect detection results. The appearance defect detection model can be a neural network model used for defect detection. Specifically, it can be a pre-trained YOLOv8 model.
[0032] As an example, when the agricultural product is cabbage, a set of cabbage images with added defect labels can be pre-obtained. Then, each cabbage image in the set can be used as input to a YOLOv8 model, and the corresponding defect label can be used as the expected output of the YOLOv8 model. The YOLOv8 model is then trained to obtain a pre-trained model. This pre-trained YOLOv8 model is used as a visual defect detection model. The agricultural product image is input into this model to obtain the visual defect detection results. These results can be "Defect 1, defect location; Defect 2, defect location".
[0033] The fourth step involves merging the aforementioned component detection results, appearance defect detection results, and multi-source data of agricultural products to obtain agricultural product traceability information. This traceability information may include: agricultural product ID, agricultural product spectral data, agricultural product image, component detection results, and appearance defect detection results.
[0034] Optionally, after step four above, the following steps may also be included: In the first sub-step, the aforementioned information collection device can broadcast the traceability information of the agricultural products to the blockchain service layer.
[0035] In the second sub-step, the aforementioned blockchain service layer can generate early warning information based on the component testing results and appearance defect testing results included in the agricultural product traceability information, and send the early warning information to the regulatory terminal. The blockchain service layer may include an early warning smart contract. This smart contract can automatically generate early warning information when the component testing results are substandard or the appearance defect testing results meet defect conditions. The defect conditions can be that the number of defects exceeds a preset defect threshold. The defect threshold can be 5. The early warning information can be a quality inspection failure. In practice, when the blockchain service layer detects that the component testing results are substandard or the appearance defect testing results exceed the defect threshold, it generates early warning information and sends it to the regulatory terminal.
[0036] The third sub-step involves the blockchain service layer receiving the processing result from the regulatory terminal, storing the result on the blockchain, and sending the result to the information collection device. In practice, regulatory personnel can upload the processing result to the blockchain service layer after processing substandard agricultural products. This processing result may include: agricultural product number, quality inspection result, processing result, quality inspector, timestamp, etc. The blockchain service layer can store the processing result on the blockchain and send it to the information collection device.
[0037] As an example, the above processing result could be: "Agricultural product number: 1, quality inspection result: pesticide residue meets the standard, appearance defects do not meet the standard (including: defect 1, defect location; defect 2, defect location), processing result: agricultural product has been returned to the factory for sorting, quality inspector: A, time: 20260102."
[0038] In the fourth sub-step, the information acquisition device can train the spectral composition detection model and the appearance defect detection model based on the processing results to obtain an updated spectral composition detection model and an updated defect detection model.
[0039] As an example, the information acquisition device can retrieve the aforementioned agricultural product spectral data from a local database, assign pesticide residue compliance labels to them, and use this as sample spectral data. Next, it can retrieve agricultural product images, assign defect labels to them, and use these as sample images. When the accumulated sample spectral data reaches a preset number, the spectral component detection model can be trained using each sample spectral data to obtain an updated spectral component detection model, and this updated model can be used to perform subsequent component detection tasks. Similarly, when the accumulated sample images reach a preset number, the appearance defect detection model can be trained using each sample image to obtain an updated defect detection model, and this updated model can be used to perform subsequent appearance defect detection tasks.
[0040] Steps one through four of the aforementioned optional solutions, along with their related content, constitute an inventive point of this disclosure, solving the aforementioned technical problem: "the risk of food fraud." The high risk of food fraud is often due to the inherent subjectivity and error-proneness of relying on manual component testing and appearance screening; some processing plants may also tamper with quality inspection results. Addressing these factors can reduce food fraud. To achieve this, firstly, IoT devices are deployed to automatically collect agricultural product information. Next, for near-infrared spectral data, a pre-trained random forest model is used to accurately identify whether the components of agricultural products meet standards. For agricultural product images, a pre-trained appearance defect detection model can be used to detect defects. Thus, component and appearance testing of agricultural products can be performed without manual intervention, ensuring objective and accurate results. Subsequently, component and defect detection information is incorporated into agricultural product traceability information. Secondly, the agricultural product traceability information, which integrates component and appearance defect detection results, is uploaded to the blockchain service layer for storage. Combining the distributed ledger characteristics of blockchain, the immutability and full traceability of traceability information are achieved, guaranteeing the authenticity of agricultural product traceability information. Subsequently, through pre-designed early warning smart contracts, once the traceability information of agricultural products meets the trigger conditions, quality inspection early warning information is automatically generated and simultaneously pushed to regulatory authorities. This achieves an automated control chain from the Internet of Things, artificial intelligence, and blockchain to regulatory authorities, reducing human interference, preventing food fraud, and improving the effectiveness of quality inspection results. Finally, the spectral composition detection model and appearance defect detection model can be iteratively updated based on the processing results from regulatory authorities, continuously improving the detection accuracy of the models and thus enhancing the authenticity of quality inspection.
[0041] Second, based on the aforementioned agricultural product traceability information and the preset terminal private key, a signature data packet is generated, and the aforementioned signature data packet is transmitted to the network transport layer.
[0042] In some embodiments, the data sensing layer 1 can generate a signed data packet based on the agricultural product traceability information and a preset terminal private key, and then transmit the signed data packet to the network transport layer. In practice, firstly, the data sensing layer can digitally sign the agricultural product traceability information using the preset private key to obtain a digital signature. Then, the digital signature and the agricultural product traceability information can be merged into a signed data packet. Next, the signed data packet can be transmitted to the network transport layer. Optionally, the signed data packet may also include a preset public key. The terminal private key and the public key can be a key pair.
[0043] Optionally, the data sensing layer generates a signed data packet based on the agricultural product traceability information and a preset terminal private key, which may include the following steps: The first step is to package the aforementioned agricultural product traceability information into an agricultural product data package. In practice, the information collection device in the data perception layer can package the agricultural product traceability information into an agricultural product data package based on a preset packaging technology. This packaging technology can be JSON technology.
[0044] The second step involves digitally signing the aforementioned agricultural product data packet using the private key corresponding to the local terminal, resulting in a signed data packet. The local terminal can be an information collection device, and each information collection device can uniquely correspond to a single terminal private key.
[0045] As an example, workers at various stages of the supply chain can submit registration requests through an information collection device to obtain a unique blockchain address and terminal private key. The information collection device in the aforementioned data perception layer can then digitally sign the aforementioned agricultural product data packet based on a preset digital signature technology and the terminal private key, obtaining a digital signature. This digital signature technology can be either an asymmetric encryption algorithm (RSA) or an elliptic curve digital signature algorithm (ECDSA). Next, the digital signature and the aforementioned agricultural product data packet are combined into a signed data packet.
[0046] In practice, each information collection device at every stage uses a built-in private key to perform digital signatures at the source of data generation, avoiding the need for collection terminals to upload data to a centralized server for unified signing, packaging, and blockchain uploading. This avoids the risk of data loss and tampering due to single points of failure, thus improving the security and reliability of agricultural product traceability information.
[0047] Optionally, the data awareness layer described above can also be configured to perform the following steps: The first step involves the data perception layer receiving a registration request from a user. The data perception layer generates a terminal private key using a pre-defined random number generator and associates this private key with the information collection device corresponding to the registration request. The random number generator can be a Cryptographically Secure Pseudorandom Number Generator (CSPRNG). The terminal private key can be a string.
[0048] As an example, each participant in the supply chain can initiate a registration request through the information collection device in the data awareness layer. When the information collection device receives a registration request from a user, it can generate a random string using a pseudo-random number generator, which serves as the terminal's private key. This terminal's private key is then associated with the information collection device used by the user.
[0049] The second step involves generating the public key corresponding to the aforementioned terminal private key based on a preset asymmetric key generation algorithm. In practice, the aforementioned information collection device can obtain the public key by performing mathematical derivation operations on the aforementioned terminal private key based on a preset asymmetric encryption algorithm (such as the Elliptic Curve Digital Signature Algorithm ECDSA).
[0050] The third step is to hash the aforementioned public key to generate a blockchain address. This blockchain address represents the public identity of the information collection device on the distributed shared ledger within the blockchain service layer.
[0051] As an example, the aforementioned information collection device can perform a Keccak-256 hash operation on the public key to obtain a 32-byte hash value. Then, the last 20 bytes of this hash value can be extracted to obtain a hash value sub-block. Next, a preset network prefix can be added to the front of this hash value sub-block to obtain a network address. This network prefix can be 0x. Finally, the network address can be hexadecimal encoded to obtain the blockchain address.
[0052] The fourth step involves sending the aforementioned blockchain address to the blockchain service layer for registration. In practice, firstly, the information collection device can send the generated blockchain address to the blockchain service layer via the network transport layer. Then, the blockchain service layer can permanently record the blockchain address and public key in its distributed shared ledger using a pre-defined identity registration contract, thus completing permanent on-chain registration. This identity registration contract can be a smart contract used for identity registration in blockchain technology.
[0053] In some embodiments, the network transport layer 2 can be configured to broadcast the signed data packet to each blockchain node in the blockchain node set included in the blockchain service layer. The network transport layer can be a network communication environment built on existing Internet technologies and secure communication protocols (such as HTTPS, TLS / SSL, etc.). In practice, after generating the signed data packet, the information collection device in the data perception layer can broadcast the signed data packet to one or more blockchain nodes in the blockchain service layer through the network transport layer.
[0054] In some embodiments, the blockchain service layer 3 described above can be configured to perform the following processes: First, the aforementioned signature data packet is stored on-chain by each blockchain node in the included blockchain node set, thus obtaining the on-chain stored data.
[0055] In some embodiments, the blockchain service layer 3 can perform on-chain storage of the signed data packets through various blockchain nodes in the included blockchain node set to obtain on-chain stored data. The blockchain service layer can be a peer-to-peer (P2P) network composed of multiple blockchain nodes. The blockchain service layer can include a blockchain node device 31. The blockchain node device can include at least one blockchain node. Each blockchain node in the blockchain node set can be a server or computer. The hardware structure of the blockchain node can include: a processor, large-capacity storage, high-speed network interface, etc. The software installed in the blockchain node can include: a consensus algorithm (e.g., PBFT), a ledger storage module, a smart contract engine, and a P2P communication module. The ledger storage module can be used to package consensus-reached transaction data into blocks and link them to an existing blockchain to achieve persistent data storage. The hardware corresponding to each blockchain node in the blockchain node set can be deployed at different participants in the supply chain. These participants can include agricultural product production enterprises, processing plants, logistics companies, government regulatory departments, etc. The blockchain service layer also includes smart contracts pre-deployed on a distributed shared ledger. The aforementioned distributed shared ledger can be a database copy linked chronologically, its immutability and unforgeability guaranteed by cryptography. All nodes in the aforementioned blockchain service layer possess a complete or partial copy of this ledger, ensuring data transparency and multi-party backup. The aforementioned smart contract defines the data structure and data update rules for agricultural product traceability information. For example, the data structure for agricultural product traceability information needs to include fields such as: agricultural product number, operation type, timestamp, geographical location, and specific content hash. The aforementioned data update rules can stipulate that only quality inspection information signed with a private key can be accepted.
[0056] In practice, each blockchain node in the aforementioned blockchain node cluster can store the aforementioned signed data packets on-chain based on blockchain technology to obtain on-chain stored data.
[0057] In practice, the connections between the various blockchain nodes in the aforementioned blockchain node cluster are mesh-like and decentralized. Therefore, the failure of any single node will not affect the operation of the entire network, thus solving the single point of failure problem from a physical structural perspective.
[0058] Optionally, the aforementioned blockchain service layer can be a "consortium blockchain" composed of multiple supply chain participants.
[0059] Alternatively, the aforementioned blockchain service layer can also be a public blockchain. For example, the aforementioned blockchain service layer can record each signed data packet on Ethereum or other high-performance public blockchains.
[0060] Alternatively, the aforementioned blockchain service layer can also be a private blockchain, for example, a private blockchain deployed by a single large agricultural group or core enterprise for its internal or upstream and downstream partners.
[0061] It should be noted that the core of this disclosure lies in utilizing the distributed and immutable characteristics of blockchain, and regardless of whether it is a consortium blockchain, a public blockchain, or a private blockchain, it should all fall within the protection scope of this disclosure.
[0062] Optionally, the above-mentioned on-chain storage of the signed data packet through each blockchain node in the included blockchain node set to obtain on-chain stored data may include the following steps: The first step involves each blockchain node in the aforementioned blockchain node set verifying the signed data packet using its stored public key to obtain a verification result. The public key can be broadcast from the information collection device to the blockchain node along with the signed data packet, or it can be pre-stored on the blockchain. In practice, for each blockchain node in the aforementioned blockchain node set, the corresponding public key can first be obtained by querying the registered identity information on the chain. Specifically, during the system initialization phase, each information collection device has written its blockchain address and public key into the distributed shared ledger through an identity registration contract. When a blockchain node receives a signed data packet, it can query the corresponding public key from the chain based on the sender's (information collection device) address contained in the data packet and use it for signature verification. Afterward, the blockchain node can use the aforementioned public key to decrypt the digital signature in the signed data packet, obtain the original hash value, recalculate the hash value of the received agricultural product traceability information, and compare whether the two are consistent. If the results are consistent, the data has not been tampered with, and the verification passes; otherwise, the verification fails.
[0063] Optionally, when the information collection device needs to upload agricultural product traceability information, it uses a private key to digitally sign the agricultural product traceability information and broadcasts the original data, signature, and blockchain address together to the blockchain service layer (P2P network). Each blockchain node in the aforementioned blockchain service layer can use the public key corresponding to the sender's publicly disclosed blockchain address to verify whether the signature was generated by the corresponding private key.
[0064] Optionally, when the verification result is determined to be successful, the blockchain node may store the signed data packet. When the verification result is determined to be unsuccessful, the blockchain node may discard the signed data packet.
[0065] The second step involves determining that each verification result satisfies a preset verification condition, and then identifying the aforementioned signed data packet as a data packet to be stored. This verification condition can be that the percentage of unverified verification results out of the total number of verification results exceeds a preset percentage. This percentage can be a preset threshold, such as 75%. In practice, when the percentage of unverified verification results exceeds this threshold, the aforementioned signed data packet can be identified as a data packet to be stored.
[0066] The third step involves each blockchain node in the aforementioned blockchain node set performing the following steps: The first sub-step involves determining the sequence number corresponding to the aforementioned data packets to be stored, based on a pre-defined consensus algorithm. In practice, each blockchain node in the aforementioned blockchain node set can cache multiple data packets, including the aforementioned data packets to be stored. First, the aforementioned data packets to be stored can be incorporated into a local data packet set to obtain a data packet set to be stored. Next, based on a pre-defined consensus algorithm, the sequence number corresponding to each data packet to be stored in the data packet set to be stored can be determined. Here, each data packet to be stored is assigned a globally unique sequence number to ensure that the order of the various data packets to be stored is consistent.
[0067] As an example, the consensus algorithm mentioned above may include, but is not limited to, at least one of the following: Practical Byzantine Fault Tolerance (PBFT), Raft algorithm, and Proof of Authority (PoA).
[0068] The second sub-step involves packaging the data packets to be stored into a new block based on the aforementioned sequence numbers. This new block can be a new storage block within the blockchain. The new block can include a block header and a block body. The block header may contain the hash value of the previous block. The block body may include each data packet to be stored. In practice, firstly, the data packets to be stored can be sorted according to their corresponding sequence numbers to obtain a sequence of data packets to be stored. Then, each data packet in this sequence can be packaged into a new block.
[0069] The third sub-step involves connecting the new blockchain to a pre-defined distributed shared ledger. This distributed shared ledger is jointly maintained by the aforementioned set of blockchain nodes, with each node storing a complete or partial copy. In practice, after a new block is generated, each blockchain node can append the new block to the end of its locally maintained distributed shared ledger and broadcast it to other nodes, thus achieving ledger synchronization.
[0070] Optionally, the aforementioned blockchain service layer can record the summary information (such as hash values) of agricultural product traceability information on the chain, while large raw data files (such as high-definition photos and PDF test reports) can be stored in the InterPlanetary File System (IPFS) or other distributed storage networks, and then record the returned content address (CID) on the chain.
[0071] Optionally, the aforementioned blockchain service layer can record summary information (such as hash values) of agricultural product traceability information on the chain, while storing large-volume raw data files in object storage services provided by cloud service providers, and then uploading the cloud service access link and the file's hash value to the chain. Although the storage itself is centralized, the hash value on the chain ensures that the file's integrity has not been tampered with, thus achieving the same purpose of this disclosure.
[0072] Second, based on the agricultural product number of the received data request, the corresponding on-chain stored data is sent to the application presentation layer.
[0073] In some embodiments, the blockchain service layer 3 can send the corresponding on-chain stored data to the application presentation layer based on the agricultural product number of the received data request. The data request can be a data query request sent from the application presentation layer to the blockchain service layer. The data request may include the agricultural product number to be queried. In practice, when one or more blockchain nodes in the blockchain service layer receive a data request, they can search for multiple on-chain stored data related to the agricultural product number in the distributed shared ledger based on the agricultural product number corresponding to the data request, and then send this on-chain stored data to the application presentation layer.
[0074] In some embodiments, the application presentation layer 4 described above can be configured to perform the following processes: First, in response to receiving a query request, the query request is parsed to generate an agricultural product number, and a data request is sent to the blockchain service layer based on the agricultural product number.
[0075] In some embodiments, the application presentation layer 4 may, in response to receiving a query request, parse the query request to generate an agricultural product number, and initiate a data request to the blockchain service layer based on the agricultural product number.
[0076] As an example, users can initiate a query request by scanning the QR code on the packaging of agricultural products. Specifically, users can scan the QR code on the packaging with their mobile phones. The mobile browser is then activated and accesses the URL embedded in the QR code. This URL points to the traceability information query interface in the application presentation layer, and the agricultural product number is included in the request parameters. After receiving the request, the backend service of the application presentation layer sends a data query instruction to one or more nodes in the blockchain service layer to retrieve all on-chain stored data associated with the agricultural product number.
[0077] It should be noted that this disclosure preferably uses QR codes as the entry point for querying information. However, any technology capable of carrying a unique identifier and binding it to a physical product can be used as an alternative. For example, NFC (Near Field Communication) tags allow users to read information by simply tapping an NFC tag on an agricultural product with an NFC-enabled mobile phone.
[0078] Optionally, an API gateway may also be included between the application presentation layer and the blockchain service layer. For example, a user-initiated query request can first reach this gateway, which then requests data from multiple blockchain nodes, processes and formats the data, and finally returns the result. This gateway serves as a load balancer, cacher, and data aggregator, and is an optimized and alternative implementation of the publicly disclosed query mechanism.
[0079] Second, based on the received data stored on each chain, a visual webpage is generated, and the visual webpage is returned to the target terminal browser.
[0080] In some embodiments, the application presentation layer 4 can generate a visual webpage based on the received on-chain stored data, and return the visual webpage to the target terminal browser. The target terminal browser can be the browser on the terminal where the user initiated the query request.
[0081] As an example, the traceability information query interface described above retrieves a complete and immutable data chain from the blockchain, signed and confirmed by all parties. This data chain can include planting records from "Farm A," testing reports from "Processing Plant B," and transportation routes from "Logistics C." The traceability information query interface can parse and integrate this on-chain data to generate a clear and intuitive agricultural product traceability information webpage for users to view.
[0082] Optionally, the application presentation layer described above can maintain a relational database in the backend service. This relational database can be used to record the relationship between agricultural product numbers and on-chain stored data in the blockchain service layer. Although the relational logic is deployed off-chain, the data source it references is still trusted on-chain data. By moving some of the relational logic off-chain, the on-chain storage and computation costs can be balanced.
[0083] Further reference Figure 2 The diagram illustrates a flow 200 of some embodiments of a blockchain-based distributed trusted transmission mechanism for agricultural product traceability according to this disclosure. This blockchain-based distributed trusted transmission mechanism for agricultural product traceability includes the following steps: Step 201: The data perception layer acquires agricultural product traceability information through the information collection device.
[0084] In some embodiments, the data perception layer can acquire agricultural product traceability information through an information collection device.
[0085] Step 202: The data perception layer generates a signed data packet based on the above agricultural product traceability information and the preset terminal private key, and transmits the signed data packet to the network transmission layer.
[0086] In some embodiments, the data perception layer can generate a signed data packet based on the agricultural product traceability information and a preset terminal private key, and transmit the signed data packet to the network transport layer.
[0087] Step 203: The network transport layer broadcasts the received signature data packet to each blockchain node in the blockchain node set included in the blockchain service layer.
[0088] In some embodiments, the network transport layer described above may broadcast the received signed data packets to each blockchain node in the blockchain node set included in the blockchain service layer.
[0089] Step 204: Each blockchain node in the aforementioned blockchain node set stores the aforementioned signature data packet on the blockchain to obtain the on-chain stored data.
[0090] In some embodiments, each blockchain node in the aforementioned blockchain node set can store the aforementioned signed data packet on-chain to obtain on-chain stored data.
[0091] Step 205: In response to the application presentation layer receiving a query request initiated by the user, the application presentation layer parses the query request to generate an agricultural product number, and initiates a data request to the blockchain service layer based on the agricultural product number.
[0092] In some embodiments, in response to the application presentation layer receiving a query request initiated by a user, the application presentation layer may parse the query request to generate an agricultural product number, and initiate a data request to the blockchain service layer based on the agricultural product number.
[0093] Step 206: The blockchain service layer sends the corresponding on-chain stored data to the application presentation layer based on the agricultural product number of the received data request.
[0094] In some embodiments, the blockchain service layer can send the corresponding on-chain stored data to the application presentation layer based on the agricultural product number of the received data request.
[0095] Step 207: The application presentation layer generates a visual webpage based on the received on-chain storage data, and returns the visual webpage to the target terminal browser.
[0096] In some embodiments, the application presentation layer can generate a visual webpage based on the received on-chain storage data, and return the visual webpage to the target terminal browser.
[0097] refer to Figure 3 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of an information acquisition device, which are similar to... Figure 2 Corresponding to the partial method embodiments shown, this information acquisition device can be specifically applied to various electronic devices.
[0098] like Figure 3 As shown, the information collection device 300 in some embodiments includes an acquisition unit 301 and a generation unit 302. The acquisition unit 301 is configured to acquire agricultural product traceability information; the generation unit 302 is configured to generate a signed data packet based on the agricultural product traceability information and a preset terminal private key, and to transmit the signed data packet to the network transport layer.
[0099] It is understandable that the units recorded in the information acquisition device 300 are related to the reference. Figure 2 Steps 201 and 202 in the described method correspond to each other. Therefore, the operations, features, and beneficial effects described above for the method also apply to the information acquisition device 300 and the units contained therein, and will not be repeated here.
[0100] refer to Figure 4 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of an information acquisition device, which are similar to... Figure 2 Corresponding to the partial method embodiments shown, this blockchain node device can be specifically applied to various electronic devices.
[0101] like Figure 4 As shown, in some embodiments, the blockchain node device 400 includes an on-chain storage unit 401 and a sending unit 402. The on-chain storage unit 401 is configured to store signed data packets on-chain to obtain on-chain stored data; the sending unit 402 is configured to send the corresponding on-chain stored data to the application presentation layer according to the agricultural product number requested by the received data.
[0102] It is understandable that the units recorded in the blockchain node device 400 are related to the reference. Figure 2 Steps 204 and 206 in the described method correspond to each other. Therefore, the operations, features, and beneficial effects described above for the method also apply to the blockchain node device 400 and the units contained therein, and will not be repeated here.
[0103] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. An agricultural product traceability system based on a blockchain-based distributed trusted transmission mechanism, characterized in that, include: A data perception layer, wherein the data perception layer is configured to: acquire agricultural product traceability information through an information collection device; generate a signed data packet based on the agricultural product traceability information and a preset terminal private key; and transmit the signed data packet to the network transport layer. A network transport layer, wherein the network transport layer is configured to broadcast the signed data packet to each blockchain node in the blockchain node set included in the blockchain service layer; A blockchain service layer is configured to: store the signed data packet on-chain through each blockchain node in the included blockchain node set to obtain on-chain stored data; and send the corresponding on-chain stored data to the application presentation layer according to the agricultural product number of the received data request. An application presentation layer is configured to: in response to receiving a query request, parse the query request to generate an agricultural product number, and initiate a data request to the blockchain service layer based on the agricultural product number; generate a visual webpage based on the received on-chain stored data, and return the visual webpage to the target terminal browser.
2. The system according to claim 1, characterized in that, The data perception layer is further configured to: In response to the data perception layer receiving a registration request from a user, a terminal private key is generated using a preset random number generator, and the terminal private key is associated with the information collection device corresponding to the registration request. Based on a preset asymmetric key generation algorithm, a public key corresponding to the terminal's private key is generated; The public key is hashed to generate a blockchain address; The blockchain address is sent to the blockchain service layer for registration.
3. The system according to claim 1, characterized in that, The data perception layer is further configured to: The traceability information of the agricultural products is packaged to obtain an agricultural product data package; The agricultural product data packet is digitally signed using the terminal private key corresponding to the local terminal to obtain a signed data packet.
4. The system according to claim 2, characterized in that, The individual blockchain nodes in the blockchain node set are further configured as follows: For each blockchain node in the blockchain node set, the blockchain node verifies the signed data packet based on the stored public key to obtain a verification result; In response to the determination that each of the obtained verification results meets the preset verification conditions, the signature data packet is determined as a data packet to be stored; Each blockchain node in the blockchain node set performs the following steps: Based on a preset consensus algorithm, the sequence number corresponding to the data packet to be stored is determined; Based on the sequence number, the data packet to be stored is packaged into a new block; The new blockchain is connected to a pre-defined distributed shared ledger.
5. A method for agricultural product traceability based on a blockchain distributed trusted transmission mechanism, applied to the agricultural product traceability system based on a blockchain distributed trusted transmission mechanism as described in any one of claims 1 to 4, characterized in that, include: The data perception layer acquires agricultural product traceability information through information collection devices; The data perception layer generates a signed data packet based on the agricultural product traceability information and a preset terminal private key, and transmits the signed data packet to the network transmission layer. The network transport layer broadcasts the received signed data packets to each blockchain node in the blockchain node set included in the blockchain service layer. Each blockchain node in the blockchain node set stores the signed data packet on-chain to obtain on-chain stored data. In response to the application presentation layer receiving a query request initiated by the user, the application presentation layer parses the query request to generate an agricultural product number, and initiates a data request to the blockchain service layer based on the agricultural product number; The blockchain service layer sends the corresponding on-chain stored data to the application presentation layer based on the agricultural product number of the received data request. The application presentation layer generates a visual webpage based on the received on-chain stored data and returns the visual webpage to the target terminal browser.
6. An information acquisition device, characterized in that, include: The acquisition unit is configured to acquire agricultural product traceability information; The generation unit is configured to generate a signed data packet based on the agricultural product traceability information and a preset terminal private key, and to transmit the signed data packet to the network transport layer.
7. A blockchain node device, characterized in that, include: The on-chain storage unit is configured to store the signed data packet on-chain, thus obtaining the on-chain stored data; The sending unit is configured to send the corresponding on-chain stored data to the application presentation layer based on the agricultural product number requested by the received data request.