Data query method for full life cycle traceability of large-scale manufacturing based on blockchain
By establishing a blockchain-based consortium chain structure in large-scale manufacturing enterprises and using KV data tables and efficient data query algorithms, the problem of low efficiency in data query throughout the entire life cycle is solved, efficient and reliable data query is achieved, and the system's disaster tolerance and data security are improved.
Patent Information
- Application Number
- CN202311165015.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-09-11
AI Technical Summary
In large-scale manufacturing enterprises, existing technologies have low efficiency in querying product data throughout its entire life cycle, making it difficult to meet the efficiency needs of the enterprise. In addition, the reliability and disaster recovery capabilities are weak. Data is easily tampered with in a centralized model, and decentralized solutions are inefficient in querying data throughout its entire life cycle.
Establish a blockchain-based consortium chain structure, including the data layer, network layer, consensus layer, and contract layer. Use KV data tables to store the correspondence between transaction pre/post indexes and transaction hash values. Design an efficient data query algorithm for the entire life cycle to reversely query transaction data through pre/post indexes.
It improves the efficiency of data query throughout the product life cycle, enhances the system's reliability and disaster tolerance, reduces the risk of data tampering, and meets the efficient data query needs of large-scale manufacturing companies.
Smart Images

Figure HDA0004441888440000011 
Figure HDA0004441888440000012 
Figure HDA0004441888440000013
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain technology, and in particular relates to a data query method for tracing the entire life cycle of large-scale manufacturing based on blockchain. Background Art
[0002] The full lifecycle of a large-scale manufacturing product represents the entire process from raw material procurement to product delivery. Taking steel production as an example, this process includes raw material arrival, raw material transportation, material production, material arrival, material transportation, ironmaking, molten iron transportation, converters, refining, molten steel transportation, continuous casting, ingot transportation, rolling, product warehousing, and product shipment. Material production, ironmaking, converters, refining, continuous casting, and rolling are production processes, while the remaining processes are transportation processes. Product lifecycle traceability is the foundation of integrated scheduling and ensures real-time decision-making based on production conditions. Data query involves querying data on a specific product throughout its entire lifecycle, from raw materials to finished product. The production process of large-scale manufacturing enterprises is complex. For example, steel production involves numerous production processes, from ironmaking to steelmaking to rolling. Furthermore, different products require different processes due to their varying production processes. Data query within the full lifecycle traceability process requires coordination across all production processes, which places high demands on the performance of product lifecycle data query methods.
[0003] Chinese patent application "CN114612111A: A Bidirectional Traceability Method and System for the Steel Industry Chain" proposes a bidirectional traceability method and system for the steel industry chain. Based on traceability permission levels, this method controls enterprise nodes in the steel industry chain to conduct bidirectional traceability, achieving centralized traceability and reducing the amount of traceability data retained during the traceability process. However, the proposed technical solution suffers from a serious centralization issue, leading to the following problems: First, reliability cannot be guaranteed. Each department manages its data independently, allowing authorized users to modify it at will, making data tampering relatively cost-effective. Second, disaster recovery is low. In the event of a system failure or improper human operation, data loss cannot be recovered, impacting normal system operation and causing losses to the enterprise. Third, to avoid economic losses and maintain production efficiency, large-scale manufacturing enterprises operate machines in all production processes at high speeds, generally without downtime. Consequently, a large amount of data is generated in a short period of time. Furthermore, the product lifecycle involves numerous processes, and data for each process is stored in separate data tables. The query process for this data is complex and requires numerous data query operations, which is time-consuming and difficult to meet efficiency requirements.
[0004] Chinese patent application "CN114282860A: A Traceability System and Method Based on Hyperledger Fabric" provides a traceability system and method based on Hyperledger Fabric. Several different blockchain nodes receive data output by at least the manufacturer, warehousing, transportation, and sales parties, allowing consumers to trace steel information. This method is decentralized, public, tamper-proof, and traceable, effectively addressing issues such as information falsification, inconvenient traceability, and lack of trust in current product quality traceability systems. However, its technical solution is a traditional blockchain query solution. When performing a full lifecycle data query, it is necessary to query the transaction content of all transactions (which have a large amount of data) for transaction data related to the current process and the problematic product. This double-condition query results in low efficiency and is difficult to meet the needs of manufacturing companies. In addition, this solution targets the entire supply chain and product transportation of large-scale manufacturing industries, from raw material suppliers to product customers, rather than specifically addressing the individual production processes within a manufacturing company. Summary of the Invention
[0005] In response to the shortcomings of the existing technology, the present invention proposes a data query method for traceability of the entire life cycle of large-scale manufacturing based on blockchain.
[0006] The data query method for traceability of the entire life cycle of large-scale manufacturing based on blockchain specifically includes the following contents:
[0007] Establish a consortium blockchain for product traceability throughout its entire life cycle;
[0008] The blockchain comprises a data layer, a network layer, a consensus layer, a contract layer, and an application layer. Upon receiving a user's request to trace a problem product, the application layer invokes the contract layer's efficient full-lifecycle data query algorithm. Based on the input problem product batch number, the algorithm performs a full-lifecycle data query in the data layer's pre- and post-index KV (Key-Value) tables and transaction data. The query results are then returned to the application layer, which then provides feedback to the user.
[0009] The data layer integrates KV data tables and transaction data to provide trusted data for full life cycle traceability; the KV data tables include pre-index data and post-index data, and transaction data includes transportation transactions and production transactions;
[0010] Transactions are divided into transactions corresponding to production processes and transactions corresponding to transportation processes. The data structure of the two is the same, including the transaction hash value and transaction content. The transaction content structure is: transaction type, pre-index, post-index and other content. Among them, each process transaction corresponds to a transaction type. If the transaction is a transaction corresponding to a production process, the pre-index is set to the name of the material before production. If multiple materials are involved, they are separated by "+" in the middle. The post-index is set to the name of the material after production. If the transaction is a transaction corresponding to a transportation process, the pre-index and post-index are both set to the name of the transported material. Other content records the specific information of the transaction.
[0011] Two KV data tables are established at the data layer for each transaction type. These tables store the correspondence between the pre- and post-indexes and the transaction hash values. This information is then stored in the KV data tables. This facilitates efficient retrieval of transactions based on transaction type and pre- and post-indexes. When retrieving transactions based on transaction type and pre- and post-indexes, the transaction hash value is first retrieved from the corresponding KV data table, and then the transaction corresponding to that hash value is searched across all transactions.
[0012] The network layer includes P2P (Peer to Peer) network, data verification mechanism and data dissemination protocol technology to realize information interaction between nodes;
[0013] The consensus mechanism adopted by the consensus layer is the PBFT (Practical Byzantine Fault Tolerance) consensus mechanism;
[0014] The contract layer designs an efficient data query algorithm for the entire life cycle. When a product has a problem, the algorithm is used to query the entire life cycle data, that is, to work backwards from the last process to the first process and find the transaction data corresponding to each process. Specifically:
[0015] Step 1: Obtain the transaction of the last process whose leading index is the batch number of the product to be traced;
[0016] Step 2: Get the transactions of the previous process in sequence, set the acquired transactions as the current transactions, and add the query results until the first process:
[0017] If the leading index of the current transaction contains "+", which means that the related transaction of the previous process is not unique, then it will be split into several fields using "+", and the previous process transaction with the trailing index of each field will be obtained respectively;
[0018] Otherwise, directly obtain the previous process transaction whose post-index is the pre-index of the current transaction;
[0019] The application layer, also known as the display layer, receives a user's request to trace a problem product, calls the contract layer's full life cycle efficient data query algorithm, performs a product full life cycle data query based on the input problem product batch number, and returns the query result to the application layer. The application layer then feeds back the product full life cycle data query result to the user;
[0020] Beneficial technical effects of the present invention:
[0021] The present invention introduces blockchain technology to form a decentralized model, effectively solving the problems of weak credibility and disaster tolerance. At the same time, at the data layer, the original transaction data structure is improved, and pre-indexes and post-indexes are added; and the KV data table is used to store the correspondence between the pre- / post-indexes of the transaction and the transaction hash value; and then at the contract layer, the pre-index and post-index are used to design a new product full life cycle efficient data query algorithm. This algorithm does not need to read the transaction content, but obtains the hash value of the transaction that meets the conditions in the corresponding KV data table, and then directly retrieves the transaction through the transaction hash value with a significantly smaller data volume, thereby solving the problem of inefficiency. Compared with the decentralized method that does not use the KV data table and the traditional centralized model, the present invention has significantly improved the efficiency of product full life cycle data query. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A structural diagram of a data query method for tracing the entire life cycle of large-scale manufacturing based on blockchain in an embodiment of the present invention;
[0023] Figure 2 An example diagram of a transaction structure according to an embodiment of the present invention;
[0024] Figure 3 An example diagram of a transaction process search using a method for efficient data query throughout the entire life cycle according to an embodiment of the present invention;
[0025] Figure 4 An example diagram of a transaction search process using a method without a KV data table in an embodiment of the present invention;
[0026] Figure 5 An example diagram of the full life cycle efficient data query algorithm process in an embodiment of the present invention.
[0027] Figure 6 Schematic diagram of the impact of the number of nodes on data query efficiency in an embodiment of the present invention and a method that does not use a KV data table; Figure a shows five full-lifecycle data query operations, and Figure b shows 25 full-lifecycle data query operations;
[0028] Figure 7Schematic diagram of the impact of raw data volume on data query efficiency for an embodiment of the present invention, a method not using a KV data table, and a centralized method; Figures a and b respectively perform one and ten full-lifecycle data query operations;
[0029] Figure 8 Schematic diagram of the relationship between the total processing time and the number of full life cycle data queries for an embodiment of the present invention, a method not using a KV data table, and a centralized method; Figures a and b respectively show 16 nodes using the first and second sets of original data to perform full life cycle data query operations, and Figures c and d respectively show 28 nodes using the first and second sets of original data to perform full life cycle data query operations. DETAILED DESCRIPTION
[0030] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0031] The data query method for traceability of the entire life cycle of large-scale manufacturing based on blockchain is as follows: Figure 1 As shown, specifically including the following:
[0032] Establish a consortium blockchain for product traceability throughout its entire life cycle;
[0033] The blockchain comprises a data layer, a network layer, a consensus layer, a contract layer, and an application layer. Upon receiving a user's request to trace a problem product, the application layer invokes the contract layer's efficient full-lifecycle data query algorithm. Based on the input problem product batch number, the algorithm performs a full-lifecycle data query in the data layer's pre- and post-index KV tables and transaction data. The query results are then returned to the application layer, which then provides feedback to the user.
[0034] The data layer integrates KV data tables and transaction data to provide trusted data for full life cycle traceability; the KV data tables include pre-index data and post-index data, and transaction data includes transportation transactions and production transactions;
[0035] Transactions are divided into transactions corresponding to production processes and transactions corresponding to transportation processes. The data structures of the two are the same, including the transaction hash value and transaction content. The transaction content structure is: transaction type, pre-index, post-index and other content. Among them, each process transaction corresponds to a transaction type. If the transaction is a transaction corresponding to a production process, the pre-index is set to the name of the material before production. If multiple materials are involved, they are separated by "+" in the middle. The post-index is set to the name of the material after production. If the transaction is a transaction corresponding to a transportation process, both the pre-index and post-index are set to the name of the transported material. Other content records specific transaction information such as temperature, weight, and composition. Figure 2Taking the raw material transportation (bulkTransfer), material production (materialProduce), and material entry (materialEnter) processes of steel production as an example, the corresponding types of transaction data structures are displayed. It can be seen that the post-index of the previous process and the pre-index of the next process have a corresponding relationship.
[0036] Two KV data tables are established for each transaction type in the data layer to store the correspondence between the transaction pre / post index and the transaction hash value, and store it in the KV data table; this facilitates efficient retrieval of transactions through transaction types and pre / post indexes; when retrieving transactions through transaction types and pre / post indexes, first obtain the transaction hash value in the corresponding KV data table, and then search for the transaction corresponding to the hash value in all transactions; avoid obtaining the transaction content of all transactions with a larger amount of data, and search for transactions through the transaction type and pre / post index in the transaction content; in comparison, the two methods have the same number of retrievals, but the time for a single retrieval of the former is significantly less than the time for a single retrieval of the latter; for example, when retrieving the factory transaction of a problem product (product batch number is "product batch number a"), the search processes of the method of the present invention and the method not using the KV data table are as follows: Figure 3 and Figure 4 shown.
[0037] The network layer includes P2P network, data verification mechanism and data dissemination protocol technology to realize information interaction between nodes;
[0038] The consensus layer adopts the PBFT consensus mechanism, which is suitable for consortium chains and has low algorithm complexity and communication complexity, high throughput and efficiency, and strong security and stability.
[0039] The smart contract of the contract layer is developed and deployed without human intervention. Once the conditions are triggered, it is automatically executed, thus saving a lot of resources and improving processing speed. In the present invention, it is a full-life cycle data query contract. It uses a full-life cycle efficient data query algorithm to query the front / back index KV data table and transaction data in the data layer; a full-life cycle efficient data query algorithm is designed; when a problem occurs in a product, the full-life cycle efficient data query algorithm is used to perform a full-life cycle data query, that is, to work backward from the last process to the first process and find the transaction data corresponding to each process; specifically:
[0040] Step 1: Obtain the transaction of the last process whose leading index is the batch number of the product to be traced;
[0041] Step 2: Get the transactions of the previous process in sequence, set the acquired transactions as the current transactions, and add the query results until the first process:
[0042] If the leading index of the current transaction contains "+", which means that the related transaction of the previous process is not unique, then it will be split into several fields using "+", and the previous process transaction with the trailing index of each field will be obtained respectively;
[0043] Otherwise, directly obtain the previous process transaction whose post-index is the pre-index of the current transaction;
[0044] The application layer, also known as the display layer, receives a user's request to trace a problem product, calls the contract layer's full life cycle efficient data query algorithm, performs a product full life cycle data query based on the input problem product batch number, and returns the query result to the application layer. The application layer then feeds back the product full life cycle data query result to the user;
[0045] Taking steel production as an example, the batch number of a problematic product is "product batch number a". The process of using the full life cycle efficient data query algorithm is as follows: Figure 5 As shown, the subsequent process of finding the billet transportation transaction is similar to the above process, so it is not listed one by one.
[0046] This study used a consortium blockchain built on an Ubuntu virtual machine system using the Hyperledger Fabric platform and implemented the proposed efficient full-lifecycle data query algorithm at the contract layer. The first control group employed a decentralized approach without using key-value (KV) tables, implementing a smart contract for full-lifecycle data query. The second control group employed a centralized model, querying data from a MySQL database. Four variables were considered: experimental environment, number of full-lifecycle data queries, amount of raw data, and number of nodes.
[0047] (1) The impact of the number of nodes on data query efficiency: The method of the present invention and the method without using KV data tables were respectively used on 16, 28, and 37 nodes, using the same set of original data (0.23MB), to perform 5 and 25 full life cycle data query operations respectively. The results show that when the number of full life cycle data queries and the amount of original data are the same, the more nodes the alliance chain has, the smaller the average processing time per unit of the full life cycle efficient data query method; and when the number of nodes is the same, the single time consumption of the method of the present invention, the method without using KV data tables, and the centralized model shows a decreasing trend. As shown in the attached figure, Figure 6 As shown;
[0048] (2) The impact of the amount of raw data on data query efficiency: The method of the present invention, the method without using the KV data table, and the centralized method using the MySQL database use two sets of raw data (0.23MB and 0.31MB) respectively. When the number of alliance chain nodes is 37, each performs 1 and 10 full life cycle data query operations. The results show that under the same experimental environment and the number of full life cycle data queries, the single processing time using the first set of raw data is shorter than that of the second set of raw data, and the increase rate of the method of the present invention, the method without using the KV data table, and the centralized model shows a sequential increasing trend. As shown in the attached figure Figure 7 As shown;
[0049] (3) The method of the present invention, the method without using KV data table, and the centralized method using MySQL database use two sets of original data (0.23MB and 0.31MB) respectively. When the number of alliance chain nodes is 16 and 28, 1, 5, 10, and 25 full life cycle data query operations are performed respectively. The results show that under the same experimental environment and original data, the total processing time increases with the increase in the number of full life cycle data queries, and the increase rates of the three methods show a decreasing trend. As shown in the attached figure, the total processing time increases with the increase in the number of full life cycle data queries. Figure 8 As shown;
[0050] (4) The impact of different variables on data query efficiency: The results show that the impact of the four variables, namely the number of full-life cycle data queries, experimental environment, amount of original data, and number of nodes, on the efficiency of full-life cycle data queries is in a decreasing order. Among them, the number of full-life cycle data queries determines the number of times data is queried, and therefore has the greatest impact on efficiency; and the impact of the experimental environment on efficiency is second only to the number of full-life cycle data queries. Therefore, it can be seen that the method of the present invention has a greater efficiency advantage.
[0051] In the actual production process of large-scale manufacturing, the need to trace problem products is more urgent. The full life cycle data query provides the data foundation for locating quality problems, and its efficiency is crucial. Compared with methods that do not use KV data tables and centralized models, the method of the present invention can better meet the efficiency needs of users.
Claims
1. A blockchain-based efficient data query method for the entire life cycle of large-scale manufacturing, characterized by: Specifically include the following: Establish a consortium blockchain for product traceability throughout its entire life cycle; The blockchain comprises a data layer, a network layer, a consensus layer, a contract layer, and an application layer. Upon receiving a user's request to trace a problem product, the application layer invokes the contract layer's efficient full-lifecycle data query algorithm. Based on the input problem product batch number, the algorithm performs a full-lifecycle data query in the data layer's pre- and post-index key-value pairs, key-value tables, and transaction data. The query results are then returned to the application layer, which then provides feedback to the user. The data layer integrates KV data tables and transaction data to provide trusted data for full life cycle traceability; the KV data tables include pre-index data and post-index data, and transaction data includes transportation transactions and production transactions; Transactions are divided into transactions corresponding to production processes and transactions corresponding to transportation processes. The data structure of the two is the same, including the transaction hash value and transaction content. The transaction content structure is: transaction type, pre-index, post-index, and other content. Among them, each process transaction corresponds to a transaction type. If the transaction is a transaction corresponding to a production process, the pre-index is set to the name of the material before production. If multiple materials are involved, they are separated by "+" in the middle. The post-index is set to the name of the material after production. If the transaction is a transaction corresponding to a transportation process, both the pre-index and post-index are set to the name of the transported material. Other content records the specific information of the transaction. Two KV data tables are established at the data layer for each transaction type to store the correspondence between the transaction pre / post index and the transaction hash value, and store it in the KV data table; this facilitates efficient retrieval of transactions by transaction type and pre / post index; when retrieving transactions by transaction type and pre / post index, first obtain the transaction hash value in the corresponding KV data table, and then search for the transaction corresponding to the hash value among all transactions.
2. The efficient data query method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: The network layer includes peer to peer, P2P network, data verification mechanism and data dissemination protocol technology to realize information interaction between nodes.
3. The efficient data query method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: The consensus mechanism adopted by the consensus layer is Practical Byzantine Fault Tolerance (PBFT) consensus mechanism.
4. The efficient data query method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: The contract layer designs an efficient data query algorithm for the entire life cycle; when a problem occurs with a product, the efficient data query algorithm is used to query the entire life cycle data, that is, to work backwards from the last process to the first process and find the transaction data corresponding to each process.
5. The efficient data query method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 4 is characterized in that: The contract layer designs an efficient data query algorithm for the entire life cycle, specifically: Step 1: Obtain the transaction of the last process whose leading index is the batch number of the product to be traced; Step 2: Get the transactions of the previous process in sequence, set the acquired transactions as the current transactions, and add the query results until the first process: If the leading index of the current transaction contains "+", which means that the related transaction of the previous process is not unique, then it will be split into several fields using "+", and the previous process transaction with the trailing index of each field will be obtained respectively; Otherwise, directly obtain the previous process transaction whose post index is the pre index of the current transaction.
6. The efficient data query method for the entire life cycle of large-scale manufacturing based on blockchain according to claim 1 is characterized in that: The application layer, i.e., the display layer, receives the user's request to trace the problem product, calls the full life cycle efficient data query algorithm of the contract layer, performs a full life cycle data query on the product based on the input problem product batch number, and returns the query result to the application layer. The application layer then feeds back the full life cycle data query result to the user.
Citation Information
Patent Citations
Hyperledger Fabric-based traceability system and method
CN114282860A
Bidirectional traceability method and system for steel industry chain
CN114612111A
Commodity traceability system based on block chain and big data technology
CN111539750A