Agricultural product whole-chain traceability method and device, medium and product

By generating privacy-compliant proofs through blockchain technology and zero-knowledge proof algorithms, and combining them with a trusted execution environment and blockchain architecture, the problem of data authenticity and lack of trust in centralized traceability systems is solved, realizing an efficient, reliable, and scalable traceability system for agricultural product traceability data.

CN121481571APending Publication Date: 2026-02-06BEIJING GREEN BALCONY ECOLOGICAL AGRICULTURE TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202511662008.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

Existing agricultural product traceability technologies rely on centralized databases, with highly centralized data management authority, making it difficult to guarantee the integrity and authenticity of the traceability chain, leading to a lack of trust between consumers and regulators.

Method used

It adopts blockchain technology, generates privacy compliance certificates through zero-knowledge proof algorithms, performs data signing in a trusted execution environment, combines the main chain and side chain architecture of the blockchain, stores encrypted traceability certificates, and provides differentiated data parsing and report generation mechanisms.

Benefits of technology

Without disclosing commercially sensitive information, the system ensures the authenticity and integrity of traceability data, improves the operational efficiency and scalability of the traceability system, meets the query needs of different users, and achieves a balance between precise supervision and the right to know.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121481571A_ABST
    Figure CN121481571A_ABST
Patent Text Reader

Abstract

The invention discloses an agricultural product whole-chain traceability method and device, a medium and a product, and relates to the technical field of agricultural product traceability. The method comprises the following steps: obtaining traceability data of a target agricultural product at each node and generating a privacy compliance proof; performing data signature on the traceability data of the initial node and the privacy compliance proof in the trusted execution environment to obtain an encrypted traceability certificate; determining any one of the plurality of intermediate nodes and the final node as a target node, and in the trusted execution environment, performing data signature on the hash value of the previous node, the traceability data of the target node and the privacy compliance proof to obtain an encrypted traceability certificate of the target node; storing all the encrypted traceability vouchers to a side chain of the block chain; all the hash values are anchored to the main chain of the block chain; determining the hash value of the final node as a root hash value, and generating a traceability code; and in response to a query instruction, tracing and analyzing all the encrypted tracing vouchers step by step. By implementing the technical scheme provided by the invention, the authenticity of the original data of agricultural product traceability can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of agricultural product traceability, and in particular to an agricultural product whole-chain traceability method, device, medium and product. BACKGROUND

[0002] Agricultural product quality and safety is the focus of public attention. With the increasing demand of consumers for food safety and transparency, agricultural product traceability technology has become a core component of smart agriculture. Establishing an effective whole-chain traceability system is an important means to ensure food safety. However, most existing agricultural product traceability technologies use centralized databases to store information, and the data is entered and managed by a single institution (usually the enterprise itself). Since the management authority is highly centralized, the operator has the ability to modify the historical data in the warehouse without leaving traces, which makes the integrity and authenticity of the traceability chain largely dependent on the self-discipline of the enterprise, making it difficult to gain the full trust of consumers and regulators, and reducing the authenticity of the original data of agricultural product traceability. SUMMARY

[0003] The embodiments of the present application provide an agricultural product whole-chain traceability method, device, medium and product, which are used to solve the technical problem of how to improve the authenticity of the original data of agricultural product traceability.

[0004] The technical scheme of the embodiments of the present application is as follows: In a first aspect, the embodiments of the present application provide an agricultural product whole-chain traceability method applied to an agricultural product whole-chain traceability system, wherein the agricultural product whole-chain traceability system at least includes an initial node, a plurality of intermediate nodes, a final node and a blockchain, and the blockchain includes a blockchain main chain and a blockchain side chain, and the method comprises the following steps: Respectively acquiring traceability data corresponding to the target agricultural product at the initial node, a plurality of intermediate nodes and the final node, wherein the traceability data includes public data and private data; Generating a corresponding private compliance proof based on the private data through a zero-knowledge proof algorithm; Performing data signature on the traceability data corresponding to the initial node and the private compliance proof in a trusted execution environment of the initial node to obtain an encrypted traceability credential corresponding to the initial node; Determining any one of a plurality of intermediate nodes and the final node as a target node, and obtaining the encrypted traceability credential of the target node according to the following steps: Performing data signature on the hash value of the encrypted traceability credential of the previous node of the target node, the traceability data corresponding to the target node and the private compliance proof generated by the target node in a trusted execution environment of the target node to obtain the encrypted traceability credential of the target node; The encrypted traceability certificate corresponding to each node is respectively stored to the side chain of the blockchain; The hash values corresponding to all the encrypted traceability certificates from the initial node to the final node are sequentially anchored to the main chain of the blockchain, and the main chain of the blockchain is used to provide a traceability entry; The hash value corresponding to the final node is determined as a root hash value; Based on the root hash value, a traceability code corresponding to the target agricultural product is generated; In response to a query instruction from a user to the traceability code, the root hash value stored in the main chain of the blockchain is extracted; Based on the root hash value, all the encrypted traceability certificates corresponding to the final node to the initial node are traced and parsed level by level.

[0005] Optionally, the privacy compliance proof corresponding to the privacy data is generated by a zero-knowledge proof algorithm, including: based on a preset privacy compliance rule, performing logical operation on the privacy data to generate a compliance condition, the preset privacy compliance rule being used to define a data condition that needs to be met by the privacy data; based on the zero-knowledge proof algorithm, receiving the privacy data as a secret input and receiving the compliance condition as a public input, obtaining the privacy compliance proof, the privacy compliance proof being used to verify whether the privacy data meets the privacy compliance rule without leaking the specific content of the privacy data.

[0006] Optionally, the traceability data corresponding to the initial node and the privacy compliance proof are data signed in the trusted execution environment of the initial node to obtain the encrypted traceability certificate corresponding to the initial node, including: in the trusted execution environment, generating a unique identity identifier and a key corresponding to the initial node, the key including a public key and a private key; assembling the traceability data corresponding to the initial node and the privacy compliance proof and the unique identity identifier to form a to-be-signed data set; signing the to-be-signed data set by the private key; combining the data signature, the public key and the to-be-signed data set to obtain the encrypted traceability certificate corresponding to the initial node.

[0007] Optionally, before the traceability data corresponding to the initial node and the privacy compliance proof are data signed in the trusted execution environment of the initial node, the method further includes: in the trusted execution environment, calculating a hash value of the traceability data corresponding to the initial node; matching the hash value with a preset hash reference value to obtain a hash value matching result; if the hash value matching result is a matching success, the traceability data passes the integrity check, and the data signing step is performed.

[0008] Optionally, the tracing and resolving all encrypted traceable credentials corresponding to the initial node from the final node based on the root hash value comprises: tracing all hash values corresponding to the initial node from the final node based on the root hash value; extracting encrypted traceable credentials corresponding to each hash value; resolving the public data in each encrypted traceable credential; and generating a first visual traceable report based on the public data.

[0009] Optionally, the privacy data at least includes pesticide use dosage, fertilizer component proportioning, and additive dosage in a processing procedure, and after the generating a first visual traceable report based on the public data, the method further comprises: if the user has a supervisory authority, resolving the public data and the privacy data in each encrypted traceable credential; and generating a second visual traceable report based on the public data and the privacy data.

[0010] Optionally, the agricultural product whole-chain traceable system further comprises a storage unit configured to store original data of the traceable data.

[0011] In a second aspect, an embodiment of the present application provides an agricultural product whole-chain traceable device, which comprises one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes comprising computer instructions, and the one or more processors are configured to invoke the computer instructions to enable the agricultural product whole-chain traceable device to perform the method described in the first aspect and any possible implementation manner of the first aspect.

[0012] In a third aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an agricultural product whole-chain traceable device, enable the agricultural product whole-chain traceable device to perform the method described in the first aspect and any possible implementation manner of the first aspect.

