A food testing data processing method based on blockchain

By performing multi-dimensional division and hashing operations on food inspection data, sharding and using parallel blockchain architecture and multi-node concurrent verification algorithms, the tampering risk of food inspection data in transmission and storage process and the traditional blockchain architecture are solved. The problem of performance bottlenecks has achieved efficient and safe processing of food testing data.

CN118916369BActive Publication Date: 2025-02-11WEIFANG UNIV OF SCI & TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411404211.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2025-02-11
Estimated Expiration
2044-10-10

AI Technical Summary

Technical Problem

Food testing data is easily threatened by data tampering during transmission and storage. Traditional data processing methods are difficult to cope with huge data volumes. Especially in single-chain blockchain architecture, processing efficiency and response time are limited, and the data verification process is Safety and stability are difficult to guarantee.

Method used

By dividing food testing data in different dimensions, using a multi-dimensional data hashing algorithm to generate hash values, data sharding is performed and parallel blockchain architecture is introduced, and the sharded data is distributed on different links and runs independently. The node concurrent verification algorithm is used to verify and enhances the complexity and attack resistance of the verification value through nonlinear transformation and smoothing processing.

Benefits of technology

Effectively prevent tampering of food testing data during transmission and storage, improve the concurrency and response speed of data processing, enhance the security and stability of data verification, and ensure the integrity and consistency of food testing data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916369B_ABST
    Figure CN118916369B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data processing, and in particular to a food detection data processing method based on blockchain. The content includes: obtaining food detection data and dividing it according to different dimensions, calculating the hash value of food detection data of different dimensions, and using the data sharding algorithm to calculate the sharding data, introducing a parallel blockchain architecture, distributing the sharding data on different links for independent operation; calculating the verification value of the sharding data, judging the legitimacy of the sharding data based on the verification value of the sharding data, and recording the hash value of the legal sharding data and the corresponding food detection data of different dimensions on the blockchain. It solves the problem that food detection data is easily tampered with during transmission and storage, and it is difficult to ensure the integrity and authenticity of the data; traditional data processing methods are difficult to cope with huge amounts of data, it is difficult to ensure the security and stability of data verification, and it is easy to be attacked or data conflicts occur, resulting in inaccurate or inconsistent verification results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a food testing data processing method based on blockchain. Background Art

[0002] As global food safety issues become increasingly serious, the importance of food testing technology continues to increase. Food safety issues not only threaten consumer health, but also pose a challenge to the reputation and economic interests of companies. Although traditional food testing methods have guaranteed food safety to a certain extent, they are still insufficient in data processing and transparency. The emergence of blockchain technology provides a new way. By combining the characteristics of blockchain's immutability, decentralization and transparency, it can effectively solve the tampering risks and data opacity in traditional food testing data processing, improve the credibility and management level of food testing data, ensure the health and safety of consumers, and inject new impetus into the sustainable development of the food industry. With the continuous development and maturity of blockchain technology, blockchain-based food testing data processing methods will be widely used, which is expected to further improve the processing efficiency and reliability of food testing data and escort food safety.

[0003] However, the existing food inspection data processing methods have the following technical problems: food inspection data are vulnerable to data tampering during transmission and storage, resulting in the integrity and authenticity of food inspection data cannot be guaranteed; traditional data processing methods are difficult to cope with huge amounts of data, especially in a single-chain blockchain architecture, where processing efficiency and response time are greatly limited; the security and stability of food inspection data verification are difficult to guarantee, especially in a high-concurrency environment, where traditional verification methods are vulnerable to attacks or data conflicts, resulting in inaccurate or inconsistent food inspection data verification results. Summary of the invention

[0004] The present invention provides a food inspection data processing method based on blockchain to solve the problem that food inspection data is easily threatened by data tampering during transmission and storage, resulting in the lack of guarantee of data integrity and authenticity; traditional data processing methods are difficult to cope with huge amounts of data, especially in a single-chain blockchain architecture, where processing efficiency and response time are greatly limited, and security and stability in the data verification process are difficult to guarantee, especially in a high-concurrency environment, where traditional verification methods are susceptible to attacks or data conflicts, resulting in inaccurate or inconsistent verification results.

