Large-scale manufacturing full-life-cycle efficient traceability method based on block chain
Through the InMPT structure and parallel search mechanism, the problem of inefficient data retrieval during traceability in large-scale manufacturing supply chains is solved, efficient full life cycle traceability is achieved, retrieval efficiency is improved, and the problems of large amount of data and retrieval pressure are solved.
Patent Information
- Application Number
- CN202411264055.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-10
AI Technical Summary
In the large-scale manufacturing supply chain, when the product's entire life cycle is traced, the data volume is large and the retrieval pressure is huge. The existing technology is inefficient in the on-chain and off-chain mode, and cannot effectively solve the storage and retrieval pressure problem.
Using Index Merkle Patricia Trie (InMPT) structure and parallel search mechanism, a parallel search index MPT (PRIMPT) structure is constructed through transaction division and node division, and the transaction index in the pre-stage in the blockchain node group is directly searched in parallel to reduce off-chain data. Search to improve search efficiency.
It significantly improves the data retrieval efficiency of the entire life cycle traceability of large-scale manufacturing, reduces the search time complexity, reduces the number of data retrieval from O(log(n)) to O(log(n/k)), and parallel data retrieval increases the frequency of high frequency The efficiency of search requests is improved by about 1233% compared with traditional chain-on-chain methods.
Smart Images