[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium comprising instructions, which, when executed on an agricultural product whole-chain traceable device, enable the agricultural product whole-chain traceable device to perform the method described in the first aspect and any possible implementation manner of the first aspect.

[0014] In summary, the one or more technical solutions provided by the present application have at least the following technical effects or advantages: By dividing the full-chain traceability data into public data and private data, and using zero-knowledge proof algorithm to process the private data (such as pesticide dosage, fertilizer component ratio, etc.), a privacy compliance proof is generated. Without directly revealing specific numerical values and other business sensitive information, it can prove to consumers or regulators that the production, processing and other links meet the preset compliance rules (such as pesticide residue standards, additive use specifications, etc.), effectively solving the contradiction between complete disclosure that may lead to business secret leakage and non-disclosure that leads to lack of trust in traditional traceability, realizing data credible verification, and improving the authenticity of original traceability data.

[0015] By performing data signature operations in the trusted execution environment (TEE) of each node, including generating identity and key, assembling data to be signed, and signing using private key, an encrypted traceability certificate is formed. It can ensure that the key signature process is executed in a hardware isolated and protected environment, effectively preventing malware attacks, data tampering or fake signatures, and ensuring the authenticity, integrity and non-repudiation of each traceability certificate from the source.

[0016] By adopting the main chain + side chain blockchain architecture, the encrypted traceability certificate containing detailed information is stored in the blockchain side chain, while only the corresponding hash value (data fingerprint) of each certificate is anchored in the main chain in order, and the hash of the final node is used as the root hash value. It can greatly reduce the storage and computing burden of the main chain, and improve the operation efficiency and scalability of the entire traceability system. When users query, they only need to obtain the root hash as the entrance from the lightweight main chain, and can trace back and verify the entire chain, realizing fast, efficient and complete on-chain traceability.

[0017] By providing different data parsing and report generation mechanisms for users with different permissions, when ordinary users query the traceability code, the system only parses and displays public data, and generates a first visual traceability report; while users with regulatory authority can further parse the private data in the certificate, and generate a second visual traceability report containing more detailed information. It can perform fine access control according to user roles and permissions, meet the information right of ordinary consumers from the field to the table, and meet the needs of regulatory agencies for deep review and audit, realizing differentiated services and precise regulation of traceability information.

[0018] By calculating the hash value of the traceability data in the trusted execution environment before signing, and matching it with the preset hash reference value, and storing the original data in a separate storage unit, it can add an integrity check before the data is recorded on the chain, preventing incomplete or incorrectly formatted data from being recorded, and ensuring the quality of the data on the chain. At the same time, independent storage of original data provides a final data basis for possible deep audit and dispute resolution, constituting a dual guarantee of on-chain record and off-chain check. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 is a flowchart of a method for agricultural product whole-chain traceability provided by an embodiment of the present application; Figure 2 is a flowchart of generating a privacy compliance proof provided by an embodiment of the present application; Figure 3 is a flowchart of generating an initial node encrypted traceability credential provided by an embodiment of the present application; Figure 4 is another flowchart of a method for agricultural product whole-chain traceability provided by an embodiment of the present application; Figure 5 is a structural diagram of an agricultural product whole-chain traceability device provided by an embodiment of the present application.

[0020] The reference signs are explained as follows: 601, central processing unit; 602, read-only memory; 603, random access memory; 604, bus; 605, input / output interface; 606, input part; 607, output part; 608, storage part; 609, communication part; 610, driver; 611, detachable medium. DETAILED DESCRIPTION

[0021] In order to make the objectives, technical solutions and advantages of the present application clearer, the following will further describe the present application with reference to the accompanying drawings, and the described embodiments should not be regarded as limiting the present application, and all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0022] In the description of the embodiments of the present application, the words “exemplary”, “for example”, or “for instance” are used to represent an example, illustration or description. Any embodiment or design solution described as “exemplary”, “for example” or “for instance” in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design solutions. Rather, the words “exemplary”, “for example” or “for instance” are intended to present the relevant concept in a specific manner.

[0023] In the description of the embodiments of the present application, the term “first\second” is merely to distinguish similar objects, and does not represent a specific order of the objects. Understandably, “first\second” can be interchanged with a specific order or sequence as allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0024] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an integral module or unit that includes the functions of the module or unit. The terms "include", "contain", "have" and their variants mean "including but not limited to", unless otherwise specifically emphasized.

[0025] In the embodiments of the present application, the relevant data collection process should be strictly in accordance with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and within the scope of authorization of laws and regulations and the personal information subject, carry out subsequent data use and processing behavior.

[0026] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by a person skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0027] In the related art, information is stored by a centralized database, the data of which is entered and managed by a single institution (usually the enterprise itself), the management authority is highly centralized, and the authenticity of traceability is difficult to guarantee. To solve the above problems, the embodiments of the present application provide a method, device, medium and product for agricultural product whole chain traceability, which can effectively improve the authenticity of the original data of agricultural product traceability.

[0028] Figure 1 is a flowchart of the agricultural product whole chain traceability method provided by the embodiments of the present application.

[0029] The embodiments of the present application disclose an agricultural product whole chain traceability method, which is applied to an agricultural product whole chain traceability system. The agricultural product whole chain traceability system at least includes an initial node, a plurality of intermediate nodes, a final node and a block chain. The block chain includes a block chain main chain and a block chain side chain, as shown in Figure 1 The method comprises the following steps: Step S101, respectively acquiring traceability data corresponding to the target agricultural product at the initial node, the plurality of intermediate nodes and the final node, the traceability data including public data and private data.

[0030] Specifically, the traceability data of each node is automatically acquired, cleaned and integrated through the communication network between the agricultural product whole-chain traceability system and each node to form a structured traceability dataset covering the whole chain, ensuring the complete correspondence of data in terms of source, timestamp and node attribution, such as the seed source, fertilization record, quarantine certificate and other data of the planting base or breeding farm as the traceability data of the initial node, the processing technology parameters, storage environment temperature and humidity, logistics track and other information of the processing, storage and transportation links as the traceability data corresponding to multiple intermediate nodes; the final node points to the sales terminal, and the distributor information, sales time and place and other data need to be collected as the traceability data, which is not specifically limited here. The traceability data is composed of public data and private data, the public data includes product batch number, production date and other information that can be publicly queried, and the private data involves detailed operation records or supplier identity and other sensitive contents of the enterprise.

[0031] Among them, the initial node represents the starting link of the agricultural product supply chain, which refers to the initial production or harvesting stage of agricultural products, such as crop planting fields or livestock breeding sites, used to represent the beginning of the product life cycle; the multiple intermediate nodes refer to the processing, storage, transportation and other intermediate links in the process from production to consumption of agricultural products, such as processing plants, warehouses or logistics transfer stations, representing multiple entity stages in the supply chain; the final node represents the last link before the agricultural products reach the consumers, which refers to retail stores, supermarkets or direct sales platforms, etc. sales terminal, used to represent the end point of product circulation; the traceability data refers to the collection of historical information recording the attributes, states and operations of agricultural products at each node, including text, numerical value, image and other forms, used to realize the traceability of product source and flow direction; the public data refers to the information that can be disclosed to the public without obstacles, which refers to non-sensitive data such as product general description, certification mark, etc. such as production batch or shelf life, used to provide basic traceability query service; the private data refers to restricted access information involving business secrets or personal privacy, such as supplier contact information or internal cost details, etc., representing sensitive content that needs to be authorized to obtain.

[0032] For example, an organic rice production enterprise collects product data through the deployed traceability system: at the initial node (planting base), the soil sensor is used to acquire the pH value data (private data), and the planting date (public data) is recorded; at the intermediate node (processing plant), the equipment monitoring system is used to acquire the rice milling precision parameters (private data), and the processing batch number (public data) is generated; at another intermediate node (cold chain warehouse), the temperature and humidity recorder is used to acquire the storage environment data (private data), and the warehousing time (public data) is recorded; at the final node (supermarket sales point), the POS system is used to acquire the sales time (public data), and the member purchase record (private data) is associated. All data is automatically integrated by the agricultural product whole-chain traceability system.

