Traditional Chinese medicine decoction pieces whole life cycle traceability method and system based on blockchain
By generating baseline hash values of the physical characteristics of Chinese herbal medicine pieces and using dynamic cross-validation smart contracts, the problems of inconsistency between data and physical state and insufficient protection of commercial privacy in the traceability of Chinese herbal medicine pieces are solved, and efficient and reliable traceability of Chinese herbal medicine pieces throughout their entire life cycle is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI CHONGMINGBIRD SOFTWARE CO LTD
- Filing Date
- 2026-03-09
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies for tracing the origin of Chinese herbal medicine pieces suffer from inconsistencies between data and physical condition, as well as insufficient protection of commercial privacy. This results in a trust gap between the credibility of information and the credibility of physical goods, and the on-chain data is sparse and its value is reduced.
By extracting spectral waveform data from Chinese herbal medicine samples to generate physical feature baseline hash values, and combining this with dynamic cross-validation smart contracts, the traceability of Chinese herbal medicine samples throughout their entire lifecycle is achieved. A digital twin archive is established using blockchain technology, and privacy protection is verified through a random challenge mechanism.
It achieves uniqueness and tamper-proof traceability of Chinese herbal medicine pieces, improves the authenticity and reliability of data, protects commercial privacy, and enhances the reliability and practical value of traceability results.
Smart Images