[0005] A food inspection data processing method based on blockchain of the present invention specifically includes the following technical solutions:

[0006] A food testing data processing method based on blockchain, comprising the following steps:

[0007] S1: Acquire food testing data, divide the food testing data according to different dimensions, and obtain food testing data of different dimensions; perform hash operations based on the food testing data of different dimensions using a multi-dimensional data hash algorithm to generate hash values ​​of the food testing data of different dimensions;

[0008] S2: Based on the hash values ​​of food testing data of different dimensions, the data sharding algorithm is used to calculate the sharded data, and a parallel blockchain architecture is introduced to distribute the sharded data on different links for independent operation;

[0009] S3: Based on the shard data, a multi-node concurrent verification algorithm is used to calculate the verification value of the shard data; based on the verification value of the shard data, the legitimacy of the shard data is judged, and the hash values ​​of the legal shard data and the corresponding food inspection data of different dimensions are recorded on the blockchain.

[0010] Preferably, the S1 specifically includes:

[0011] The specific calculation formula for the hash value of food testing data in different dimensions is:

[0012]

[0013] in, Indicates Food testing data in 3 dimensions The hash value of Indicates Food testing data in 3 dimensions; represents a constant; Represents the modulus operator; Indicates the modulus of the modulus.

[0014] Preferably, the S2 specifically includes:

[0015] The specific implementation steps of the data sharding algorithm are as follows: the first step is to perform weighted processing on the hash value of the food detection data of each dimension; the second step is to perform exponential decay processing on the hash value of the food detection data of each dimension; the third step is to add a constant term to adjust the baseline value of the sharded data.

[0016] Preferably, the S3 specifically includes:

[0017] The multi-node concurrent verification algorithm verifies the shard data through the verification node, introduces nonlinear transformation and smoothing processing, and obtains the verification value of the shard data.

[0018] Preferably, the S3 specifically includes:

[0019] In the process of implementing the multi-node concurrent verification algorithm, a tangent function is introduced into the shard data on each verification node for nonlinear transformation to obtain the shard data after nonlinear transformation.

[0020] Preferably, the S3 specifically includes:

[0021] Based on the sharded data after nonlinear transformation, a logarithmic function is introduced for smoothing to obtain the sharded data verification results generated by each verification node.

[0022] Preferably, the S3 specifically includes:

[0023] The shard data verification results generated by each verification node are averaged to obtain the final shard data verification result; a sensitivity control step is introduced to smooth the final shard data verification result to obtain the verification value of the shard data.

[0024] Preferably, the S3 specifically includes:

[0025] Set a threshold and judge the legitimacy of the shard data by comparing the verification value of the shard data with the threshold; record the hash values ​​of the legal shard data and the corresponding food inspection data of different dimensions on the blockchain; the hash values ​​of the illegal shard data and the corresponding food inspection data of different dimensions are rejected and recorded on the blockchain and need to be re-verified.

[0026] The beneficial effects of the technical solution of the present invention are:

[0027] 1. By dividing the food inspection data into different dimensions and using the multi-dimensional data hash algorithm to perform hash operations respectively, the hash values ​​of the food inspection data of different dimensions are generated, providing a unique identifier that can be used to verify the integrity of the food inspection data and prevent the tampering or loss of the food inspection data during transmission and storage, thereby ensuring the authenticity and integrity of the food inspection data;

[0028] 2. By using the data sharding algorithm to shard the food testing data, and combining it with the parallel blockchain architecture, the sharded data is distributed on different links and runs independently. Each link can process the sharded data independently, which significantly improves the concurrency and response speed of data processing, effectively solves the performance bottleneck problem of the traditional blockchain architecture in a concurrent environment, and greatly improves the processing efficiency of food testing data;

[0029] 3. In the multi-node concurrent verification process, the complexity and unpredictability of the verification value of the shard data are enhanced by performing nonlinear transformation of the tangent function and smoothing of the logarithmic function on the shard data. Combined with the sensitivity control step adjusted by the Sigmoid function, the verification value of the shard data is smooth and stable, which not only improves the efficiency of node verification, but also enhances the anti-attack capability, ensuring the security and integrity of food testing data in the entire processing flow;