[0033] Through the above-mentioned embodiments, the public and private data of each link of the supply chain is systematically collected, ensuring the continuity of the traceability information in the time and space dimensions, avoiding the breaking of the traceability chain due to missing node data, and distinguishing the data disclosure attributes, which not only meets the basic query needs of consumers, but also protects core business secrets. The complete data set provides a complete information base for subsequent quality analysis and problem positioning, directly improving the reliability and practicality of the traceability system.

[0034] In step S102, the corresponding private compliance proof is generated based on the private data through a zero-knowledge proof algorithm.

[0035] Specifically, without revealing any actual private data content, the compliance assertion to be proved is predefined, for example, the pesticide residue of the agricultural product is lower than the national standard value or the temperature during transportation is always between 2-8 degrees Celsius. The private data (such as laboratory test report original data, whole-process temperature sensor log) is taken as a private input, which is input into a specific zero-knowledge proof algorithm (such as zk-SNARKs, zk-STARKs) together with the public compliance standard (such as the national standard threshold), thereby constructing a proof circuit about the private input satisfying the public assertion relationship, and finally outputting a short, verifiable string, i.e. the private compliance proof. This proof itself does not contain any original private data, but any verifier (such as a regulatory agency or a consumer) who obtains this proof can use the corresponding verification key to ensure that the corresponding private data behind it indeed satisfies the established compliance rules.

[0036] Among them, the zero-knowledge proof algorithm represents an advanced class of cryptography protocols, which allows the prover to prove to the verifier that a certain assertion is true, without revealing any additional knowledge other than the assertion itself, and is a calculation method and mathematical framework for realizing trusted verification without transmitting data itself; the private compliance proof refers to the final output of the cryptographic voucher, which is the result of the zero-knowledge proof algorithm, indicating an electronic evidence that can exist independently and be verified, which indicates that the private data has complied with a certain established rule (such as regulations, standards or contract terms).

[0037] For example, assume that the temperature records (privacy data) of a batch of beef in cold chain transportation need to prove that the whole process is not higher than 4 degrees Celsius (compliance rules). Electronic devices (such as gateways on transport vehicles) collect all temperature sensor raw data at all time points, but do not upload them directly. Instead, it runs the zk-SNARKs algorithm with these data as input. The algorithm internally checks whether each data point is ≤4℃, and generates a very small proof file (e.g. only a few hundred bytes) accordingly. Subsequently, when retailers or regulators query the traceability information, they can only see the public data (such as normal transportation) and this additional proof file. They use the public verification key to verify the proof, and the system returns a result that the proof is valid, thereby ensuring that the temperature is compliant throughout the process, but never knowing any specific temperature readings.

[0038] Through the above embodiment, the privacy data is processed by the zero-knowledge proof algorithm to generate a compliance proof, which first separates the data value and details, so that the compliance can be trusted and verified without exposing the original sensitive information. The complex compliance audit is converted into an efficient and automatically executable verification process, greatly reducing the cost and privacy leakage risk of third-party verification. It provides a paradigm for sharing and using sensitive data in the supply chain, which not only protects the privacy rights and business secrets of data subjects, but also meets the needs of regulatory transparency and consumer trust.

[0039] Figure 2 FIG. 1 is a schematic diagram of a process for generating a privacy compliance proof provided by an embodiment of the present application.

[0040] On the basis of the above embodiment, as an optional embodiment, referring to Figure 2 , the step S102 shown in Figure 1 may be implemented by steps S201-S202 of Figure 2 , which will be described in detail below.

[0041] In step S201, the privacy data is logically operated based on a preset privacy compliance rule to generate a compliance condition, and the preset privacy compliance rule is used to define the data condition that the privacy data needs to meet.

[0042] Specifically, the system first pre-stores a series of privacy compliance rules in a machine-readable format (such as logical expressions, scripts, or configuration parameters), which clearly specify the standards that privacy data must meet in terms of legality, ethics, and business norms, and extracts specific privacy data of the target agricultural product and substitutes it as an operation element into these rules for logical operation. This operation is not just simple arithmetic calculation, but can include a series of processes based on Boolean logic (such as AND, OR, NOT), comparison operations (such as greater than, equal to, contained in), and more complex function operations (such as data desensitization intensity verification, specific pattern matching). The ultimate purpose of the operation is not to output the data itself, but for each rule, to obtain a Boolean result (true or false) about whether the corresponding privacy data meets the rule, which is the compliance condition, for example, for a rule, a condition indicating that the data is compliant or the data is not compliant is generated, and all these generated conditions collectively constitute a quantitative and formalized description of the compliance status of the target agricultural product privacy data.

[0043] Among them, the preset privacy compliance rule refers to the standard and clause set pre-configured in the system by the administrator or regulatory requirements to judge whether the privacy data is legal, which is the digital form of a series of conditional statements, such as the supplier's ID number must be desensitized or the product's internal cost field cannot be empty, which is used to provide judgment basis for automated compliance review; the compliance condition refers to the specific result generated after logical operation, which is a Boolean assertion (True / False) representing the compliance status of a single or multiple privacy data with respect to a certain preset rule, such as data desensitization compliance=True, temperature record completeness=False, which is used to clearly identify the specific compliance status of each check item.

[0044] For example, in a pig traceability scenario, the preset privacy compliance rules include: rule 1 (data integrity): the veterinary inspection report number at the slaughter stage cannot be empty; rule 2 (data format): the farmer's ID number field must be in desensitized format (such as 110123X); rule 3 (business logic): the market weight must be between 50kg and 200kg. After the system obtains the privacy data of a batch of pigs, it will perform logical operation one by one: for rule 1, check whether the veterinary inspection report number field has a valid value, generate the compliance condition report number integrity=True; for rule 2, use regular expression to match whether the farmer's ID number field conforms to the desensitized format, generate the compliance condition ID number format compliance=True; for rule 3, compare the market weight=180kg with the rule condition, generate the compliance condition market weight compliance=True.

[0045] At step S202, based on the zero-knowledge proof algorithm, the privacy data is received as a secret input, and the compliance condition is received as a public input, to obtain a privacy compliance proof, which is used to verify whether the privacy data satisfies the privacy compliance rule without leaking the specific content of the privacy data.

[0046] Specifically, the system inputs the original privacy data (such as specific detection values, internal identifiers, etc.) that needs to be kept secret as a secret input that is never leaked to the outside, and inputs the explicit compliance condition (such as detection qualification, temperature within the range, etc. Boolean assertion) as a public parameter, into the selected zero-knowledge proof algorithm (such as zk-SNARKs), in a completely closed computing environment, through steps such as constructing arithmetic circuits and generating proof keys, the relationship between the secret input and the public input is mathematically coded and operated, and finally a small-sized but complete verification information containing cryptographic voucher, i.e. privacy compliance proof, is output. The generated proof has two key features: on the one hand, any verifier can use the corresponding public verification key to confirm the authenticity of the statement that the privacy data satisfies the compliance condition; on the other hand, the specific content of the original privacy data as the secret input remains encrypted throughout the proof generation and verification process, and the verifier cannot obtain any byte information about the privacy data itself.

[0047] Among them, the public input refers to the parameter provided for the zero-knowledge proof algorithm, which is known by both parties and can be publicly disclosed, which refers to the role of the compliance condition in the proof process, which is used to build a publicly verifiable proof basis.

[0048] For example, in organic vegetable traceability, the system inputs the specific detection value (0.05mg / kg as privacy data / secret input) of pesticide residues and the conclusion that the residue is less than the national standard 0.1mg / kg (as compliance condition / public input) into the zero-knowledge proof algorithm. After the algorithm runs, a cryptographic proof is generated. When the regulatory agency inspects, it only needs to verify this proof to be sure that the pesticide residue is indeed up to standard, but the specific value of 0.05mg / kg cannot be known throughout the process, effectively protecting the accuracy of the detection data of the enterprise.

[0049] At step S103, the initial node corresponding to the traceability data and the privacy compliance proof are data signed in the trusted execution environment of the initial node, to obtain the initial node corresponding to the encrypted traceability voucher.

