A blockchain-based trusted traceability method for ship data
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-14
- Publication Date
- 2026-08-14
AI Technical Summary
[0007]本发明的目的是为了解决基于数字孪生的舰船供应链中面临的信息数据管理难度大、数据安全可靠溯源难等技术问题,创造性地提出一种基于区块链的舰船数据可信溯源方法
[0065]本方法,与现有技术相比,具有如下优点:
Smart Images

Figure CN115375305B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a blockchain-based trusted traceability method for ship data, belonging to the field of blockchain application technology. Background Technology
[0002] As a typical complex industrial product, the manufacturing process of naval vessels involves hundreds or even thousands of processing steps and numerous participating units, characterized by long construction cycles and a large number of collaborators. The sheer number of participants makes data tracking and management at each stage of the ship's entire lifecycle within the supply chain challenging.
[0003] Shipbuilding supply chain management systems prioritize collaboration across all links in the supply chain and emphasize information sharing. Through information sharing, business operations at each stage are improved and coordinated, achieving synchronized operation of the entire supply chain. However, because the shipbuilding supply chain process is not transparent, and participating entities do not fully trust each other, current issues include difficulties in data traceability, lengthy evidence collection times, and regulatory challenges. Therefore, to address the data management problems in the shipbuilding supply chain, a secure and intelligent supply chain information management solution is needed.
[0004] Digital twin technology comprehensively utilizes sensing, computing, modeling, and simulation technologies to map physical entities in a virtual space. The physical twin represents the physical entity of the supply chain, and its data is transmitted to the digital twin in real time. The digital twin reflects the real-time state of the physical twin. The results of pre-simulation on the digital twin can be used to guide the behavior of the physical twin. By building a digital twin system for the shipbuilding supply chain, the entire process from design, production, warehousing, transaction, and logistics can be digitized, facilitating better monitoring and management of the supply chain.
[0005] Blockchain technology offers a new solution for shipbuilding supply chains based on digital twins. Blockchain is an open, distributed ledger running on a peer-to-peer network. It effectively manages transactions between multiple entities without intermediaries, ensuring verifiability, traceability, and immutability. With its decentralized, tamper-proof, and traceable characteristics, blockchain is applied across numerous industries. Applying blockchain to the supply chain system ensures that data is immutable after storage and allows for rapid tracking, identification, and accurate tracing of shipbuilding product circulation information across processes, increasing transparency throughout the supply chain and guaranteeing data authenticity and reliability. By incorporating suppliers, manufacturers, distributors, retailers, and regulatory agencies into the blockchain network, a data trust system for the entire shipbuilding supply chain can be built without the need for third-party institutions.
[0006] Furthermore, with the rapid development of artificial intelligence (AI) technology, its application in the supply chain field has also received widespread attention. Since the supply chain generates a large amount of data at each stage, AI technology can fully leverage the information contained within this data to improve weak links in the supply chain, thereby optimizing supply chain decisions, such as assisting in production and inventory decisions and optimizing logistics management. Summary of the Invention
[0007] The purpose of this invention is to solve the technical problems of difficult information and data management and difficult data security and traceability in the ship supply chain based on digital twins, and to creatively propose a reliable traceability method for ship data based on blockchain.
[0008] To achieve the above objectives, the present invention adopts the following technical solution.
[0009] First, the relevant concepts and contents involved in this invention will be explained.
[0010] A supply chain (SC) is a chain-like structure formed between upstream and downstream enterprises involved in the production and distribution of products or services to end users. The roles involved in the entire supply chain process typically include raw material suppliers, manufacturers, warehouse operators, logistics providers, distributors, retailers, and end users.
[0011] A digital twin (DT) is a digital representation of a real physical entity or system. DT comprehensively utilizes technologies such as sensing, computing, modeling, and simulation to map physical entities in a virtual space. The physical twin represents the physical entity of the supply chain, and its data is transmitted to the digital twin in real time. The digital twin reflects the real-time state of the physical twin. Results from simulations on the digital twin can be used to guide the behavior of the physical twin.
[0012] Digital Supply Chain Twin: A digital twin within a supply chain is called a Digital Supply Chain Twin (DSCT). A DSCT is a digital representation of the physical supply chain, encompassing all relevant data within the supply chain and its operating environment. The digital twin represents the digital model within the DSCT, while the physical twin represents the physical entity portion of the DSCT. A two-way data exchange exists between the two to maintain the twin relationship.
[0013] Blockchain: An open, distributed ledger that runs on a peer-to-peer network, enabling trust to be established between multiple independent individuals or systems without the need for intermediaries. Data in a blockchain is sequentially linked into a chain structure in the form of blocks, and cryptographic methods are used to maintain the security, verifiability, and immutability of the data.
[0014] Consensus mechanism: This is a protocol or algorithm used in a blockchain system to maintain data consistency, and it is also key to establishing trust in a blockchain system without a centralized institution. Specific blockchain nodes vote on transactions, completing the verification and confirmation of transactions within a certain timeframe. If nodes with unrelated interests reach a consensus on a transaction, the transaction is added to the entire blockchain ledger, thus ensuring data consistency.
[0015] A smart contract is a piece of code on the blockchain that executes automatically when certain conditions are met. The execution process requires no third-party involvement and is transparent and immutable.
[0016] A blockchain-based method for trusted traceability of ship data includes the following steps:
[0017] Step 1: Data collection.
[0018] First, the physical twin in the digital supply chain twin collects data generated in the ship's supply chain (e.g., through edge sensors, etc.).
[0019] The digital twin of the ship supply chain updates the collected data in real time to correspond to changes in the physical supply chain.
[0020] The collected data is encrypted according to its security classification, while non-classified data does not require encryption.
[0021] Step 2: Generate a transaction.
[0022] In digital supply chain twins, blockchain is used as the storage layer for the digital twin. Specifically, ship design units, raw material suppliers, manufacturing units, quality management units, warehousing units, logistics units, sales units, maintenance units, and end users participate in the blockchain system as different organizations or individuals.
[0023] Based on smart contracts, log data generated during data exchange, flow, and use by various participants in the supply chain on the blockchain system, along with additional information on users, objects, methods, and times of use in data flow events, are collected and used as key traceability data. This data is recorded on the blockchain ledger in an immutable manner, thereby achieving a mechanism for generating and storing immutable and non-repudiable key traceability data for the ship supply chain.
[0024] Blockchain nodes, categorized by function and responsibility, include client nodes, ledger nodes, and peer nodes. Client nodes generate transactions and send transaction requests to the blockchain network; ledger nodes support the consensus process, sorting transactions to achieve global consistency in transaction order and packaging transactions into blocks; peer nodes are responsible for receiving blocks from consensus nodes, adding valid blocks to their local storage, and thus storing and maintaining the blockchain ledger.
[0025] Specifically, the process of generating a transaction includes the following steps:
[0026] Step 2.1: Supply chain participants, acting as client nodes, generate transactions from the data of their respective links, sign them, and send them to the blockchain network.
[0027] Step 2.2: Based on the execution order of smart contract calls in the transaction, abstract the transaction into a directed acyclic graph, and classify transactions with the same directed acyclic graph into the same type of transaction.
[0028] Step 3: Transaction consensus.
[0029] Consensus nodes are selected from the ledger nodes of the blockchain to vote on transactions, thereby completing the verification and confirmation of transactions.
[0030] This invention optimizes the Byzantine Fault Tolerance consensus algorithm by dividing consensus into two modes: strong consensus and weak consensus. Different types of transactions require different energy consumption and time to execute, necessitating the allocation of appropriate consensus modes to improve system performance. Therefore, the optimization goal of the consensus algorithm is to minimize consensus time consumption with limited energy resources.
[0031] Specifically, the transaction consensus includes the following steps:
[0032] Step 3.1: Consensus is divided into two modes: strong consensus and weak consensus. This invention proposes a transaction allocation algorithm based on intelligent conversion, which allocates a consensus mode and consensus computing node for each type of transaction.
[0033] Specifically, the transaction allocation algorithm based on intelligent conversion has the following steps:
[0034] Step 3.1.1: Construct the time consumption mapping table T-Table and the energy consumption mapping table E-Table under strong consensus mode and weak consensus mode.
[0035] Step 3.1.2: Ignoring time consumption for the time being, with the goal of minimizing energy consumption, a greedy algorithm is used to obtain the initial consensus mode allocation plan table ES.
[0036] Step 3.1.3: Traverse each row of the consensus mode allocation plan table ES, and subtract the value of the corresponding row of the energy consumption mapping table E-Table from each element in the row to obtain the energy normalization table ES'.
[0037] ES' demonstrates a potentially better option for allocating transaction consensus models.
[0038] Step 3.1.4: Traverse the energy standardization table ES' to find negative numbers. After finding a negative number, determine whether changing the consensus mode can reduce the total energy consumption. If it can, change the consensus mode for the transaction. If it cannot, do not change it.
[0039] Ultimately, a consensus-based energy consumption allocation plan, ES-Plan, was obtained.
[0040] Step 3.1.5: Traverse the consensus mode allocation plan table ES-Plan for optimizing energy consumption, and subtract the value of the corresponding row in the time consumption mapping table T-Table from each element in that row to obtain the time normalization table TS'.
[0041] TS's also demonstrates a potential for better transaction consensus distribution options.
[0042] Step 3.1.6: Traverse the time normalization table TS' to find negative numbers. After finding a negative number, determine whether changing the consensus mode can reduce the total time consumption. If it can, change the consensus mode for the transaction. If it cannot, do not change it.
[0043] Ultimately, the final consensus model allocation plan table TS-Plan was obtained.
[0044] Step 3.2: Among the accounting nodes, select 3f+1 nodes as consensus nodes to participate in the transaction consensus process, where f is the maximum tolerable number of malicious nodes. Select a master consensus node from among them to be responsible for generating and broadcasting blocks.
[0045] In a strong consensus model, the number of consensus nodes exceeds half the number of ledger nodes. In a weak consensus model, the number of consensus nodes does not exceed half the number of ledger nodes.
[0046] Step 3.3: The primary consensus node assigns a sequence number to the transaction. Each consensus node broadcasts a pre-ready verification message PrePre, verifies the PrePre message, and then broadcasts a ready message Pre to all other consensus nodes.
[0047] When a consensus node receives 2f Pre messages after receiving a PrePre message, it broadcasts a commit message Comm to other consensus nodes.
[0048] When a consensus node receives 2f+1 commit messages Comm, it considers that the blockchain system has reached a consensus on the transaction.
[0049] Step 3.4: The consensus node executes the transaction that has reached a consensus and sends the execution result of the transaction to the main consensus node.
[0050] When the primary consensus node receives more than f+1 identical execution results for transactions with the same sequence number, it considers the transaction to be legitimate.
[0051] Step 3.5: When a specified number of transactions are received or the current block time expires, the master consensus node sorts the legitimate transactions received within the current block time, packages the sorted transactions into a block, and broadcasts the block to all peer nodes in the blockchain.
[0052] Step 3.6: After receiving a block, peer nodes verify it, and the verified valid block is added to their respective blockchain ledgers. This ensures the consistency of the ledger data.
[0053] Step 4: Data traceability.
[0054] Throughout the entire shipbuilding supply chain, the quality management unit is responsible for acceptance and verification in normal processes, as well as for identifying and assigning responsibility for problems in abnormal situations. In normal processes, the management unit checks whether equipment uploads compliant data as required in various environments by reviewing on-chain data. For compliant data, the quality management unit initiates special acceptance transactions to confirm the process is error-free. When quality issues arise with ship equipment, the quality management unit combines the actual problem with the on-chain data to trace the source of the problem. Each piece of data on the chain carries the signature information of the data provider, allowing the quality management unit to determine the responsible party for the quality issue based on the signature information.
[0055] A text-based encrypted data retrieval mechanism was designed for on-chain encrypted data. This mechanism involves three entities: the data holder, the supply chain blockchain, and the queryer, who performs encrypted data tracing. The steps include:
[0056] Step 4.1: The data holder generates a secure index for the collection of documents it holds and stores it in the blockchain ledger along with the encrypted collection of documents.
[0057] Step 4.2: The queryer, as the requesting entity for the traceability data, completes identity authentication to avoid problems such as unauthorized access and leakage of the traceability data during its use.
[0058] Step 4.3: The queryer sends the query phrase to the data holder, who generates a corresponding query trap based on the query phrase and then sends the query trap to the queryer.
[0059] Step 4.4: The queryer uses the obtained query trap to filter out blockchain transaction information containing specified data from the blockchain ledger. With the help of the data holder, the queryer decrypts the data obtained from the blockchain ledger to obtain the corresponding plaintext query results.
[0060] For plaintext data on the blockchain, this method employs external database access and built-in indexing to construct a query layer for the ship supply chain, thereby increasing the ways to query traceability data from the blockchain ledger and improving the efficiency of querying key traceability data. Specifically:
[0061] First, an external database connection method is adopted, authorizing users to read the current blockchain data into the organization's trusted database for query and analysis through data monitoring.
[0062] Subsequently, an internal indexing method was adopted, establishing the query layer within the blockchain system by setting primary key and secondary indexes in the blockchain ledger. Based on actual needs, secondary indexes were set for query fields to point to the primary key. Then, the storage location of the relevant traceability data was found based on the primary key index, completing the traceability data query in two stages.
[0063] Furthermore, this invention utilizes artificial intelligence algorithms to process supply chain data stored in the blockchain, improving weak links in the supply chain and thereby optimizing supply chain decision-making. Specifically, it employs a Long Short-Term Memory (LSTM) neural network algorithm to process ship supply chain data stored in the blockchain and predict demand within the supply chain, thereby guiding and optimizing physical supply chain production.
[0064] Beneficial effects
[0065] Compared with existing technologies, this method has the following advantages:
[0066] This invention integrates blockchain and artificial intelligence technologies into a digital supply chain twin, ensuring secure data sharing and reliable traceability in the ship supply chain. At the same time, it can optimize supply chain decisions by mining the information contained in the supply chain data, thus promoting the intelligent development of the entire ship supply chain ecosystem.
[0067] 1. This method integrates blockchain and artificial intelligence technologies within a digital twin architecture to achieve intelligent management of the ship supply chain system. The top-level architecture of the digital twin supply chain, from bottom to top, consists of a physical layer, a storage layer, an analytics layer, and a presentation layer. The physical layer includes the physical entities participating in the ship supply chain, where edge sensors at each stage collect data generated throughout the entire lifecycle, and responsible personnel upload core data as transaction signatures. The blockchain serves as the storage layer, enabling secure data sharing and reliable traceability of ship data. The analytics layer processes the data stored in the blockchain using artificial intelligence algorithms, which can predict supply chain demand to support business decisions. The presentation layer primarily provides visualization of the current state of the ship supply chain.
[0068] 2. This invention proposes a transaction processing method based on strong and weak consensus modes, improving the performance of the blockchain consensus process. Based on the execution order of smart contract calls, the transaction process from upstream to downstream of the supply chain is abstracted as a directed acyclic graph (DAG). Transactions with the same DAG are grouped into the same category. Different types of transactions require different energy consumption and time to execute; this invention improves system performance by assigning appropriate consensus modes to different types of transactions.
[0069] 3. This method achieves secure sharing and reliable traceability of ship data. First, entities requesting access to traceability data must complete identity authentication to prevent unauthorized access and leakage during data use. For on-chain plaintext data queries, an external database connection and built-in indexing method are employed, increasing the ways to query traceability data from the blockchain ledger and improving the efficiency of querying key traceability data. For on-chain encrypted data, a special encrypted traceability data retrieval mechanism is constructed to ensure both data security and the reliability of query results. Attached Figure Description
[0070] Figure 1 This is a schematic diagram of the method of the present invention.
[0071] Figure 2 This is a flowchart of the entire lifecycle of the ship supply chain based on the method of this invention. Detailed Implementation
[0072] The specific implementation process of the method of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
[0073] Example
[0074] like Figure 1 As shown, this embodiment specifically illustrates a method for data traceability based on blockchain technology in the ship supply chain, as detailed below:
[0075] Step 1: Data collection.
[0076] The shipbuilding supply chain is a typical example of a supply chain network, with a complex number and composition of participating entities. Centered on final assembly and construction or final assembly integration enterprises, the shipbuilding supply chain controls the logistics, information flow, and capital flow of each node enterprise. From customer demand analysis, product design and development, raw material and component procurement, intermediate product manufacturing, to the production of the entire ship or engine system, it connects design companies, raw material suppliers, supporting equipment suppliers, section manufacturing companies, integration companies, warehousing companies, logistics companies, distribution companies, retail companies, quality management units, and users into a network structure with overall supply and demand functions. Each participant acts as a physical twin of the digital supply chain twin, collecting data generated in the shipbuilding supply chain through edge sensors. The digital twin of the shipbuilding supply chain updates the collected data in real time to correspond to changes in the state of the physical entity. The collected data is encrypted according to the security level; non-classified data does not require encryption.
[0077] Step 2: Generate a transaction.
[0078] In digital supply chain twins, blockchain is used as the storage layer for the digital twin. For example... Figure 2 As shown, shipbuilding raw material suppliers, manufacturers, warehouse operators, logistics providers, distributors, retailers, quality control personnel, and end users participate in the blockchain system as different organizations or individuals. Each participant can dynamically join the shipbuilding supply chain blockchain network. The blockchain system, based on smart contracts, collects logs generated during data exchange, flow, and use by each participant in the supply chain. It also adds information such as the user, object, method, and time of use in data flow events, using this as key traceability data. This data is recorded immutably on the blockchain ledger, achieving a mechanism for generating and storing immutable and non-repudiable key traceability data for the shipbuilding supply chain.
[0079] Blockchain nodes are categorized into three types based on their functional responsibilities: client nodes, ledger nodes, and peer nodes. Client nodes send transaction requests to the blockchain network after generating a transaction. Ledger nodes support the consensus process, sorting transactions to achieve global consistency in transaction order and packaging transactions into blocks. Peer nodes are primarily responsible for receiving blocks from consensus nodes, adding valid blocks to their local machine, and thus storing and maintaining the blockchain ledger. The process of generating a transaction includes the following sub-steps:
[0080] Step 2.1: Supply chain participants, acting as client nodes, generate transactions from the data of their respective segments, sign them, and send them to the blockchain network.
[0081] Step 2.2: Based on the execution order of smart contract calls in the transaction, abstract the transaction into a Directed Acyclic Graph (DAG), and classify transactions with the same DAG into the same category.
[0082] Step 3: Transaction consensus.
[0083] Consensus nodes are selected from the ledger nodes of the blockchain to vote on transactions, thereby completing the verification and confirmation of transactions.
[0084] This invention optimizes the Byzantine Fault Tolerance consensus algorithm, dividing the consensus mechanism into two modes: strong consensus and weak consensus, based on the number of nodes participating in the consensus process. Different consensus modes involve nodes of different sizes and require different energy costs to process transactions.
[0085] Define a binary function s(TR) i When its value is 0, it indicates that the transaction type is TR. i In weak consensus mode, a value of 1 indicates a transaction type TR. i Processed under a strong consensus model. Define TR for each type of transaction. i Let the processing time, energy cost, and transaction volume under the strong consensus model be T, respectively. s (TR i E s (TR i ) and N s (TR i Let T be the time consumption, energy cost, and transaction amount under the weak consensus model. w (TR i E w (TR i ) and N w (TR i ).
[0086] Different types of transactions require varying energy consumption and time to execute under different consensus models. Therefore, the optimization objective of consensus algorithms is to minimize consensus time consumption with limited energy resources. This optimization problem is formally expressed as follows:
[0087]
[0088] Where, N TR Represents the total number of transactions; TR i N(TR) represents the i-th type of transaction; i ) represents the number of transactions of the i-th type; Ns(TR) i ) represents the number of transactions of the i-th type processed under the strong consensus model; N w (TR i E represents the number of transactions of the i-th type processed under the weak consensus model; S (TR i E represents the energy consumption of the i-th type of transaction under strong consensus mode;w (TR i ) represents the energy consumption of the i-th type of transaction in the weak consensus mode; E represents the total energy consumption of all transactions; E max Indicates energy consumption limit; T S (TR i ) represents the time consumption of the i-th type of transaction under strong consensus mode; T W (TR i ) represents the time consumption of the i-th type of transaction in the weak consensus mode; T represents the total time consumption of all transactions; s(i) represents the consensus mode selection function of transaction i.
[0089] Specifically, it includes the following steps:
[0090] Step 3.1: Consensus is divided into two modes: strong consensus and weak consensus. This invention proposes a transaction allocation algorithm based on intelligent conversion, which allocates a consensus mode and consensus computing node for each type of transaction.
[0091] Specifically, the transaction allocation algorithm based on intelligent conversion has the following steps:
[0092] Step 3.1.1: Construct the time consumption mapping table T-Table and the energy consumption mapping table E-Table under strong consensus mode and weak consensus mode.
[0093] Step 3.1.2: Ignoring time consumption for the time being, with the goal of minimizing energy consumption, a greedy algorithm is used to obtain the initial consensus mode allocation plan table ES.
[0094] Step 3.1.3: Traverse each row of the consensus mode allocation plan table ES, and subtract the value of the corresponding row of the energy consumption mapping table E-Table from each element in the row to obtain the energy normalization table ES'.
[0095] ES' demonstrates a potentially better option for allocating transaction consensus models.
[0096] Step 3.1.4: Traverse the energy standardization table ES' to find negative numbers. After finding a negative number, determine whether changing the consensus mode can reduce the total energy consumption. If it can, change the consensus mode for the transaction. If it cannot, do not change it.
[0097] Ultimately, a consensus-based energy consumption allocation plan, ES-Plan, was obtained.
[0098] Step 3.1.5: Traverse the consensus mode allocation plan table ES-Plan for optimizing energy consumption, and subtract the value of the corresponding row in the time consumption mapping table T-Table from each element in that row to obtain the time normalization table TS'.
[0099] TS's also demonstrates a potential for better transaction consensus distribution options.
[0100] Step 3.1.6: Traverse the time normalization table TS' to find negative numbers. After finding a negative number, determine whether changing the consensus mode can reduce the total time consumption. If it can, change the consensus mode for the transaction. If it cannot, do not change it.
[0101] Ultimately, the final consensus model allocation plan table TS-Plan was obtained.
[0102] The pseudocode for the above execution flow is given below.
[0103] Input: Transaction list TR, Energy constraint E max
[0104] Output: Consensus Allocation Plan (TS-Plan)
[0105] (1) function OTA(TR, E max )
[0106] (2)Call TCM to generate energy mapping table E-Table and time mapping table T-Table.
[0107] (3)Execute the greedy algorithm to generate initial consensus planES.
[0108] (4)Call RSTG on E-Table,ES to obtain energy standardized table ES'.
[0109] (5)Call IES to get a novel intermediate consensus plan ES-Plan.
[0110] (6)Call RSTG on T-Table,ES-Plan to obtain time standardized table TS'.
[0111] (7)Call ITS to get the final consensus plan TS-Plan under E max .
[0112] (8) Return TS-Plan
[0113] (9)end function
[0114] (10)function TCM(TR)
[0115] (11)for i←0to M-1 / / M types of transactions in TR
[0116] (12)for j←0to N-1 / / Each type has N transactions
[0117] (13)T←j×T s (TR i )+(N(TR i )-j)×T w (TR i )
[0118] (14)E←j×E s (TR i )+(N(TR i )-j)×E w (TR i )
[0119] (15)Add T to T-Table,add E to E-Table
[0120] (16)end for
[0121] (17)end for
[0122] (18)return T-Table,E-Table
[0123] (19)end function
[0124] (20)function RSTG(X-Table,XS)
[0125] (21)Input consumption mapping X-Table and consensus plan XS.
[0126] (22)Create novel table XS’.
[0127] (23)for m←0 to M-1
[0128] (24)Read XS from the m-th row.
[0129] (25)t=XS[m]
[0130] (26)for n←0 to N-1
[0131] (27)XS’[m][n]←X-Table[m][n]-X-Table[m][t]
[0132] (28)end for
[0133] (29)end for
[0134] (30)return XS’
[0135] (31)function IES(ES’,ES)
[0136] (32)Input intermediate table ES’and sub-optimal consensus plan ES.
[0137] (33)for m←0 to M-1
[0138] (34)for n←0 to N-1
[0139] (35)if ES’[m][n]<0 then
[0140] (36)while find transaction k,after switching with
[0141] transaction m,the energy cost is reduced.
[0142] (37)Exchange ES[m]and ES[k]
[0143] (38)end while
[0144] (39)end if
[0145] (40)end for
[0146] (41)end for
[0147] (42)ES-Plan←ES
[0148] (43)return ES-Plan
[0149] (44)end function
[0150] (45)function ITS(TS’,ES-Plan,E-Table,E max )
[0151] (46)Define variable E that stores total energy cost.
[0152] (47)Assign value E according to ES-Plan and E-Table.
[0153] (48)for m←0to M-1
[0154] (49)for n←0to N-1
[0155] (50)if TS’[m][n]<0then
[0156] (51)while find transaction k,after switching with
[0157] transaction m,the energy cost is reduced.
[0158] (52)if E<E max then
[0159] (53)Exchange ES-Plan[m]and ES-Plan[k].
[0160] (54)else Deny the switch operation.
[0161] (55)Update table TS’.
[0162] (56)end if
[0163] (57)end while
[0164] (58)end if
[0165] (59)end for
[0166] (60)end for
[0167] (61)TS-Plan←ES-Plan
[0168] (62) return TS-Plan
[0169] (63)end function
[0170] Among them, E-Table is the energy mapping table, T-Table is the time mapping table, ES' is the energy normalization table, TS' is the time normalization table, ES is the initial consensus allocation plan obtained by executing a greedy algorithm, ES-Plan is the intermediate consensus allocation plan after intelligent conversion to optimize energy consumption, and TS-Plan is the final consensus allocation plan after intelligent conversion to optimize time.
[0171] Specifically, lines (1) through (9) show the entire execution flow of generating a consensus plan by the Optimal Transaction Allocation (OTA) function calling four other algorithms.
[0172] Lines (10) to (18) are the Transaction Cost Mapping (TCM) function, which is used to construct time and energy consumption mapping tables for different transaction types under different consensus modes.
[0173] After adopting the greedy algorithm, the Reference Standard Table Generation (RSTG) function in lines (20) to (30) is called to construct an intermediate standardized table, which shows a potential better transaction consensus mode allocation option.
[0174] The Intelligent Energy Conversion (IES) function in lines (31) to (44) and the Intelligent Time Conversion (ITS) function in lines (45) to (63) are the core components. They optimize the results through intelligent conversion operations, thereby obtaining a near-optimal consensus scheme under constraints.
[0175] Step 3.2: Select 3f+1 nodes from the accounting nodes as consensus nodes to participate in the transaction consensus process, where f is the maximum tolerable number of malicious nodes. In strong consensus mode, the number of consensus nodes should exceed half of the accounting nodes, while in weak consensus mode, the number of consensus nodes should not exceed half of the accounting nodes. Select a master consensus node from among them to be responsible for generating and broadcasting blocks.
[0176] Step 3.3: The primary consensus node assigns a sequence number to the transaction. Subsequent consensus nodes broadcast a pre-verification message, PrePre. Each consensus node verifies the PrePre message and then broadcasts a preparation message, Pre, to all other consensus nodes. When a consensus node receives 2f Pre messages after receiving the PrePre message, it broadcasts a commit message, Comm, to the other consensus nodes. When a consensus node receives 2f+1 Comm commit messages, it considers the blockchain system to have reached a consensus on the transaction.
[0177] Step 3.4: The consensus node executes the agreed-upon transaction and sends the execution result to the master consensus node. The master consensus node considers the transaction valid when it receives more than f+1 identical execution results for transactions with the same sequence number.
[0178] Step 3.5: When a specified number of transactions are received or the current block time ends, the master consensus node sorts the legitimate transactions received during the current block time, packages the sorted transactions into a block, and broadcasts the block to all peer nodes in the blockchain.
[0179] Step 3.6: After receiving the block, the peer nodes verify it. The verified valid block is added to their respective blockchain ledgers to ensure the consistency of the ledger data.
[0180] Step 4: Data traceability.
[0181] Throughout the entire shipbuilding supply chain, the quality management unit is responsible for acceptance and verification in normal processes, as well as for identifying and assigning responsibility for problems in abnormal situations. In normal processes, the management unit checks whether equipment uploads compliant data as required in various environments by reviewing on-chain data. For compliant data, the quality management unit initiates special acceptance transactions to confirm the process is error-free. When quality issues arise with ship equipment, the quality management unit combines the actual problem with the on-chain data to trace the source of the problem. Each piece of data on the chain carries the data provider's signature information, allowing the quality management unit to determine the responsible party for the quality issue based on the signature.
[0182] This method designs a text-based encrypted retrieval mechanism for on-chain encrypted data. The text-based encrypted retrieval mechanism involves three entities: the data holder, the ship supply chain blockchain, and the queryer. When performing encrypted tracing, the queryer includes the following sub-steps:
[0183] Step 4.1: High-security data needs to be encrypted before being uploaded to the blockchain ledger. Specifically, the data holder generates a secure index for their document collection and stores it along with the encrypted document collection in the blockchain ledger.
[0184] Step 4.2: The queryer, as the requesting entity for the traceability data, needs to complete identity authentication to avoid problems such as unauthorized access and leakage of the traceability data during its use.
[0185] Step 4.3: The queryer sends the query phrase to the data holder, who generates a corresponding query trap based on the query phrase and then sends the query trap to the queryer.
[0186] Step 4.4: This method uses the authentication center responsible for user identity creation as a trusted key management institution. This institution is responsible for key generation and distribution, and uses smart contract-based access control to verify the legitimacy and sufficient permissions of users requesting keys. Legitimate queryers can use the obtained query trapdoor to filter blockchain transaction information containing specified data from the blockchain ledger. With the data holder's permission, the queryer can obtain a decryption key from the key management center to decrypt the data obtained from the blockchain ledger, obtaining the corresponding plaintext query results.
[0187] For plaintext data on the blockchain, this method employs external database access and built-in indexing to construct a ship supply chain query layer, thereby increasing the ways to query traceability data from the blockchain ledger and improving the efficiency of querying key traceability data. Specifically, the method includes the following steps:
[0188] First, in the external database method, authorized users can read the current blockchain data into the institution's trusted database for query and analysis by setting up a data monitoring module.
[0189] Secondly, the built-in indexing method establishes the query layer within the blockchain system by setting primary key indexes and secondary indexes in the blockchain ledger. Based on actual needs, secondary indexes are set to point to the primary key for the query fields. Then, the storage location of the relevant traceability data is found based on the primary key index, completing the traceability data query in two stages.
[0190] Furthermore, artificial intelligence technology is being used to support supply chain production.
[0191] Since the operation of the supply chain depends on time characteristics, this method uses a long short-term memory neural network algorithm to process the ship supply chain data stored in the blockchain, predict the demand in the supply chain, and thus guide the optimization of physical supply chain production.
[0192] The above description is merely a preferred embodiment of the present invention, and the present invention should not be limited to the content disclosed in this embodiment and the accompanying drawings. Any equivalent or modified embodiments made without departing from the spirit of the present invention fall within the protection scope of the present invention.
Claims
1. A blockchain-based method for trusted traceability of ship data, characterized in that, Includes the following steps: Step 1: Data Collection; First, the physical twin in the digital supply chain twin collects data generated in the ship supply chain; the digital twin of the ship supply chain updates the collected data in real time to correspond to changes in the physical supply chain's status. The collected data is encrypted according to its security level, while non-classified data does not need to be encrypted. Step 2: Generate a transaction; In digital supply chain twins, blockchain is used as the storage layer for the digital twin. Based on smart contracts, log data generated by each participant in the supply chain during data exchange, flow, and use on the blockchain system, as well as information on users, objects of use, methods of use, and times of use in additional data flow events, are collected and used as key traceability data and recorded on the blockchain ledger in an immutable manner. Blockchain nodes, categorized by function and responsibility, include client nodes, ledger nodes, and peer nodes. Client nodes generate transactions and send transaction requests to the blockchain network. Ledger nodes support the consensus process, sorting transactions to achieve global consistency in transaction order and packaging transactions into blocks. Peer nodes are responsible for receiving blocks from consensus nodes, adding valid blocks to their local storage, and thus storing and maintaining the blockchain ledger. Supply chain participants, acting as client nodes, generate transactions from data at their respective stages, sign them, and send them to the blockchain network. Based on the execution order of smart contract calls, transactions are abstracted into directed acyclic graphs, and transactions with the same directed acyclic graph are classified into the same category. Step 3: Transaction Consensus; Consensus nodes are selected from the ledger nodes of the blockchain to vote on transactions, thereby completing the verification and confirmation of transactions. This includes the following steps: Step 3.1: Assign consensus mode and consensus computing nodes to each type of transaction. Consensus is divided into two modes: strong consensus and weak consensus. Step 3.2: Among the accounting nodes, select 3f+1 nodes as consensus nodes to participate in the consensus process of transactions, where f is the maximum number of malicious nodes that can be tolerated. Select a master consensus node from among them to be responsible for generating and broadcasting blocks. In a strong consensus model, the number of consensus nodes exceeds half the number of accounting nodes; in a weak consensus model, the number of consensus nodes does not exceed half the number of accounting nodes. Step 3.3: The primary consensus node assigns a sequence number to the transaction; the consensus nodes broadcast a pre-ready verification message PrePre, each consensus node verifies the PrePre message, and then broadcasts a ready message Pre to all other consensus nodes; When a consensus node receives 2f Pre messages after receiving the PrePre message, the consensus node broadcasts a commit message Comm to other consensus nodes. When a consensus node receives 2f+1 commit messages Comm, it considers that the blockchain system has reached a consensus on the transaction; Step 3.4: The consensus node executes the transaction that has reached a consensus and sends the execution result of the transaction to the main consensus node; When the primary consensus node receives more than f+1 identical execution results for transactions with the same sequence number, it considers the transaction to be valid. Step 3.5: When a specified number of transactions are received or the current block time expires, if any of the above situations occur, the master consensus node sorts the legitimate transactions received within the current block time, packages the sorted transactions into a block, and broadcasts the block to all peer nodes in the blockchain. Step 3.6: After receiving a block, the peer nodes verify it, and the verified valid blocks are added to their respective blockchain ledgers; this ensures the consistency of the ledger data. Step 4: Data tracing, including both encrypted and plaintext data; For on-chain encrypted data, a text-based encrypted retrieval mechanism is employed, including the following steps: Step 4.1: The data holder generates a secure index for the collection of documents it holds and stores it in the blockchain ledger along with the encrypted collection of documents; Step 4.2: The queryer, as the requesting entity for the traceability data, completes identity authentication to avoid problems such as unauthorized access and leakage of the traceability data during its use; Step 4.3: The queryer sends the query phrase to the data holder, who generates a corresponding query trap based on the query phrase and then sends the query trap to the queryer. Step 4.4: The queryer uses the obtained query trap to filter out blockchain transaction information containing specified data from the blockchain ledger; with the help of the data holder, the queryer decrypts the data obtained from the blockchain ledger and obtains the corresponding plaintext query results; For plaintext data on the blockchain, an external database connection method and an internal index method are used to construct the ship supply chain query layer. First, the external database connection method is used, and authorized users can read the current blockchain data into the institution's trusted database for query and analysis through data listening. Subsequently, the built-in indexing method was adopted to establish the query layer within the blockchain system. This was achieved by setting primary key indexes and secondary indexes in the blockchain ledger. Based on actual needs, secondary indexes were set to point to the primary key for the query fields. Then, the storage location of the relevant traceability data was found based on the primary key index, and the traceability data query was completed in two stages.
2. The blockchain-based trusted traceability method for ship data as described in claim 1, characterized in that, In step 3, during transaction consensus, a binary function s(TR) is defined. i When its value is 0, it indicates that the transaction type is TR. i In weak consensus mode, a value of 1 indicates a transaction type TR. i Processed under a strong consensus model; define TR for each type of transaction. i Let the processing time, energy cost, and transaction volume under the strong consensus model be T, respectively. s (TR i E s (TR i ) and N s (TR i Let T be the time consumption, energy cost, and transaction amount under the weak consensus model. w (TR i E w (TR i ) and N w (TR i ); The optimization objective of consensus algorithms is to minimize consensus time consumption with limited energy resources. This optimization problem can be formally expressed as follows: (1) Among them, TR i Represents the i-th type of transaction; Ns(TR) i ) represents the number of transactions of the i-th type processed under the strong consensus model; N w (TR i E represents the number of transactions of the i-th type processed under the weak consensus model; S (TR i E represents the energy consumption of the i-th type of transaction under strong consensus mode; w (TR i ) represents the energy consumption of the i-th type of transaction in the weak consensus mode; E represents the total energy consumption of all transactions; E max Indicates energy consumption limit; T S (TR i ) represents the time consumption of the i-th type of transaction under strong consensus mode; T W (TR i ) represents the time consumption of the i-th type of transaction under weak consensus mode; T represents the total time consumed by all transactions; s(i) represents the consensus mode selection function for transaction i. An algorithm based on intelligent transformation is used to assign consensus modes and consensus computing nodes to each type of transaction. The steps are as follows: Step 3.1.1: Construct the time consumption mapping table T-Table and energy consumption mapping table E-Table for strong consensus mode and weak consensus mode; Step 3.1.2: Ignoring time consumption for the time being, and with the goal of minimizing energy consumption, a greedy algorithm is used to obtain the initial consensus mode allocation plan table ES; Step 3.1.3: Traverse each row of the consensus mode allocation plan table ES, and subtract the value of the corresponding row of the energy consumption mapping table E-Table from each element in the row to obtain the energy normalization table ES'; ES' demonstrates a potentially better option for allocating consensus patterns in transactions; Step 3.1.4: Traverse the energy standardization table ES' to find negative numbers. After finding a negative number, determine whether changing the consensus mode can reduce the total energy consumption. If it can, change the consensus mode for the transaction. If it cannot, do not change it. Ultimately, a consensus-based energy consumption allocation plan, ES-Plan, was obtained. Step 3.1.5: Traverse the consensus mode allocation plan table ES-Plan for optimizing energy consumption, and subtract the value of the corresponding row in the time consumption mapping table T-Table from each element in that row to obtain the time normalization table TS'; TS' also demonstrated potential better transaction consensus model allocation options; Step 3.1.6: Traverse the time normalization table TS' to find negative numbers. After finding a negative number, determine whether changing the consensus mode can reduce the total time consumption. If it can, change the consensus mode for the transaction. If not, do not change it. Ultimately, the final consensus model allocation plan table TS-Plan was obtained.
Citation Information
Patent Citations
Method for recording commodity circulation process by using nested digital twinning body
CN110689356A
Transaction system and method of operation thereof
US20210350363A1