[0030] 4. By setting thresholds to judge the verification value of shard data, it is ensured that only legal data can be recorded on the blockchain, which improves the reliability of data storage and management, ensures the legality and consistency of the final stored data, and provides a guarantee for the long-term storage of food testing data. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 This is a flow chart of a food inspection data processing method based on blockchain described in the present invention. DETAILED DESCRIPTION

[0032] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0034] The following is a detailed description of a specific solution of a food inspection data processing method based on blockchain provided by the present invention in conjunction with the accompanying drawings.

[0035] See attached Figure 1 , which shows a flowchart of a food inspection data processing method based on blockchain provided by an embodiment of the present invention, the method comprising the following steps:

[0036] S1. Acquire food testing data, divide the food testing data according to different dimensions, and obtain food testing data of different dimensions; perform hash operations based on the food testing data of different dimensions using a multi-dimensional data hash algorithm to generate hash values ​​of the food testing data of different dimensions;

[0037] Obtain food testing data. In order to ensure the authenticity and integrity of food testing data, the food testing data is divided according to different dimensions to obtain food testing data of different dimensions, such as temperature, humidity, and chemical component concentration;

[0038] Use a multi-dimensional data hash algorithm to perform hash operations on food testing data of different dimensions to generate hash values ​​of food testing data of different dimensions; the hash value is generated to provide a unique identifier for verifying the integrity of the food testing data and preventing the food testing data from being tampered with or lost;

[0039] The multi-dimensional data hash algorithm generates a stable and random hash value by combining logarithmic transformation, square root transformation and modulus operation to ensure the integrity and authenticity of food testing data of different dimensions during the verification and validation process;

[0040] Logarithmic transformation of food detection data of different dimensions can effectively reduce the dynamic range of food detection data of different dimensions, making the food detection data of different dimensions smooth and continuous, reducing conflicts caused by the great differences in food detection data of different dimensions during the hash operation process, and also helping to improve the randomness of the hash value;

[0041] In order to further smooth the distribution of food inspection data of different dimensions and avoid differences in food inspection data of different dimensions in extreme cases, square root transformation is performed on the food inspection data of different dimensions that have undergone logarithmic transformation. During the square root transformation process, a constant value is introduced to adjust the smoothness of the square root transformation result in order to prevent the occurrence of extreme values ​​in the food inspection data of different dimensions, which may lead to instability of the square root transformation result.

[0042] The modulo operation ensures that the hash values ​​of food testing data of different dimensions fluctuate within a predetermined range, thereby avoiding extremely large or extremely small hash values. The modulo range can be set according to actual needs;

[0043] The specific calculation formula for the hash value of food testing data in different dimensions is:

[0044]

[0045] in, Indicates Food testing data in 3 dimensions The hash value of Indicates Food testing data in various dimensions, such as temperature, humidity, and chemical component concentration; Express Perform natural logarithmic transformation to transform The range of food testing data in each dimension is compressed, the impact of extreme values ​​is reduced, and the stability of food testing data processing is enhanced. It can avoid the input of the natural logarithm function being zero; Expressing the Food testing data in 3 dimensions With constant The square root of the sum is calculated to further smooth the Fluctuations in food testing data in different dimensions; Represents a constant, which is used to avoid the instability of the square root transformation result caused by extremely small square root input values; Represents the modulo operator, which is used to control the length and range of the hash value of food testing data of different dimensions for easy storage and comparison; The modulus represents the modulus of the modulus, which is used to limit the range of the hash value of the food detection data of different dimensions. It can be set according to the specific implementation scenario and is not limited here;

[0046] By performing hash operations on food testing data of different dimensions, not only the security and stability of data processing are improved, but also a reliable input basis is provided for subsequent processing, ensuring the integrity and consistency of food testing data during transmission, storage and processing;

[0047] S2. Based on the hash values ​​of food testing data of different dimensions, the data sharding algorithm is used to calculate the sharded data, and a parallel blockchain architecture is introduced to distribute the sharded data on different links for independent operation;

[0048] As the amount of food testing data continues to grow, the traditional single-chain blockchain architecture faces bottlenecks in processing efficiency and response time. According to the hash values ​​of food testing data in different dimensions, the data sharding algorithm is used to calculate the sharded data, which improves the data processing throughput and response speed.