[0050] Specifically, it is ensured that all operations are completed in the isolated safe area of the trusted execution environment (TEE), the security of key and data operation is ensured through the tamper-proofing feature thereof, the complete traceability data collected by the initial node and the previously generated privacy compliance proof are structured and assembled, the digital signature algorithm (such as the signature scheme based on SM2 or RSA) is executed by using the pre-injected TEE cryptographic key, and finally an encrypted traceability credential with uniqueness, non-repudiation and integrity is output. The credential serves as an encapsulation carrier of the data credibility of the initial node, and simultaneously contains the publicly verifiable data content and the cryptographic guarantee of the authenticity thereof.

[0051] Among them, the trusted execution environment refers to an isolated secure computing area in the main processor, which is ensured by a hardware protection mechanism that the internally loaded code and data are not affected by external malicious software in terms of confidentiality and integrity, and is used to provide a secure execution sandbox for critical operations; the data signature refers to a process of performing mathematical operation on specific data by using a private key in asymmetric cryptography, a digital string corresponding to the data content and the key of the signer is generated by calculation, and is used to verify the authenticity of the data source and the integrity of the transmission process; the encrypted traceability credential refers to the final output result formed after signature processing, which is a structured data packet containing original data, compliance proof and digital signature, and is used as a comprehensive proof of the credibility of the node data.

[0052] Through the above embodiments, the node data and the compliance proof are jointly signed in the trusted execution environment to generate an encrypted credential, the hardware-level security capability of the TEE is used to ensure that the signature key and the signature process cannot be stolen or tampered with, the credibility of the credential is ensured from the root, the data content and the compliance proof are bound and signed, the credential has the dual attributes of data authenticity guarantee and privacy compliance status proof, the practical value of the credential is greatly improved, an independently verifiable and irrefutable trust anchor is provided for the subsequent link of the traceability chain, a solid foundation is laid for building an end-to-end trusted traceability system, and the problem of collaborative implementation of data source credibility and privacy protection is effectively solved.

[0053] Figure 3 is a flowchart of generating an encrypted traceability credential of an initial node provided by the embodiments of the present application.

[0054] On the basis of the above embodiments, as an optional embodiment, referring to Figure 3 , the step S103 shown in Figure 1 may be implemented by the steps S301-S304 of Figure 3 , which will be specifically described below.

[0055] Step S301, in the trusted execution environment, a unique identity identifier corresponding to the initial node and a key are generated, the key including a public key and a private key.

[0056] Specifically, in the hardware isolated secure area of the trusted execution environment, a globally unique identity identifier can be generated using a hash algorithm or a UUID generation mechanism, ensuring that each node has a non-repetitive identity code in the traceability system. Then a standard asymmetric encryption algorithm such as elliptic curve cryptography or RSA is used to generate a key pair, which is not specifically limited here. The private key is securely stored immediately after being generated in the trusted execution environment and never disclosed, and the public key can be exported through a secure channel and submitted to the blockchain network or certificate authority for registration.

[0057] Wherein, the unique identity identifier represents a globally unique digital identity code, which is randomly generated using UUIDv4 or calculated based on the public key hash value, and is used to unambiguously identify a specific node in a distributed system; the key refers to a key pair combination used in asymmetric cryptography, including a mathematically related public key and private key, which is generated using standard algorithms such as elliptic curve secp256k1 or RSA-2048, and is used to implement digital signature and encrypted communication; the public key represents a publicly distributed encryption key, which is published externally through a certificate or blockchain registration, and is used to verify digital signatures and encrypted data sent to the node; the private key represents a decryption key that must be strictly kept secret, which is only used within the trusted execution environment and never disclosed, and is used to generate digital signatures and decrypt received data.

[0058] Through the above embodiments, the generation of node identity and key in the trusted execution environment is completed, ensuring the security and unobservability of the key material generation process, fundamentally preventing the risk of private key leakage. The unique identifier generated based on the strong randomness of cryptography effectively avoids node identity conflicts and forgery problems, establishing a clear identity recognition system for the distributed traceability system. This mechanism provides a reliable security foundation for all subsequent data signature and exchange operations, enabling each node to participate in the construction of the traceability chain in a verifiable manner, while meeting the core requirements of data source authenticity and operation non-repudiation.

[0059] Step S302, assemble the traceability data corresponding to the initial node, the privacy compliance proof, and the unique identity identifier to form a set of data to be signed.

[0060] Specifically, under the protection of the trusted execution environment, three key elements are logically associated and formatted: one is the complete traceability data collected from the initial node, including product basic information and process records, etc. The second is the privacy compliance proof generated by zero-knowledge proof technology, which is a cryptographic certificate for verifying data compliance. The third is the unique identity identifier representing the identity of the initial node. During assembly, these elements are serialized into a structured data set according to the predefined data format specification (such as JSON, XML or ProtocolBuffers, etc.), and the final output is a signed data set.

[0061] Among them, the signed data set represents the complete data packet formed after assembly processing, which is a structured data object containing all necessary elements and ready for digital signature operation, used as input content for digital signature algorithm.

[0062] Through the above embodiment, the traceability data, compliance proof and identity identifier are structured and assembled to form a signed data set, establishing a complete association between data source, content and compliance status, ensuring the comprehensiveness and consistency of the signature object, and providing a clear and complete processing object for subsequent digital signature operation through standardized data format integration, avoiding verification failure due to data missing or format confusion, and enhancing the reliability and verifiability of the entire traceability system.

[0063] Step S303, signing the signed data set by private key.

[0064] Specifically, under the strict protection of the trusted execution environment, a structured signed data set can be calculated by a cryptographic hash function (such as SHA-256) to generate a fixed-length message digest, which is a unique digital fingerprint of the data set. Based on the signature algorithm (such as ECDSA or RSA-PSS), the private key is used to encrypt the message digest to generate a unique digital signature value. The final output is a complete data packet composed of the original signed data set and the corresponding digital signature.

[0065] In the traceability scenario of organic vegetable farms as initial nodes, the trusted execution environment of the farm server stores the private key of the farm. The signed data set containing the vegetable planting records, pesticide residue detection compliance proof and farm identity is signed by the ECDSA algorithm: first, the data set is hashed by SHA-256, and then the private key is used to encrypt the hash value to generate a digital signature. The final encrypted traceability certificate contains the original data set and the corresponding digital signature, which can be used by any relevant party to verify the farm's public key.

[0066] Through the above embodiment, the data signature, the public key, and the to-be-signed data set are combined to establish an undeniable binding relationship between the data and a specific node, ensuring that any third party can verify that the data indeed comes from the claimed node using the corresponding public key. The integrity protection mechanism provided by the digital signature can detect whether the data has been tampered with after signing, effectively ensuring the authenticity and reliability of the traceability data.

[0067] In step S304, the data signature, the public key, and the to-be-signed data set are combined to obtain the encrypted traceability credential corresponding to the initial node.

[0068] Specifically, under the protection of the trusted execution environment, the three core elements are integrated: the just-generated data signature, the public key corresponding to the signature private key, and the original to-be-signed data set. The assembly process serializes these three parts into a complete, independently distributable data package according to the predefined credential format specification, and the final output is the encrypted traceability credential corresponding to the initial node.

[0069] Through the above embodiment, the data signature, the public key, and the to-be-signed data set are combined to establish an undeniable binding relationship between the data and a specific node, ensuring that any third party can verify that the data indeed comes from the claimed node using the corresponding public key. The integrity protection mechanism provided by the digital signature can detect whether the data has been tampered with after signing, effectively ensuring the authenticity and reliability of the traceability data.

[0070] In step S104, any one of the plurality of intermediate nodes and the final node is determined as a target node, and in the trusted execution environment of the target node, the hash value of the encrypted traceability credential of the previous node of the target node, the traceability data corresponding to the target node, and the privacy compliance proof generated by the target node are data signed to obtain the encrypted traceability credential of the target node.

