Fresh agricultural product tracing method and device based on block chain
By dividing fresh agricultural product data into public and private data in the blockchain system and using zero-knowledge proof algorithms for encryption, the risk of privacy data being exposed and tampered with in the traceability system is solved, achieving data traceability and privacy protection, and improving the efficiency and regulatory capabilities of the traceability system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING RES CENT FOR INFORMATION TECH & AGRI
- Filing Date
- 2025-12-25
- Publication Date
- 2026-05-15
AI Technical Summary
Existing blockchain-based traceability systems for fresh agricultural products face a contradiction between privacy and data immutability when processing corporate privacy data. This can lead to privacy leaks by storing privacy data on the blockchain or increased risk of data tampering by storing it in off-chain databases.
A data partitioning strategy is adopted to divide the business data of fresh agricultural products into public data and private data. Public data is stored on the business sub-chain, while private data is encrypted using a zero-knowledge proof algorithm and then uploaded to the regulatory main chain, so as to achieve data traceability and immutability, and to verify it through a zero-knowledge proof file.
While protecting privacy data, it ensures the traceability and immutability of data, improves the efficiency of source tracing and query, reduces audit complexity, and strengthens the multi-stage collaborative supervision capabilities.
Smart Images

Figure CN122048376A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a blockchain-based method and apparatus for tracing the origin of fresh agricultural products. Background Technology
[0002] With the continuous improvement of people's living standards and food safety awareness, consumers are paying increasing attention to the quality, safety, and traceability information of fresh agricultural products. Traditional centralized traceability systems have inherent defects such as easy data tampering, lack of transparency, and high trust costs, making it difficult to meet the urgent needs of modern agricultural product supply chains for reliable traceability. Blockchain technology, with its decentralized, immutable, and traceable characteristics, provides a new path for building a reliable traceability system. Currently, most blockchain-based traceability applications adopt a single-chain architecture. Although this model achieves information transparency and traceability to a certain extent, it generally suffers from poor scalability, limited system performance, and rigid access control, which restricts its practical application and promotion in the complex scenario of fresh agricultural products involving high frequency and multiple participants.
[0003] In related technologies, to overcome the limitations of single-chain systems, the industry has begun to explore multi-chain architectures. By subdividing and allocating the traceability process to different chain structures, multi-chain systems have shown certain advantages in terms of data security, system resistance to attacks, response time, transaction throughput, and latency control.
[0004] However, existing multi-chain-based regulatory solutions still face a dilemma when dealing with corporate privacy data: one is to put all corporate privacy data on the blockchain, which ensures the transparency and immutability of the data, but seriously sacrifices privacy; the other is to store privacy data in an off-chain database, which reduces storage costs and improves system efficiency, but weakens the immutability and audit transparency of the data, and increases the risk of data tampering. Summary of the Invention
[0005] This application provides a blockchain-based method and device for tracing the origin of fresh agricultural products, which addresses the technical problem that while storing all of a company's private data on the blockchain ensures data transparency and immutability, it severely sacrifices privacy. Conversely, storing private data in an off-chain database reduces storage costs and improves system efficiency, but weakens data immutability and audit transparency, and increases the risk of data tampering.
[0006] This application provides a blockchain-based method for tracing the origin of fresh agricultural products, comprising the following steps: Obtain initial business data for fresh agricultural products at each stage of the business process; Determine the data partitioning strategy corresponding to each business process; Based on the data segmentation strategy corresponding to each business segment, the initial business data corresponding to each business segment is divided into initial public data and initial private data. The initial public data is uploaded to the business chain corresponding to the business process in the blockchain, and an initial storage identifier corresponding to the initial public data is generated. The initial privacy data is encrypted using a zero-knowledge proof algorithm to obtain a zero-knowledge proof file; Upload the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain.
[0007] According to the blockchain-based traceability method for fresh agricultural products provided in this application, after uploading the zero-knowledge proof file and the initial storage identifier to the traceability supervision main chain in the blockchain, the method further includes: In response to data supervision instructions, a data verification request is initiated to the traceability and supervision main chain, wherein the data verification request includes: verification key; The zero-knowledge proof file is verified using the verification key to obtain a verification result, which indicates whether the initial privacy data corresponding to the zero-knowledge proof file is compliant and / or whether the initial privacy data corresponding to the zero-knowledge proof file exists.
[0008] According to the blockchain-based traceability method for fresh agricultural products provided in this application, the method further includes: Receive traceability information query requests, which include: product identification information of the agricultural product to be queried; Based on the product identification information, obtain the target storage identifier associated with the agricultural product to be queried from the traceability and supervision main chain; Based on the target storage identifier, the target public data corresponding to the agricultural product to be queried is determined from the business chain.
[0009] According to the blockchain-based traceability method for fresh agricultural products provided in this application, the business process includes at least one of the following: Production process; Data collection stage; Processing stage; Storage stage; Transportation process; Sales process.
[0010] According to the blockchain-based fresh agricultural product traceability method provided in this application, a data partitioning strategy corresponding to each business link is determined, including at least one of the following: When the business process is the production process, the data partitioning strategy is determined as follows: production environment and farm information are determined as initial public data, and production costs and production quantities are determined as initial private data. When the business process involves data collection, the data segmentation strategy is determined as follows: the collection time and location are defined as the initial public data, while the collection cost, collection method, and selling price are defined as the initial private data. When the business process is the processing stage, the data segmentation strategy is determined as follows: the processing date and raw materials are determined as the initial public data, and the cost of raw materials purchased, the processing method, and the selling price are determined as the initial private data. When the business process involves storage, the data partitioning strategy is determined as follows: storage time, storage location, and warehouse environment are defined as initial public data, while storage cost and storage quantity are defined as initial private data. When the business process is transportation, the data partitioning strategy is determined as follows: transportation routes, transportation methods, and transportation environment are determined as initial public data, while transportation costs and transportation quantities are determined as initial private data. When the business process is the sales process, the data segmentation strategy is determined as follows: product batches and product quantities are determined as initial public data, while sales costs and sales prices are determined as initial private data.
[0011] This application also provides a blockchain-based traceability device for fresh agricultural products, comprising the following modules: The first acquisition module is used to acquire initial business data for fresh agricultural products at each business stage; The first determination module is used to determine the data partitioning strategy corresponding to each business process; The partitioning module is used to partition the initial business data corresponding to each business process into initial public data and initial private data according to the data partitioning strategy corresponding to each business process. The first upload module is used to upload the initial public data to the business chain corresponding to the business process in the blockchain, and generate the initial storage identifier corresponding to the initial public data. The processing module is used to encrypt the initial privacy data based on the zero-knowledge proof algorithm to obtain the zero-knowledge proof file; The second upload module is used to upload the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain.
[0012] According to the blockchain-based traceability device for fresh agricultural products provided in this application, it also includes: The initiation module is used to initiate a data verification request to the traceability supervision main chain in response to data supervision instructions after uploading the zero-knowledge proof file and the initial storage identifier to the traceability supervision main chain in the blockchain. The data verification request includes: verification key; The verification module is used to verify the zero-knowledge proof file according to the verification key to obtain the verification result. The verification result is used to indicate whether the initial privacy data corresponding to the zero-knowledge proof file is compliant and / or whether the initial privacy data corresponding to the zero-knowledge proof file exists.
[0013] According to the blockchain-based traceability device for fresh agricultural products provided in this application, it also includes: The receiving module is used to receive traceability information query requests, wherein the traceability information query requests include: product identification information of the agricultural product to be queried; The second acquisition module is used to obtain the target storage identifier associated with the agricultural product to be queried from the traceability and supervision main chain based on the product identification information; The second determination module is used to determine the target public data corresponding to the agricultural product to be queried from the business chain based on the target storage identifier.
[0014] According to the blockchain-based traceability device for fresh agricultural products provided in this application, the business process includes at least one of the following: Production process; Data collection stage; Processing stage; Storage stage; Transportation process; Sales process.
[0015] According to the blockchain-based traceability device for fresh agricultural products provided in this application, the first determining module is further configured to perform at least one of the following: When the business process is the production process, the data partitioning strategy is determined as follows: production environment and farm information are determined as initial public data, and production costs and production quantities are determined as initial private data. When the business process involves data collection, the data segmentation strategy is determined as follows: the collection time and location are defined as the initial public data, while the collection cost, collection method, and selling price are defined as the initial private data. When the business process is the processing stage, the data segmentation strategy is determined as follows: the processing date and raw materials are determined as the initial public data, and the cost of raw materials purchased, the processing method, and the selling price are determined as the initial private data. When the business process involves storage, the data partitioning strategy is determined as follows: storage time, storage location, and warehouse environment are defined as initial public data, while storage cost and storage quantity are defined as initial private data. When the business process is transportation, the data partitioning strategy is determined as follows: transportation routes, transportation methods, and transportation environment are determined as initial public data, while transportation costs and transportation quantities are determined as initial private data. When the business process is the sales process, the data segmentation strategy is determined as follows: product batches and product quantities are determined as initial public data, while sales costs and sales prices are determined as initial private data.
[0016] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any of the blockchain-based fresh agricultural product traceability methods described above.
[0017] This application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements any of the blockchain-based fresh agricultural product traceability methods described above.
[0018] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the blockchain-based fresh agricultural product traceability methods described above.
[0019] The blockchain-based fresh agricultural product traceability method and device provided in this application divides data at each stage into public data and private data. Public data is stored on the business slave chain to ensure traceability and immutability, while private data is encrypted with zero-knowledge proofs and uploaded to the regulatory main chain. This protects sensitive information while meeting verification requirements. Through the zero-knowledge proof algorithm, the exposure of private data is avoided, while allowing regulators or consumers to verify the authenticity of the data. This resolves the contradiction between data openness and privacy protection in the traceability process. The "main chain-slave chain" collaborative architecture distributes data storage pressure and improves traceability query efficiency. The regulatory main chain can quickly verify the consistency of data across the entire chain through zero-knowledge proof documents and storage identifiers, reducing audit complexity and strengthening the regulatory capability for multi-stage collaboration. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is one of the flowcharts of the blockchain-based traceability method for fresh agricultural products provided in this application.
[0022] Figure 2 This is a schematic diagram of the zero-knowledge proof process provided in this application.
[0023] Figure 3 This is a schematic diagram of the traceability and supervision of fresh agricultural products provided in this application.
[0024] Figure 4 This is a schematic diagram of the blockchain-based traceability device for fresh agricultural products provided in this application.
[0025] Figure 5 A schematic diagram of the physical structure of an electronic device is provided. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0027] The following is combined Figures 1-3 This application describes a blockchain-based method for tracing the origin of fresh agricultural products.
[0028] Figure 1 This is one of the flowcharts illustrating the blockchain-based traceability method for fresh agricultural products provided in this application, such as... Figure 1 As shown, the method includes the following: Step 101: Obtain initial business data for fresh agricultural products at each business stage.
[0029] The business process for fresh agricultural products includes at least one of the following: Production process; Data collection stage; Processing stage; Storage stage; Transportation process; Sales process.
[0030] The initial business data for each business segment refers to the business-related data determined in that business segment, or the data used in that business segment. This initial business data can be, for example, the production cost and production quantity in the production segment, or the transportation cost and transportation route in the transportation segment, etc. There are no restrictions on this.
[0031] The initial business data for each business segment can be provided by the relevant enterprise corresponding to that business segment. For example, the initial business data for the production segment can be provided by the production enterprise, and the initial business data for the transportation segment can be provided by the transportation enterprise. There are no restrictions on this.
[0032] In other words, in this embodiment of the application, it may be receiving initial business data sent by electronic devices belonging to enterprises corresponding to different production stages.
[0033] Step 102: Determine the data partitioning strategy corresponding to each business process.
[0034] In this embodiment of the application, after obtaining the initial business data of fresh agricultural products in each business link, a data partitioning strategy corresponding to each business link can be determined. This data partitioning strategy can be used to partition the initial business data of different business links.
[0035] Optionally, in some embodiments, determining a data partitioning strategy corresponding to each business process includes at least one of the following: When the business process is the production process, the data partitioning strategy is determined as follows: production environment and farm information are determined as initial public data, and production costs and production quantities are determined as initial private data. When the business process involves data collection, the data segmentation strategy is determined as follows: the collection time and location are defined as the initial public data, while the collection cost, collection method, and selling price are defined as the initial private data. When the business process is the processing stage, the data segmentation strategy is determined as follows: the processing date and raw materials are determined as the initial public data, and the cost of raw materials purchased, the processing method, and the selling price are determined as the initial private data. When the business process involves storage, the data partitioning strategy is determined as follows: storage time, storage location, and warehouse environment are defined as initial public data, while storage cost and storage quantity are defined as initial private data. When the business process is transportation, the data partitioning strategy is determined as follows: transportation routes, transportation methods, and transportation environment are determined as initial public data, while transportation costs and transportation quantities are determined as initial private data. When the business process is the sales process, the data segmentation strategy is determined as follows: product batches and product quantities are determined as initial public data, while sales costs and sales prices are determined as initial private data.
[0036] Privacy data refers to data that is kept confidential during the production process and is not intended to be known during data transfer and querying.
[0037] Public data has lower confidentiality than private data, and it can be queried and made public during the data flow and query stages.
[0038] It is understandable that the confidentiality requirements of the initial business data in different stages are different. Therefore, it is possible to determine the data partitioning strategy corresponding to each business stage, and then partition the initial business data of that business stage based on the data partitioning strategy corresponding to that business stage.
[0039] Step 103: Based on the data partitioning strategy corresponding to each business segment, divide the initial business data corresponding to each business segment into initial public data and initial private data.
[0040] In this embodiment of the application, after determining the data partitioning strategy corresponding to each business link, the initial business data corresponding to each business link can be divided into initial public data and initial private data according to the data partitioning strategy corresponding to each business link.
[0041] In other words, in the embodiments of this application, when the business process is the production process, the data partitioning strategy can be determined as follows: the production environment and farm information are determined as the initial public data, and the production cost and production quantity are determined as the initial private data.
[0042] When the data collection process is the business process, the data segmentation strategy is determined as follows: the collection time and location are defined as the initial public data, and the collection cost, collection method, and selling price are defined as the initial private data.
[0043] When the business process is the processing stage, the data segmentation strategy is determined as follows: the processing date and raw materials are determined as the initial public data, and the cost of raw materials, processing method and selling price are determined as the initial private data.
[0044] When the business process involves storage, the data partitioning strategy is determined as follows: storage time, storage location, and warehouse environment are defined as initial public data, while storage cost and storage quantity are defined as initial private data.
[0045] When the business process is transportation, the data partitioning strategy is determined as follows: transportation routes, transportation methods, and transportation environment are determined as initial public data, while transportation costs and transportation quantities are determined as initial private data.
[0046] When the business process is the sales process, the data segmentation strategy is determined as follows: product batches and product quantities are determined as initial public data, while sales costs and sales prices are determined as initial private data.
[0047] Step 104: Upload the initial public data to the business sub-chain corresponding to the business process in the blockchain, and generate the initial storage identifier corresponding to the initial public data.
[0048] In this embodiment of the application, after dividing the initial business data of each business link into initial public data and initial private data, the initial public data of each business link can be uploaded to the business sub-chain corresponding to that business link. Then, the initial public data of the corresponding business sub-chain can be retrieved according to the business link.
[0049] Step 105: Encrypt the initial privacy data based on the zero-knowledge proof algorithm to obtain the zero-knowledge proof file.
[0050] In this embodiment of the application, after dividing the data of the corresponding business process into initial privacy data and initial public data according to the data partitioning strategy, the initial privacy data can be encrypted based on the zero-knowledge proof algorithm to obtain the zero-knowledge proof file.
[0051] Zero-knowledge proof documents typically refer to documents that use zero-knowledge proof technology to prove that certain statements about a document or data are true without revealing the contents of the document or data itself.
[0052] In other words, in the embodiments of this application, the initial privacy data can be encrypted based on a zero-knowledge proof algorithm to obtain a zero-knowledge proof file.
[0053] In the embodiments of this application, see Figure 2 , Figure 2 This is a schematic diagram of the zero-knowledge proof process provided in this application. The first stage is the trust setting stage, which is to establish a verifiable framework for verifying the general rule "whether the chain contains enterprise privacy data". The input of the verification process is the verification rule C: "whether the chain contains enterprise privacy data". The verification process is to run the zero-knowledge proof (ZKP) algorithm to transform the verification rule C into a provable format. The output of the verification process is: proof key and verification key.
[0054] The second stage is the proof generation stage, where the business proves to the main chain that the business does indeed contain its private data on the chain, but does not need to disclose the specific data content. The inputs for this stage are: public statement x: "The chain contains the company's private data", private evidence w: the actual private data on the chain, and proof key. The process is for the company to run the proof generation algorithm, read the private data on the chain, verify that the data does indeed conform to the preset "privacy data" rule C, and generate a zero-knowledge proof file π. The output of this stage is the proof file π, a cryptographic proof that "the company does indeed have private data content on the business chain", but does not disclose any specific data.
[0055] The third stage is the verification stage, where the tracing main chain verifies the proof provided by the chain to confirm the authenticity of the statement. The inputs for this stage are the public statement x: "The chain contains corporate privacy data", proof document π: proof document provided by the company, and verification key. The process is as follows: the tracing main chain runs the verification algorithm to check whether proof π is valid. The outputs for this stage are: Accept: confirming that the company's statement is true and that privacy data does exist on the chain; Reject: the company's proof is invalid, and there may not be privacy data on the chain, or the company has provided false proof.
[0056] Step 106: Upload the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain.
[0057] In this embodiment of the application, after encrypting the initial privacy data based on the zero-knowledge proof algorithm to obtain the zero-knowledge proof file, the zero-knowledge proof file and the initial storage identifier can be uploaded to the traceability and supervision main chain in the blockchain.
[0058] In the embodiments of this application, see Figure 3 , Figure 3 This application provides a schematic diagram of the traceability and supervision of fresh agricultural products. It can be that the initial public data of different business links are uploaded to the corresponding business sub-chain in the blockchain, the initial privacy data of different business links are encrypted into zero-knowledge proof files, and then the zero-knowledge proof files and storage identifiers are uploaded to the traceability and supervision main chain in the blockchain.
[0059] Optionally, in some embodiments, after uploading the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain, the method further includes: in response to a data supervision instruction, initiating a data verification request to the traceability and supervision main chain, wherein the data verification request includes: a verification key; verifying the zero-knowledge proof file according to the verification key to obtain a verification result, wherein the verification result is used to indicate whether the initial privacy data corresponding to the zero-knowledge proof file is compliant, and / or whether the initial privacy data corresponding to the zero-knowledge proof file exists.
[0060] In other words, in the embodiments of this application, it is possible to determine whether the initial privacy data is compliant and / or whether the initial privacy data corresponding to the zero-knowledge proof document exists in the future regulatory process by verifying the key without disclosing the initial privacy data.
[0061] Therefore, in this embodiment of the application, the authenticity and compliance of data are verifiable by using encrypted proof documents. This not only solves the privacy leakage problem caused by "full on-chain", but also avoids the data tampering risk brought about by "off-chain storage". It builds a new data governance model of "data not being public and proof being verifiable", and achieves the dual goals of protecting corporate privacy and ensuring the trustworthy supervision of data by regulatory authorities.
[0062] Optionally, in some embodiments, a traceability information query request may also be received, wherein the traceability information query request includes: product identification information of the agricultural product to be queried; obtaining a target storage identifier associated with the agricultural product to be queried from the traceability supervision main chain based on the product identification information; and determining the target public data corresponding to the agricultural product to be queried from the business sub-chain based on the target storage identifier.
[0063] Among them, the traceability information query request refers to the request made by the user to query the initial business data of a certain business link of the fresh agricultural product.
[0064] Among them, the product identification information of the agricultural product to be queried can be, for example, the product number of the agricultural product to be queried. This product number can be stored in the blockchain, so that the initial business data can be easily retrieved based on the product identification information.
[0065] Among them, the storage identifier associated with the agricultural product to be queried and the target storage identifier are obtained from the traceability and supervision main chain.
[0066] In other words, in this embodiment of the application, after receiving a traceability information query request, the target storage identifier associated with the agricultural product to be queried can be obtained from the traceability supervision main chain based on the product identification information, and then the target public data can be determined from the corresponding business sub-chain based on the target storage identifier.
[0067] In the disclosed embodiments, by uploading the initial storage identifiers and zero-knowledge proof files of the initial public data from different business links to the traceability and supervision main chain of the blockchain, it is possible to support the centralized aggregation and correlation analysis of data from the entire process of fresh agricultural products from production to sales. This eliminates the need to connect to each enterprise's system separately, simplifies the supervision process, improves supervision efficiency, and enables rapid location and traceability of quality and safety issues of fresh agricultural products, thereby strengthening the full-chain supervision capability.
[0068] The blockchain-based traceability method for fresh agricultural products provided in this application divides data at each stage into public and private data. Public data is stored on the business sub-chain to ensure traceability and immutability, while private data is encrypted using zero-knowledge proofs and uploaded to the regulatory main chain. This protects sensitive information while meeting verification requirements. The zero-knowledge proof algorithm avoids the exposure of private data while allowing regulators or consumers to verify the authenticity of the data, resolving the contradiction between data openness and privacy protection in the traceability process. The "main chain-sub chain" collaborative architecture distributes data storage pressure and improves traceability query efficiency. The regulatory main chain can quickly verify the consistency of data across the entire chain through zero-knowledge proof documents and storage identifiers, reducing audit complexity and strengthening the regulatory capability for multi-stage collaboration.
[0069] The following describes the blockchain-based fresh agricultural product traceability device provided in this application. The blockchain-based fresh agricultural product traceability device described below can be referred to in correspondence with the blockchain-based fresh agricultural product traceability method described above.
[0070] Figure 4 This is a schematic diagram of the blockchain-based traceability device for fresh agricultural products provided in this application, such as... Figure 4 As shown, the blockchain-based traceability device for fresh agricultural products includes the following: The first acquisition module 401 is used to acquire the initial business data of fresh agricultural products in each business process; The first determining module 402 is used to determine the data partitioning strategy corresponding to each business link; The partitioning module 403 is used to partition the initial business data corresponding to each business link into initial public data and initial private data according to the data partitioning strategy corresponding to each business link. The first upload module 404 is used to upload the initial public data to the business chain corresponding to the business process in the blockchain, and generate the initial storage identifier corresponding to the initial public data. Processing module 405 is used to encrypt the initial privacy data based on the zero-knowledge proof algorithm to obtain the zero-knowledge proof file; The second upload module 406 is used to upload the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain.
[0071] Optionally, in some embodiments, the blockchain-based fresh agricultural product traceability device further includes: The initiation module (not shown in the figure) is used to initiate a data verification request to the traceability supervision main chain in response to the data supervision instructions after uploading the zero-knowledge proof file and the initial storage identifier to the traceability supervision main chain in the blockchain. The data verification request includes: verification key; The verification module (not shown in the figure) is used to verify the zero-knowledge proof file according to the verification key to obtain the verification result. The verification result is used to indicate whether the initial privacy data corresponding to the zero-knowledge proof file is compliant and / or whether the initial privacy data corresponding to the zero-knowledge proof file exists.
[0072] Optionally, in some embodiments, the blockchain-based fresh agricultural product traceability device further includes: The receiving module (not shown in the figure) is used to receive traceability information query requests, wherein the traceability information query requests include: product identification information of the agricultural product to be queried; The second acquisition module (not shown in the figure) is used to obtain the target storage identifier associated with the agricultural product to be queried from the traceability and supervision main chain based on the product identification information; The second determining module (not shown in the figure) is used to determine the target public data corresponding to the agricultural product to be queried from the business chain based on the target storage identifier.
[0073] Optionally, in some embodiments, the business process includes at least one of the following: Production process; Data collection stage; Processing stage; Storage stage; Transportation process; Sales process.
[0074] Optionally, in some embodiments, the first determining module 402 is specifically configured to perform at least one of the following: When the business process is the production process, the data partitioning strategy is determined as follows: production environment and farm information are determined as initial public data, and production costs and production quantities are determined as initial private data. When the business process involves data collection, the data segmentation strategy is determined as follows: the collection time and location are defined as the initial public data, while the collection cost, collection method, and selling price are defined as the initial private data. When the business process is the processing stage, the data segmentation strategy is determined as follows: the processing date and raw materials are determined as the initial public data, and the cost of raw materials purchased, the processing method, and the selling price are determined as the initial private data. When the business process involves storage, the data partitioning strategy is determined as follows: storage time, storage location, and warehouse environment are defined as initial public data, while storage cost and storage quantity are defined as initial private data. When the business process is transportation, the data partitioning strategy is determined as follows: transportation routes, transportation methods, and transportation environment are determined as initial public data, while transportation costs and transportation quantities are determined as initial private data. When the business process is the sales process, the data segmentation strategy is determined as follows: product batches and product quantities are determined as initial public data, while sales costs and sales prices are determined as initial private data.
[0075] The blockchain-based fresh agricultural product traceability device provided in this application divides data at each stage into public and private data. Public data is stored on the business sub-chain to ensure traceability and immutability, while private data is encrypted using zero-knowledge proofs and uploaded to the regulatory main chain. This protects sensitive information while meeting verification requirements. Through the zero-knowledge proof algorithm, the exposure of private data is avoided, while allowing regulators or consumers to verify the authenticity of the data. This resolves the contradiction between data openness and privacy protection during the traceability process. The "main chain-sub chain" collaborative architecture distributes data storage pressure and improves traceability query efficiency. The regulatory main chain can quickly verify the consistency of data across the entire chain through zero-knowledge proof documents and storage identifiers, reducing audit complexity and strengthening the regulatory capability for multi-stage collaboration.
[0076] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540. The processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions stored in the memory 530 to execute a blockchain-based traceability method for fresh agricultural products.
[0077] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0078] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the blockchain-based traceability method for fresh agricultural products provided by the above methods.
[0079] In another aspect, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the blockchain-based fresh agricultural product traceability method provided by the above methods.
[0080] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A blockchain-based method for tracing the origin of fresh agricultural products, characterized in that, include: Obtain initial business data for fresh agricultural products at each stage of the business process; Determine the data partitioning strategy corresponding to each of the aforementioned business processes; Based on the data partitioning strategy corresponding to each of the business processes, the initial business data corresponding to each of the business processes is divided into initial public data and initial private data. The initial public data is uploaded to the business sub-chain corresponding to the business process in the blockchain, and an initial storage identifier corresponding to the initial public data is generated. The initial privacy data is encrypted using a zero-knowledge proof algorithm to obtain a zero-knowledge proof file; The zero-knowledge proof file and the initial storage identifier are uploaded to the traceability and supervision main chain in the blockchain.
2. The method according to claim 1, characterized in that, After uploading the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain, the method further includes: In response to a data supervision instruction, a data verification request is initiated to the traceability supervision main chain, wherein the data verification request includes: a verification key; The zero-knowledge proof file is verified using the verification key to obtain a verification result, wherein the verification result is used to indicate whether the initial privacy data corresponding to the zero-knowledge proof file is compliant, and / or whether the initial privacy data corresponding to the zero-knowledge proof file exists.
3. The method according to claim 1, characterized in that, The method further includes: Receive a traceability information query request, wherein the traceability information query request includes: product identification information of the agricultural product to be queried; Based on the product identification information, obtain the target storage identifier associated with the agricultural product to be queried from the traceability and supervision main chain; Based on the target storage identifier, the target public data corresponding to the agricultural product to be queried is determined from the business chain.
4. The method according to claim 1, characterized in that, The business process includes at least one of the following: Production process; Data collection stage; Processing stage; Storage stage; Transportation process; Sales process.
5. The method according to claim 4, characterized in that, The determination of the data partitioning strategy corresponding to each of the business processes includes at least one of the following: When the business process is the production process, the data partitioning strategy is determined as follows: production environment and farm information are determined as the initial public data, and production cost and production quantity are determined as the initial private data. When the business process is the data collection process, the data segmentation strategy is determined as follows: the collection time and location are determined as the initial public data, and the collection cost, collection method, and selling price are determined as the initial private data. When the business process is the processing process, the data partitioning strategy is determined as follows: the processing date and raw materials are determined as the initial public data, and the cost of raw materials, processing method and selling price are determined as the initial private data. When the business process is the storage process, the data partitioning strategy is determined as follows: storage time, storage location, and warehouse environment are determined as the initial public data, and storage cost and storage quantity are determined as the initial private data. When the business process is the transportation process, the data partitioning strategy is determined as follows: the transportation route, transportation mode, and transportation environment are determined as the initial public data, and the transportation cost and transportation quantity are determined as the initial private data. When the business process is the sales process, the data segmentation strategy is determined as follows: product batch and product quantity are determined as the initial public data, and sales cost and sales price are determined as the initial private data.
6. A blockchain-based traceability device for fresh agricultural products, characterized in that, include: The first acquisition module is used to acquire initial business data for fresh agricultural products at each business stage; The first determining module is used to determine the data partitioning strategy corresponding to each of the business processes; The partitioning module is used to partition the initial business data corresponding to each business step into initial public data and initial private data according to the data partitioning strategy corresponding to each business step. The first upload module is used to upload the initial public data to the business sub-chain corresponding to the business link in the blockchain, and generate an initial storage identifier corresponding to the initial public data. The processing module is used to encrypt the initial privacy data based on a zero-knowledge proof algorithm to obtain a zero-knowledge proof file; The second upload module is used to upload the zero-knowledge proof file and the initial storage identifier to the traceability and supervision main chain in the blockchain.
7. The apparatus according to claim 6, characterized in that, include: The initiation module is used to initiate a data verification request to the traceability supervision main chain in response to a data supervision instruction after the zero-knowledge proof file and the initial storage identifier are uploaded to the traceability supervision main chain in the blockchain. The data verification request includes: a verification key. The verification module is used to verify the zero-knowledge proof file according to the verification key to obtain a verification result, wherein the verification result is used to indicate whether the initial privacy data corresponding to the zero-knowledge proof file is compliant, and / or whether the initial privacy data corresponding to the zero-knowledge proof file exists.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the blockchain-based fresh agricultural product traceability method as described in any one of claims 1 to 5.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the blockchain-based fresh agricultural product traceability method as described in any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the blockchain-based fresh agricultural product traceability method as described in any one of claims 1 to 5.