[0049] The specific implementation steps of the data sharding algorithm are as follows:

[0050] First, the hash value of the food detection data of each dimension is multiplied by a predefined weight. The weight is pre-set according to the importance of the food detection data of different dimensions. Through weighted processing, the sharding result can be adjusted according to the importance of each dimension, so that the sharding data is representative and balanced;

[0051] Furthermore, the hash value of the food detection data of each dimension is subjected to exponential decay processing. The exponential decay is to reduce the influence of the extreme values ​​in the hash value of the food detection data of each dimension on the shard data, ensure the balance of the shard data, and adjust the degree of decay through the control parameters of the exponential decay function to ensure that the hash values ​​of the food detection data of different dimensions remain balanced when combined, and avoid extreme values ​​dominating the shard results;

[0052] Finally, a constant term is added to adjust the entire shard data to ensure that the baseline value of the shard data is within a reasonable range, which is conducive to subsequent storage and processing;

[0053] The calculation formula for shard data is:

[0054]

[0055] in, Indicates Shard data; It represents the sum of the hash values ​​of the food testing data after weighted and exponential decay processing in all dimensions; Indicates The hash value of food testing data in each dimension; Indicates the total number of dimensions; Indicates The weight corresponding to each dimension reflects the relative importance of the hash value of food testing data of different dimensions in the sharded data; Represents an exponential decay function, which prevents extreme values ​​from dominating the sharding results through exponential decay; represents the control parameter of the exponential decay function, which can be set according to the specific implementation scenario and is not limited here; Represents a constant term, which is used to adjust the baseline value of the shard data to ensure that all shard data has a basic offset to avoid the concentration or dispersion of shard data. It can be set according to the specific implementation scenario and is not limited here;

[0056] The parallel blockchain architecture is introduced to distribute shard data on different links and run them independently. Each link can process shard data independently. The parallel operation of links significantly improves the concurrent capability of data processing.

[0057] The data sharding algorithm and parallel blockchain architecture solve the performance bottleneck problem of the traditional blockchain architecture in a concurrent environment, improve the data processing speed and concurrency, and provide reliable technical support for processing food testing data;

[0058] S3. Based on the shard data, a multi-node concurrent verification algorithm is used to calculate the verification value of the shard data; based on the verification value of the shard data, the legitimacy of the shard data is judged, and the hash values ​​of the legal shard data and the corresponding food testing data of different dimensions are recorded on the blockchain;

[0059] Based on the shard data, a multi-node concurrent verification algorithm is used to calculate the verification value of the shard data; the multi-node concurrent verification algorithm verifies the shard data through the verification node, introduces nonlinear transformation and smoothing processing technology, and ensures the legitimacy, consistency and immutability of the shard data;

[0060] Specifically, a nonlinear transformation is performed on the shard data at each verification node to obtain the shard data after the nonlinear transformation; the nonlinear transformation uses a tangent function, which can increase the complexity and unpredictability of the shard data and avoid potential safety hazards caused by simple linear processing; the shard data after the nonlinear transformation is further smoothed to obtain the shard data verification results generated by each verification node; the smoothing uses a logarithmic function, which can effectively reduce the impact of extreme values ​​on the shard data verification results; the shard data verification results generated by each verification node are averaged to obtain the final shard data verification result, ensuring that the final shard data verification result can reflect the comprehensive opinions of all verification nodes; in order to further adjust and optimize the final shard data verification result, a sensitivity control step adjusted by a Sigmoid function is introduced, which can smooth the final shard data verification result to obtain the verification value of the shard data, so that the verification value of the shard data remains stable;

[0061] The calculation formula for the verification value of the shard data is:

[0062]

[0063] in, Indicates The verification value of the shard data is used to determine the The legitimacy and validity of each shard’s data; Indicates the total number of verification nodes The reciprocal of is used to find the average value; Indicates the first Sum the verification results of each shard data; Indicates The fragment data is in The value on the verification node; Expressing the The fragment data is in The values ​​on each node are transformed tangently to increase complexity and randomness and prevent security risks caused by simple linear relationships. Represents the natural logarithm function, which is used for smoothing and reducing the impact of extreme values; Represents the Sigmoid function, which is used to smooth the shard data verification results generated by different verification nodes; It represents the control parameter for adjusting the output amplitude of the Sigmoid function, which can be set according to the specific implementation scenario and is not limited here; It represents the control parameter for adjusting the steepness and response sensitivity of the Sigmoid function, which can be set according to the specific implementation scenario and is not limited here; Represents an exponential decay function, which is used to smooth the shard data verification results generated by different verification nodes;