[0071] Specifically, the target node here refers to the final node or any intermediate node in the supply chain. In the secure isolation area of the trusted execution environment of the target node, the encrypted traceability credential of the previous node (i.e., the direct upstream node in the supply chain) is obtained and verified, and the cryptographic hash value of the credential is calculated. This hash value serves as a cryptographic link connecting upstream and downstream data. The hash value, the traceability data corresponding to the target node (such as processing parameters, storage environment, etc.), and the privacy compliance proof generated based on the self-privacy data through the zero-knowledge proof algorithm are assembled. After assembly, the new data set is data signed using the private key of the target node. The new data signature, the public key of the target node, and the data set containing the three elements are combined to obtain a new encrypted traceability credential representing the target node.

[0072] Wherein, the target node refers to any node in the supply chain except the initial node, which can be an intermediate node such as a processing plant or a warehouse, or a final node such as a supermarket, used to represent the entity currently processing data; the previous node refers to the adjacent node directly upstream of the target node in the supply chain sequence, for example, for a warehouse, its previous node can be a processing plant, used to establish a direct front-back association relationship between nodes; the hash value refers to a fixed length, unique corresponding digital fingerprint obtained by calculating the encrypted traceability certificate of the previous node through a cryptographic hash function, used to represent the upstream complete data chain in the form of ciphertext, ensuring the integrity of the chain connection.

[0073] Through the above embodiment, the target node jointly signs the hash value of the previous node certificate, its own traceability data and compliance proof, creating a cryptographic link, so that any tampering with historical data will cause all subsequent node hash value verification to fail, thereby ensuring the integrity of the entire data chain, decoupling local data verification of the node from global chain verification, each node only needs to verify the certificate of its direct predecessor, and the entire historical chain can be trusted, realizing efficient transmission and expansion of trust. This chain-based certificate structure provides independent verifiable and non-repudiable electronic evidence for product circulation track, greatly enhancing the anti-counterfeiting ability and overall credibility of the traceability system, solving the problem of data silos and trust transmission in a multi-agent environment.

[0074] Step S105, the encrypted traceability certificate corresponding to each node is respectively stored to the side chain of the block chain.

[0075] Specifically, in the agricultural product traceability system, the encrypted traceability certificates automatically generated by each node (including the initial node, all intermediate nodes and final nodes) on the supply chain are packaged by each node or a unified collector, verified through the consensus mechanism (such as authority proof, proof of stake, etc.) of the side chain, and confirmed by the nodes in the side chain network in the form of transaction, and encapsulated into a new block. Each encrypted traceability certificate is permanently recorded on the distributed ledger of the side chain as an independent transaction or combined with other certificates of the same batch into a transaction, and the side chain ensures the security of its own state through cross-chain mechanism (such as anchoring, relay) with the main chain.

[0076] Wherein each node refers to all entities participating in information recording on the agricultural product supply chain, including the initial node of production, intermediate nodes such as processing, transportation, and storage, and the final node of sales, for representing all source parties of traceability data; the blockchain refers to a decentralized distributed database technology that uses chain block structure, cryptography hash, and consensus algorithm to ensure data non-tamperability and traceability, and is used as a trusted storage base for traceability data; the side chain refers to a blockchain system running in parallel with the main blockchain but independent of each other, which interacts with the main chain through a two-way anchoring mechanism for value or information, is an affiliated chain with independent consensus rules and functions, and is used to expand the performance of the main chain and process massive data in specific scenarios.

[0077] Through the above embodiments, the encrypted traceability credentials of each node are respectively stored in the blockchain side chain, which takes advantage of the independence and scalability of the side chain, effectively avoids the performance bottleneck and high cost of the main chain, makes it possible to store massive traceability data at low cost and high efficiency, provides strong tamper-proof protection and traceable verification capability for credential data, greatly enhances the public credibility of data, and lays a solid data foundation for building a transparent, trustworthy, and efficient agricultural product traceability ecosystem, realizing the generation of traceability data in a trusted environment, the transmission under cryptography protection, and the permanent record in a distributed ledger.

[0078] Step S106, the hash values corresponding to all encrypted traceability credentials from the initial node to the final node are anchored to the blockchain main chain in order, and the blockchain main chain is used to provide a traceability entry.

[0079] Specifically, all encrypted traceability credentials generated from the initial node to the final node in the whole process of the supply chain are calculated to obtain their corresponding cryptographic hash values, and an ordered hash value list is constructed in the order of nodes (i.e. the actual flow order of agricultural products). This ordered list is further hashed to generate a Merkle tree root hash or an aggregated hash, and finally the root hash value representing the complete traceability chain is recorded on the blockchain main chain through cross-chain protocol or anchoring transaction. The blockchain main chain, as the trust anchor and global entry of the entire system, ensures the integrity and timestamp proof of the root hash value and the entire credential sequence it represents due to its tamper-proof property.

[0080] Wherein the blockchain main chain refers to the underlying distributed ledger that undertakes core value flow and security protection, and is used to provide the highest level of security and credibility; the traceability entry refers to the starting point of query and verification provided for external users or systems, which is usually a blockchain browser, DApp interface, or code scanning function, and is used to guide users to enter and verify the entire traceability chain.

[0081] By the above embodiment, the hash values of all node credentials are sequentially anchored to the main chain of the blockchain, providing a minimalist but extremely solid trust anchor for the entire traceability chain. Any tampering with any credential in the side chain will result in a hash value that does not match the main chain record. The main chain, as a unified and easily accessible traceability entry, provides a simple and reliable way for users to initiate and trust the verification of the entire complex traceability process, skillfully balancing data transparency, storage cost and system reliability.

[0082] Step S107, determine the hash value corresponding to the final node as the root hash value.

[0083] Specifically, a Merkle tree (Merkle Tree) or other cryptographic data structure can be used, and the hash values of all encrypted traceability credentials are used as leaf nodes for layer-by-layer hash operations. Finally, in the completed Merkle tree, the only top-level hash value at the top of the tree, which is finally derived from all lower-level hash values, is determined as the root hash value. This root hash value is mathematically directly dependent on the hash value of the final node credential (because it is at the end of the sequence, its hash value is one of the last inputs for building the tree), but essentially it represents the collective fingerprint of all credentials from the initial node to the final node.

[0084] The root hash value refers to the final hash value at the top layer of a Merkle tree or similar hash tree structure, which is derived from the hash values of all bottom layer data blocks at each level. It is a top-level cryptographic digest that can represent the integrity of the entire data set, used for efficient and secure integrity verification of the entire data set.

[0085] For example, assume that a batch of apple traceability chain contains three nodes: orchard (initial node), cold chain logistics (intermediate node), and fruit store (final node). The system first calculates the hash values of the encrypted traceability credentials of the three nodes, denoted as H1, H2, and H3. Then a Merkle tree is constructed: first calculate the hash of H1 and H2 to get H12, then calculate the hash of H12 and H3 to get the root hash Root. In this structure, the hash value H3 of the final node (fruit store) is one of the direct inputs for calculating the root hash Root. Therefore, Root is finally determined as the root hash value of the entire batch of apple traceability data, and it is anchored to the main chain of the blockchain.

[0086] By the above embodiment, the hash value corresponding to the final node is determined as the root hash value, establishing the trust anchor for the entire traceability data set, so that consumers or regulatory agencies can efficiently and reliably trust a long and complex product circulation history by verifying a simple root hash value.

[0087] Step S108, based on the root hash value, generate the traceability code corresponding to the target agricultural product.

[0088] Specifically, an identifier is generated for user convenience using the determined root hash value. The process first takes the root hash value representing the integrity of the entire supply chain data as the core input, combines it with the specific identifier of the enterprise or product (such as brand code, batch number), and processes it through an encoding algorithm (such as Base58, Base64, or binary to hexadecimal, etc.) to generate a string or two-dimensional code of moderate length, easy for machine recognition and manual processing. To enhance practicality and prevent errors, a check code mechanism (such as CRC check) is usually introduced. The final generated traceability code is a digital identity label that converts complex cryptographic summaries into user-friendly forms, serving as the only key to access the entire blockchain traceability data.

[0089] wherein the traceability code refers to the final digital code generated for querying and verifying traceability information, which is a string or graphic code (such as two-dimensional code, bar code) formed by encoding the root hash and other data, used as an entry credential for users to access traceability information.