Figure CN119128014A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain-based high-efficiency traceability method for the entire life cycle of large-scale manufacturing. Background Art
[0002] The large-scale manufacturing supply chain is a complex system that includes suppliers, manufacturers, distributors, and customers, who work together to produce and circulate products. For supply chain management, product traceability throughout the entire life cycle is crucial, that is, retrieving the data of the entire life cycle of the problem product from raw materials to sales. In recent years, blockchain has emerged as a promising full-life cycle traceability technology. It has ideal characteristics such as decentralization, transparency, and immutability, breaking information silos and increasing the speed of information exchange between supply chain stakeholders. Product data at each stage is stored on the chain as a transaction and retrieved during the traceability process. However, in the large-scale manufacturing supply chain, the number of products is huge, each product goes through many stages, and the amount of data at each stage is large, resulting in a large amount of data for the overall transaction and huge storage pressure; at the same time, product traceability throughout the life cycle requires one-by-one retrieval of multiple transaction data at each stage, and the demand for full life cycle traceability is large, resulting in a high frequency of data retrieval requests and huge storage and retrieval pressure. In order to reduce the storage and retrieval pressure, the on-chain and off-chain mode is proposed. Therefore, an efficient on-chain and off-chain data retrieval method in full life cycle traceability is needed.
[0003] The Chinese patent "CN112950227A Blockchain-based China-Europe Land-Sea Express Transnational Supply Chain Information Traceability System and Method" provides a blockchain-based China-Europe Land-Sea Express Transnational Supply Chain Information Traceability System and Method, including a product traceability module and a query module, wherein the product traceability module includes a supply chain on-chain module and a supply chain off-chain module, thereby realizing the retrieval of traceability information and improving the reliability of traceability information on the other hand. However, the technical solution described therein stores the complete transaction data off-chain and only stores the hash value of the transaction on-chain for verification. When tracing the source, the data at each stage is retrieved from data tables or documents with a large amount of data at different addresses off-chain, rather than directly on the chain. High communication requirements result in long time consumption and low overall efficiency.
[0004] The Chinese patent "CN113157733A An efficient traceability query method for multi-chain data association" provides an efficient traceability query method for multi-chain data association, which features include: identifying the target transaction to be traced, finding all corresponding target chains based on the cross-chain transaction data association, issuing query requests in parallel, and the target chain querying according to the key value of the target transaction and returning the query results, thereby effectively improving the traceability query efficiency and the scalability of the entire system. However, its technical solution stores the previous transaction association information of each transaction on the chain. When each transaction data is generated, it is necessary to retrieve its corresponding previous transaction information from all blocks with a large amount of data. Its efficiency is even lower than the above-mentioned method of storing only the transaction hash value on the chain.
[0005] The Chinese patent "CN117194518A Data Query Method for Whole Life Cycle Traceability of Large-Scale Manufacturing Based on Blockchain" provides a data query method for whole life cycle traceability of large-scale manufacturing based on blockchain, which adds the index of the current stage and the index of the previous stage to the transaction structure, so that the key information of the transaction can be obtained without retrieving all transactions, which improves the efficiency of retrieving transactions during tracing. However, its technical solution lacks the association between index information and off-chain data, and is not suitable for on-chain and off-chain models. Summary of the invention
[0006] In view of the shortcomings of the prior art, the purpose of the present invention is to propose an efficient traceability method for the entire life cycle of large-scale manufacturing based on blockchain, including:
[0007] Step 1: For the products to be traced in the entire manufacturing life cycle, obtain the batch number of the products to be traced, and for multiple stages in the entire life cycle of large-scale manufacturing, determine the last stage in the entire life cycle of large-scale manufacturing;
[0008] Step 2: The last stage in the full life cycle of large-scale manufacturing is used as the current stage, and the batch number is used as the index of the current transaction;
[0009] Step 3: For the hash value of the index of each current transaction in the current stage, determine the target group number of the blockchain used to implement the current search request from the multiple node groups and group numbers of the pre-divided blockchains. For each current transaction, obtain the hash value of the index of all transactions in the previous stage of the current stage in the pre-built InMPT structure after transaction division through the nodes in the blockchain node group corresponding to the target group number according to the hash value of the index of the current transaction, wherein all blockchain node groups corresponding to the target group number are executed in parallel when obtaining the hash value of the index of all transactions in the previous stage of the current stage;
[0010] Wherein, the InMPT structure after transaction division, i.e., the Index Merkle Patricia Trie structure, includes index information of all transactions in all stages of the entire manufacturing life cycle, the index information of the transaction includes key and value, the key is the hash value of the index of the transaction, the value includes the off-chain storage location of the complete information of the transaction, and the hash value of the index of all transactions in the previous stage corresponding to the transaction, the InMPT structure after transaction division adopts the MPT structure, the InMPT structure after transaction division includes a root node, a stage branch node, an extension node, a branch node and a leaf node, the root node is connected to the stage branch node, a stage branch corresponds to a stage in the entire manufacturing life cycle, the stage branch node is connected to the extension node among multiple nodes containing the index information of all transactions in the corresponding stage, and the multiple nodes containing the index information of all transactions in the corresponding stage include an extension node, a branch node and a leaf node;
[0011] Step 4: Determine whether the current stage is the first stage in the full life cycle of large-scale manufacturing. If the current stage is the first stage in the full life cycle of large-scale manufacturing, the process ends; if the current stage is not the first stage in the full life cycle of large-scale manufacturing, execute step 5;
[0012] Step 5: Set the previous stage of the current stage as the new current stage, use the hash value of the index of each transaction in the previous stage as the hash value of the index of the current transaction, and return to execute step 3.
[0013] Optionally, the InMPT structure after the transaction division is constructed by the following steps:
[0014] Step A1: Obtain the indexes of all transactions in all stages of the entire life cycle of large-scale manufacturing. For each transaction index, calculate the index through a hash algorithm to obtain the hash value of the transaction index, that is, the key of the transaction. Obtain the hash value of the transaction index of the previous stage of the transaction and the off-chain storage location of the complete transaction information to obtain the value of the transaction. The key and value of the transaction constitute the index information of the transaction, and then obtain the index information of all transactions.
[0015] Step A2: According to the MPT structure and the index information of all transactions, an initial InMPT structure is constructed, wherein the initial InMPT structure contains the index information of all transactions in all stages, and the initial InMPT structure includes a root node, multiple extension nodes, multiple branch nodes, and multiple leaf nodes. For each transaction, the key of the index of the transaction is composed of the extension node of the transaction, the branch node of the transaction, and the leaf node of the transaction, and the value of the transaction is stored in the leaf node of the transaction;
[0016] Step A3: According to the various stages of the entire life cycle of large-scale manufacturing, a stage branch node is set between the root node and the extension node in the initial InMPT structure, and the transaction index information in the initial InMPT structure is divided according to the stage. Then, based on the stage corresponding to the stage branch node and the structure corresponding to the stage after the transaction index information in the initial InMPT structure is divided, the InMPT structure after transaction division is obtained.
[0017] Optionally, step 3 specifically includes:
[0018] Step 3.1: For each index of the current transaction in the current stage, the hash value of each current index is calculated by the hash algorithm, and then the current search request is generated and sent to the blockchain. After receiving the current search request, the blockchain calculates the target group number of the blockchain node group used to implement the current search request in the blockchain according to the hash value of the index of the transaction in the current search request from among the multiple node groups and group numbers of the pre-divided blockchain;
[0019] Step 3.2: For each current transaction, through the nodes in the blockchain node group corresponding to the target group number, according to the hash value of the index of the current transaction, in the pre-built InMPT structure after transaction division, find the leaf node corresponding to the hash value of the index of the current transaction, and obtain the hash value of the index of all transactions in the previous stage of the current stage from the value of the leaf node corresponding to the hash value of the index of the current transaction.
[0020] Optionally, in step 3.1, the target group number of the blockchain node group used to implement the current search request in the blockchain is calculated according to the hash value of the index of the transaction in the current search request, which is specifically implemented in the following way:
[0021] Divide the hash value of the current transaction index by the total number of blockchain node groups, and then perform a modulo operation to obtain the target group number of the blockchain node group corresponding to the hash value of the current transaction index for implementing the current search request, which is specifically implemented by the following formula:
[0022] R j =Ij modm(1)
[0023] Among them, I j represents the hash value of the index of the current transaction in the current retrieval request j, m represents the total number of blockchain nodes, R j Indicates the target group number of the blockchain node group used to implement the current retrieval request j.
[0024] Optionally, the pre-division of the multiple node groups and the group numbers of the node groups of the blockchain is achieved by the following steps:
[0025] Step B1: Determine the total number of groups for all nodes in the blockchain;
[0026] Step B2: Divide all nodes in the blockchain according to the total number of groups, and determine the group number to which each node belongs, so as to obtain multiple node groups and group numbers of the node groups in the blockchain.
[0027] Optionally, step B1 specifically includes:
[0028] The formula for the total number of groups is established, which is specifically expressed by formula (2):
[0029]
[0030] Where m represents the total number of blockchain nodes; c represents the communication time between nodes in each blockchain group and nodes in other blockchain groups; o represents the time required to respond to the current data retrieval request in the InMPT structure before the blockchain nodes are grouped; T is the optimization target, T represents the time required to respond to the current retrieval request when the total number of groups is m; st is the constraint condition, N + is a positive integer, min m T minimizes T when the total number of groups is m;
[0031] By taking the derivative of formula (2), we get:
[0032] dT / dm=co / m 2 (3)
[0033] Setting the derivative to 0, we get
[0034]
[0035] Since m∈N + , the optimal solution of formula (2) is:
[0036]
[0037] The total number m of blockchain node groups is obtained as formula (5).
[0038] Optionally, step B2 specifically includes:
[0039] For the address of the node in the blockchain, a hash value is obtained through a hash algorithm. The hash value is divided by the total number of groups, and then a modulus operation is performed to obtain the group number to which the node in the blockchain is assigned. This is specifically achieved through the following formula:
[0040] G i =Hash(Ad i )(modm)(6)
[0041] Among them, Ad i represents the address of node i, m represents the total number of blockchain nodes, G i represents the group number of node i;
[0042] The beneficial effects of adopting the above technical solution are:
[0043] In the present invention, the InMPT realizes that the leaf node corresponding to the previous transaction can be directly retrieved through the value of the leaf node corresponding to the current transaction, thereby avoiding the retrieval of complete transaction information off-chain to obtain the index of the previous transaction; the transaction partitioning realizes parallel data retrieval on different transaction branches of the InMPT, thereby reducing the retrieval time complexity from O(log(n)) to O(log(n / k)), improving the retrieval efficiency for large amounts of transaction data; the node partitioning realizes parallel data retrieval of different node groups, thereby improving the retrieval efficiency when the frequency of retrieval requests is high. Compared with the traditional on-chain and off-chain methods that only store transaction hash values on the chain, the present invention improves the data retrieval efficiency in the full life cycle traceability by about 1233%. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flowchart of the PRIMPT method in the whole life cycle traceability of large-scale manufacturing based on blockchain in an embodiment of the present invention;
[0045] Figure 2 A structural diagram of an automobile supply chain in an embodiment of the present invention;
[0046] Figure 3 An example diagram of an InMPT structure in an embodiment of the present invention;
[0047] Figure 4 This is an example diagram of an InMPT structure after transaction division in an embodiment of the present invention;
[0048] Figure 5 This is an example diagram of the full life cycle traceability process of a PRIMPT method in an embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram comparing the efficiency of an InMPT structure and a traditional on-chain and off-chain mode in an embodiment of the present invention;
[0050] Figure 7 A schematic diagram showing the efficiency comparison between an InMPT structure for transaction division and a traditional on-chain and off-chain model in an embodiment of the present invention;
[0051] Figure 8 This is a schematic diagram comparing the efficiency of an InMPT structure with node division in an embodiment of the present invention and a traditional on-chain and off-chain model. DETAILED DESCRIPTION
[0052] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0053] In view of the problems existing in the prior art, the present invention provides an efficient traceability method for the entire life cycle of large-scale manufacturing based on blockchain. Specifically, the MPT structure is improved through the InMPT structure and the parallel retrieval mechanism (including transaction division and node division). Therefore, the method of the present invention can also be called PRIMPT (Parallel Retrieve Index MerklePatricia Trie), which can be understood as a parallel retrieval index MPT, and then combined with Figure 1 , the present invention may include the following steps:
[0054] Step 1: For the products to be traced in the entire manufacturing life cycle, obtain the batch number of the products to be traced, and for multiple stages in the entire life cycle of large-scale manufacturing, determine the last stage in the entire life cycle of large-scale manufacturing;
[0055] Among them, the full life cycle of large-scale manufacturing can be the automotive supply chain, Figure 2 This is the automobile supply chain structure diagram. The automobile manufacturing process is as follows: on the supplier side, the raw material quality inspection department inspects the raw materials. After the inspection, the raw materials enter the raw material warehouse, and then the parts workshop realizes parts production, and the produced parts are stored in the supplier parts warehouse. The supplier provides parts to the manufacturer. Specifically, the parts in the supplier parts warehouse are transferred to the manufacturer parts warehouse, and then stamped in the stamping workshop, the stamped work-in-progress is welded in the welding workshop, the welded work-in-progress is painted in the painting workshop, and then the painted work-in-progress is assembled in the assembly workshop, and the finished product after assembly, that is, the car, is stored in the car warehouse, and then the car is delivered to the dealer, and the dealer trades the car to the customer.
[0056] Among them, combined Figure 2All stages of the automobile supply chain include, in order, raw material warehousing, parts production, parts warehousing, parts supply, stamping, welding, painting, final assembly, automobile warehousing, automobile delivery and automobile sales. The last stage in the entire life cycle of large-scale manufacturing is automobile sales. The final product of the automobile supply chain is a car. Then the product to be traced in step 1 is a car with quality problems.
[0057] In specific implementation, the present invention can use the batch number of the car with quality problems as an index, and trace it back from the car sales stage to the first stage of the car supply chain, that is, to the raw material warehousing stage.
[0058] Step 2: The last stage in the full life cycle of large-scale manufacturing is used as the current stage, and the batch number is used as the index of the current transaction;
[0059] Step 3: For the hash value of the index of each current transaction in the current stage, determine the target group number of the blockchain used to implement the current search request from the multiple node groups and group numbers of the pre-divided blockchains. For each current transaction, obtain the hash value of the index of all transactions in the previous stage of the current stage in the pre-built InMPT structure after transaction division through the nodes in the blockchain node group corresponding to the target group number according to the hash value of the index of the current transaction, wherein all blockchain node groups corresponding to the target group number are executed in parallel when obtaining the hash value of the index of all transactions in the previous stage of the current stage;
[0060] Wherein, the InMPT structure after transaction division, i.e., the Index Merkle Patricia Trie structure, includes index information of all transactions in all stages of the entire manufacturing life cycle, the index information of the transaction includes key and value, the key is the hash value of the index of the transaction, the value includes the off-chain storage location of the complete information of the transaction, and the hash value of the index of all transactions in the previous stage corresponding to the transaction, the InMPT structure after transaction division adopts the MPT structure, the InMPT structure after transaction division includes a root node, a stage branch node, an extension node, a branch node and a leaf node, the root node is connected to the stage branch node, a stage branch corresponds to a stage in the entire manufacturing life cycle, the stage branch node is connected to the extension node among multiple nodes containing the index information of all transactions in the corresponding stage, and the multiple nodes containing the index information of all transactions in the corresponding stage include an extension node, a branch node and a leaf node;
[0061] Among them, step 3 is specifically implemented by the following steps:
[0062] Step 3.1: For each index of the current transaction in the current stage, the hash value of each current index is calculated by the hash algorithm, and then the current search request is generated and sent to the blockchain. After receiving the current search request, the blockchain calculates the target group number of the blockchain node group used to implement the current search request in the blockchain according to the hash value of the index of the transaction in the current search request from among the multiple node groups and group numbers of the pre-divided blockchain;
[0063] The pre-division of the multiple node groups and the group numbers of the node groups of the blockchain is achieved by the following steps:
[0064] Step B1: Determine the total number of groups for all nodes in the blockchain;
[0065] Wherein, step B1 specifically includes:
[0066] The formula for the total number of groups is established, which is specifically expressed by formula (2):
[0067]
[0068] Where m represents the total number of blockchain nodes; c represents the communication time between nodes in each blockchain group and nodes in other blockchain groups; o represents the time required to respond to the current data retrieval request in the InMPT structure before the blockchain nodes are grouped; T is the optimization target, T represents the time required to respond to the current retrieval request when the total number of groups is m; st is the constraint condition, N + is a positive integer, min m T minimizes T when the total number of groups is m;
[0069] By taking the derivative of formula (2), we get:
[0070] dT / dm=co / m 2 (3)
[0071] Setting the derivative to 0, we get
[0072]
[0073] Since m∈N + , the optimal solution of formula (2) is:
[0074]
[0075] The total number m of blockchain node groups is obtained as formula (5).
[0076] Step B2: Divide all nodes in the blockchain according to the total number of groups, and determine the group number to which each node belongs, so as to obtain multiple node groups and group numbers of the node groups in the blockchain.
[0077] Wherein, step B2 specifically includes:
[0078] For the address of the node in the blockchain, a hash value is obtained through a hash algorithm. The hash value is divided by the total number of groups, and then a modulus operation is performed to obtain the group number to which the node in the blockchain is assigned. This is specifically achieved through the following formula:
[0079] G i =Hash(Ad i )(modm)(6)
[0080] Among them, Adi represents the address of node i, m represents the total number of groups of blockchain nodes, and Gi represents the group number of node i.
[0081] After the nodes in the blockchain are divided, step 4.1 can determine the target group number of the blockchain node group used to implement the current search request in the blockchain, which is specifically achieved in the following way:
[0082] Divide the hash value of the current transaction index by the total number of blockchain node groups, and then perform a modulo operation to obtain the target group number of the blockchain node group corresponding to the hash value of the current transaction index for implementing the current search request, which is specifically implemented by the following formula:
[0083] R j =I j modm(1)
[0084] Among them, I j represents the hash value of the index of the current transaction in the current retrieval request j, m represents the total number of blockchain nodes, R j Indicates the target group number of the blockchain node group used to implement the current retrieval request j.
[0085] Step 3.2: For each current transaction, through the nodes in the blockchain node group corresponding to the target group number, according to the hash value of the index of the current transaction, in the pre-built InMPT structure after transaction division, find the leaf node corresponding to the hash value of the index of the current transaction, and obtain the hash value of the index of all transactions in the previous stage of the current stage from the value of the leaf node corresponding to the hash value of the index of the current transaction.
[0086] The InMPT structure after the transaction division is constructed by the following steps:
[0087] Step A1: Obtain the indexes of all transactions in all stages of the entire life cycle of large-scale manufacturing. For each transaction index, calculate the index through a hash algorithm to obtain the hash value of the transaction index, that is, the key of the transaction. Obtain the hash value of the transaction index of the previous stage of the transaction and the off-chain storage location of the complete transaction information to obtain the value of the transaction. The key and value of the transaction constitute the index information of the transaction, and then obtain the index information of all transactions.
[0088] Among them, combined with Table 1 is an example of InMPT data, that is, an example of index information. The example stages involved are raw material warehousing, parts production and parts warehousing in the automobile supply chain. The first column in the table is the stage and transaction index. Based on the hash value of the transaction index, the key of the second column can be calculated. Based on the stage sequence of the automobile supply chain, the hash value of the previous stage index in the third column of the table can be obtained. For example, the previous stage of parts warehousing is parts production, and the hash value of the previous stage index of part1 in the parts warehousing stage is the key of part1 in the parts production stage. Since there are multiple types of production raw materials in one stage, There is a transaction index with multiple previous stage indexes. In this case, the hash values of the previous stage indexes are separated by "+". For example, part1 is produced by bulk11 and bulk12, then the hash value of the previous stage index of part1 in the value of the parts production stage includes the hash value of the index of bulk11 in the raw material warehousing stage and the hash value of the index of bulk12 in the raw material warehousing stage, and the hash values of the two indexes are separated by "+". part2 is produced by bulk21 and bulk22, and the previous stage index value of part2 in the value of the parts production stage is the same.
[0089] Table 1 InMPT data example
[0090]
[0091] It should be noted that the address in value is the off-chain address of the complete transaction information. Based on the off-chain address, the complete transaction information can be queried off-chain. In Table 1, the previous stage index of the raw material warehousing stage bulk11, bulk12, bulk21 and bulk22 is null, because for the automobile supply chain, the raw material warehousing is the first stage and there is no previous stage, so the previous stage here is empty.
[0092] Step A2: According to the MPT structure and the index information of all transactions, an initial InMPT structure is constructed, wherein the initial InMPT structure contains the index information of all transactions in all stages, and the initial InMPT structure includes a root node, multiple extension nodes, multiple branch nodes, and multiple leaf nodes. For each transaction, the key of the index of the transaction is composed of the extension node of the transaction, the branch node of the transaction, and the leaf node of the transaction, and the value of the transaction is stored in the leaf node of the transaction;
[0093] The initial InMPT structure reference Figure 3 , Figure 3 This is the initial InMPT structure built based on the index information in Table 1. This figure is only for example understanding. 0 to f in the figure are branch nodes, a7 and 1 and d connecting two branch nodes are extension nodes, and the leaf node is at the end of the structure. For example, 8 and {null,addressO12} in the lower left corner of the figure together constitute a leaf node.
[0094] Step A3: According to the various stages of the entire life cycle of large-scale manufacturing, a stage branch node is set between the root node and the extension node in the initial InMPT structure, and the transaction index information in the initial InMPT structure is divided according to the stage. Then, based on the stage corresponding to the stage branch node and the structure corresponding to the stage after the transaction index information in the initial InMPT structure is divided, the InMPT structure after transaction division is obtained.
[0095] Among them, the InMPT structure after transaction division refers to Figure 4 , 0 to a connected to the root node are stage branch nodes. Specifically, when constructing the InMPT structure after transaction division, Figure 3 The InMPT structure is divided and sorted based on the stage. For example, 0 is the raw material storage stage. Figure 3 The structure composed of the transaction index information of raw material entry is obtained by dividing and sorting, that is, the structure composed of the information of bulk11, bulk12, bulk21 and bulk22 in the raw material entry stage, and the stage branch structure corresponding to the raw material entry stage is obtained. The stage branch structure corresponding to the raw material entry is inserted into the branch corresponding to the stage node 0, and the same is true for other stages. In this way, the InMPT structure after transaction division can be constructed.
[0096] It should be noted that Figure 3 0 to f in the above represent branch nodes. Figure 4 0 to a represent stage branch nodes, and the two have different meanings.
[0097] Step 4: Determine whether the current stage is the first stage in the full life cycle of large-scale manufacturing. If the current stage is the first stage in the full life cycle of large-scale manufacturing, the process ends; if the current stage is not the first stage in the full life cycle of large-scale manufacturing, execute step 5;
[0098] It should be noted that the present invention is to achieve product traceability, so this step determines whether the current stage is the first stage in the entire life cycle of large-scale manufacturing.
[0099] Among them, the current stage is the first stage in the entire life cycle of large-scale manufacturing. The characterization traceability is completed, so the process is completed.
[0100] Step 5: Set the previous stage of the current stage as the new current stage, use the hash value of the index of each transaction in the previous stage as the hash value of the index of the current transaction, and return to execute step 3.
[0101] Combination Figure 5 When tracing the source of the problematic automobile product, the present invention specifically includes: converting the information "Automobile Sales: Automobile Batch Number" into a hash value hashA, and then in the automobile sales branch, using the assigned node group, retrieving the hashA and the hash value hashB of the previous stage index, in the automobile delivery branch, using the assigned node group, retrieving the hashB and the hash value hashC of the previous stage index, and moving forward according to the stage sequence of the automobile supply chain, combined with Table 1, in the parts storage branch, using the assigned node group, retrieving hashI (a7fd046) and the hash value of the previous stage index hashJ(a7c2453), in the parts production branch, use the assigned node group to retrieve hashJ(a7c2453) and the hash values of all its previous stage indexes, hashK1+hashK2+...(i.e. a749265+a701b38), in the partProduce branch, use the assigned node group to retrieve hashK1, hashK2,...(i.e. a749265, a701b38) respectively, among which a749265 and a701b38 both correspond to the raw material warehousing stage, which is the last stage of the automobile supply chain, so the traceability ends.
[0102] The present invention builds a 48-node alliance chain on an Ubuntu virtual machine system with the help of a Hyperledger Fabric platform, and implements five methods: the PRIMPT method (i.e., the InMPT structure that realizes transaction and node division), the InMPT structure that only realizes the transaction division, the InMPT structure that only realizes the node division, a separate InMPT structure (without the transaction division and the node division), and a traditional on-chain and off-chain mode; to verify the efficiency advantage of the PRIMPT method under large amounts of data, there are two groups of original data, both of which are randomly generated. The first group has a size of 21.5MB, recording the full life cycle data of 100,000 vehicles; the second group has a size of 214MB, recording the full life cycle data of 1 million vehicles; to verify the efficiency advantage of the PRIMPT method under high-frequency retrieval requests, in the experiment, the five methods are respectively used to perform 10, 50, and 100 full life cycle traceability operations.
[0103] The five methods are respectively used to use the first and second groups of original data, and perform 10, 50, and 100 full life cycle traceability operations. The average processing time per unit time is shown in Tables 2 and 3.
[0104] Table 2 Average execution time of full life cycle traceability operations per unit number under the first group of original data
[0105]
[0106] Table 3 Average execution time of full life cycle traceability operations per unit number under the second group of original data
[0107]
[0108] Among them, the number of node groups of the PRIMPT method and the InMPT structure of the node division are both the most efficient number of groups. Under the first set of original data, the number of node groups of the PRIMPT method and the InMPT structure of the node division is shown in Table 4; under the second set of original data, the number of node groups of the PRIMPT method and the InMPT structure of the node division is shown in Table 5.
[0109] Table 4 Number of node groups under the first set of original data
[0110]
[0111] Table 5 Number of node groups under the second set of original data
[0112]
[0113] (1) Efficiency advantage of the InMPT structure: The full life cycle traceability efficiency of the InMPT structure and traditional on-chain and off-chain methods is compared in the attached figure. Figure 6 The results show that when the number of traceability operations in the entire life cycle is the same, the average execution time of the InMPT structure is shorter than that of the traditional on-chain and off-chain methods;
[0114] (2) The InMPT structure of the transaction division: The comparison of the full life cycle traceability efficiency of the InMPT structure of the transaction division and the traditional on-chain and off-chain methods is shown in the attached figure. Figure 7 As shown. Figure 6 and attached Figure 7 It can be seen that when the number of full life cycle traceability operations is the same, the average traceability execution time of the InMPT structure of the transaction partition is shorter than that of the traditional on-chain and off-chain methods, and the efficiency advantage of the former over the latter is greater than that of the InMPT alone. When the size of the original data increases significantly, the increase time of the InMPT structure of the transaction partition is significantly shortened compared with the traditional on-chain and off-chain methods;
[0115] (3) Efficiency advantage of the InMPT structure with node division: The efficiency of the InMPT structure with node division and the traditional on-chain and off-chain methods in the whole life cycle is compared as shown in the attached figure. Figure 8 As shown. Figure 6 and attached Figure 8 It can be seen that under the same circumstances, the average traceability execution time of the node-divided InMPT structure is shorter than that of the traditional on-chain and off-chain methods, and the efficiency advantage of the former over the latter is greater than that of the separate InMPT structure. As the number of operations increases, the efficiency gap between the node-divided InMPT structure and the traditional on-chain and off-chain methods becomes more obvious;
[0116] (4) Efficiency advantage of the PRIMPT method: In summary, in the PRIMPT method, the design of the InMPT structure, the transaction division and the node division all have efficiency advantages. It can be seen from the experimental results in Tables 4 and 5 that the PRIMPT algorithm combined with the InMPT architecture, the transaction division and the node division has the shortest average execution time for full life cycle traceability, which is about 1233% more efficient than traditional on-chain and off-chain methods.
[0117] In large-scale manufacturing supply chains, there is an urgent need to trace the entire life cycle of problematic products. The PRIMPT method can better meet users' efficiency needs than traditional on-chain and off-chain methods.
[0118] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. A blockchain-based high-efficiency traceability method for the entire life cycle of large-scale manufacturing, characterized in that: include: Step 1: For the products to be traced in the entire manufacturing life cycle, obtain the batch number of the products to be traced, and for multiple stages in the entire life cycle of large-scale manufacturing, determine the last stage in the entire life cycle of large-scale manufacturing; Step 2: The last stage in the full life cycle of large-scale manufacturing is used as the current stage, and the batch number is used as the index of the current transaction; Step 3: For the hash value of the index of each current transaction in the current stage, determine the target group number of the blockchain used to implement the current search request from the multiple node groups and group numbers of the pre-divided blockchains. For each current transaction, obtain the hash value of the index of all transactions in the previous stage of the current stage in the pre-built InMPT structure after transaction division through the nodes in the blockchain node group corresponding to the target group number according to the hash value of the index of the current transaction, wherein all blockchain node groups corresponding to the target group number are executed in parallel when obtaining the hash value of the index of all transactions in the previous stage of the current stage; Wherein, the InMPT structure after transaction division, i.e., the Index Merkle Patricia Trie structure, includes index information of all transactions in all stages of the entire manufacturing life cycle, the index information of the transaction includes key and value, the key is the hash value of the index of the transaction, the value includes the off-chain storage location of the complete information of the transaction, and the hash value of the index of all transactions in the previous stage corresponding to the transaction, the InMPT structure after transaction division adopts the MPT structure, the InMPT structure after transaction division includes a root node, a stage branch node, an extension node, a branch node and a leaf node, the root node is connected to the stage branch node, a stage branch corresponds to a stage in the entire manufacturing life cycle, the stage branch node is connected to the extension node among multiple nodes containing the index information of all transactions in the corresponding stage, and the multiple nodes containing the index information of all transactions in the corresponding stage include an extension node, a branch node and a leaf node; Step 4: Determine whether the current stage is the first stage in the full life cycle of large-scale manufacturing. If the current stage is the first stage in the full life cycle of large-scale manufacturing, the process ends; if the current stage is not the first stage in the full life cycle of large-scale manufacturing, execute step 5; Step 5: Set the previous stage of the current stage as the new current stage, use the hash value of the index of each transaction in the previous stage as the hash value of the index of the current transaction, and return to execute step 3.
2. The efficient traceability method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: The InMPT structure after the transaction division is constructed by the following steps: Step A1: Obtain the indexes of all transactions in all stages of the entire life cycle of large-scale manufacturing. For each transaction index, calculate the index through a hash algorithm to obtain the hash value of the transaction index, that is, the key of the transaction. Obtain the hash value of the transaction index of the previous stage of the transaction and the off-chain storage location of the complete transaction information to obtain the value of the transaction. The key and value of the transaction constitute the index information of the transaction, and then obtain the index information of all transactions. Step A2: According to the MPT structure and the index information of all transactions, an initial InMPT structure is constructed, wherein the initial InMPT structure contains the index information of all transactions in all stages, and the initial InMPT structure includes a root node, multiple extension nodes, multiple branch nodes, and multiple leaf nodes. For each transaction, the key of the index of the transaction is composed of the extension node of the transaction, the branch node of the transaction, and the leaf node of the transaction, and the value of the transaction is stored in the leaf node of the transaction; Step A3: According to the various stages of the entire life cycle of large-scale manufacturing, a stage branch node is set between the root node and the extension node in the initial InMPT structure, and the transaction index information in the initial InMPT structure is divided according to the stage. Then, based on the stage corresponding to the stage branch node and the structure corresponding to the stage after the transaction index information in the initial InMPT structure is divided, the InMPT structure after transaction division is obtained.
3. The efficient traceability method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: Step 3 specifically includes: Step 3.1: For each index of the current transaction in the current stage, the hash value of each current index is calculated by the hash algorithm, and then the current search request is generated and sent to the blockchain. After receiving the current search request, the blockchain calculates the target group number of the blockchain node group used to implement the current search request in the blockchain according to the hash value of the index of the transaction in the current search request from among the multiple node groups and group numbers of the pre-divided blockchain; Step 3.2: For each current transaction, through the nodes in the blockchain node group corresponding to the target group number, according to the hash value of the index of the current transaction, in the pre-built InMPT structure after transaction division, find the leaf node corresponding to the hash value of the index of the current transaction, and obtain the hash value of the index of all transactions in the previous stage of the current stage from the value of the leaf node corresponding to the hash value of the index of the current transaction.
4. The efficient traceability method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 3 is characterized in that: In step 3.1, the target group number of the blockchain node group used to implement the current search request is calculated based on the hash value of the index of the transaction in the current search request, which is specifically implemented in the following way: Divide the hash value of the current transaction index by the total number of blockchain node groups, and then perform a modulo operation to obtain the target group number of the blockchain node group corresponding to the hash value of the current transaction index for implementing the current search request, which is specifically implemented by the following formula: R j =I j modm(1) Among them, I j represents the hash value of the index of the current transaction in the current retrieval request j, m represents the total number of blockchain nodes, R j Indicates the target group number of the blockchain node group used to implement the current retrieval request j.
5. The efficient traceability method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: The pre-division of the multiple node groups and the group numbers of the node groups of the blockchain is achieved by the following steps: Step B1: Determine the total number of groups for all nodes in the blockchain; Step B2: Divide all nodes in the blockchain according to the total number of groups, and determine the group number to which each node belongs, so as to obtain multiple node groups and group numbers of the node groups in the blockchain.
6. The PRIMPT method in blockchain-based large-scale manufacturing full life cycle traceability according to claim 5 is characterized in that: Step B1 specifically includes: The formula for the total number of groups is established, which is specifically expressed by formula (2): Where m represents the total number of blockchain nodes; c represents the communication time between nodes in each blockchain group and nodes in other blockchain groups; o represents the time required to respond to the current data retrieval request in the InMPT structure before the blockchain nodes are grouped; T is the optimization target, T represents the time required to respond to the current retrieval request when the total number of groups is m; st is the constraint condition, N + is a positive integer, min m T minimizes T when the total number of groups is m; By taking the derivative of formula (2), we get: dT / dm=c-o / m 2 (3) Setting the derivative to 0, we get Since m∈N + , the optimal solution of formula (2) is: The total number m of blockchain node groups is obtained as formula (5).
7. The PRIMPT method in blockchain-based large-scale manufacturing full life cycle traceability according to claim 5 is characterized in that: Step B2 specifically includes: For the address of the node in the blockchain, a hash value is obtained through a hash algorithm. The hash value is divided by the total number of groups, and then a modulus operation is performed to obtain the group number to which the node in the blockchain is assigned. This is specifically achieved through the following formula: G i =Hash(Ad i )(modm)(6) Among them, Adi represents the address of node i, m represents the total number of groups of blockchain nodes, and Gi represents the group number of node i.
Citation Information
Patent Citations
Food and drug tracing method and system based on blockchain
CN112488734A
Verifiable traceability method and device based on block chain
CN116894047A
Block chain-based data query method for large-scale manufacturing full-life-cycle traceability
CN117194518A
A blockchain system for transparent supply chain management
DE202024104003U1
Cited By
Belt pulley raw material traceability management method and system based on block chain
CN121599682A