[0064] Set a threshold , which can be set according to the specific implementation scenario and is not limited here; the verification value of the shard data is compared with the threshold to determine the legitimacy of the shard data. The verification value of the shard data Greater than threshold , then The data of the first shard will be considered valid and The hash values ​​of the shard data and the corresponding food inspection data of different dimensions are recorded on the blockchain; otherwise, they will be rejected and recorded on the blockchain and need to be re-verified;

[0065] Concurrent verification of nodes improves data processing efficiency, while enhancing anti-attack capabilities and data processing stability through nonlinear transformation and smoothing processing, providing a solid foundation for subsequent data storage and management, and ensuring that food inspection data always maintains security and integrity throughout the entire processing process.

[0066] In summary, a food inspection data processing method based on blockchain was completed.

[0067] The order of the embodiments of the invention is for description only and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0068] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0069] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions described in the above embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A food testing data processing method based on blockchain, characterized in that: The following steps are involved: S1: Acquire food testing data, divide the food testing data according to different dimensions, and obtain food testing data of different dimensions; perform hash operations based on the food testing data of different dimensions using a multi-dimensional data hash algorithm to generate hash values ​​of the food testing data of different dimensions; S2: Based on the hash values ​​of food testing data of different dimensions, the data sharding algorithm is used to calculate the sharding data, and a parallel blockchain architecture is introduced to distribute the sharding data on different links for independent operation; the calculation formula for sharding data is: ; in, Indicates Shard data; Indicates Food testing data in 3 dimensions The hash value of Indicates the total number of dimensions; Indicates The weight corresponding to each dimension; represents an exponential decay function; represents the control parameter of the exponential decay function; represents a constant term; S3: Based on the sharded data, a multi-node concurrent verification algorithm is used to verify the sharded data through the verification node, and nonlinear transformation and smoothing are introduced to the sharded data to calculate the verification value of the sharded data; based on the verification value of the sharded data, the legitimacy of the sharded data is judged, and the hash values ​​of the legal sharded data and the corresponding food inspection data of different dimensions are recorded on the blockchain.

2. According to a blockchain-based food testing data processing method according to claim 1, it is characterized in that: The S1 specifically includes: The specific calculation formula for the hash value of food testing data in different dimensions is: ; in, Indicates Food testing data in 3 dimensions The hash value of Indicates Food testing data in 3 dimensions; represents a constant; Represents the modulus operator; The modulus of the modulus.

3. According to a blockchain-based food testing data processing method according to claim 1, it is characterized in that: The S3 specifically includes: In the process of implementing the multi-node concurrent verification algorithm, a tangent function is introduced into the shard data on each verification node for nonlinear transformation to obtain the shard data after nonlinear transformation.

4. According to a blockchain-based food testing data processing method according to claim 3, it is characterized in that: In the S3, it also includes: Based on the sharded data after nonlinear transformation, a logarithmic function is introduced for smoothing to obtain the sharded data verification results generated by each verification node.

5. A food detection data processing method based on blockchain according to claim 4, characterized in that: In the S3, it also includes: The shard data verification results generated by each verification node are averaged to obtain the final shard data verification result; a sensitivity control step is introduced to smooth the final shard data verification result to obtain the verification value of the shard data.

6. A method for processing food testing data based on blockchain according to claim 5, characterized in that: In the S3, it also includes: Set a threshold and judge the legitimacy of the shard data by comparing the verification value of the shard data with the threshold; record the hash values ​​of the legal shard data and the corresponding food inspection data of different dimensions on the blockchain; the hash values ​​of the illegal shard data and the corresponding food inspection data of different dimensions are rejected and recorded on the blockchain and need to be re-verified.

Citation Information

Patent Citations

  • Document duplication judgment method and device, electronic equipment and storage medium

    CN113361249A

  • Block chain health degree testing method and device, storage medium and program product

    CN116955100A