[0090] Through the above embodiments, the traceability code corresponding to the target agricultural product is generated based on the root hash value, realizing the conversion of underlying complex cryptographic evidence into a simple access interface for users, greatly reducing the use threshold of end users, improving the usability and popularity of the traceability system, and truly realizing the value landing of blockchain traceability technology from concept to practical application.

[0091] Step S109, in response to the query instruction of the traceability code from the user, the root hash value stored in the blockchain main chain is extracted.

[0092] Specifically, when the terminal device (such as a mobile scanner or computer client) receives the user's query instruction for the traceability code, the system parses this code into the corresponding root hash value or directly as a query index, and through the node interface (such as remote procedure call or blockchain browser API) of the blockchain main chain, the traceability code or the parsed root hash value is used as the key query condition to search for the matching anchor record in the distributed ledger of the main chain. After finding the transaction containing the record, the system extracts the complete root hash value from the transaction data (such as OP_RETURN field or smart contract state).

[0093] wherein the user refers to the entity initiating the traceability query operation, which can be a consumer, a regulator, or a supply chain participant, representing the end user and service object of the traceability information; the query instruction refers to the data request signal issued by the user through scanning, inputting, or clicking, which is a structured command containing traceability code information, used to explicitly express the information acquisition intention to the system.

[0094] Through the above embodiment, in response to the user query instruction, the root hash value stored in the main chain of the blockchain is extracted, a credible data verification process starting from user demand is established, and the core concept of providing bottom trust for the traceability system by the blockchain technology is realized.

[0095] In step S110, based on the root hash value, all encrypted traceability credentials corresponding to the final node to the initial node are traced and parsed level by level.

[0096] Specifically, based on the root hash value obtained from the main chain as a trust anchor, the encrypted traceability credential of the final node is located in the side chain storage, and the integrity of the entire Merkle tree or hash sequence to which it belongs is verified using the root hash value. After verification, the encrypted traceability credential of the final node is parsed, and the key information (such as product status, operation time, etc.) and the hash value of the credential of the previous node (i.e. the direct upstream supplier) are extracted. The hash value is used as an index to search and obtain the encrypted traceability credential of the previous node in the side chain, which is also parsed and information is extracted, and the hash value of the further previous node is obtained. This process is repeated along the reverse direction of the supply chain (from the final node to the initial node), and the credentials of each node are traced and verified until the credential of the initial node is parsed and verified. Finally, all the parsed data of the nodes on the complete chain (such as operation details, responsible subjects, time and place, etc.) are integrated to restore the credible history of the target agricultural product from the origin to the end point.

[0097] Through the above embodiment, a complete and verifiable product circulation evidence chain is constructed, so that each link of the product from production to consumption can be traced, greatly enhancing the transparency and credibility of the traceability information, and realizing the perfect unity of technical credibility and practicality.

[0098] Figure 4 is another flowchart of an agricultural product full-chain traceability method provided by the embodiment of the present application.

[0099] Based on the above embodiment, as an optional embodiment, referring to Figure 4 , the step S110 shown in Figure 1 may be implemented by the steps S401-S406 of Figure 4 , which will be described in detail below.

[0100] In step S401, based on the root hash value, all hash values corresponding to the final node to the initial node are traced level by level.

[0101] Specifically, based on the root hash value obtained from the blockchain main chain as the benchmark for integrity verification, the validity of the root hash value is first verified in the Merkle tree structure stored in the side chain, confirming that the entire data set has not been tampered with. The system starts from the leaf node hash representing the final node and derives the intermediate hash values step by step through the sibling node hashes of the Merkle tree, verifying the correctness of each intermediate hash value and recording all hash values on the complete path from the root node to the final node leaf hash. The system locates the second-to-last node's certificate based on the previous node certificate hash value (as a chain pointer) stored in the final node's encrypted traceability certificate, and obtains its hash value, and verifies its position in the Merkle tree in the same way until the initial node's certificate hash is verified and recorded. Finally, the system obtains a complete sequence of hash values from the final node to the initial node that has been completely verified.

[0102] For example, assume that a batch of fruits has a traceability chain containing a orchard, a processing plant, a logistics center, and a supermarket, with their certificate hash values being H1, H2, H3, and H4, respectively, and the root hash of the constructed Merkle tree being R. When a consumer queries, the system first verifies the integrity of the entire tree using R on the main chain. Then, starting from H4 of the supermarket node (the final node), the correctness of H4 is verified through the Merkle proof path, and the hash values H3, H2, H1, etc. are recorded. Next, the hash pointer (i.e., H3) pointing to the logistics center certificate is parsed from the H4 certificate, and the position of H3 in the tree is verified. This process is repeated step by step until the complete hash sequence [H4, H3, H2, H1] is obtained and the validity of each hash is verified.

[0103] Step S402, extract the encrypted traceability certificate corresponding to each hash value.

[0104] Specifically, after completing the step-by-step tracing and verification from the root hash value to each node hash value, the verified and sequentially arranged hash values (complete sequence from the initial node to the final node) are used as precise indexes to perform batch queries in the side chain database or distributed file system that stores the encrypted traceability certificates. Each hash value serves as a unique digital fingerprint of the corresponding certificate, and through the mapping relationship between the hash value and the storage location of the encrypted traceability certificate (such as a hash index table or content-addressed storage), the complete certificate data is extracted. These certificates typically include digital signatures, public keys, and encoded data sets to be signed, among other core components. The system performs preliminary format verification during the extraction process to ensure the structural integrity of each certificate, preparing for subsequent detailed parsing and verification.

[0105] Through the above embodiments, the encrypted traceability certificate corresponding to each hash value is extracted, first realizing the conversion from a cryptographic fingerprint to a complete data entity, enabling the abstract hash verification result to be associated with specific business traceability information, and completing the key connection between trusted verification and practical value.

[0106] Step S403, parse the public data in each encrypted traceability certificate.

[0107] Specifically, after successfully extracting all the encrypted traceability certificates of the nodes, the public data field in each encrypted traceability certificate is accessed, which is usually stored in an encoded form (such as Base64, JSON, etc.). Through the corresponding decoding algorithm and format parser, the system converts these encoded data into readable plaintext information, and performs necessary type conversion and structure reorganization. The parsed content includes product basic information, operation timestamp, node identity, compliance status summary, etc. non-sensitive information, while strictly excluding access to any privacy data field. The parsed results from all nodes are integrated in the order of the supply chain to form a complete publicly traceable information chain.

[0108] For example, when parsing a batch of cold-chain transported seafood traceability certificates, the system parses the fishing area (such as the Northwest Pacific), the fishing date, and the fishing boat number from the certificate of the fishing node; parses the processing type (such as quick freezing), the factory date, and the license number from the certificate of the processing plant; parses the transportation temperature range (such as -18℃ to -22℃) and the carrier name from the logistics certificate; and parses the on-shelf date and store address from the retailer's certificate. All these parsed public data are organized in chronological order and displayed to the querying consumer.

[0109] Through the above examples, the public data in each encrypted traceability certificate is parsed, which realizes the conversion of underlying cryptographic data packets into user-understandable business information, completes the key conversion from technical implementation to user value, and enhances the consumer's confidence in product quality and safety.

[0110] Step S404, generating a first visual traceability report based on the public data.

[0111] Specifically, based on the public data extracted and verified from the encrypted traceability certificates of each node, logical integration and content organization are performed according to the timeline and supply chain path. The report generation engine can be used to combine structured data such as text, numerical values, and timestamps with pre-set visual templates, and through elements such as charts, timelines, and map trajectories, the scattered public data can be converted into intuitive visual displays. The first visual traceability report focuses on the overall picture of product circulation, including key operation events, time nodes, geographical location migration, responsible subjects, and other core information of each node, forming a comprehensive traceability report for end users, which is easy to understand and presents the compliance circulation process from production to consumption.

[0112] The first visualized traceability report refers to a summary document formed after systematic analysis of the product circulation history, and is a structured display of key information of each link in the supply chain, used to prove the credibility of the product source and the transparency of the circulation process to the user.

