A Traceability Method and System Based on Blockchain
By obtaining and analyzing the characteristic data in the entire product production process, the unique correspondence and traceability of product traceability are achieved, the problem of insufficient correspondence between product and on-chain information in the existing technology is solved, and the traceability efficiency and data on-chain efficiency are improved.
Patent Information
- Application Number
- CN202411151854.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2044-08-21
AI Technical Summary
In the prior art, when using blockchain technology to trace product information, it only relies on external information, and cannot guarantee the unique correspondence and traceability between the product's own attributes and the chained information.
By obtaining various characteristic data in the entire product production process, analyzing parameter changes, obtaining change characteristic data, and configuring the initial acquisition accuracy, collecting parameter values during the preset production cycle, analyzing the chain rolling accuracy, adjusting the parameter values for blockchain rolling, realizing product traceability.
On the premise of ensuring the traceability of the parameter values of product change characteristic data, the data length when the product change characteristic data is put on the chain is reduced, the data rolling efficiency is improved, and the correspondence between the product itself parameters and the data rolling information during the product information traceability process is ensured.
Smart Images

Figure CN119130488B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information traceability, and particularly to a traceability method and system based on blockchain. Background Art
[0002] Blockchain traceability is a method of using blockchain technology to track and verify products throughout the process. The main advantages of blockchain traceability lie in its characteristics of non-tamperable data, traceability, decentralization, and distributed ledger. These features enable blockchain technology to ensure the authenticity and credibility of information, improve traceability efficiency, and protect the rights and interests of consumers.
[0003] In the prior art, when using blockchain technology to trace blockchain on-chain information based on product information, since only external information such as product electronic tags is used for traceability query, it is easy to cause that although the product label and on-chain information can be corresponding, but because the product itself may not necessarily correspond to the on-chain information, thus the unique correspondence and traceability between the product itself attributes and the on-chain information cannot be guaranteed. Summary of the Invention
[0004] In view of the above-mentioned disadvantages of the prior art, the purpose of the present invention is to provide a traceability method and system based on blockchain, which is used to solve the problem that in the prior art, when using blockchain technology to trace blockchain on-chain information based on product information, since only external information such as product electronic tags is used for traceability query, it is easy to cause that although the product label and on-chain information can be corresponding, but because the product itself may not necessarily correspond to the on-chain information, thus the unique correspondence and traceability between the product itself attributes and the on-chain information cannot be guaranteed.
[0005] To achieve the above purpose and other related purposes, the present invention provides a traceability method based on blockchain, including the following steps: On-chain processing process: Obtain various types of characteristic data of the product in the whole production process of the product, and obtain the changing characteristic data in various types of characteristic data according to the parameter change situation of the characteristic data; Configure the initial acquisition accuracy of the changing characteristic data, and collect the parameter values of the changing characteristic data within a preset production cycle; Analyze the on-chain accuracy allowed for the parameter values of all the changing characteristic data within the preset production cycle; Control to adjust the parameter values of the changing characteristic data with the initial acquisition accuracy to the on-chain parameter values corresponding to the on-chain accuracy, and perform blockchain on-chain of the on-chain parameter values according to the preset production cycle to obtain blockchain on-chain information;
[0006] Traceability processing process: Collect the traceability parameter values of the changing characteristic data corresponding to the product and the corresponding preset production cycle, and trace each on-chain information of the corresponding product from the blockchain on-chain information.
[0007] In an embodiment of the present invention, various types of characteristic data of a product in the entire production process of the product are obtained, including: obtaining a data set S of the entire production process of the product all , and according to the data classification attributes, the screened data belonging to the product's own characteristics in the data set are selected as characteristic data S t .
[0008] In an embodiment of the present invention, according to the parameter change situation of the characteristic data, the changing characteristic data in various types of characteristic data are obtained, including: searching for various types of characteristic data S t corresponding parameter values A i , and each precision digit x of each parameter value A of each type i is compared one by one, and the characteristic data S in which the numerical values composed of each precision digit x are all different t is used as the changing characteristic data S g .
[0009] In an embodiment of the present invention, each precision digit x of each parameter value A of each type i is compared one by one, and the characteristic data S in which the numerical values composed of each precision digit x are all different t is used as the changing characteristic data S g , including: judging whether there are exactly the same items among the precision digits x in each parameter value A max when the initial acquisition precision J i is reached. If so, the characteristic data S i corresponding to the parameter value A t is used as the fixed characteristic data S r . If not, the characteristic data S i corresponding to the parameter value A t is used as the changing characteristic data S g , where x represents the digits of the parameter value A i distributed according to natural numbers from left to right, and x ∈ [1, 2,..., J max .
[0010] In an embodiment of the present invention, the initial acquisition precision of the changing characteristic data is configured, and the parameter values of the changing characteristic data within a preset production cycle are collected, including: according to the initial acquisition precision J max , the precision digits x from left to right of the parameter value A n of the changing characteristic data S g within the preset production cycle t i are adjusted to the initial acquisition precision J max , and the parameter value A max is collected according to the initial acquisition precision J i .
[0011] In one embodiment of the present invention, the chain accuracy of the parameter values of all the changing characteristic data within the preset production cycle is analyzed, including: determining the chain accuracy of the parameter values of all the changing characteristic data within the preset production cycle t n The previous parameter value A i-1 The value a of each precision digit x from left to right i-1 Is it consistent with the next parameter value A i The value a of each precision digit x from left to right i are the same, if there is a value a with at least one precision digit x (x,i-1) and the value a (x,i) If they are not the same, the control continues to obtain the preset production cycle t n The next parameter value A i+1 , if the value a of each precision digit x i-1 and the value a i are the same, the control resets the previous parameter value A i-1 and the next parameter value A i The comparison precision bits are compared in a self-increasing manner according to the precision bit number, and the chain precision is updated.
[0012] In one embodiment of the present invention, the control resets the last parameter value A i-1 and the next parameter value A i The comparison precision bits are compared in the manner of increasing the precision bits, and the chain precision is updated, including: controlling the current precision bits to increase by 1, obtaining the precision bits as x+1, and replacing the previous parameter value A i-1 The value a of the x+1th precision digit (x+1,i-1) With the next parameter value A i The value a of the x+1th precision digit (x+1,i) Compare until the number of self-increment is y j When the previous parameter value A i-1 The x+y j The precision value a (x+y,i-1) With the next parameter value A i The x+y j The precision value a (x+y,i) If they are not the same, update the output increment times y j The corresponding single chain accuracy is x+y j , where (x+y j )≤J max , J max is the initial acquisition accuracy; according to the preset production cycle t n The single chain accuracy x+y obtained by each update j , get the preset production cycle t n Winding accuracy within x all =x+∑yj , where y j is the number of self - increments of the parameter value A n collected within the preset production cycle t i .
[0013] In an embodiment of the present invention, the parameter value of the change characteristic data with the initial acquisition accuracy is controlled to be adjusted to the on - chain parameter value corresponding to the on - chain accuracy, and the on - chain parameter value is uploaded to the blockchain according to the preset production cycle, obtaining the blockchain on - chain information, including: according to the obtained on - chain accuracy x all =x + ∑y j , for each parameter value A n within the preset production cycle t i , perform data update with the accuracy bit from left to right being the on - chain accuracy x n within the preset production cycle t all =x + ∑y j , obtaining the on - chain parameter value A Si , and establish a corresponding relationship between the on - chain parameter value A Si and the preset production cycle t n to perform the on - chain of the blockchain, and associate the full - process product production data within the preset production cycle t Si -t n with A n -t Si -t n to obtain the blockchain on - chain information.
[0014] In an embodiment of the present invention, the traceability parameter value of the change characteristic data corresponding to the product and the corresponding preset production cycle are collected, and each on - chain information corresponding to the product is traced from the blockchain on - chain information, including: according to the preset production cycle t n , find the corresponding on - chain parameter values A Si and the on - chain accuracy x n within the preset production cycle t all =x + ∑y j , judge whether the accuracy digit x SY from left to right of the traceability parameter value A SY is less than the on - chain accuracy x n within the preset production cycle t all =x + ∑y j . If x SY <x all , then control to output an alarm signal indicating that the accuracy digit does not meet the standard. If x SY ≥x SY , then adjust the accuracy digit x all from left to right of the traceability parameter value A SY to the on - chain accuracy within the preset production cycle t SY n The winding accuracy x within all 。
[0015] The present invention also provides a traceability system based on blockchain, including: a feature selection unit, which obtains various feature data of a product in the whole process of product production, and obtains the changing feature data in various feature data according to the parameter change situation of the feature data; a data acquisition unit, which configures the initial acquisition accuracy of the changing feature data and acquires the parameter values of the changing feature data within a preset production cycle; a blockchain analysis unit, which analyzes the blockchain accuracy allowed for the parameter values of all the changing feature data within the preset production cycle; a blockchain control unit, which controls to adjust the parameter values of the changing feature data with the initial acquisition accuracy to the blockchain parameter values corresponding to the blockchain accuracy, and performs blockchain uploading of the blockchain parameter values according to the preset production cycle to obtain blockchain upload information; and a traceability query unit, which acquires the traceability parameter values of the changing feature data corresponding to the product and the corresponding preset production cycle, and traces and obtains each upload information of the corresponding product from the blockchain upload information.
[0016] As above, a traceability method and system based on blockchain of the present invention have the following beneficial effects: By obtaining the changing feature data based on the product itself in the whole process of product production data, it is possible to use the parameter values of the changing feature data as the basis for tracing the product upload information. Moreover, after acquiring the parameter values of the changing feature data that meet the maximum acquisition accuracy, by analyzing, it is determined that the blockchain accuracy that can meet the condition that the parameter values are all different, that is, the minimum number of digits of the blockchain accuracy that meets the condition that the parameter values are all different. And according to this blockchain accuracy, it is controlled to upload the parameter values of the corresponding number of digits of the changing feature data, which can reduce the data length when the product changing feature data is uploaded and improve the data upload efficiency on the premise of ensuring the traceability of the parameter values of the product changing feature data. And after the parameter values of the product changing feature data and the corresponding preset production cycle are uploaded, it is convenient for users to obtain the unique uploaded data corresponding to them safely and accurately according to the preset production cycle obtained from, for example, product labels and the parameter values of the changing feature data of the product itself, ensuring the correspondence between the product's own parameters and the uploaded data information during the product information tracing process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flowchart of the traceability method of the present invention.
[0018] Figure 2 It is an architecture diagram of the traceability system of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0019] Please refer to Figure 1, the present invention provides a traceability method based on blockchain, comprising the following steps:
[0020] On-chain processing process: Obtain various types of characteristic data of the product in the entire production process of the product, and obtain the changing characteristic data in various types of characteristic data according to the parameter change situation of the characteristic data; Configure the initial acquisition accuracy of the changing characteristic data, and collect the parameter values of the changing characteristic data within a preset production cycle; Analyze the on-chain accuracy allowed for the parameter values of all changing characteristic data within the preset production cycle; Control to adjust the parameter values of the changing characteristic data with the initial acquisition accuracy to the on-chain parameter values corresponding to the on-chain accuracy, and perform blockchain on-chain of the on-chain parameter values according to the preset production cycle to obtain blockchain on-chain information;
[0021] Traceability processing process: Collect the traceability parameter values of the changing characteristic data corresponding to the product and the corresponding preset production cycle, and trace each on-chain information of the corresponding product from the blockchain on-chain information.
[0022] It is not difficult to find from the above that in the process of blockchain uploading and traceability processing of the whole-process information of product production, it includes two parts: the uploading process and the traceability process. Specifically, in the uploading process, various characteristic data of the product in the whole-process of product production obtained are historical characteristic data in the past, and each characteristic data has parameter value information when obtained. Furthermore, it is possible to determine the types of characteristic data with continuously changing parameter values of the characteristic data according to the parameter change situation of the characteristic data, and use this type of characteristic data as the changing characteristic data. Since there may be more than one type of characteristic data with different parameter values, all characteristic data with different parameter values can be obtained, and one of them can be selected as the changing characteristic data, or all characteristic data with different parameter values can be used as the changing characteristic data respectively. For example, during the packaging production process of agricultural products, after measuring the weight and shape of the product itself according to a certain initial acquisition accuracy, the weight parameter value and the shape parameter value are different, so both can be used as the changing characteristic data. After determining the changing characteristic data, configure the initial acquisition accuracy when the changing characteristic data satisfies different parameter values, and control to obtain all parameter values according to the initial acquisition accuracy within the preset production cycle. Usually, this initial parameter accuracy can be the maximum parameter accuracy that can be measured by the corresponding measuring equipment in the whole process of product production. After obtaining the parameter values of all changing characteristic data within the preset production cycle, it meets the uploading accuracy when all parameter values are different within the preset production cycle. And according to this uploading accuracy, after the parameter values of each changing characteristic data are collected, perform unified accuracy processing on the parameter values according to this uploading accuracy, so that each parameter value remains in a state of being different and is calibrated and uploaded together with the corresponding preset production cycle, and at the same time, the whole-process information of product production is uploaded and stored together with the parameter values of the changing characteristic data corresponding to the preset production cycle and the corresponding uploading progress. In the traceability process, by inputting the traceability parameter value of the product and the corresponding preset production cycle into the system, the unique uploading information corresponding to the traceability parameter value can be quickly retrieved according to the input preset production cycle. Through the above method, the uniqueness of the traceability parameter value of each uploaded product during traceability can be guaranteed, so that the authenticity of each uploaded product and the unique correspondence of the blockchain uploading information can be ensured according to the unique traceability parameter value.
[0023] Among them, obtaining various characteristic data of the product in the whole process of product production includes: obtaining the data set S of the whole process of product production all , and screening out the screened data belonging to the product's own characteristics in the data set as the characteristic data S according to the data classification attribute t .
[0024] In an embodiment of the present invention, when obtaining various characteristic data S tWhen it comes to this, the characteristic data of the product is the data belonging to the product's own attributes. This data can be obtained from the dataset S of the entire production process of the product all , according to the different classification attributes in the dataset S all , and retrieved and filtered out. For example, in the packaging production process of agricultural products such as apples, the shape of the packaging box, the packaging method, etc. can be used as the production process data of the product. Selecting parameters such as the size of the packaging box, the shape of the apple, and the weight of the apple as the data obtained according to the product's own characteristics, so it can be used as the characteristic data S all in the dataset S t .
[0025] Specifically, according to the parameter change situation of the characteristic data, the changing characteristic data in various types of characteristic data is obtained, including: finding the parameter values A t corresponding to various types of characteristic data S i , comparing each precision digit x of each parameter value A i of each type one by one, and obtaining the characteristic data S t where the values composed of each precision digit x are all different as the changing characteristic data S g .
[0026] In an embodiment of the present invention, when determining the changing characteristic data in the characteristic data, by querying the parameter values A t of the characteristic data S i . And comparing all the parameter values A i under each type to determine whether each parameter value A i is in a situation where they are all different. If so, control to use the characteristic data S i corresponding to all different parameter values A t as the changing characteristic data S g .
[0027] Preferably, comparing each precision digit x of each parameter value A i of each type one by one, and obtaining the characteristic data S t where the values composed of each precision digit x are all different as the changing characteristic data S g , including: judging whether there are exactly the same items among the precision digits x in the parameter values A max when reaching the initial acquisition precision J i . If there are, then use the characteristic data S i corresponding to the parameter value A t as the fixed characteristic data S r . If not, then use the characteristic data S i corresponding to the parameter value A t as the changing characteristic data S g, where x represents the parameter value A i Digits distributed according to natural numbers from left to right, and x ∈ [1, 2,..., J max .
[0028] In an embodiment of the present invention, when comparing each parameter value A i for each precision digit x, by determining that when reaching the initial acquisition precision J max the respective parameter values A i at each precision digit x, whether there are exactly the same precision bit values. When there are exactly the same situations, it indicates that the parameter value A i corresponding characteristic data S t cannot be used as the basis for unique traceability after being uploaded to the blockchain. If there are at least one different precision bit values at the x-th precision digit, then the parameter value A i corresponding characteristic data S t can be used as the variable characteristic data S g . When making the judgment, the precision digit x needs to satisfy x ∈ [1, 2,..., J max , so as to ensure that the precision digit x does not exceed the initial acquisition precision J max . And this initial acquisition precision J max can also be understood as the maximum acquisition precision.
[0029] Furthermore, configure the initial acquisition precision of the variable characteristic data, and collect the parameter values of the variable characteristic data within the preset production cycle, including: according to the initial acquisition precision J max , adjust the precision digit x of the parameter value A n of the variable characteristic data S g from left to right within the preset production cycle t i to the initial acquisition precision J max , and collect the parameter value A max according to the initial acquisition precision J i .
[0030] In an embodiment of the present invention, during the process of obtaining the variable characteristic data and collecting the parameter values of the variable characteristic data, by using the initial acquisition precision J max as the precision digit x of the parameter value A n of the variable characteristic data S g within the preset production cycle t i , it can ensure the uniqueness of the parameter values A g of each variable characteristic data S i to the greatest extent. Furthermore, further determine the parameter value A g that can just satisfy each variable characteristic data S iThe uniqueness upper-chain accuracy, that is, corresponding to the parameter value A g that just meets each change characteristic data S i The minimum value of uniqueness.
[0031] Furthermore, analyze the upper-chain accuracy allowed for the parameter values of all change characteristic data within the preset production cycle, including: judging within the preset production cycle t n and under the preset accuracy bit, for the previous parameter value A i-1 whether the value a i-1 of each accuracy bit x from left to right is the same as the value a i of each accuracy bit x from left to right of the next parameter value A i If there is at least one value a (x,i-1) of accuracy bit x and value a (x,i) that are not the same, then control to continue to obtain the next parameter value A n within the preset production cycle t i+1 , if the value a i-1 of each accuracy bit x and value a i are all the same, then control to reset the comparison accuracy bits of the previous parameter value A i-1 and the next parameter value A i to be compared in the way of incrementing according to the number of accuracy bits, and update the upper-chain accuracy.
[0032] In an embodiment of the present invention, determine the minimum value of the parameter value A g that just meets each change characteristic data S i of uniqueness, that is, when determining the upper-chain accuracy, by judging within the preset production cycle t n and under the preset accuracy bit, whether the value a i-1 of each accuracy bit x from left to right of the previous parameter value A i-1 is the same as the value a i of each accuracy bit x from left to right of the next parameter value A i . That is to say, when collecting the parameter value A g of the change characteristic data S i , under the preset accuracy bit x, compare the value a i-1 of each accuracy bit x from left to right of the previous parameter value A i-1 with the value a i of each accuracy bit x from left to right of the next parameter value A i . If there is at least one case where the values are different, it indicates that the parameter value A i-1 and the parameter value A iDistinction. Otherwise, the two cannot be distinguished, and it is necessary to further set a new comparison precision bit for comparison, and when at least one of the two has a different value, the current precision bit x can implement the parameter value A i-1 and the parameter value A i for distinction, and then update the corresponding upper-chain precision of the output.
[0033] Specifically, control to reset the previous parameter value A i-1 and the next parameter value A i for comparison of the comparison precision bits, and update the upper-chain precision, including: controlling the current precision bit number to increment by 1 to obtain the precision bit number x + 1, and the previous parameter value A i-1 the value a of the (x + 1)-th precision bit (x+1,i-1) is compared with the next parameter value A i the value a of the (x + 1)-th precision bit (x+1,i) until the increment count is y j at which time, the previous parameter value A i-1 the value a of the (x + y)-th j precision bit (x+y,i-1) is compared with the next parameter value A i the value a of the (x + y)-th j precision bit (x+y,i) are different, update the output increment count y j the corresponding single upper-chain precision x + y j , where, (x + y j ) ≤ J max , J max is the initial acquisition precision; according to each single upper-chain precision x + y obtained by updating within the preset production cycle t n , the upper-chain precision x within the preset production cycle t j is obtained n = x + ∑y all , where, y j is the increment count of the parameter value A j collected within the preset production cycle t n . i
[0034] In an embodiment of the present invention, during the process of resetting the comparison precision bits of the previous parameter value A i-1 and the next parameter value A i , it is carried out by incrementing the precision bit number. Specifically, by incrementing the original precision bit number x by 1, that is, x + 1. Then, under the precision bit number x + 1, the value a of the (x + 1)-th precision bit of the parameter value A i-1 is compared with the parameter value A (x+1,i-1) and the parameter value A i The value a of the (x + 1)-th precision digit (x+1,i) is compared to determine whether they are the same. If they are different, directly output x + 1 as the single upper-chain precision corresponding to one increment. If the number of increments required is y j to satisfy the previous parameter value A i-1 of the (x + y)-th j precision digit value a (x+y,i-1) and the next parameter value A i of the (x + y)-th j precision digit value a (x+y,i) are different, then use x + y j as the single upper-chain precision corresponding to y increments. And according to the entire preset production cycle t j and the increased value y of the upper-chain precision updated each time n , further obtain the upper-chain precision x j within the preset production cycle t n = x + ∑y all = x + ∑y j . Through this upper-chain precision x all = x + ∑y j , it is possible to further adjust the precision digits of all parameter values, ensuring that all parameter values are different, while also reducing the data length when the parameter values are uploaded to the chain.
[0035] The present invention also provides a preferred embodiment. When collecting the apple weight information as the variable feature data during the agricultural product packaging production process, the previous A apple weight is 195.022 g, and the next B apple weight is also 195.022 g. At this time, it is possible to increase one more precision digit to the right. That is, if the value corresponding to the next precision digit of the A apple is 2 and the value corresponding to the next precision digit of the B apple is 3, it indicates that they are different, and it is possible to directly increment by 1 based on the original 6-digit precision. If incrementing by one, the value corresponding to the next precision digit of the A apple is 2 and the value corresponding to the next precision digit of the B apple is also 2, then increment by one again until the value corresponding to the next precision digit of the A apple is different from the value corresponding to the next precision digit of the B apple. Finally, output the final precision digit when they are different as the single upper-chain precision when comparing the A apple and the B apple. If obtaining the upper-chain precision within the entire preset upper-chain cycle, it is also necessary to compare the weight information of all apples collected within this preset cycle to obtain the final total upper-chain precision.
[0036] Furthermore, control is performed to adjust the parameter value of the variable feature data with the initial acquisition precision to the upper-chain parameter value corresponding to the upper-chain precision, and perform blockchain uploading of the upper-chain parameter value according to the preset production cycle to obtain blockchain upload information, including: according to the obtained upper-chain precision x all = x + ∑yj For each parameter value A within the preset production cycle t n perform data update with a precision from left to right equal to the upstream precision x within the preset production cycle t i to obtain the upstream parameter value A n where x = x + ∑y all =x+∑y j and establish a corresponding relationship between the upstream parameter value A Si and the preset production cycle t Si to perform upstreaming on the blockchain, and associate the entire process data of product production within the preset production cycle t n with A Si -t n to obtain the blockchain upstreaming information n where the entire process data of product production within the preset production cycle t Si is associated with A n -t
[0037] In an embodiment of the present invention, after determining the upstream precision x within the preset production cycle t n where x = x + ∑y all =x+∑y j to ensure the difference of each parameter value A within the preset production cycle t n perform data update with a precision from left to right equal to the upstream precision x within the preset production cycle t i on each parameter value A within the preset production cycle t n and after the update, the upstream parameter value A i can be obtained. Using this upstream parameter value A n combined with the preset production cycle t all establish a corresponding relationship between A j -t Si to perform upstreaming on the blockchain, which can realize using the corresponding relationship between A Si -t n as the uniqueness reference during the self-inspection of the corresponding product. It ensures that according to the actual parameter value of the user based on the change characteristic data of the product, it is further determined whether there is corresponding blockchain upstreaming information within the corresponding preset production cycle t Si -t n thus ensuring the unique traceability of product data according to the parameter value of the change characteristic data Si -t n as the uniqueness reference during the self-inspection of the corresponding product. It ensures that according to the actual parameter value of the user based on the change characteristic data of the product, it is further determined whether there is corresponding blockchain upstreaming information within the corresponding preset production cycle t n thus ensuring the unique traceability of product data according to the parameter value of the change characteristic data
[0038] Furthermore, collect the traceability parameter value of the change characteristic data corresponding to the product and the corresponding preset production cycle, and trace the upstreaming information of the corresponding product from the blockchain upstreaming information, including: according to the preset production cycle t n find the corresponding upstream parameter values A Si within the preset production cycle tn The winding accuracy x within all = x + ∑y j , determine the traceability parameter value A SY The number of accuracy digits x from left to right SY Whether it is less than the preset production cycle t n The winding accuracy x within all = x + ∑y j , if x SY <x lla , then control the output of the alarm signal with the number of accuracy digits x not meeting the standard. If x SY ≥x SY , then adjust the traceability parameter value A all The number of accuracy digits x from left to right SY to the preset production cycle t SY The winding accuracy x within n . all .
[0039] In an embodiment of the present invention, during the traceability process based on the traceability parameter value of the change characteristic data of the product, by according to the preset production cycle t indicated on the product label, etc. n and the traceability parameter value A of the change characteristic data of the product itself SY , further determine the traceability parameter value A SY The number of accuracy digits x from left to right SY Whether it is less than the preset production cycle t n The winding accuracy x within all = x + ∑y j . When x SY <x all , it indicates that the number of accuracy digits x of the current traceability parameter value A SY is not sufficient to confirm the winding information of the product. And when x SY ≥x SY , it indicates that the winding information can be determined using the number of accuracy digits x of the current traceability parameter value A all . Moreover, before traceability, it is also necessary to adjust the number of accuracy digits x corresponding to the traceability parameter value A SY to the winding accuracy x SY , so as to directly trace the corresponding winding information based on the winding accuracy x SY . SY Adjust to the winding accuracy x all , so as to directly trace the corresponding winding information based on the winding accuracy x all .
[0040] Such as Figure 2As shown, the present invention also provides a traceability system based on blockchain, including: a feature selection unit, which obtains various types of feature data of a product in the entire production process of the product, and obtains the changing feature data among various types of feature data according to the parameter change situation of the feature data; a data acquisition unit, which configures the initial acquisition accuracy of the changing feature data and acquires the parameter values of the changing feature data within a preset production cycle; an on-chain analysis unit, which analyzes the on-chain accuracy allowed for the parameter values of all the changing feature data within the preset production cycle; an on-chain control unit, which controls to adjust the parameter values of the changing feature data with the initial acquisition accuracy to the on-chain parameter values corresponding to the on-chain accuracy, and performs blockchain on-chain of the on-chain parameter values according to the preset production cycle to obtain blockchain on-chain information; and a traceability query unit, which acquires the traceability parameter values of the changing feature data corresponding to the product and the corresponding preset production cycle, and traces the corresponding on-chain information of the corresponding product from the blockchain on-chain information.
[0041] In summary, by obtaining the changing feature data based on the product itself in the entire process of product production data, the present invention can use the parameter values of the changing feature data as the basis for tracing the on-chain information of the product. Moreover, after collecting the parameter values of the changing feature data that meet the maximum acquisition accuracy, by analyzing, the on-chain accuracy that can meet the condition that the parameter values are all different is determined, that is, the minimum number of on-chain accuracy digits that meet the condition that the parameter values are all different. And according to this on-chain accuracy control, the parameter values of the changing feature data corresponding to the on-chain accuracy digits are controlled to be on-chain, which can, on the premise of ensuring the traceability of the parameter values of the product changing feature data, also reduce the data length when the product changing feature data is on-chain and improve the on-chain efficiency of the data. And after the parameter values of the product changing feature data and the corresponding preset production cycle are on-chain, it is convenient for users to obtain the unique on-chain data corresponding to them safely and accurately according to the preset production cycle obtained from, for example, product labels and the parameter values of the product's own changing feature data, ensuring the correspondence between the product's own parameters and the on-chain data information during the product information tracing process. Therefore, the present invention effectively overcomes various disadvantages in the prior art and has high industrial utilization value.
[0042] The above embodiments are only illustrative of the principles and effects of the present invention and are not used to limit the present invention. Any person familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or changes completed by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed by the present invention should still be covered by the claims of the present invention.
Claims
1. A blockchain-based traceability method, characterized in that: The steps include: On-chain processing: Acquire various characteristic data of the product in the whole production process, and obtain the change characteristic data in various characteristic data according to the parameter change of the characteristic data; Configuring the initial acquisition accuracy of the change characteristic data, and acquiring parameter values of the change characteristic data within a preset production cycle; Analyze the chain accuracy of the parameter values of all the changing characteristic data within the preset production cycle; Controlling to adjust the parameter value of the change characteristic data of the initial acquisition accuracy to the on-chain parameter value corresponding to the on-chain accuracy, and performing on-chaining of the on-chain parameter value on the blockchain according to the preset production cycle to obtain blockchain on-chain information; The chain-up accuracy that allows the parameter values of all the changing characteristic data to change within the preset production cycle is analyzed, including: Determine the preset production cycle t n The previous parameter value A i-1 The value a of each precision digit x from left to right i-1 Is it consistent with the next parameter value A i The value a of each precision digit x from left to right i are the same, if there is at least one value a with precision x (x,i-1) and the value a (x,i) If they are not the same, the control continues to obtain the preset production cycle t n The next parameter value A i+1 , if the value a of each precision digit x i-1 and the value a i are the same, the control resets the previous parameter value A i-1 and the next parameter value A i The comparison precision bits are compared in a manner of increasing the number of precision bits, and the chain precision is updated; Traceability process: Collect the traceability parameter values of the change characteristic data corresponding to the product and the corresponding preset production cycle, and trace the on-chain information of the corresponding product from the on-chain information on the blockchain.
2. The blockchain-based traceability method according to claim 1, characterized in that: Obtain various characteristic data of products throughout the entire production process, including: Get the dataset S of the entire production process all According to the data classification attributes, the filtered data belonging to the product characteristics in the data set are filtered out as the feature data S t .
3. The blockchain-based traceability method according to claim 1, characterized in that: According to the parameter changes of the characteristic data, the change characteristic data in various characteristic data are obtained, including: Find all types of characteristic data S t The corresponding parameter value A i , each type of parameter value A i Each precision digit x is compared one by one, and the characteristic data S composed of different precision digits x is obtained. t As the change characteristic data S g .
4. The blockchain-based traceability method according to claim 3 is characterized in that: Set each parameter value of each type A i Each precision digit x is compared one by one, and the characteristic data S composed of different precision digits x is obtained. t As the change characteristic data S g ,include: Determine whether the initial acquisition accuracy has been reached max The parameter values A i Whether there are exactly the same items in the precision digits x in the , if so, then the parameter value A i The corresponding characteristic data S t As fixed feature data S r , if it does not exist, then the parameter value A i The corresponding characteristic data S t As the change characteristic data S g , where x represents the parameter value A i The number of digits distributed according to natural numbers from left to right, and x∈[1,2,...,J max ].
5. The blockchain-based traceability method according to claim 1, characterized in that: Configuring the initial acquisition accuracy of the change characteristic data and acquiring parameter values of the change characteristic data within a preset production cycle includes: According to the initial acquisition accuracy J max , set the preset production cycle t n The change characteristic data S g The parameter value A i The number of digits of precision x from left to right is adjusted to the initial acquisition precision J max , and according to the initial acquisition accuracy J max Collect the parameter value A i .
6. The blockchain-based traceability method according to claim 1, characterized in that: Control resets the last parameter value A i-1 and the next parameter value A i The comparison precision bits are compared in a manner of increasing the number of precision bits, and the chain precision is updated, including: The control increments the current precision by 1, and the precision is x+1, and the previous parameter value A is i-1 The value a of the x+1th precision digit (x+1,i-1) With the next parameter value A i The value a of the x+1th precision digit (x+1,i) Compare until the number of self-increment is y j When the previous parameter value A i-1 The x+y j The value of the precision digit a (x+y,i-1) With the next parameter value A i The x+y j The value of the precision digit a (x+y,i) If they are not the same, update the output increment times y j The corresponding single chain accuracy is x+y j , where (x+y j )≤J max , J max is the initial acquisition accuracy; According to the preset production cycle t n The single chain accuracy x+y obtained by each update j , get the preset production cycle t n Winding accuracy within x all =x+∑y j , where y j In the preset production cycle t n Parameter value A collected within i The number of self-increment.
7. The blockchain-based traceability method according to claim 6 is characterized in that: Controlling to adjust the parameter value of the change characteristic data of the initial acquisition accuracy to the on-chain parameter value corresponding to the on-chain accuracy, and performing the on-chain parameter value on the blockchain according to the preset production cycle to obtain the blockchain on-chain information, including: According to the obtained winding accuracy x all =x+∑y j , for the preset production cycle t n The parameter values in A i From left to right, the precision is the preset production cycle t n Winding accuracy within x all =x+∑y j The data is updated to obtain the uplink parameter value A Si , and the uplink parameter value A Si and the preset production cycle t n Build A Si -t n The corresponding relationship is put on the blockchain, and the preset production cycle t n The whole process data of product production in Si -t n Establish an association and obtain the blockchain information.
8. The blockchain-based traceability method according to claim 7 is characterized in that: Collect the traceability parameter values of the change characteristic data corresponding to the product and the corresponding preset production cycle, and trace the blockchain information of the corresponding product from the blockchain information, including: According to the preset production cycle t n , find the corresponding uplink parameter value A Si In the preset production cycle t n Winding accuracy within x all =x+∑y j , determine the traceability parameter value A SY The number of digits of precision x from left to right SY Is it less than the preset production cycle t? n Winding accuracy within x all =x+∑y j , if x SY <x all , then the number of digits of output precision x is controlled SY Substandard alarm signal, if x SY ≥x all , then the traceability parameter value A SY The number of digits of precision x from left to right SY Adjust to the preset production cycle t n Winding accuracy within x all .
9. A traceability system applied to the blockchain-based traceability method according to any one of claims 1 to 8, characterized in that: include: A feature selection unit, wherein the feature selection unit obtains various feature data of the product in the entire production process of the product, and obtains change feature data in various feature data according to parameter changes of the feature data; A data collection unit, wherein the data collection unit configures an initial collection accuracy of the change characteristic data and collects parameter values of the change characteristic data within a preset production cycle; An uplink analysis unit, the uplink analysis unit analyzing the uplink accuracy of the parameter values of all the changed characteristic data allowed to change within the preset production cycle; An on-chain control unit, wherein the on-chain control unit controls the parameter value of the change characteristic data of the initial acquisition accuracy to be adjusted to an on-chain parameter value corresponding to the on-chain accuracy, and performs blockchain on-chain on the blockchain of the on-chain parameter value according to the preset production cycle to obtain blockchain on-chain information; as well as The traceability query unit collects the traceability parameter values of the change characteristic data corresponding to the product and the corresponding preset production cycle, and traces the on-chain information of the corresponding product from the on-chain information of the blockchain.
Citation Information
Patent Citations
Fruit and vegetable agricultural product tracing method, device and system based on block chain and storage medium
CN111369267A
Annuity data tail difference processing method and device and electronic equipment
CN114066644A