Blockchain-based portable agricultural product quality traceability method and system

By collecting and encrypting multi-source heterogeneous data, constructing blockchain data entities, and performing source verification and conflict rating, the problem of insufficient accuracy and credibility of data integration in agricultural product traceability systems is solved, and secure data storage, accurate quantification, and dynamic optimization of traceability results are achieved.

CN121998670BActive Publication Date: 2026-06-30SUZHOU CHENGJIAN BIOTECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUZHOU CHENGJIAN BIOTECHNOLOGY CO LTD
Filing Date
2026-04-10
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing agricultural product traceability systems suffer from low accuracy in integrating heterogeneous data from multiple sources, insufficient data reliability, inability to effectively prioritize information and handle conflicts, and static traceability results that cannot be continuously iterated and optimized.

Method used

By collecting multi-source heterogeneous raw data streams from various links in the supply chain, parsing and encrypting them to generate tamper-proof blockchain data entities, and constructing a source verification and conflict rating system, trust quantification and dynamic optimization are achieved.

Benefits of technology

It enables secure storage and standardized integration of multi-source heterogeneous data, accurately quantifies data credibility, resolves information conflicts, and ensures real-time updates and credibility of traceability results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998670B_ABST
    Figure CN121998670B_ABST
Patent Text Reader

Abstract

This invention relates to the field of blockchain application technology and discloses a portable agricultural product quality traceability method and system based on blockchain. The method includes collecting and storing multi-source heterogeneous raw data streams from various links in the supply chain to obtain an initial information set; parsing the source identifier and timestamp of each data entry in the initial information set, classifying them into preliminarily trustworthy entries and potentially conflicting entries according to a preset multi-party participation standard; for potentially conflicting entries, obtaining associated logistics and processing records and outputting a conflict rating index; calculating a trust score for each data entry based on the conflict rating index and the preliminarily trustworthy entries to obtain a comprehensive trust value; extracting entries with a trust value higher than a preset trust threshold and generating a unified quality traceability summary; matching the summary content with consumer query input and outputting a relevant traceability report; and dynamically updating the trust score through backtracking verification and difference analysis to output continuously optimized traceability results. This method can accurately integrate multi-source heterogeneous data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain application technology, and in particular to a portable agricultural product quality traceability method and system based on blockchain. Background Technology

[0002] Currently, the agricultural product supply chain involves multiple links such as planting, processing, logistics, and sales. The participation of multiple parties leads to the dispersion of data sources and heterogeneous formats, making it difficult for consumers and regulators to fully grasp the true information of products. Agricultural product quality traceability has become a key requirement to ensure food safety and industry trust.

[0003] In existing technologies, agricultural product traceability largely relies on centralized databases to store information, with production and logistics data collected manually or via a single terminal to form a traceability chain. While some solutions introduce simple data encryption methods, they fail to address the core trust issue, leaving the data vulnerable to tampering and deletion. Other technologies rely on blockchain for data storage but lack conflict resolution capabilities. When information provided by multiple parties in the supply chain contradicts each other (e.g., planting records show organic cultivation, while logistics records indicate batch mixing), the credibility of the information cannot be determined solely by the blockchain data itself. Furthermore, current blockchain-based traceability systems largely remain at the data-on-chain level, lacking a trust quantification system at the data entry level. Consumers and regulators can only view raw data, making it difficult to quickly identify highly reliable information and accurately assess agricultural product quality.

[0004] Existing technologies suffer from low accuracy in integrating multi-source heterogeneous data. Summary of the Invention

[0005] This invention provides a portable agricultural product quality traceability method and system based on blockchain to solve the problem of low accuracy in integrating multi-source heterogeneous data.

[0006] Firstly, in order to solve the above-mentioned technical problems, the present invention provides a portable agricultural product quality traceability method based on blockchain, comprising:

[0007] Collect multi-source heterogeneous raw data streams from various links in the supply chain, store the multi-source heterogeneous raw data streams, and obtain an initial information set;

[0008] The source identifier and timestamp of each data entry in the initial information set are parsed. If the source identifier matches the preset multi-party participation standard, it is determined as a preliminary credible entry. If it does not match, it is marked as a potential conflict entry, and the classified data group is obtained.

[0009] For the potential conflict entries in the classified data group, obtain the associated logistics and processing records. By comparing the timestamps and batch codes, if the timestamp sequences are continuous and the batch codes are not duplicated, output the conflict rating index.

[0010] The conflict rating index and the preliminary trust entries are classified and processed. A trust score is calculated for each data entry based on the conflict rating index and the preliminary trust entries. The trust scores are then merged to obtain a comprehensive trust value.

[0011] Entries with a higher overall trust level than a preset trust level threshold are extracted from the overall trust level value, and key fields in the entries are integrated to obtain a unified quality traceability summary;

[0012] For the unified quality traceability summary, obtain the consumer query input, match the query keywords with the summary field, and if the matching degree exceeds the preset matching degree threshold, it is determined to be relevant traceability information and the final output report is obtained;

[0013] Based on the relevant traceability information in the final output report, the system traces back to the initial information set, calculates the attribute value difference characteristics between the relevant traceability information and the initial information set, and updates the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result.

[0014] Secondly, the present invention provides a portable agricultural product quality traceability system based on blockchain, comprising:

[0015] The data acquisition and storage module is used to acquire multi-source heterogeneous raw data streams from various links in the supply chain, store the multi-source heterogeneous raw data streams, and obtain an initial information set;

[0016] The data classification module is used to parse the source identifier and timestamp of each data entry in the initial information set. If the source identifier matches the preset multi-party participation standard, it is determined as a preliminary credible entry. If it does not match, it is marked as a potential conflict entry, and the classified data group is obtained.

[0017] The conflict rating module is used to obtain the associated logistics and processing records for the potential conflict entries in the classified data group. By comparing the timestamps and batch codes, if the timestamp sequence is continuous and the batch codes are not repeated, the conflict rating index is output.

[0018] The trust score calculation module is used to classify and process the conflict rating index and the preliminary trust entries, calculate the trust score of each data entry based on the conflict rating index and the preliminary trust entries, and merge the trust scores to obtain a comprehensive trust score.

[0019] The traceability summary generation module is used to extract entries that are higher than the preset trust threshold from the comprehensive trust value, integrate the key fields in the entries, and obtain a unified quality traceability summary.

[0020] The report generation module is used to obtain consumer query input for the unified quality traceability summary, match query keywords with summary fields, and if the matching degree exceeds the preset matching degree threshold, it is determined to be relevant traceability information and the final output report is obtained.

[0021] The traceability result optimization module is used to trace back to the initial information set based on the relevant traceability information in the final output report, calculate the attribute value difference characteristics between the relevant traceability information and the initial information set, and update the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result.

[0022] Compared with the prior art, the present invention has the following beneficial effects:

[0023] (1) This invention utilizes blockchain technology to achieve secure storage and standardized integration of multi-source heterogeneous data in the supply chain, fundamentally addressing the core pain points of insufficient data credibility and chaotic formats in traditional traceability schemes. Traditional agricultural product traceability relies heavily on centralized databases, with centralized data storage permissions, making them susceptible to human tampering, deletion, or system failures, leading to difficulties for consumers and regulators in trusting the authenticity of traceability information. Simultaneously, the data collection terminals and formats differ across supply chain stages (planting, processing, logistics, and sales), such as planting records being tabular data and logistics trajectories being GPS location data, making data difficult to utilize collaboratively. This invention collects multi-source heterogeneous raw data streams from various nodes in the supply chain, first parsing and extracting business characteristics and assembling them into standardized data entities to be uploaded to the blockchain, then generating encrypted digest values ​​with timestamps through hash operations, and finally storing them in the blockchain network and linking them to the main chain. The decentralized nature of blockchain ensures that data cannot be manipulated by a single node; the encrypted digest value acts like a data fingerprint, and any tampering will cause the digest value to change, achieving data immutability from a technical perspective.