[0113] Through the above embodiments, the scattered structured data is converted into a user-friendly visual narrative, greatly reducing the cognitive threshold for users to understand complex supply chain information, improving the usability and popularity of the traceability system, and realizing the value conversion of traceability technology from concept verification to practical application.

[0114] In step S405, if the user has supervisory authority, the public data and private data in each encrypted traceability credential are parsed.

[0115] Specifically, in the access control process of the traceability system, when the user's identity is verified and it is identified that he has higher-level supervisory authority, an enhanced data parsing mechanism will be triggered. After successfully extracting the encrypted traceability credentials of all nodes, not only the public data in the credentials will be parsed like ordinary users, but also the protected private data fields in the credentials will be decrypted and read using the decryption key or access token authorized for regulatory agencies. The complete data structure of the encrypted traceability credentials is accessed, including sensitive information that is usually hidden from the public, such as detailed pesticide residue specific values, internal cost details, supplier contact information, and non-de-identified original test reports.

[0116] The supervisory authority refers to a high-level system access right, which is a special credential granted by the system administrator to regulatory agency personnel, allowing them to view sensitive information beyond public data.

[0117] Through the above embodiments, the public and private data are parsed for users with supervisory authority, realizing hierarchical data access control and providing complete data transparency for necessary regulatory audits while protecting commercial privacy and personal information.

[0118] In step S406, a second visualized traceability report is generated based on the public data and the private data.

[0119] Specifically, based on the integrated complete data set, including regular public data and deeply decrypted private data, using an analysis model and a visualization template specially designed for regulatory audits, not only the basic path of product circulation is displayed, but also sensitive information such as accurate test values, internal operation logs, and supplier details is integrated into the visual chart in a compliant manner through cross-comparison, trend analysis, and anomaly detection, etc. A second visualized traceability report is generated, which contains the core evidence chain and deep analysis results. This report aims to meet the deep needs of regulatory agencies for traceability accuracy, evidence integrity, and problem troubleshooting.

[0120] The second visualized traceability report is a graphical summary document designed for regulatory review, containing deep information of the whole chain, and is composed of professional charts, evidence chain time sequence diagrams, abnormal data highlights, and other elements, and is used to support the decision-making of regulatory agencies.

[0121] For example, for a batch of organic vegetables, the second visualized traceability report generated by the system not only contains a time axis from planting to sales, but also embeds detailed pesticide use records (such as accurate dosage per mu) and soil detection raw data at the planting stage, additive input details and operator information at the processing stage, whole-process temperature sensor raw reading curve and threshold value exceeding warning at the logistics stage, and supplier qualification file link and internal sampling results at the sales stage. The report is signed by cryptography to ensure its effectiveness as legal evidence.

[0122] Through the above embodiments, a hierarchical transparent trust system is constructed, which not only guarantees the legitimate rights and interests of commercial subjects, but also provides a technical infrastructure for intelligent regulation, and realizes efficient cooperation between enterprise self-discipline and government regulation.

[0123] On the basis of the above embodiments, as an optional embodiment, see Figure 4 , the step S103 shown before also includes Figure 1 the steps S501-S503, which are described below. Figure 4

[0124] Step S501, in the trusted execution environment, a hash value of the traceability data corresponding to the initial node is calculated.

[0125] Specifically, in the hardware-level security isolation area of the trusted execution environment (TEE), the complete traceability data (including product identification, production records, environmental parameters, and other structured information) corresponding to the initial node is taken as input, and a built-in cryptographic hash function of the TEE is called. The function maps the traceability data of any length to a fixed length, nearly unique digital fingerprint, i.e. hash value. During the calculation process, the original traceability data is always in an encrypted or protected state, and once it leaves the TEE environment, the hash value cannot be reversely deduced to the original content. The final obtained hash value will serve as the only representative of the data integrity of the node, providing the most basic and core cryptographic material for building the entire encrypted traceability credential system, making data integrity verification possible, and being an indispensable key link for all subsequent trusted operations.

[0126] Step S502, match the hash value with a preset hash reference value to obtain a hash value matching result.

[0127] ​Specifically, the hash value of the initial node traceability data calculated previously is compared with one or more preset hash reference values defined in advance and stored securely. The preset hash reference value generally represents a standard hash calculated and stored in a trusted state (such as when the data is first authenticated), which can be derived from a standard database, a digital certificate, or a previous trusted record, and is completed by an accurate string or numerical comparison algorithm to check whether the two hash values are completely consistent, and output a hash value matching result of a Boolean type, which is explicitly marked as a match success or a match failure. The result reflects the consistency between the current data state and the preset reference.

[0128] The hash value matching result refers to the final conclusion of the matching operation, which is a state identifier indicating a match success or a match failure, and is used to indicate whether the current data passes the integrity verification.

[0129] Through the above embodiments, it can be quickly detected whether the data has been tampered with through simple hash comparison, greatly improving the verification efficiency of data credibility, providing a basic trust guarantee for the entire traceability system, and ensuring that only verified and complete data can continue to circulate and be used in the system.

[0130] Step S503, if the hash value matching result is a match success, the traceability data passes the integrity check, and the step of data signing is performed.

[0131] Specifically, after completing the hash value matching verification in the trusted execution environment, if the hash value matching result is a match success, it indicates that the traceability data of the current initial node is completely consistent with the preset reference state, and has not been tampered with or damaged. At this time, the system determines that the batch of data passes the integrity check, and then performs the subsequent cryptographic security operation, i.e., data signing. Once completed, it means that the initial node has made an electronic commitment with legal effect on the authenticity and integrity of the batch of data. If the hash value matching result is a match failure, the traceability data does not pass the integrity check and will not be operated subsequently.

[0132] The integrity check refers to a process of verifying whether the data has remained in its original state and has not been illegally changed during storage or transmission, and is a method of detecting data consistency by comparing hash values, which is used to ensure the authenticity and credibility of the data.

[0133] Through the above embodiments, a rigorous verification-before-signing workflow is constructed, ensuring that only authentic and complete data can be given an electronic signature with legal effect, thereby eliminating the risk of problem data being legalized from the source, and making the entire traceability chain based on these signed data have strong public credibility and evidence effectiveness.

[0134] On the basis of the above-mentioned embodiments, as an optional embodiment, the agricultural product whole-chain traceability system further comprises a storage unit, the storage unit being configured to store original data of the traceability data.

[0135] Specifically, in the overall architecture of the agricultural product whole-chain traceability system, the storage unit, as a core data persistence component, undertakes the key role of a bottom-layer data warehouse, and is usually composed of a distributed file system, a cloud storage service or a local secure database, without specific limitation here, and the core function thereof is to store original data of the traceability data collected from each node of the supply chain for a long time, safely and reliably. This includes all initial records without pruning or aggregation, such as original environmental parameters read by sensors, detailed records manually entered by operators, high-resolution image or video evidence, etc. These original data, as the cornerstone of the entire traceability information system, not only support the verification of the on-chain hash value, but also provide the most fundamental and irreplaceable evidence source when a dispute occurs or in-depth audit is performed.

[0136] Among them, the agricultural product whole-chain traceability system refers to a digital tracking management system covering all links from production to consumption, which is a software and hardware collection comprehensively using Internet of Things, blockchain and cryptography technology, and is used to realize the transparency and credibility of agricultural product circulation; the storage unit refers to a hardware or software module in the system specially responsible for data persistence, which is a data warehouse composed of a database server, a distributed file cluster, etc., and is used to provide stable and reliable data storage services for the system; the original data of the traceability data refers to initial data records generated at each node of the supply chain without any aggregation or integrity conversion, which are the most basic data forms of sensor readings, manually entered information, image files, etc., and are used as the ultimate factual basis for all subsequent processing and verification.

[0137] Through the above-mentioned embodiments, the special storage unit is arranged to save the original traceability data, thereby solving the bottleneck of high storage cost and limited capacity of the blockchain system, and through the hybrid architecture of on-chain storage and off-chain storage, the economic storage of massive detail data is realized while the data credibility is ensured, so that the traceability system is not only a verifiable system, but also an investigable system, which enables it to be upgraded from a simple authenticity verification tool to a powerful supply chain data analysis and optimization platform.