Figure CN122175601A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of traditional Chinese medicine traceability technology, and involves a blockchain-based method and system for tracing the entire life cycle of traditional Chinese medicine decoction pieces. Background Technology
[0002] Traditional Chinese medicine (TCM) decoction pieces are the material basis for TCM clinical prescriptions, and their quality directly affects the safety and efficacy of medication. The supply chain for TCM decoction pieces is long and complex, encompassing multiple stages from planting and harvesting medicinal materials, processing, storage, and logistics to hospital pharmacies or retail outlets. To ensure the quality and safety of TCM decoction pieces, establishing a complete and reliable full lifecycle traceability system is crucial.
[0003] Blockchain technology, due to its decentralized, tamper-proof, and transparent characteristics, is considered an important technological means for building a new generation of traceability systems. Currently, solutions applying blockchain technology to product traceability have seen some development. For example, Chinese Patent Publication No. CN114493637A describes a blockchain-based method, equipment, and medium for tracing traditional Chinese medicine. This method assigns codes to containers and the smallest packaging of traditional Chinese medicine, and then links information from planting, transportation, and processing stages with corresponding identification codes before uploading them to the blockchain to achieve information traceability.
[0004] However, the aforementioned existing technical solutions still have significant technical shortcomings in practical applications. On the one hand, whether it is manual data entry or simple IoT data upload, it is difficult to fundamentally guarantee that the on-chain data is always bound to the real state of the offline physical entity. There is a possibility that data is used before physical operations, or that sensors are physically interfered with to forge data, resulting in a trust gap between the credibility of information and the credibility of the physical entity.
[0005] On the other hand, requiring all parties in the supply chain to upload all detailed operational data to the shared ledger in a completely transparent manner would infringe on the business privacy of each company, resulting in weak willingness among participants. Ultimately, this would lead to sparse on-chain data, reduced value, and difficulty in forming effective collaborative supervision. Summary of the Invention
[0006] In view of this, in order to solve the problems mentioned in the background technology above, a blockchain-based method and system for tracing the entire life cycle of traditional Chinese medicine decoction pieces is proposed.
[0007] The objective of this invention can be achieved through the following technical solution: The first embodiment of this invention provides a blockchain-based method for tracing the entire life cycle of traditional Chinese medicine decoction pieces, including: extracting physical feature data of the spectral waveform of traditional Chinese medicine decoction piece samples, generating a physical feature baseline hash value through encrypted hash operation, binding the physical feature baseline hash value with the unique identifier code of the decoction piece, and creating a digital twin archive on the blockchain.
[0008] Deploy dynamic cross-validation smart contracts on the blockchain, the dynamic cross-validation smart contracts including functions for generating validation rules and performing random selection.
[0009] When Chinese herbal medicine slices are circulated, the dynamic cross-validation smart contract is triggered, which sends a verification commitment request containing verification rules to the responsible node of the current link.
[0010] The system receives the stage commitment data generated by the responsible node based on the verification commitment request, stores the stage commitment data on the blockchain, and drives the dynamic cross-validation smart contract to execute the random selection function to generate random inspection challenge tasks.
[0011] The random inspection challenge task is assigned to a non-directly related party node determined by the random selection function, and the challenge verification evidence returned by the non-directly related party node after executing the random inspection challenge task is received.
[0012] The dynamic cross-validation smart contract is invoked on the blockchain to compare the consistency of the challenge verification evidence and the commitment data of the process, generate a process credibility rating, and update it to the digital twin file.
[0013] Obtain snapshot data of the on-site characteristics of Chinese herbal medicine slices in the final stage, combine it with the full-chain credible historical data of the credibility rating of the aforementioned stage contained in the digital twin archive, perform state consistency verification, and generate the final verification result.
[0014] The second embodiment of the present invention provides a blockchain-based traceability system for the entire life cycle of traditional Chinese medicine decoction pieces, including: a data acquisition module, a feature baseline generation module, a smart contract management module, a challenge task-driven module, a credibility rating processing module, and a closed-loop status verification module.
[0015] The data acquisition module is connected to the feature baseline generation module, the feature baseline generation module is connected to the smart contract management module, the smart contract management module is connected to the challenge task driving module, the challenge task driving module is connected to the credibility rating processing module, and the credibility rating processing module is connected to the closed-loop state verification module.
[0016] The data acquisition module includes a spectral detection device and an IoT sensing device, used to collect physical characteristic data and real-time status data.
[0017] The feature baseline generation module is used to acquire physical feature data of Chinese herbal medicine slices, generate physical feature baseline hash values, and create digital twin archives.
[0018] The smart contract management module is used to deploy and manage dynamic cross-validation smart contracts, which include functions for generating validation rules and executing random selection.
[0019] The challenge task-driven module is used to drive the dynamic cross-validation smart contract to generate and assign random inspection challenge tasks after receiving the link commitment data from the responsible party node.
[0020] The credibility rating processing module is used to receive challenge verification evidence, perform consistency comparison in the dynamic cross-validation smart contract, and generate a link credibility rating.
[0021] The closed-loop status verification module is used to acquire on-site feature snapshot data of the final stage, combine it with the stage credibility rating in the whole chain's trusted historical data, perform status consistency verification, and generate the final verification result.
[0022] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) This invention extracts physical characteristic data of Chinese herbal medicine slices and generates baseline hash values on the blockchain, transforming unique physical attributes into tamper-proof digital fingerprints, establishing a high-strength anti-counterfeiting anchor between physical and digital identities, and ensuring the uniqueness and non-repudiation of traceable objects from the source.
[0023] (2) This invention uses a dynamic cross-validation smart contract-driven commitment-random challenge-verification mechanism. The responsible node only needs to commit to the minimum necessary rules, while a randomly selected independent third-party node performs privacy-preserving inspections and provides real-time evidence. This design protects business privacy while breaking the fixed-party self-verification model and improving the authenticity of on-chain data.
[0024] (3) This invention dynamically calculates and updates the credibility rating of each link through consistency comparison results. During the final verification, the feature change model is called, and based on the weighted full-chain environmental parameters and initial feature data, the expected feature range of the current Chinese medicine decoction pieces is reasonably inferred, reducing the risk of misjudgment caused by natural changes in compliance, thereby enhancing the reliability and practical value of traceability results. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a schematic diagram illustrating the implementation steps of the method of the present invention.
[0027] Figure 2 This is a schematic diagram of the system module connections 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] Please see Figure 1 As shown, the first embodiment of the present invention provides a blockchain-based method for tracing the entire life cycle of traditional Chinese medicine decoction pieces, including: S1. Extracting physical feature data of the spectral waveform of traditional Chinese medicine decoction piece samples, generating a physical feature baseline hash value through encrypted hash operation, binding the physical feature baseline hash value with the unique identifier code of the decoction piece, and creating a digital twin file on the blockchain.
[0030] It should be noted that the purpose of step S1 is to generate an immutable and unique physical characteristic digital fingerprint, i.e., a physical characteristic baseline hash value, for each initial batch of Chinese herbal medicine slices, serving as a trust anchor point for subsequent full lifecycle traceability. This process is initiated during the sample quality inspection stage of the production process, and is implemented as follows: First, the Chinese herbal medicine sample is scanned by a spectral detection device to obtain spectral waveform data. The spectral waveform data includes the absorption or reflection intensity of the Chinese herbal medicine sample for light of a specific wavelength, such as near-infrared light covering the 900-1700 nanometer band.
[0031] Next, based on the pre-stored characteristic peak wavelength comparison relationship, absorption peaks related to sample water content and specific alkaloid content are screened from the spectral waveform data, and the wavelength position and peak height of the selected absorption peaks are recorded to form physical characteristic data.
[0032] The source of the characteristic peak wavelength comparison relationship is: preparing several standard medicinal slice samples with known water content and specific alkaloid content.
[0033] Standard medicinal slices were scanned using a spectral detection device to obtain their standard spectral waveform data, which was then preprocessed to form an independent variable matrix.
[0034] The dependent variable matrix is constructed using known water content and specific alkaloid content data. Partial least squares regression analysis is then performed to extract principal components between the independent and dependent variable matrices and generate a regression coefficient vector.
[0035] Based on the distribution of the regression coefficient vector, identify the continuous wavelength range where the absolute value of the regression coefficient is at a high level, and determine the continuous wavelength range as the corresponding characteristic absorption peak wavelength range.
[0036] One implementation method for identifying continuous wavelength ranges is as follows: set a threshold for the absolute value of a regression coefficient, mark wavelength points whose absolute value of the coefficient is higher than this threshold; cluster the marked wavelength points, and determine the clustering intervals with more than a preset number of members and continuous wavelengths as the characteristic absorption peak wavelength range.
[0037] The determined characteristic absorption peak wavelength ranges are associated and stored with their corresponding target component identifiers to form a characteristic peak wavelength reference relationship. The target component identifiers specifically refer to known water content and the content of specific alkaloids.
[0038] The physical feature data is converted into a binary string, and then subjected to cryptographic hashing using algorithms including but not limited to SHA-256 to generate a fixed-length physical feature baseline hash value. The implementation process of the SHA-256 cryptographic hashing algorithm is as follows: The physical characteristic data is encoded into a binary message, and the binary message is padded so that the total length of the padded message equals 448 bits modulo 512. The padding rules are as follows: first, a '1' bit is appended to the end of the message, followed by k '0' bits, where k is the smallest non-negative integer that meets the message length requirement, and finally a 64-bit field is appended, which represents the bit length of the original message before padding in binary form.
[0039] The padded binary message is divided into N consecutive 512-bit message blocks. For each message block, an expansion process is performed to generate a sequence of 64 32-bit words W[0] to W
[63] , where the first 16 words are taken directly from the message block, and the subsequent 48 words are recursively generated by a preset shift and XOR logic operation function.
[0040] Eight 32-bit hash registers are initialized. A compression function is performed on each message block, consisting of 64 rounds of iteration. In each round, the values of the eight registers are updated through a series of cyclic shifts, bitwise logical operations, and modulo additions, based on the current message extension, a preset constant, and the current values of the registers.
[0041] After processing all message blocks, the values of the final eight registers are concatenated sequentially to generate a 256-bit hash value output, which is the physical characteristic baseline hash value.
[0042] S2. Deploy a dynamic cross-validation smart contract on the blockchain, wherein the dynamic cross-validation smart contract includes functions for generating validation rules and executing random selection, specifically including: The contract pre-defines minimum necessary rules for verifying compliance at different stages. These minimum necessary rules exist in parameterized form, including upper and lower limits for ambient temperature in the warehousing stage, a maximum allowable transportation time threshold in the transportation stage, and an enumerated value representing the completion status of a specific operation in the processing stage. Setting the minimum necessary rules does not require the responsible node to upload continuous raw data; it only requires them to commit to whether the result meets the threshold requirements in the rules when verification is triggered.
[0043] By calling the random selection function configured in the contract, and using the hash value of the latest block of the blockchain as a random seed, a supply chain node selection algorithm is adopted to select nodes that have no direct business relationship with the current verification process from the list of registered nodes that have excluded the direct upstream and downstream nodes of the current link, as indirect related party nodes.
[0044] The supply chain node selection algorithm is integrated into the contract's internal function. It is used to select a node to perform the inspection task from a dynamically updated list of registered supply chain nodes based on a random number seed. The algorithm is implemented as follows:
[0045] in, It is the index of the selected node in the list of registered nodes after excluding the direct upstream and downstream nodes of the current stage. It is the latest block hash value that can be obtained when the contract is executed. It is a random number or counter for the current transaction, used to increase the randomness of the input. This is the number of nodes in the registered node list that excludes direct upstream and downstream nodes in the current stage. It is a cryptographic hash function based on the SHA-3 standard. Its execution process deterministically converts the input data into a fixed-length hash digest, specifically including: The first step is input concatenation and data padding: The latest block hash value and the random number of the current transaction are concatenated in a preset order to form the original input bit string. The padding rules defined by the SHA-3 standard are applied to the original input bit string, that is, a bit "1" is appended to the end of the bit string, followed by several bits "0", and finally a bit "1" is appended, so that the total length after padding is an integer multiple of the length of the specific block.
[0046] The second step, state initialization and absorption phase, involves initializing a 5×5×64 three-dimensional bit state array, setting all bits to zero. The padded message is then divided into contiguous 1088-bit blocks. For each message block, the following operations are performed: Perform a bitwise XOR operation between the current message block and a corresponding slice in the state array.
[0047] A permutation function is performed on the updated state array. This permutation function consists of five sub-steps that act sequentially on the state array to complete a full round of confusion and diffusion: (1) Calculate and update each bit based on the parity of each column to achieve long-distance diffusion between columns.
[0048] (2) Perform a predefined cyclic shift operation on each bit in the state array except for the origin to shuffle the bit positions.
[0049] (3) Rearrange the 5×5 slice of the state array according to the fixed permutation pattern.
[0050] (4) Perform non-linear logic operations including NOT gates and AND gates on each row to provide the non-linear characteristics of the algorithm.
[0051] (5) XOR a 64-bit constant associated with the current round to a specific position in the state array, breaking the symmetry. For SHA3-256, this absorption phase iterates the permutation function for a total of 24 rounds.
[0052] The third step, the squeezing phase and digest generation, begins after all message blocks have been absorbed. At this point, the permutation function is executed again on the state array (again, for 24 rounds). After each round, a 256-bit sequence is read from a specific slice of the state array and output; this output sequence is the desired hash value.
[0053] Step 4: Index Calculation: The hash value generated in Step 3 is interpreted as an unsigned large integer. This integer is then moduloed by the number of nodes in the registered node list that excludes the direct upstream and downstream nodes of the current link. The remainder is the index of the selected node in the list.
[0054] S3. When the Chinese herbal medicine slices are circulating, the dynamic cross-validation smart contract is triggered, which sends a verification commitment request containing verification rules to the responsible node of the current stage, specifically including: Based on the minimum necessary rules in the verification commitment request, the responsible party node performs a self-check on its local business data. This self-check process benchmarks the upper and lower limits of the ambient temperature in the warehousing process, the maximum allowable transportation time threshold in the transportation process, and the enumerated values of the operation status that represent whether a specific operation has been completed in the processing process. Specifically, for the warehousing process, it checks whether the average ambient temperature of each warehousing area in the historical monitoring period of the responsible party node falls within the range defined by the upper and lower limits.
[0055] For the transportation process, the actual transportation time of the batch of Chinese herbal medicine pieces to be transferred from the previous stage of outbound scanning to the current stage of inbound scanning is checked to see if it is less than or equal to the maximum allowable transportation time threshold.
[0056] For the processing stage, its self-inspection logic involves determining the compliance of key operation states. The operation state enumeration values define the compliance states that specific operations should achieve. During self-inspection, the execution status field of the key process steps associated with the batch of Chinese herbal medicine pieces to be transferred is queried in the local production records. If the value of the execution status field is consistent with the compliance states defined in the enumeration values, it is determined to be a match. If they are inconsistent or the record is missing, it is determined to be a mismatch.
[0057] The key process steps and specific operation examples are as follows: Clean selection: A specific operation is defined as the removal of all non-medicinal parts, and its compliance status enumeration value can be set to "completed".
[0058] Roasting: A specific operation can be defined as having undergone roasting, and its compliance status enumeration value can be set to executed.
[0059] Drying: A specific operation can be defined as the moisture content test being passed, and its compliance status enumeration value can be set as qualified.
[0060] After the self-check passes, the responsible node generates a structured step commitment data. This step commitment data includes a Boolean value representing the commitment status and a commitment timestamp synchronized by a network time protocol server. To ensure the authenticity and non-repudiation of the data source, an asymmetric encryption algorithm is used to digitally sign the step commitment data. This process can be represented as follows: , ,in This represents the final generated stage commitment data. It is a unique identifier that follows the minimum necessary verification rules for this commitment. It is a boolean value representing the commitment status; for example, true indicates that the rules are met. It is the timestamp when the commitment was generated.
[0061] For the generated digital signature, This represents a predefined digital signature function, such as the Elliptic Curve Digital Signature Algorithm (ECDSA). It is the undisclosed private key held by the responsible party node.
[0062] Finally, the responsible node will broadcast the transaction, which includes the commitment data and digital signature, to the blockchain network.
[0063] S4. Receive the stage commitment data generated by the responsible party node according to the verification commitment request, store the stage commitment data on the blockchain, and drive the dynamic cross-validation smart contract to execute the random selection function to generate random inspection challenge tasks.
[0064] S5. Assign the random inspection challenge task to a non-directly related party node determined by the random selection function, and receive the challenge verification evidence returned by the non-directly related party node after executing the random inspection challenge task, specifically including: A random inspection challenge task containing the verification method and the task deadline is generated, and the identity information of the party being verified in the random inspection challenge task is hashed to generate a privacy protection challenge task.
[0065] Privacy protection challenges are published through the event log mechanism of blockchain.
[0066] After the non-directly related party node detects the privacy protection challenge task, it requests and obtains an encrypted access token with a time-limited window and a single-use proxy routing address from the dynamic cross-validation smart contract. This token is then used to invoke the IoT device interface of the target stage to obtain the temporary data access permissions required to execute the verification method. The proxy routing address is used to conceal the real IP address of the requester at the data transmission layer, ensuring the anonymity of the inspection process.
[0067] Nodes not directly related to the target link can access the IoT device interface to obtain real-time status data through temporary data access permissions.
[0068] The real-time status data is bound to the corresponding data acquisition timestamp, and a hash operation is performed to generate challenge verification evidence.
[0069] The challenge verification evidence, along with real-time status data, is submitted to the blockchain.
[0070] S6. Invoke the dynamic cross-validation smart contract on the blockchain to compare the consistency of the challenge verification evidence and the commitment data of the process, generate a process credibility rating and update it to the digital twin file.
[0071] Specifically, the credibility rating of the generation process includes: Dynamic cross-validation of smart contract retrieval and challenge verification evidence-linked commitment data.
[0072] The real-time status data accompanying the challenge verification evidence is logically compared with the threshold range promised in the process commitment data to generate a single comparison result.
[0073] The historical successful challenge count and historical total challenge count of the responsible node are updated based on the result of a single comparison. The total challenge count is incremented by one regardless of the comparison result; the successful challenge count is incremented only when the comparison result is true.
[0074] Add the historical successful challenge count to the first preset positive integer to obtain the numerator value.
[0075] Add the total historical challenge count to the second preset positive integer to obtain the denominator value.
[0076] The ratio of the numerator value to the denominator value is calculated to obtain the link credibility rating of the responsible party node.
[0077] It should be noted that both the first preset positive integer and the second preset positive integer are smoothing factors. As a specific example, the first preset positive integer can be 1 and the second preset positive integer can be 2. Their function is to prevent drastic fluctuations in the rating when the number of challenges is small and to provide an initial basic rating for newly added nodes.
[0078] S7. Obtain snapshot data of the on-site characteristics of Chinese herbal medicine slices in the final stage, combine it with the full-chain credible historical data of the credibility rating of the aforementioned stage contained in the digital twin archive, perform state consistency verification, and generate the final verification result.
[0079] The state consistency verification includes: using the physical feature baseline hash value as an index, retrieving and decrypting the corresponding initial physical feature data from an off-chain controlled database (such as the decentralized storage system IPFS or encrypted cloud storage).
[0080] Extract the credibility rating of each stage from the digital twin archive. Call the feature variation model, taking the initial physical feature data and the stage credibility rating as input, and output the expected feature range. The specific implementation is as follows: Environmental parameters such as temperature, humidity, and duration are extracted from reliable historical data across the entire chain.
[0081] The environmental parameters of each stage are combined in time series to form an environmental parameter sequence. Simultaneously, the credibility rating of each stage is used as a confidence weighting factor input into the model.
[0082] The initial physical feature data, environmental parameter sequence, and confidence weight factors are input into a feature change model trained using historical batches of medicinal slices variation data. This feature change model is a three-layer fully connected neural network. The input layer dimensions are the initial physical feature data dimension, the environmental parameter sequence dimension, and the confidence weight factor dimension. The output layer is the center value vector and tolerance range of the expected feature range. During training, the actual final feature snapshot data of historical batches are used as labels, and the mean squared error is used as the loss function, with backpropagation algorithm for optimization. The weighted environmental parameter sequence is input along with the initial feature data by concatenation or by adding weight vectors.
[0083] The initial training data for the feature change model comes from batch change data of traditional Chinese medicine decoction pieces generated in an experimental environment and calibrated by chemical analysis methods. After the method of this invention is put into operation, batch data with confidence ratings higher than the calibration threshold at each stage can be continuously added to the training set to iteratively optimize the model.
[0084] The logic of the feature change model is as follows: if the confidence rating of a certain link is low (i.e., the confidence weight factor is small), the model will expand the tolerance range of the output when predicting (i.e., the expected feature range becomes wider). This means that due to the doubt about the data in that link, the system’s certainty about the final physical feature change is reduced, and the matching standard needs to be relaxed or manual review needs to be triggered. Conversely, if the confidence of the whole chain is high, the tolerance range is narrowed and precision matching is performed.
[0085] Match the on-site feature snapshot data with the expected feature range: calculate the deviation of each dimension value of the on-site data from the center value of the corresponding dimension of the expected range. If the deviation of all dimensions falls within their respective preset tolerance thresholds, the state is determined to be consistent, and a final result of verification is generated; if the deviation of any dimension exceeds the tolerance, the state is determined to be inconsistent, and a final result of verification is generated.
[0086] Furthermore, to ensure the effective participation of nodes not directly involved, this invention incorporates a node reputation and incentive mechanism. Nodes that successfully complete inspection tasks and submit valid evidence will receive reputation points as a reward. Nodes with higher reputation points will have a higher priority for future selection for governance. Malicious or passive nodes will have points deducted to lower their reputation and reduce their chances of being selected in the future.
[0087] Reference Figure 2 As shown, the second embodiment of the present invention provides a blockchain-based traceability system for the entire life cycle of traditional Chinese medicine decoction pieces, including: a data acquisition module, a feature baseline generation module, a smart contract management module, a challenge task-driven module, a credibility rating processing module, and a closed-loop state verification module.
[0088] The data acquisition module is connected to the feature baseline generation module, the feature baseline generation module is connected to the smart contract management module, the smart contract management module is connected to the challenge task driving module, the challenge task driving module is connected to the credibility rating processing module, and the credibility rating processing module is connected to the closed-loop state verification module.
[0089] The data acquisition module includes a spectral detection device and an IoT sensing device, used to collect physical characteristic data and real-time status data.
[0090] The feature baseline generation module is used to acquire physical feature data of Chinese herbal medicine slices, generate physical feature baseline hash values, and create digital twin archives.
[0091] The smart contract management module is used to deploy and manage dynamic cross-validation smart contracts, which include functions for generating validation rules and executing random selection.
[0092] The challenge task-driven module is used to drive the dynamic cross-validation smart contract to generate and assign random inspection challenge tasks after receiving the link commitment data from the responsible party node.
[0093] The credibility rating processing module is used to receive challenge verification evidence, perform consistency comparison in the dynamic cross-validation smart contract, and generate a link credibility rating.
[0094] The closed-loop status verification module is used to acquire on-site feature snapshot data of the final stage, combine it with the stage credibility rating in the whole chain's trusted historical data, perform status consistency verification, and generate the final verification result.
[0095] The above content is merely an example and illustration of the concept of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the concept of the invention or exceed the scope defined by the present invention, and all such modifications and additions should fall within the protection scope of the present invention.
Claims
1. A blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces, characterized in that: include: Physical feature data of the spectral waveform of Chinese herbal medicine slices are extracted, and physical feature baseline hash values are generated through encrypted hash operation. The physical feature baseline hash values are then bound to the unique identifier of the herbal medicine slices to create a digital twin archive on the blockchain. Deploy dynamic cross-validation smart contracts on a blockchain, wherein the dynamic cross-validation smart contracts include functions for generating validation rules and performing random selection; When Chinese herbal medicine pieces are circulated, the dynamic cross-validation smart contract is triggered, which sends a verification commitment request containing verification rules to the responsible node of the current link. Receive the stage commitment data generated by the responsible party node according to the verification commitment request, store the stage commitment data on the blockchain, and drive the dynamic cross-validation smart contract to execute the random selection function to generate random inspection challenge tasks; The random inspection challenge task is assigned to a non-directly related party node determined by the random selection function, and the challenge verification evidence returned by the non-directly related party node after executing the random inspection challenge task is received. The dynamic cross-validation smart contract is invoked on the blockchain to compare the consistency of the challenge verification evidence and the commitment data of the process, generate a process credibility rating and update it to the digital twin file; Obtain snapshot data of the on-site characteristics of Chinese herbal medicine slices in the final stage, combine it with the full-chain credible historical data of the credibility rating of the aforementioned stage contained in the digital twin archive, perform state consistency verification, and generate the final verification result.
2. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The physical feature data of the extracted spectral waveforms of traditional Chinese medicine decoction pieces are used to generate physical feature baseline hash values through encrypted hash operations, including: The spectral waveform data of traditional Chinese medicine decoction pieces is obtained by scanning the samples with a spectral detection device. Based on the pre-stored characteristic peak wavelength comparison relationship, absorbance peaks related to sample water content and specific alkaloid content are screened from the spectral waveform data, and the wavelength position and peak height of the selected absorbance peaks are recorded to form physical characteristic data. The physical feature data is converted into a binary string, and then processed by a preset cryptographic hash algorithm to generate a fixed-length physical feature baseline hash value.
3. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The dynamic cross-validation smart contract includes functions for generating validation rules and performing random selection, including: The contract pre-sets minimum necessary rules for verifying compliance at different stages. These minimum necessary rules include: upper and lower limits of ambient temperature in the warehousing stage, the maximum allowable transportation time threshold in the transportation stage, and an enumerated value of the operation status in the processing stage that indicates whether a specific operation has been completed. By calling the random selection function configured in the contract, and using the hash value of the latest block of the blockchain as a random seed, a supply chain node selection algorithm is adopted to select nodes that have no direct business relationship with the current verification process from the list of registered nodes that have excluded the direct upstream and downstream nodes of the current link, as indirect related party nodes.
4. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The step of receiving the process commitment data generated by the responsible party node based on the verification commitment request includes: Based on the verification rules in the verification commitment request, the responsible node performs a self-check on its local business data and generates process commitment data that includes the commitment status and commitment timestamp. Using the private key held by the responsible node, the commitment data for the aforementioned stage is digitally signed, generating the signed commitment data for the stage, and then submitted to the blockchain for storage.
5. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The step of assigning the random inspection challenge task to non-directly related party nodes determined by the random selection function includes: Generate the random inspection challenge task that includes the verification method and the task deadline, and hash the identity information of the party being verified in the random inspection challenge task to generate a privacy protection challenge task. Privacy protection challenges are published through the event log mechanism of blockchain; After the non-directly related party node hears the privacy protection challenge task, it requests and obtains an encrypted access token with a time-limited window from the dynamic cross-validation smart contract, thereby calling the IoT device interface of the target link to obtain the temporary data access permissions required to execute the verification method.
6. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The step of receiving the challenge verification evidence returned by the non-directly related party node after executing the random inspection challenge task includes: Nodes not directly related to the target link can access the IoT device interface to obtain real-time status data through temporary data access permissions. Bind real-time status data with the corresponding data acquisition timestamp, and perform hash operations to generate challenge verification evidence; The challenge verification evidence, along with real-time status data, is submitted to the blockchain.
7. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The credibility rating of the generation process includes: Dynamic cross-validation of smart contract retrieval and challenge verification evidence-linked commitment data; The real-time status data attached to the challenge verification evidence is logically compared with the threshold range promised in the process commitment data to generate a single comparison result. Update the historical successful challenge count and historical total challenge count of the responsible node based on the results of a single comparison. Add the historical successful challenge count to the first preset positive integer to obtain the numerator value; Add the total historical challenge count to the second preset positive integer to obtain the denominator value; The ratio of the numerator value to the denominator value is calculated to obtain the link credibility rating of the responsible party node.
8. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The state consistency verification includes: Using the physical feature baseline hash value as an index, the corresponding initial physical feature data is obtained from the off-chain controlled database, and the link credibility rating of each link is extracted from the digital twin archive. The feature change model is invoked, taking the initial physical feature data and the link credibility rating as input, and the expected feature range is output. The on-site feature snapshot data is matched with the expected feature range, and the final verification result is generated based on the matching result.
9. The blockchain-based method for tracing the entire lifecycle of traditional Chinese medicine decoction pieces according to claim 8, characterized in that, The invoked feature change model takes initial physical feature data and process reliability rating as input, and outputs the expected feature range, including: The environmental parameters of each link are extracted from the trusted historical data of the entire chain, and the corresponding environmental parameter sequence is generated; Convert the credibility rating of each process into a confidence weighting factor; Obtain the initial physical feature data corresponding to the physical feature baseline hash value; The initial physical feature data, the environmental parameter sequence, and the confidence weight factor are input into the feature change model trained using historical batch change data of medicinal slices. The feature change model adjusts the span of the prediction interval based on the confidence weight factor and outputs the expected feature range.
10. A blockchain-based full lifecycle traceability system for traditional Chinese medicine decoction pieces, characterized in that: The system for performing the method according to any one of claims 1 to 9 comprises: The data acquisition module includes a spectral detection device and an IoT sensing device, used to collect physical characteristic data and real-time status data; The feature baseline generation module is used to acquire physical feature data of Chinese herbal medicine slices, generate physical feature baseline hash values, and create digital twin archives. The smart contract management module is used to deploy and manage dynamic cross-validation smart contracts, which include functions for generating validation rules and executing random selections. The challenge task-driven module is used to drive the dynamic cross-validation smart contract to generate and assign random inspection challenge tasks after receiving the link commitment data from the responsible party node. The credibility rating processing module is used to receive challenge verification evidence, perform consistency comparison in the dynamic cross-validation smart contract, and generate a link credibility rating. The closed-loop status verification module is used to acquire on-site feature snapshot data of the final stage, combine it with the stage credibility rating in the whole chain's trusted historical data, perform status consistency verification, and generate the final verification result.