[0024] (2) This invention, by constructing a system of source verification, conflict rating, and trust quantification, efficiently resolves multi-source information conflicts and achieves accurate quantification of data credibility, solving the problems of existing technologies being unable to effectively distinguish information priorities and difficult to handle conflicting data. Existing blockchain-based traceability solutions mostly only realize data on-chain, without designing effective processing mechanisms for the information diversity and conflict caused by the participation of multiple parties in the supply chain. When contradictions occur in records from different links, they can only be simply summarized and displayed, and cannot determine the level of information credibility. This invention first verifies the node identity corresponding to the source identifier through digital signature, and performs full-network verification of the time-series data stream by combining a practical Byzantine fault-tolerant consensus algorithm, and filters out preliminary credible entries that match the preset access whitelist; for potential conflict entries, it obtains the associated logistics and processing records by parsing the traceability index key, compares the continuity of the timestamp sequence and the uniqueness of the batch code, and generates low and high conflict rating indicators; finally, it concatenates the conflict rating indicators with historical credit data into a joint feature vector, inputs it into a random forest classifier to generate a trust score, and calculates dynamic weights based on the dispersion of the trust score and the conflict rating indicators, and obtains a comprehensive trust value through weighted average fusion. This allows for precise quantification of the credibility of each data entry, avoiding interference from conflicting data with traceability results and enabling consumers and regulators to quickly identify highly credible information, thus significantly enhancing the reference value of traceability results.

[0025] (3) This invention introduces a dynamic optimization mechanism of verification loop to achieve continuous iterative upgrades of traceability results, breaking the static limitation of the one-time output of traditional traceability schemes and further enhancing the practicality and credibility of the traceability system. Traditional traceability schemes complete the entire process after generating a traceability report. If data deviations or new conflicting information are subsequently discovered, the original traceability results cannot be corrected, which may lead to deviations between the traceability information and the actual situation, affecting the effectiveness of use. After outputting the final report, this invention still reversely retrieves the corresponding initial information set by parsing the traceability node identifier and calculates the attribute value difference characteristics between the traceability information and the initial data. If the difference characteristics exceed the preset tolerance range, the verification path that generates new conflicts is locked, the bound trust score is updated with weighted decay, and the traceability chain is reconstructed based on the updated trust score. This closed-loop optimization mode allows the traceability results to be continuously adjusted as data verification deepens, timely eliminating newly discovered conflicts and ensuring that the traceability information is always consistent with the actual situation. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of the process of the portable agricultural product quality traceability method based on blockchain provided in the first embodiment of the present invention;

[0027] Figure 2 This is a schematic diagram of the structure of a portable agricultural product quality traceability system based on blockchain provided in the second embodiment of the present invention. Detailed Implementation

[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0029] Reference Figure 1 The first embodiment of the present invention provides a portable agricultural product quality traceability method based on blockchain, comprising the following steps:

[0030] S11, Collect multi-source heterogeneous raw data streams from various links in the supply chain, store the multi-source heterogeneous raw data streams, and obtain an initial information set;

[0031] S12, parse the source identifier and timestamp of each data entry in the initial information set. If the source identifier matches the preset multi-party participation standard, it is determined as a preliminary credible entry. If it does not match, it is marked as a potential conflict entry, and the classified data group is obtained.

[0032] S13, for the potential conflict entries in the classified data group, obtain the associated logistics and processing records, and output the conflict rating index by comparing the timestamp and batch code. If the timestamp sequence is continuous and the batch code is not repeated.

[0033] S14, classify and process the conflict rating index and the preliminary trust entries, calculate the trust score of each data entry based on the conflict rating index and the preliminary trust entries, and merge the trust scores to obtain a comprehensive trust value;

[0034] S15, extract entries that are higher than the preset trust threshold from the comprehensive trust value, integrate the key fields in the entries, and obtain a unified quality traceability summary;

[0035] S16. For the unified quality traceability summary, obtain the consumer query input, match the query keywords with the summary field, and if the matching degree exceeds the preset matching degree threshold, it is determined to be relevant traceability information and the final output report is obtained.

[0036] S17. Based on the relevant traceability information in the final output report, backtrack to the initial information set, calculate the attribute value difference characteristics between the relevant traceability information and the initial information set. If the difference characteristics exceed a preset tolerance range, update the trust score to obtain an optimized traceability result.

[0037] In step S11, multi-source heterogeneous raw data streams from various links in the supply chain are collected and stored to obtain an initial information set, including:

[0038] Acquire multi-source heterogeneous raw data streams collected from various nodes of the portable agricultural product supply chain, wherein the multi-source heterogeneous raw data streams include production batch and logistics trajectory records;

[0039] The multi-source heterogeneous raw data stream is parsed, business features are extracted and assembled into a data entity to be uploaded to the blockchain. The data entity to be uploaded to the blockchain is in a standardized format. The data entity to be uploaded to the blockchain is processed to generate an encrypted digest value. The encrypted digest value carries a generation timestamp.

[0040] The encrypted digest value is stored in the blockchain network and linked to the main chain to obtain an initial information set that is immutable.