[0138] Next, the agricultural product whole-chain traceability device in the embodiments of the present application is described from the perspective of hardware processing. Please refer to Figure 5 , Figure 5 is a structural schematic diagram of an agricultural product whole-chain traceability device provided by the embodiments of the present application.

[0139] It should be noted that Figure 5The structure of the agricultural product whole-chain traceability device shown is only an example and should not bring any limitation to the function and use range of the embodiments of the present application.

[0140] As shown in Figure 5 The agricultural product whole-chain traceability device includes a central processing unit 601 which can perform various appropriate actions and processes according to programs stored in a read-only memory 602 or programs loaded from a storage section 608 into a random access memory 603, for example, the method described in the above embodiments. In the random access memory 603, various programs and data required for system operation are also stored. The central processing unit 601, the read-only memory 602, and the random access memory 603 are connected to each other through a bus 604. An input / output interface 605 is also connected to the bus 604.

[0141] The following components are connected to the input / output interface 605: an input section 606 including an audio input device, a push button switch, and the like; an output section 607 including a liquid crystal display (LCD), an audio output device, an indicator, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output interface 605 as necessary. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 610 as necessary, so that a computer program read therefrom is installed in the storage section 608 as necessary.

[0142] In particular, according to the embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, the embodiments of the present application include a computer program product including a computer program carried on a computer-readable medium, the computer program containing a computer program for executing the method shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 609 and / or installed from the removable medium 611. When the computer program is executed by the central processing unit 601, various functions defined in the present application are performed.

[0143] Note that specific examples of computer-readable storage media can include but are not limited to an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer-readable storage medium can be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

[0144] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functional processes and operations that can be implemented in systems, methods and computer program products according to various embodiments of the present application. It will be understood that each block of the flow diagrams and / or block diagrams, and combinations of blocks in the flow diagrams and / or the block diagrams, can be implemented by computer program instructions. Such instructions can be implemented by one or more software programs or components in the embodiments. Also, it will be understood that each block of the flow diagrams and / or the block diagrams, and combinations of blocks in the flow diagrams and / or the block diagrams, can be implemented by hardware components that are specifically adapted to carry out one or more steps in the embodiments. As will be described in more detail throughout the present disclosure, the embodiments include hardware component implementations that perform each step, or a combination of steps, of the methods described herein. Also, combinations of steps from different embodiments can be used.

[0145] Specifically, the agricultural product whole-chain traceability device includes a processor and a memory, and the memory stores a computer program. When the computer program is executed by the processor, the agricultural product whole-chain traceability method provided in the above embodiment is implemented.

[0146] As another aspect, the present application also provides a computer-readable storage medium. The storage medium can be included in the agricultural product whole-chain traceability device described in the above embodiments, or can exist separately and not be assembled into the agricultural product whole-chain traceability device. The storage medium carries one or more computer programs. When the one or more computer programs are executed by a processor of the agricultural product whole-chain traceability device, the agricultural product whole-chain traceability method provided in the above embodiments is implemented.

[0147] The above descriptions are merely some example embodiments of the present disclosure, and cannot limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practice of the present disclosure. The present application is intended to cover any variations, uses, or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional technical means in the art that are not described in the present disclosure. The specification and examples are merely considered as exemplary, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A method for full-chain traceability of agricultural products, characterized in that, This system is applied to a full-chain traceability system for agricultural products. The system includes at least an initial node, multiple intermediate nodes, a final node, and a blockchain. The blockchain includes a main chain and side chains. The traceability data of the target agricultural product is obtained at the initial node, the multiple intermediate nodes, and the final node, respectively. The traceability data includes public data and private data. Based on the privacy data, a corresponding privacy compliance certificate is generated using a zero-knowledge proof algorithm; In the trusted execution environment of the initial node, the traceability data corresponding to the initial node and the privacy compliance certificate are data-signed to obtain the encrypted traceability credential corresponding to the initial node; Identify any one of the intermediate nodes and the final node as the target node, and obtain the encrypted tracing credential of the target node according to the following steps: In the trusted execution environment of the target node, the hash value of the encrypted tracing credential of the previous node of the target node, the tracing data corresponding to the target node, and the privacy compliance certificate generated by the target node are data-signed to obtain the encrypted tracing credential of the target node. The encrypted traceability certificate corresponding to each node is stored in the blockchain sidechain respectively; The hash values ​​corresponding to all encrypted traceability credentials from the initial node to the final node are sequentially anchored to the blockchain main chain, which is used to provide a traceability entry point. The hash value corresponding to the final node is determined to be the root hash value; Based on the root hash value, generate the traceability code corresponding to the target agricultural product; In response to a user's query command for the traceability code, the root hash value stored in the blockchain main chain is extracted; Based on the root hash value, all encrypted tracing credentials corresponding to the final node and the initial node are traced and parsed step by step.

2. The method according to claim 1, characterized in that, The generation of corresponding privacy compliance proofs based on the privacy data using a zero-knowledge proof algorithm includes: Based on preset privacy compliance rules, logical operations are performed on the privacy data to generate compliance conditions. The preset privacy compliance rules are used to define the data conditions that the privacy data needs to meet. Based on the zero-knowledge proof algorithm, the privacy data is received as secret input, and the compliance conditions are received as public input to obtain the privacy compliance proof. The privacy compliance proof is used to verify whether the privacy data meets the privacy compliance rules without disclosing the specific content of the privacy data.

3. The method according to claim 1, characterized in that, The process of performing a data signature between the tracing data corresponding to the initial node and the privacy compliance certificate in the trusted execution environment of the initial node to obtain the encrypted tracing credential corresponding to the initial node includes: In the trusted execution environment, a unique identifier and key are generated for the initial node, the key including a public key and a private key; The source data corresponding to the initial node is assembled with the privacy compliance certificate and the unique identifier to form a dataset to be signed; The data to be signed is performed using the private key; The data signature, the public key, and the dataset to be signed are combined to obtain the encrypted tracing credential corresponding to the initial node.

4. The method according to claim 1, characterized in that, Before performing data signing between the tracing data corresponding to the initial node and the privacy compliance proof in the trusted execution environment of the initial node, the method further includes: In the trusted execution environment, the hash value of the tracing data corresponding to the initial node is calculated; The hash value is matched with a preset hash baseline value to obtain the hash value matching result; If the hash value matching result is successful, the traceability data passes the integrity verification and the data signing step is executed.

5. The method according to claim 1, characterized in that, The process of tracing and parsing all encrypted tracing credentials from the final node to the initial node based on the root hash value includes: Based on the root hash value, all hash values ​​corresponding to the final node to the initial node are traced step by step. Extract the encrypted traceability credentials corresponding to each of the hash values; Parse the public data in each of the encrypted tracing credentials; Based on the publicly available data, a first visual traceability report is generated.

6. The method according to claim 5, characterized in that, The privacy data includes at least pesticide dosage, fertilizer composition ratio, and the amount of additives used in the processing. After generating the first visual traceability report based on the public data, the method further includes: If the user has supervisory authority, then the public and private data in each of the encrypted traceability credentials are parsed. Based on the publicly available data and private data, a second visual traceability report is generated.

7. The method according to any one of claims 1-6, characterized in that, The agricultural product full-chain traceability system also includes a storage unit, which is used to store the original data of the traceability data.

8. A traceability device for the entire agricultural product supply chain, characterized in that, The agricultural product full-chain traceability device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the agricultural product full-chain traceability device to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is run on the agricultural product full-chain traceability device, the agricultural product full-chain traceability device performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the agricultural product full-chain traceability device, the agricultural product full-chain traceability device performs the method as described in any one of claims 1-7.

Citation Information

Cited By

  • Pig operation traceability system based on block chain

    CN121767007A

  • Cyclic package sharing scheduling recovery system and method based on big data

    CN122022784A

  • A big data-based recycling system and method for scheduling and sharing of recycled packages

    CN122022784B