[0041] In one implementation, this embodiment relies on portable data collection terminals (including growers' handheld smart terminals, IoT sensors in processing workshops, GPS terminals on logistics vehicles, and barcode scanning devices at sales terminals) deployed at key nodes in the agricultural product supply chain to construct a multi-dimensional data collection network, achieving comprehensive acquisition of multi-source heterogeneous raw data streams. These multi-source heterogeneous raw data streams specifically cover three core types of information: production batch data, logistics trajectory records, and auxiliary data. Production batch data includes seed varieties, fertilization and pesticide records, harvest time, and test reports from the planting stage; cleaning and disinfection parameters, sorting standards, and packaging specifications from the processing stage; and warehousing time and storage environment parameters from the sales stage. Logistics trajectory records include vehicle numbers, real-time location coordinates, driving routes, cold chain temperature and humidity change curves, and loading and unloading time nodes. Auxiliary data includes the identity identifiers and operator information of the participants in each stage. The data collection terminals support both offline storage and online synchronization modes. When in areas with weak network signals (such as remote planting bases or mountainous transportation routes), data is first cached locally and automatically uploaded after the network is restored, ensuring no data is missed during collection.

[0042] In one implementation, this embodiment addresses the problem of disorganized formats in multi-source heterogeneous data by designing a standardized parsing and assembly process. First, a rule-based parsing engine is employed to formulate specific parsing rules for different data types based on their format characteristics. For structured data (such as fertilization records in Excel format or processing parameters stored in a database), preset key fields are directly extracted. For semi-structured data (such as inspection reports in XML format or GPS location data in JSON format), core information is extracted through tag matching. For unstructured data (such as photos of handwritten planting logs or video clips of the processing process), optical character recognition (OCR) technology is used to extract text information, and key operational scene features are extracted through video frame analysis. Subsequently, the extracted business features are assembled into standardized data entities to be uploaded to the blockchain. These entities contain a fixed set of fields: data type identifier, source node ID, unique code for associated batch, core business attributes, operation timestamp, and data verification code. This ensures that data from different sources has a unified structural standard, laying the foundation for subsequent processing.

[0043] It should be noted that, to ensure data integrity and tamper resistance, this embodiment performs double encryption operations on the data entities to be uploaded to the blockchain. First, the standardized data entity is subjected to a one-way hash operation using the SHA-256 hash algorithm to generate a fixed-length hash value as the data's unique digital fingerprint. Then, combined with the generated timestamp (accurate to the millisecond level) and the source node's private key, the hash value is digitally signed to form the final encrypted digest value. The introduction of the timestamp adds an immutable time dimension proof to the data, while the digital signature ensures the traceability of the data's source. Any tampering with the original data will cause the hash value to change, thereby invalidating the digital signature.

[0044] It should be further explained that during the data storage phase on the blockchain, this embodiment uses a consortium blockchain architecture to build the blockchain network. Consortium nodes include core enterprises from each link of the supply chain, regulatory agencies, and third-party testing institutions, ensuring the credibility and security of the network. The encrypted digest value is broadcast to all nodes of the consortium blockchain via a P2P network. Each node verifies the data according to a pre-set consensus mechanism (using a Byzantine fault-tolerant consensus algorithm). After successful verification, the data is packaged into a new block. The newly generated block contains the hash value of the previous block, the current block's data set, the block generation timestamp, and other information. A chain link is formed with the main chain through hash pointers, enabling inter-block correlation and verification. This storage method ensures that no node can tamper with the data already on the chain. To modify the data in a block, the hash values ​​of all subsequent blocks must be modified simultaneously, and the approval of more than half of the nodes in the network must be obtained to obtain an initial set of information with immutability.

[0045] In step S12, the source identifier and timestamp of each data entry in the initial information set are parsed. If the source identifier matches a preset multi-party participation standard, it is determined as a preliminary trusted entry; otherwise, it is marked as a potential conflict entry, thus obtaining a categorized data group, including:

[0046] Parse the source identifier and timestamp in the initial information set, verify the node identity corresponding to the source identifier using digital signature, and construct the time-series data stream to be verified;

[0047] The practical Byzantine fault-tolerant consensus algorithm is used to perform full-network verification on the time-series data stream to be verified, and candidate data entries are obtained.

[0048] If the source identifier of the candidate data entry matches the preset multi-party participation standard, the candidate data entry is established as a preliminary credible entry; otherwise, it is marked as a potential conflict entry, and a classified data group is obtained.

[0049] In one implementation, this embodiment first performs structured parsing on each data entry in the initial information set, extracting core identifier fields and time dimension information. The source identifier uses a combination encoding rule of "node type-unique number" to ensure that the identity of each data node is uniquely traceable; the timestamp is extracted to the millisecond level, accurately recording the specific moment the data was generated, providing a foundation for subsequent time-series verification. For node authentication corresponding to the source identifier, this embodiment employs an asymmetric encryption digital signature mechanism. Each supply chain node pre-registers a public key in the blockchain network. When data is generated, it uses its own private key to sign the core information of the entry (source identifier, timestamp, key business data), forming a digital signature string which is appended to the data entry. After receiving the data, the system calls the public key corresponding to the source identifier to decrypt and verify the digital signature string. If the decryption result matches the core information of the entry, the node's identity is confirmed as legitimate; if verification fails (e.g., decryption result mismatch, public key not registered), the data entry is marked as suspicious data and temporarily excluded from subsequent processing.

[0050] It should be noted that after identity verification, this embodiment arranges all legal data entries in ascending order of timestamps to construct a time-series data stream to be verified. This data stream is grouped based on a unique batch code to ensure that data from all stages of production, processing, and logistics for the same agricultural product batch are arranged sequentially in time, facilitating subsequent verification of data consistency. For the full-network verification of the time-series data stream, this embodiment employs the Practical Byzantine Fault Tolerance (PBFT) consensus algorithm. Pre-set consensus nodes in the blockchain network (including core enterprises, regulatory agencies, and third-party testing institutions) serve as verification nodes, participating in the consensus process. First, the master node broadcasts the time-series data stream to be verified to all verification nodes. Each verification node independently verifies each entry in the data stream (including secondary identity verification and timestamp validity checks), and cross-verifies the time-series logic for the same batch (e.g., the generation time of logistics data must be later than the harvesting data and earlier than the sales data). After verification, each node reports the voting results of "agree", "disagree" or "abstain" to the entire network. When the number of "agree" votes exceeds the preset threshold (2 / 3 of the total number of verification nodes), the time-series data stream passes consensus verification and generates candidate data entries. If the threshold is not reached, a rebroadcast and secondary verification process is triggered. If the secondary verification still fails, the batch of data streams is marked as abnormal and manual verification is initiated.

[0051] It should be further explained that after candidate data entries are generated, this embodiment performs final classification based on preset multi-party participation standards. These standards are stored in the blockchain network as an access whitelist. The whitelist contains the identifiers of legitimate nodes at each stage of the supply chain that have been certified, and it supports dynamic updates (new nodes must be added after network-wide consensus verification, while node deregistration is achieved by marking them as invalid). The system iterates through each candidate data entry, checking if its source identifier exists in the access whitelist. If it does, it is established as a preliminary trusted entry and directly enters the subsequent trust calculation process; if it does not exist (e.g., uncertified temporary nodes, external unfamiliar nodes), it is marked as a potential conflict entry and stored in a dedicated conflict data pool, awaiting subsequent conflict rating processing.

[0052] In step S13, for the potential conflict entries in the categorized data group, the associated logistics and processing records are obtained. By comparing the timestamps and batch codes, if the timestamp sequences are continuous and the batch codes are not duplicated, a conflict rating index is output, including:

[0053] Parse the traceability index key of the potential conflicting entries, retrieve the logistics and processing records mapped to the traceability index key, and generate a traceability association dataset;

[0054] Extract the timestamp metadata and batch code field from the source-tracing and association dataset, and construct a timestamp sequence based on the timestamp metadata;

[0055] The time difference between adjacent nodes in the timestamp sequence is calculated. If the time difference is less than a preset interval difference, the timestamp sequence is determined to have temporal continuity.

[0056] For the source association dataset with temporal continuity, the batch code field is compared. If the batch code field has no duplicates, a low-conflict-level conflict rating index is output; if the batch code field has duplicates, a high-conflict-level conflict rating index is output.

[0057] In one implementation, the traceability index key in this embodiment adopts a three-part combination structure of "unique batch code - stage identifier - data entry ID". The unique batch code follows the coding rule of "year - production area code - category code - serial number" (e.g., 2025-JS-SG-0036). The stage identifier is used to distinguish supply chain stages such as planting, processing, logistics, and sales (ZZ represents planting, JG represents processing, and WL represents logistics). The data entry ID is the unique serial number of the data within that batch. The system accurately locates the agricultural product batch and its production stage by parsing the traceability index key of potentially conflicting entries. Then, it retrieves the corresponding full-chain logistics records (including vehicle number, loading and unloading locations and times, cold chain temperature and humidity data, transportation route trajectory, etc.) and processing records (including processing parameters, sorting standards, packaging specifications, testing time and results, etc.) from the blockchain distributed ledger. These related data are then integrated to generate a traceability-related dataset.

[0058] It should be noted that, for the traceability-related dataset, this embodiment first extracts the timestamp metadata (accurate to the second) and batch code field of each data entry, and constructs a timestamp sequence by arranging the timestamps in ascending order. For example, the timestamp sequence of a batch of agricultural products is: 2025-06-10 08:30:00 (harvesting completed in the planting stage), 2025-06-10 14:15:00 (cleaning and disinfection completed in the processing stage), 2025-06-10 16:40:00 (loading and departure in the logistics stage), 2025-06-11 09:25:00 (unloading at the transit station in the logistics stage), 2025-06-11 15:10:00 (warehousing completed in the sales stage). Then, the time difference between adjacent nodes is calculated. The preset interval difference is set according to the reasonable flow time of different supply chain stages. For example, the preset interval difference from planting to processing is 12 hours, from processing to loading in the logistics stage is 4 hours, and from transit in the logistics stage is 8 hours, etc. If the time difference between all adjacent nodes is less than the preset interval difference of the corresponding link, and there is no time stamp reversal or missing, then the timestamp sequence is determined to have temporal continuity, indicating that the flow of agricultural products in each link conforms to normal logic; if there is a time difference exceeding the preset range (such as not being loaded 24 hours after processing) or a time stamp logic contradiction (such as the logistics warehousing time being earlier than the loading time), then it is marked as a temporal break and directly enters the high conflict warning process.

[0059] It should be noted that for traceability-related datasets with temporal continuity, this embodiment further compares the batch code field of all data entries. The batch code is consistent with the batch unique code in the traceability index key, ensuring the uniformity of identification of the same batch of agricultural products at each stage. During the comparison process, the system uses an exact matching algorithm to verify whether the batch code of each record is completely consistent with the target batch unique code: if the batch codes of all data entries are not duplicated or mixed (i.e., no codes of other batches appear), it is determined that the potential conflict entry is only a technical conflict caused by the source identifier not matching the whitelist, and the actual data content is true and reliable, and a low conflict level conflict rating index (marked with "L") is output; if the comparison finds duplicate batch codes (multiple conflict records with the same batch code appear in the same time window) or mixed codes of other batches (e.g., the target batch code is 2025-JS-SG-0036, but a record of 2025-JS-SG-0037 appears), it is determined that there is a substantial conflict risk such as batch cross-contamination and data forgery, and a high conflict level conflict rating index (marked with "H") is output.

[0060] In step S14, the conflict rating index and the preliminary trust entries are classified and processed. A trust score is calculated for each data entry based on the conflict rating index and the preliminary trust entries. The trust scores are then merged to obtain a comprehensive trust value, including:

[0061] Obtain the conflict rating index and the preliminary trust entry, and concatenate the conflict rating index with the associated historical credit data to form a joint feature vector;

[0062] The joint feature vector is input into a random forest classifier, the classification output is parsed to generate a trust probability distribution, and the trust probability distribution is converted into a trust score.

[0063] The dynamic weighting coefficient is calculated based on the degree of dispersion between the trust score and the conflict rating index;

[0064] The trust scores are weighted and averaged using the dynamic weighting coefficients to output the overall trust value obtained from the fusion calculation.

[0065] In one implementation, this embodiment first integrates the conflict rating indicators and preliminary trust entries to lay the foundation for trust score calculation. For preliminary trust entries, the system retrieves the historical credit data of the corresponding source node, including the node's data upload accuracy rate, conflict data correction response speed, number of violations, and core dimension information of the third-party institution's certification level over the past 36 months. For potential conflict entries, in addition to associating the aforementioned historical credit data, the conflict rating indicators (low conflict "L" or high conflict "H") are converted into quantitative identifiers, with low conflict corresponding to a value of 0 and high conflict corresponding to a value of 1, ensuring that the conflict level can participate in feature calculation. Since the aforementioned historical credit data contains parameters of different dimensions and types, it needs to be normalized first, mapping them uniformly to the [0,1] interval before they can be concatenated into a joint feature vector. The specific normalization method is as follows: the data upload accuracy rate (percentage type, value range 0~100%) is directly divided by 100 to convert it into a value in the [0,1] interval. For example, when the accuracy rate is 95%, the normalized value is 0.95. The conflict data correction response speed (time-length, in hours) employs a maximum-minimum normalization method. Historical data from the past 36 months for all nodes in the supply chain network is pre-analyzed to determine the minimum response speed. and maximum value Response speed of the current node The normalized value is The processing method ensures that nodes with faster response times (smaller values) receive higher normalized values. If , the normalized value is taken as 1. The number of violation records (integer type, with a value range of 0 to N) adopts the saturation normalization method. Set the upper threshold K for the number of violation records. If the actual number c ≥ K, the normalized value is 0; if c = 0, the normalized value is 1; if 0 < c < K, the normalized value is 1 - c / K. The third-party agency certification level (grade type, with a total of 4 levels), no certification is judged as 0.25, local certification is judged as 0.50, national certification is judged as 0.75, and international certification is judged as 1.00. After the above normalization process, the values of each dimension are unified to the interval [0, 1]. These normalized values are concatenated in a fixed order to form a combined feature vector. If the entry is a preliminary credible entry, its combined feature vector may include the feature dimensions of "historical data accuracy, presence or absence of violation records, third-party certification level, conflict rating" after quantization; if it is a low-conflict potential conflict entry, the conflict rating dimension in the vector is 0, and at the same time, each index in the historical credit data is retained to ensure that each entry has a feature representation with a unified dimension and meets the input requirements of the random forest classifier.

[0066] Specifically, based on the industry general standard for agricultural product supply chain credit management, a node is considered credit unacceptable if it has 3 or more violations (such as data fraud, key information underreporting) within 12 months. In this embodiment, 36 months of credit data is collected, and by推算 according to the time ratio, K = 3×(36 / 12) = 9. That is, 9 cumulative violation records within 36 months are used as the saturation threshold. More than 9 times is considered a complete loss of credit (normalized value is 0), and less than 9 times is calculated for the credit score according to the linear ratio. Therefore, the threshold K = 9. Those skilled in the art understand that this threshold can be adjusted according to the risk levels of different agricultural product categories. For example, for high-risk categories (such as fresh dairy products), the threshold can be appropriately reduced.

[0067] It should be noted that in this embodiment, the constructed combined feature vectors are batch-input into the pre-trained random forest classifier. The classifier learns the mapping relationship between different feature combinations and data credibility through a large number of samples in the offline stage. The training samples cover various scenarios such as normal data, minor conflict data, and severe conflict data in each link of the supply chain, and each sample is labeled with the true credibility label after manual review. After receiving the feature vector, the classifier outputs the binary trust probability distribution of the entry being credible or not through the parallel calculation of multiple decision trees. For example, if an entry outputs "credible probability 0.92, non-credible probability 0.08", the system directly takes the credible probability as the trust score of this entry, that is, the trust score of this entry is 92 points (out of 100 points), which intuitively reflects the credibility of the data entry itself.

[0068] It should be noted that the "推算" in the original text seems to be an incorrect or incomplete expression. I translated it as "推算" as it is, but it might need to be corrected to a more accurate term in the context.It is worth noting that the training of the random forest classifier first collects data entries as samples from historically completed agricultural product traceability cases that have been finally audited and confirmed by authoritative regulatory authorities. Each sample contains its joint feature vector, which consists of conflict rating, historical credit data, etc., and a binary label, "trustworthy" or "untrustworthy," which is determined by the audit results. Using this labeled dataset, a ten-fold cross-validation method is used to optimize the key hyperparameters of the random forest, such as the number of decision trees and the maximum depth, through grid search to obtain the highest classification accuracy and F1 score on the validation set, and finally determine the model parameters. The model is periodically updated offline using new audit cases to ensure that its evaluation capabilities are synchronized with business development.

[0069] It should be noted that this embodiment introduces a dynamic weighting coefficient calculation mechanism to avoid the limitations of a single trust score. The degree of dispersion is mathematically quantified using the coefficient of variation (CV), calculated as: CV = σ / μ. Where σ is the standard deviation of the trust score and the conflict rating index, and μ is the mean of the trust score and the conflict rating index. The dispersion is graded based on the CV value: CV ≤ 0.1 indicates low dispersion; 0.1 < CV ≤ 0.3 indicates moderate dispersion; and CV > 0.3 indicates high dispersion. The dynamic weighting coefficient is adaptively allocated according to the aforementioned dispersion. For initially trustworthy items, if the trust score is higher than 90 and CV ≤ 0.1, a weight of 0.9–1.0 is assigned; if the trust score is 70–90 and 0.1 < CV ≤ 0.3, a weight of 0.7–0.8 is assigned. For potentially conflicting items, items with a low-conflict rating have a CV ≤ 0.1 if their trust score deviates from the average score of similar low-conflict items by less than 5 points. If the deviation is less than 5 points, the weighting coefficient is set to 0.6-0.7. Items with a deviation of 5 points or more have a CV > 0.1, and the weighting coefficient is set to 0.4-0.5. Items with a high-conflict rating have a CV > 0.3, and the weighting coefficient is set to 0.2-0.3 to reduce their impact on the overall trust score.

[0070] It should be noted that the calculated dynamic weighting coefficients are used to perform a weighted average fusion of the trust scores of each data item. The system groups agricultural products by batch, iterates through all data items under that batch, multiplies the trust score of each item by the corresponding dynamic weighting coefficient, sums the results, and divides by the sum of the weighting coefficients of all items to obtain the overall trust value of that batch.

[0071] In step S15, entries with a value higher than a preset trust threshold are extracted from the overall trust value. Key fields from these entries are then integrated to obtain a unified quality traceability summary, including:

[0072] Obtain the overall trust value of the data entry to be processed, compare the overall trust value with a preset trust threshold, and extract the production batch records that exceed the preset trust threshold.

[0073] Based on the production batch records, unstructured test reports are retrieved, organic standard compliance description fields are extracted, and the organic standard compliance description fields are converted into compliance feature vectors.

[0074] A multidimensional data aggregation algorithm is used to process the compliance feature vector and pesticide residue detection data to obtain a consensus compliance attribute set.

[0075] The consensus compliance attribute set and logistics node information are concatenated into a time-series associated data chain;

[0076] The time-series associated data chain is input into the summary generation model for semantic aggregation, and a unified quality traceability summary reflecting the safety status of agricultural products throughout their entire life cycle is output.

[0077] In one implementation, this embodiment first clarifies the logic for setting a preset trust threshold. The preset trust threshold is determined based on the agricultural product quality and safety level requirements and the verification results of historical traceability data, and is set to 75 points (out of 100). The system iterates through all data entries, compares the comprehensive trust value of each entry with this threshold, filters out entries with scores higher than the threshold, and extracts the associated production batch records from these entries to form a high-trust production batch dataset. For the filtered high-trust production batch records, the system uses the batch's unique code to retrieve unstructured testing reports stored in the blockchain, including soil testing reports, irrigation water testing reports, rapid pesticide residue testing reports from the planting stage, hygiene compliance reports from the processing stage, and quality sampling reports from the sales stage. These reports are mostly stored in PDF, image, or plain text format. The system uses text extraction algorithms from Natural Language Processing (NLP) technology to locate and extract descriptive fields related to organic standard compliance.

[0078] It should be noted that this embodiment transforms the extracted organic standard compliance description fields into a standardized compliance feature vector. A combination of label mapping and quantitative assignment is used to pre-define organic standard-related feature dimensions, including organic certification level, detection status of prohibited and restricted substances, soil compliance status, and processing technology compliance. For example, organic certification level is assigned scores of 0-3 for no certification, local certification, national certification, and international certification respectively; detection status of prohibited and restricted substances is assigned scores of 2 for not detected, 1 for detected but not exceeding the standard, and 0 for exceeding the standard respectively; soil compliance status is assigned scores of 2 for fully compliant, 1 for partially compliant, and 0 for non-compliant. Based on the extracted description fields, each feature dimension is assigned a corresponding value, ultimately forming a compliance feature vector such as [3,2,2,2], realizing the transformation of unstructured text information into structured data.

[0079] In one implementation, this embodiment calls a multi-dimensional data aggregation algorithm to fuse compliance feature vectors with corresponding pesticide residue detection data. The pesticide residue detection data includes the ratio of the measured concentrations of common pesticides such as carbendazim, chlorpyrifos, and imidacloprid to the national standard limits; a smaller ratio indicates stricter pesticide residue control. The algorithm integrates the two types of data through a weighted summation method, with the compliance feature vector accounting for 60% of the weight and the pesticide residue detection data accounting for 40%. A consensus compliance attribute set is generated based on the fusion result. For example, if the compliance feature vector quantification score is 85 out of 100, and the pesticide residue test data are all below the limit standard by 30% (quantification score of 90), then the fused consensus compliance attribute set is highly compliant with organic product standards, and the pesticide residue control level is excellent. If there is a certain pesticide residue ratio close to the limit standard (such as 80%), then the consensus compliance attribute set is adjusted to basically compliant with organic product standards, and some pesticide residue indicators need to be continuously monitored to ensure that the attribute set can objectively reflect the compliance level of the batch. Among them, before the pesticide residue test data is input into the multidimensional data aggregation algorithm, it has been normalized or discretized according to the test items and national standard limits, and converted into a numerical vector compatible with the compliance feature vector dimension to ensure that the algorithm can perform effective calculations.

[0080] It should be noted that, to fully present the safety status of agricultural products throughout their entire lifecycle, this embodiment concatenates the consensus compliance attribute set and logistics node information in chronological order to form a time-series correlated data chain. The logistics node information is extracted from the blockchain and includes key time node data such as harvesting time, processing start and end times, logistics transportation start and end times, transit nodes, storage temperature and humidity records, and arrival time. During concatenation, timestamps are used as the sorting basis, and the consensus compliance attribute set is embedded into the corresponding links to form a continuous and complete end-to-end data chain.

[0081] It should be noted that the time-series correlated data chain is input into a pre-trained summary generation model. This model is trained on a large number of agricultural product traceability samples, extracting core information from the structured data chain and generating a natural language summary. The model first parses key information such as time nodes, compliance attributes, and logistics status in the data chain, then integrates it according to the logical sequence of "planting-processing-logistics-testing" to form a concise and easy-to-understand unified quality traceability summary. For example, the generated summary might state that this batch of agricultural products was harvested from an organically certified planting base on a specific date; the processing strictly followed organic standards, and no artificial additives were used; the entire process involved 2-4℃ cold chain transportation, and the logistics trajectory is traceable; after multiple stages of testing, no prohibited or restricted pesticide components were detected, pesticide residues were far below national standards, and the product's safety status remained stable throughout its entire lifecycle, meeting the requirements for organic product circulation. This summary comprehensively covers core traceability information, allowing consumers to quickly understand the product quality and providing regulators with clear auditing criteria.

[0082] It is worth noting that the summary generation model adopts a BART pre-trained language model based on an encoder-decoder architecture. It uses structured time-series association data chains from historical agricultural product traceability data as model input and natural language quality traceability summaries as supervisory labels to construct a paired training dataset. It employs the AdamW optimizer and a 2×10T... -5 The learning rate, batch size, and number of training rounds were set to 16. The loss function combined cross-entropy loss and sequence semantic similarity loss. ROUGE-1, ROUGE-L, and BLEU were used as evaluation metrics to optimize the model output, enabling the model to directly convert time-series related data chains into accurate, concise, and natural language summaries that conform to the standards for agricultural product quality traceability.

[0083] In step S16, for the unified quality traceability summary, consumer query input is obtained, and query keywords are matched with the summary field. If the matching degree exceeds a preset matching degree threshold, it is determined to be relevant traceability information, and the final output report is obtained, including:

[0084] Obtain a unified quality traceability summary, parse key security indicators, and transform the unified quality traceability summary into a structured semantic index library;

[0085] Receive consumer query input and map the query input into a query intent vector;

[0086] Calculate the weighted matching degree between the query intent vector and the summary field features obtained from the semantic index;

[0087] If the weighted matching degree is greater than the preset matching degree threshold, the current entry is determined to be relevant traceability information, and the associated traceability information set is extracted;

[0088] The associated traceability information set is integrated with key security indicators to obtain the final output report.

[0089] In one implementation, this embodiment first performs structured parsing and semantic transformation on the unified quality traceability summary. The unified quality traceability summary, generated in step S15, is a summary text of the safety status of agricultural products throughout their entire lifecycle, presented in natural language. The system uses Named Entity Recognition (NER) technology and keyword extraction algorithms to parse the summary text, extracting key safety indicator entities, including but not limited to: agricultural product category (e.g., apples, vegetables), production date, certification type (e.g., organic certification), testing items (e.g., pesticide residues, heavy metals), testing results (e.g., not exceeding standards, qualified), logistics conditions, and compliance conclusions. After parsing, each key safety indicator is associated with its corresponding semantic tag and weight value, and a structured semantic index is constructed according to a preset data structure. This index uses the key safety indicator as the index key and semantic tags, original descriptive text, and weight values ​​as association values, realizing the transformation from unstructured summary to a structured knowledge base, laying the foundation for efficient retrieval and matching.

[0090] In one implementation, this embodiment uses keyword matching and rule parsing to understand the query intent based on consumer input. Consumers input queries through mobile applications or web interfaces, such as "Are these apples organic?", "Is there cold chain support during transportation?", and "What are the pesticide residue test results?". The system first preprocesses the query by word segmentation and stop word removal, extracting core keywords such as "organic," "cold chain," "pesticide residue," "testing," and "origin." Then, the query is categorized into intent types such as "organic certification query," "logistics condition query," "safety testing query," and "production source query." Based on the number and weight of keyword hits, a confidence score is generated for each intent, forming a unified query intent vector. This vectorization makes the query intent quantifiable and comparable, providing a unified input for subsequent matching degree calculations.

[0091] It should be noted that this embodiment employs a weighted matching degree calculation method based on cosine similarity to match the query intent vector with the summary field features in the semantic index. The summary field features are also represented as vectors, with each feature vector having the same dimensions as the query intent vector. The values ​​for each dimension are assigned based on the association strength between the field and different intent categories (e.g., the "organic certification" field is assigned a value of 1 in the "organic certification query" dimension, and 0 in other dimensions). During the matching degree calculation, the cosine similarity between the query intent vector and each summary field feature vector is first calculated to obtain a basic similarity value. Then, a weighted adjustment is made to the basic similarity value using preset weight values ​​in the semantic index (e.g., the weight of key security indicators) to obtain the final weighted matching degree. The system iterates through all summary fields and selects the fields with the highest weighted matching degrees as candidate matching results.

[0092] It should be further explained that this embodiment sets a preset matching degree threshold of 0.6 (range 0-1), which is determined through analysis of historical query logs. If the weighted matching degree of a candidate field is greater than 0.6, the field is determined to be relevant traceability information and added to the associated traceability information set; if the matching degree of all fields does not reach the threshold, the current summary is determined to be unable to meet the query requirements, and the system returns a prompt message suggesting that the consumer re-enter or view other batches. The associated traceability information set includes successfully matched summary fields and their original description text, confidence level, source link, and other information to ensure the integrity and traceability of the information.

[0093] In one implementation, this embodiment fuses the associated traceability information set with the key security indicators parsed in step S15 to generate a final output report. The fusion process includes information deduplication, conflict resolution, and structured reorganization. First, the fields in the associated traceability information set are deduplicated, and entries with the same or similar semantics are merged. Second, if information conflicts are found during the fusion process (such as inconsistent descriptions of the same indicator in different stages), the comprehensive trust value in step S14 is used for arbitration, and the data source information with higher trust is prioritized. Finally, the information is reorganized according to the structured template of "query intent - key indicators - detailed description" to generate a concise, accurate, and easy-to-read final output report. The report typically includes: an overview of the query, a list of key safety indicators, a detailed description and confidence level of each indicator, the data source, and a comprehensive trust level indicator. It is presented to the consumer in a combination of text and graphics, resulting in the final report. For example, if a consumer queries "the pesticide residue test results for this batch of apples," the system matches the field "all pesticide residues are within acceptable limits" in the summary, links it to specific test reports (e.g., carbendazim <0.01mg / kg, chlorpyrifos not detected), and indicates that the data comes from a third-party testing agency with a trust level of 92. The final report outputs: "This batch of apples has undergone authoritative testing, and all pesticide residue indicators meet national standards. Detailed test data is as follows."

[0094] In step S17, based on the relevant traceability information in the final output report, the process traces back to the initial information set, calculates the attribute value difference characteristics between the relevant traceability information and the initial information set, and updates the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result, including:

[0095] Obtain the traceability information from the final output report, parse the traceability node identifier, and retrieve the corresponding initial information set in reverse based on the traceability node identifier;

[0096] Calculate the attribute value difference characteristics between the traceability information and the initial information set. If the difference characteristics exceed a preset tolerance range, lock the verification path that generates a new conflict.

[0097] The current trust score bound to the verification path is weighted and attenuated based on the difference characteristics to obtain the updated trust score;

[0098] The tracing chain is reconstructed based on the updated trust score, and an optimized tracing result that has been corrected and eliminated new conflicts is output.

[0099] In one implementation, this embodiment first parses the traceability information in the final output report and extracts the traceability node identifier used to locate the original data. The traceability node identifier is composed of the node type, the corresponding link, and a unique equipment code. Based on this identifier, the system performs a reverse retrieval in the initial information set stored on the blockchain. The retrieval process employs a hierarchical backtracking strategy, first locating the specific link of the node in the supply chain, and then filtering all original data records reported by the node within the relevant time period based on the timestamp range. This includes original equipment readings, manual entry logs, and hash values ​​of attached files, thereby reconstructing the complete initial state set of the node when the data was uploaded to the blockchain.

[0100] In one implementation, this embodiment performs attribute value difference feature calculation between traceability information and the initial information set. The system extracts key attribute values ​​that have been queried by consumers and reported in the traceability information, such as "average transport temperature is 3.5℃", "pesticide residue test result is not detected", and "organic certification status is national certification". Subsequently, in the retrieved initial information set, the system searches for corresponding original data describing the same fact. For numerical attributes, if the initial information is a series of continuously collected values ​​(such as temperature records per minute), the system calculates its statistical characteristic value (such as average, median) as a benchmark; for status or textual attributes, the explicit description in the original records is directly extracted as a benchmark. The calculation of difference features adopts the appropriate method according to the attribute type. Numerical attributes are calculated as a relative deviation percentage; status attributes are judged as consistent; textual attributes are evaluated using a semantic similarity algorithm. The difference evaluation results of all attributes are summarized into a structured difference feature set, which includes the name of each attribute, traceability information value, initial information benchmark value, calculated difference degree, and difference type label.

[0101] It should be noted that this embodiment determines conflicts in the set of differing features based on a preset tolerance range. This preset tolerance range is a reasonable deviation interval set during system deployment, taking into account agricultural product quality and safety standards, sensor measurement error ranges, industry operating procedures, and historical data fluctuations. For example, the tolerance range for cold chain transportation temperature might be set to "baseline value ± 1℃," the tolerance requirement for a "not detected" conclusion on pesticide residues is "must be completely consistent," and the tolerance for textual description information is set to "semantic similarity not less than 0.85." The system compares the degree of difference of each attribute in the set of differing features with its corresponding tolerance range. If the degree of difference of an attribute exceeds its tolerance range, a new conflict is determined to have occurred. Subsequently, the system locks down the complete verification path that caused this new conflict. This path information includes the conflicting attribute, the supply chain link to which it belongs, the unique identifier of the relevant data entry, the time point when the data was generated, and the specific equipment or operator involved. Locking down the verification path is to accurately locate the source of the problem, providing a clear target for subsequent trust score correction.

[0102] It should be further explained that for each locked verification path that generates a new conflict, this embodiment will apply a weighted decay to its current trust score to reflect the decrease in the credibility of the data source. The attenuation weight is determined based on the severity of the conflict. The severity of the conflict is quantified by the proportion by which the difference feature exceeds the preset tolerance range. That is, the difference feature minus the upper tolerance limit, divided by the upper tolerance limit, and then multiplied by 100%. The value range of the attenuation weight is consistent with the dynamic weight coefficient range set based on the conflict rating index in step S14. Specifically, if the proportion is ≤10%, it is judged as a minor conflict. At this time, the conflict level corresponds to the low conflict level item in step S14. Therefore, the attenuation weight is 0.9~1.0, for example, 0.95, indicating that the trust score is only slightly reduced. If the proportion is greater than 10% and less than or equal to 50%, it is judged as a medium conflict. Its severity is between low and high conflict. Therefore, the attenuation weight is 0.6~0.8, for example, 0.7, indicating that the trust score has a moderate decrease. If the proportion is greater than 50%, it is judged as a severe conflict, corresponding to the high conflict level item in step S14. Therefore, the attenuation weight is 0.2~0.5, for example, 0.3, indicating that the trust score has significantly decreased. The system multiplies the attenuation coefficient by the original trust score of the data entry to obtain the updated, reduced trust score.

[0103] The value range is obtained by reasonably expanding and mapping the dynamic weight coefficient range disclosed in step S14 of this application. In practical applications, specific values ​​can be selected within this range according to the risk level of agricultural product categories or historical data fluctuations. For example, the lower limit of the range can be used for high-risk categories.

[0104] It is worth noting that the optimization of the traceability results is a continuous iterative process. Once the updated trust score is calculated through backtracking verification and the optimized traceability results are generated, the system will automatically execute a closed-loop operation. First, the associated credibility label of the corresponding data entry in the semantic index is updated with the new trust score. Second, the traceability summary generation module is triggered to regenerate the unified quality traceability summary for this batch based on the updated high-trust data entry and replace the original summary. Subsequently, the new summary will be used to respond to all subsequent consumer queries. At the same time, this optimization event, including conflicting content, adjusted paths, and score changes, will be fed back to the trust calculation module as a new historical credit data entry to influence the credibility assessment of future related data sources. In this way, the optimization mechanism is fully integrated with the main process, realizing a complete logical closed loop for the traceability system to evolve and continuously improve itself.

[0105] In one implementation, this embodiment outputs the reconstruction and optimization results of the traceability chain based on the updated trust score. First, the system re-executes the comprehensive trust calculation in step S14 on a batch-by-batch basis using the updated trust scores of all data entries. Then, based on the same preset trust threshold, data entries that meet the "high trust" standard are re-selected. Subsequently, the system calls the summary generation process in step S15 to generate an updated and more accurate quality traceability summary based solely on this batch of new high-trust entries. Finally, the system compares this new traceability summary with the final output report previously provided to consumers and automatically generates an "optimized traceability result report." This report not only includes the new traceability conclusions but also clearly explains the discovered conflicts, affected links, trust score adjustments, and conclusion change points in the form of appendices or annotations. This optimized report will be stored on the blockchain and permanently associated with the batch of agricultural products, ensuring that any subsequent query can obtain this latest, verified, and cyclically corrected authoritative result.

[0106] It should be noted that the setting of preset thresholds and tolerance ranges in this invention follows the principles of standard priority, data-driven approach, and safety redundancy. First, mandatory national or industry standards, such as GB series standards, are prioritized, including pesticide residue detection limits and cold chain temperature ranges, with standard values ​​directly used as tolerance boundaries. Second, for parameters without clear standards, such as time intervals and matching thresholds, these are determined by analyzing the distribution of historical normal operation data. A large amount of historical process data without conflict alarms is collected, and the statistical distribution of time intervals at each stage is calculated, such as the 90th percentile, which is used as a reference benchmark for preset interval differences. By analyzing user query logs and satisfaction feedback, a matching threshold that balances recall and precision is determined. Finally, based on the initial setting of standards or data, a safety redundancy, such as ±0.5℃, is added to cope with sensor errors and occasional fluctuations, ensuring robustness of the judgment. All thresholds exist in the form of configurable parameters, supporting calibration according to different agricultural product categories and supply chain characteristics.

[0107] To facilitate understanding of the present invention, some preferred embodiments of the present invention will be described in further detail below.

[0108] In one implementation, the blockchain network of this invention can adopt a permissioned consortium blockchain architecture. Consortium members include core agricultural production enterprises, large logistics companies, authoritative quality testing institutions, and market regulatory departments. The network employs a practical Byzantine fault-tolerant consensus mechanism, setting the number of consensus nodes to seven, including four fixed core nodes and three rotating nodes. Data on-chain uses a sharding storage strategy, distributing agricultural product traceability data from different production areas across different blockchain shards, and achieving global searchability through a cross-shard indexing mechanism. Consumers can scan the QR code on the agricultural product packaging to directly launch a lightweight blockchain explorer, verifying the existence of the hash value of a specific batch of data in the blockchain and viewing the corresponding quality traceability summary without downloading the complete ledger.

[0109] It should be noted that this embodiment can further incorporate personalized recommendations and risk warnings when responding to consumer queries and generating the final output report. Based on the consumer's historical query records and preferences (such as a greater focus on organic certification or specific pesticide residue indicators), the system uses a collaborative filtering algorithm to recommend traceability information for agricultural products from similar batches or production areas, improving query efficiency and user experience. When the overall trust value shows a continuous or significant decline recently, the system automatically pushes risk warnings to relevant producers, regulators, and consumers who have subscribed to information on that category, and suggests paying close attention to the detailed traceability reports of the relevant batches.

[0110] In another implementation, IoT technology and edge computing can be deeply integrated into the data acquisition process. Various sensors and cameras are deployed in greenhouses, processing workshops, and cold chain transport vehicles to collect environmental data and operational images in real time. Edge computing gateways deployed at the nodes are responsible for preprocessing, feature extraction, and preliminary encryption of the raw data, before synchronizing the standardized data digest to the cloud blockchain network. Simultaneously, the gateway has offline storage and breakpoint resume capabilities, ensuring uninterrupted and unlost data acquisition even in remote production areas with poor network signals or during transportation.

[0111] In summary, this invention discloses a portable agricultural product quality traceability method based on blockchain, which realizes full-process reliable traceability from data source anti-tampering, intelligent resolution of multi-source conflicts, quantitative evaluation of trust to closed-loop optimization of traceability results, effectively improving the accuracy, reliability and user trust of agricultural product quality traceability.

[0112] Reference Figure 2 The second embodiment of the present invention provides a portable agricultural product quality traceability system based on blockchain, comprising:

[0113] The data acquisition and storage module is used to acquire multi-source heterogeneous raw data streams from various links in the supply chain, store the multi-source heterogeneous raw data streams, and obtain an initial information set;

[0114] The data classification module is used to parse the source identifier and timestamp of each data entry in the initial information set. If the source identifier matches the preset multi-party participation standard, it is determined as a preliminary credible entry. If it does not match, it is marked as a potential conflict entry, and the classified data group is obtained.

[0115] The conflict rating module is used to obtain the associated logistics and processing records for the potential conflict entries in the classified data group. By comparing the timestamps and batch codes, if the timestamp sequence is continuous and the batch codes are not repeated, the conflict rating index is output.

[0116] The trust score calculation module is used to classify and process the conflict rating index and the preliminary trust entries, calculate the trust score of each data entry based on the conflict rating index and the preliminary trust entries, and merge the trust scores to obtain a comprehensive trust score.

[0117] The traceability summary generation module is used to extract entries that are higher than the preset trust threshold from the comprehensive trust value, integrate the key fields in the entries, and obtain a unified quality traceability summary.

[0118] The report generation module is used to obtain consumer query input for the unified quality traceability summary, match query keywords with summary fields, and if the matching degree exceeds the preset matching degree threshold, it is determined to be relevant traceability information and the final output report is obtained.

[0119] The traceability result optimization module is used to trace back to the initial information set based on the relevant traceability information in the final output report, calculate the attribute value difference characteristics between the relevant traceability information and the initial information set, and update the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result.

[0120] It should be noted that the blockchain-based portable agricultural product quality traceability system provided in this embodiment of the invention is used to execute all the process steps of the blockchain-based portable agricultural product quality traceability method described in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.

[0121] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and 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. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0122] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A blockchain-based method for portable quality traceability of agricultural products, characterized by, include: Collect multi-source heterogeneous raw data streams from various links in the supply chain, store the multi-source heterogeneous raw data streams, and obtain an initial information set; The source identifier and timestamp of each data entry in the initial information set are parsed. If the source identifier matches the preset multi-party participation standard, it is determined as a preliminary credible entry. If it does not match, it is marked as a potential conflict entry, and the classified data group is obtained. For the potential conflict entries in the classified data group, obtain the associated logistics and processing records. By comparing the timestamps and batch codes, if the timestamp sequences are continuous and the batch codes are not duplicated, output the conflict rating index. The conflict rating index and the preliminary trust entries are classified and processed. A trust score is calculated for each data entry based on the conflict rating index and the preliminary trust entries. The trust scores are then merged to obtain a comprehensive trust value. Entries with a higher overall trust level than a preset trust level threshold are extracted from the overall trust level value, and key fields in the entries are integrated to obtain a unified quality traceability summary; For the unified quality traceability summary, obtain the consumer query input, match the query keywords with the summary field, and if the matching degree exceeds the preset matching degree threshold, it is determined to be relevant traceability information and the final output report is obtained; Based on the relevant traceability information in the final output report, the system traces back to the initial information set, calculates the attribute value difference characteristics between the relevant traceability information and the initial information set, and updates the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result. Specifically, for the potential conflict entries in the categorized data group, associated logistics and processing records are obtained. By comparing timestamps and batch codes, if the timestamp sequences are continuous and the batch codes are not duplicated, a conflict rating index is output, including: Parse the traceability index key of the potential conflicting entries, retrieve the logistics and processing records mapped to the traceability index key, and generate a traceability association dataset; Extract the timestamp metadata and batch code field from the source-tracing and association dataset, and construct a timestamp sequence based on the timestamp metadata; The time difference between adjacent nodes in the timestamp sequence is calculated. If the time difference is less than a preset interval difference, the timestamp sequence is determined to have temporal continuity. For the source association dataset with temporal continuity, the batch code field is compared. If the batch code field has no duplicates, a low-conflict-level conflict rating index is output; if the batch code field has duplicates, a high-conflict-level conflict rating index is output. 2.The blockchain-based portable agricultural product quality traceability method of claim 1, wherein, The process involves collecting multi-source heterogeneous raw data streams from various stages of the supply chain, storing these raw data streams, and obtaining an initial information set, including: Acquire multi-source heterogeneous raw data streams collected from various nodes of the portable agricultural product supply chain, wherein the multi-source heterogeneous raw data streams include production batch and logistics trajectory records; The multi-source heterogeneous raw data stream is parsed, business features are extracted and assembled into a data entity to be uploaded to the blockchain. The data entity to be uploaded to the blockchain is in a standardized format. The data entity to be uploaded to the blockchain is processed to generate an encrypted digest value. The encrypted digest value carries a generation timestamp. The encrypted digest value is stored in the blockchain network and linked to the main chain to obtain an initial information set that is immutable. 3.The blockchain-based portable agricultural product quality traceability method of claim 1, wherein, The process involves parsing the source identifier and timestamp of each data entry in the initial information set. If the source identifier matches a preset multi-party participation standard, it is determined as a preliminarily trustworthy entry; otherwise, it is marked as a potential conflict entry, resulting in a categorized data group, including: Parse the source identifier and timestamp in the initial information set, verify the node identity corresponding to the source identifier using digital signature, and construct the time-series data stream to be verified; The practical Byzantine fault-tolerant consensus algorithm is used to perform full-network verification on the time-series data stream to be verified, and candidate data entries are obtained. If the source identifier of the candidate data entry matches the preset multi-party participation standard, the candidate data entry is established as a preliminary credible entry; otherwise, it is marked as a potential conflict entry, and a classified data group is obtained. 4.The blockchain-based portable agricultural product quality traceability method of claim 1, wherein, The classification process involves using the conflict rating index and the preliminary trust entries. A trust score is calculated for each data entry based on the conflict rating index and the preliminary trust entries. These trust scores are then combined to obtain a comprehensive trust value, including: Obtain the conflict rating index and the preliminary trust entry, and concatenate the conflict rating index with the associated historical credit data to form a joint feature vector; The joint feature vector is input into a random forest classifier, the classification output is parsed to generate a trust probability distribution, and the trust probability distribution is converted into a trust score. The dynamic weighting coefficient is calculated based on the degree of dispersion between the trust score and the conflict rating index; The trust scores are weighted and averaged using the dynamic weighting coefficients to output the overall trust value obtained from the fusion calculation. 5.The blockchain-based portable agricultural product quality traceability method of claim 2, wherein, The process of extracting entries with a value higher than a preset trust threshold from the overall trust value, integrating the key fields in the entries, and obtaining a unified quality traceability summary includes: Obtain the overall trust value of the data entry to be processed, compare the overall trust value with a preset trust threshold, and extract the production batch records that exceed the preset trust threshold. Based on the production batch records, unstructured test reports are retrieved, organic standard compliance description fields are extracted, and the organic standard compliance description fields are converted into compliance feature vectors. A multidimensional data aggregation algorithm is used to process the compliance feature vector and pesticide residue detection data to obtain a consensus compliance attribute set. The consensus compliance attribute set and logistics node information are concatenated into a time-series associated data chain; The time-series associated data chain is input into the summary generation model for semantic aggregation, and a unified quality traceability summary reflecting the safety status of agricultural products throughout their entire life cycle is output. 6.The blockchain-based portable agricultural product quality traceability method of claim 1, wherein, For the unified quality traceability summary, the system obtains consumer query input, matches query keywords with summary fields, and if the matching degree exceeds a preset matching degree threshold, it is determined to be relevant traceability information, and a final output report is obtained, including: Obtain a unified quality traceability summary, parse key security indicators, and transform the unified quality traceability summary into a structured semantic index library; Receive consumer query input and map the query input into a query intent vector; Calculate the weighted matching degree between the query intent vector and the summary field features obtained from the semantic index; If the weighted matching degree is greater than the preset matching degree threshold, the current entry is determined to be relevant traceability information, and the associated traceability information set is extracted; The associated traceability information set is integrated with key security indicators to obtain the final output report. 7.The blockchain-based portable agricultural product quality traceability method of claim 1, wherein, The step involves tracing back to the initial information set based on the relevant traceability information in the final output report, calculating the attribute value difference characteristics between the relevant traceability information and the initial information set, and updating the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result. This includes: Obtain the traceability information from the final output report, parse the traceability node identifier, and retrieve the corresponding initial information set in reverse based on the traceability node identifier; Calculate the attribute value difference characteristics between the traceability information and the initial information set. If the difference characteristics exceed a preset tolerance range, lock the verification path that generates a new conflict. The current trust score bound to the verification path is weighted and attenuated based on the difference characteristics to obtain the updated trust score; The tracing chain is reconstructed based on the updated trust score, and an optimized tracing result that has been corrected and eliminated new conflicts is output.

8. A blockchain-based portable agricultural product quality traceability system, characterized by, For implementing the method as described in any one of claims 1-7, comprising: The data acquisition and storage module is used to acquire multi-source heterogeneous raw data streams from various links in the supply chain, store the multi-source heterogeneous raw data streams, and obtain an initial information set; The data classification module is used to parse the source identifier and timestamp of each data entry in the initial information set. If the source identifier matches the preset multi-party participation standard, it is determined as a preliminary credible entry. If it does not match, it is marked as a potential conflict entry, and the classified data group is obtained. The conflict rating module is used to obtain the associated logistics and processing records for the potential conflict entries in the classified data group. By comparing the timestamps and batch codes, if the timestamp sequence is continuous and the batch codes are not repeated, the conflict rating index is output. The trust score calculation module is used to classify and process the conflict rating index and the preliminary trust entries, calculate the trust score of each data entry based on the conflict rating index and the preliminary trust entries, and merge the trust scores to obtain a comprehensive trust score. The traceability summary generation module is used to extract entries that are higher than the preset trust threshold from the comprehensive trust value, integrate the key fields in the entries, and obtain a unified quality traceability summary. The report generation module is used to obtain consumer query input for the unified quality traceability summary, match query keywords with summary fields, and if the matching degree exceeds the preset matching degree threshold, it is determined to be relevant traceability information and the final output report is obtained. The traceability result optimization module is used to trace back to the initial information set based on the relevant traceability information in the final output report, calculate the attribute value difference characteristics between the relevant traceability information and the initial information set, and update the trust score if the difference characteristics exceed a preset tolerance range to obtain an optimized traceability result.