Block chain transaction traceability query method and device

By constructing a binary path query of the transaction association tree and the Merkle tree, the problem of wasting computing resources and verifying the authenticity of the results of blockchain transaction traceability queries is solved, and fast and low-cost transaction traceability positioning is achieved.

CN120631938APending Publication Date: 2025-09-12NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510839600.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Traditional blockchain transaction traceability queries require sequentially querying each block, which wastes computing resources and makes it difficult to verify the authenticity of the traceability query results, especially when locating related blockchains in cross-chain transactions.

Method used

By constructing a transaction association tree and using prefix coding B+ tree to classify asset IDs, a transaction association tree is formed. The block where the transaction is located is quickly located based on the binary representation path of the Merkle tree, and differential coding is combined to optimize path queries and reduce computing costs.

Benefits of technology

It achieves the rapid location of the block where the exchange is located, reduces computing costs and query time, improves query speed and throughput, and ensures the accuracy and completeness of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631938A_ABST
    Figure CN120631938A_ABST
Patent Text Reader

Abstract

The invention discloses a block chain transaction traceability query method and device, and belongs to the technical field of block chains, and the block chain transaction traceability query method comprises the steps: according to a traceability query request of a user for a target asset, determining the cache information of a transaction related to the traceability query request; if the cache information does not exist, determining historical transaction association information of the target assets in a pre-constructed transaction association tree; and based on the historical transaction association information, determining a block where the target asset traceability query relates to the transaction. According to the method, the historical transaction association information of the target assets is determined through the pre-constructed transaction association tree, and finally, the block where the transaction involved in the source tracing query of the target assets is located is quickly determined based on the historical transaction association information, so that query of the transaction in each block in sequence is avoided, the query speed is increased, and the calculation cost is reduced; the problems that the current traceability query of the transaction needs to query the transaction in each block in sequence, the query time is too long, and computing resources are wasted are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a blockchain transaction traceability query method and device, and belongs to the field of blockchain technology. Background Art

[0002] Traditional transaction traceability can only query whether the target transaction information exists in each block in sequence. Due to the chain storage method of blockchain, transaction traceability queries usually need to be performed sequentially. There is a lack of perception of global information, and it is impossible to locate related blockchains and blocks in advance. Transactions need to be queried within each block, wasting computing resources. In addition, cross-chain transactions are divided into two transactions on two blockchains. It may be difficult to locate the other blockchain through one transaction, resulting in missing the previous blockchain and difficulty in verifying the authenticity of the traceability query results. Summary of the Invention

[0003] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a blockchain transaction traceability query method and device, which can quickly locate the block where the transaction is located through transaction association, reduce computing costs, and solve the problem that the current traceability query of transactions requires sequentially querying transactions in each block, which takes a long time and wastes computing resources.

[0004] In order to achieve the above objectives / solve the above technical problems, the present invention is implemented by adopting the following technical solutions: The present invention provides a blockchain transaction traceability query method, comprising: Based on the user's traceability query request for the target asset, determine the cached information of the transaction involved in the traceability query request; If there is no cached information, the historical transaction association information of the target asset is determined in the pre-built transaction association tree; Based on historical transaction association information, determine the block where the target asset traceability query involves the transaction.

[0005] Furthermore, the transaction-related information includes: The transaction chain association is expressed as: ; Represents assets i In the blockchain n The collection of intra-chain transaction associations; Represents assets i No. j Transactions on the blockchain n In the block, Representation and Assets i No. j The transaction is associated with Transactions on the blockchain nThe block in which ? Represents assets i In the blockchain n The number of historical transactions within the period; Among them, the data structure associated with the transaction chain is expressed as: ; Indicates the hash value of the block in which the transaction is made. Indicates the association within the predecessor chain, Indicates the association within the successor chain, Indicates the timestamp of the creation of the chain association, Represents the verification signature set of the verification node in the chain, Indicates binary representation path; Transaction cross-chain association is expressed as: ; Represents assets i The cross-chain associated set of transactions; Represents assets i A cross-chain transaction The source of blockchain, Represents assets i A cross-chain transaction The target blockchain; Represents assets i The number of cross-chain transactions; The data structure of cross-chain transaction association is represented as follows: ; Indicates the blockchain ID, Indicates the predecessor cross-chain association, Indicates subsequent cross-chain association, Indicates the timestamp of the cross-chain association creation, Represents the verification front set of the relay chain node, Indicates an intra-chain relationship.

[0006] Furthermore, the method for constructing the pre-constructed transaction association tree includes: Get the asset ID of the asset corresponding to the cross-chain transaction; Based on the prefix coding B+ tree, assets are classified according to the prefix coding of the asset ID to form a transaction association tree.

[0007] Furthermore, the prefix-coded B+ tree classifies assets according to the prefix codes of the asset IDs to form a transaction association tree, including: using the asset ID as a keyword, storing the transaction association information of the corresponding assets into the B+ tree according to the asset ID to obtain the transaction association tree; Among them, when a new cross-chain transaction occurs, the asset ID of the new asset is obtained; According to the asset ID of the new asset, the transaction association information is stored in the corresponding B+ tree.

[0008] Furthermore, based on historical transaction association information, the block where the target asset traceability query involves the transaction is determined, including: Determine the blockchain of the transaction to be queried based on historical transaction association information; Based on the Merkle tree of the blockchain of the exchange to be queried, each subtree is queried through the binary representation path until the block where the exchange to be queried is located is found.

[0009] Furthermore, the Merkle tree based on the blockchain of the exchange to be queried is used to search each subtree through the binary representation path until the block where the exchange to be queried is located is found, including: Starting from the root node of the Merkle tree, search downwards along the binary representation path of the transaction to be queried, traversing the binary string from the last digit forward; If the current character position is "0", continue searching in the left subtree of the current node; If the current character bit is "1", continue searching in the right subtree of the current node; Until the target child node is found; Verify whether the hash value of the transaction stored in the target child node matches the hash value of the transaction involved in the traceability query request. If so, the correct transaction has been queried.

[0010] Furthermore, the binary representation path includes: Get the path string of all transactions involved in the traceability query request; For transactions with similar paths, differential encoding is used to store the differences between similar paths, forming a binary representation path of the similar paths; The path difference is calculated as follows: ; Indicates the difference between the current path and the previous path; A binary path string representing the current path, A binary path string representing the previous path; Represents calculating the bit difference between two path strings; The path length is calculated using the following formula: ; Indicates transaction i The corresponding path length, represents any symbol, Indicates the total number of transactions that need to be queried in the block.

[0011] Furthermore, after determining the block where the target asset traceability query involves transactions based on historical transaction association information, the cache information needs to be updated, including: The cache information is represented as: ; Represents assets i Cache information, Represents stored assets i Historical transaction data, Indicates the last asset recorded i The corresponding blockchain height when the cache information is updated, Represents a record asset i The timestamp of the last update of the cached information; If the cache information is empty, search for transaction data corresponding to all historical transaction records related to the target asset, and store the transaction data found, the highest blockchain height reached, and the timestamp as cache information; If the cache information is not empty, the actual transaction data and blockchain height stored in the block of the exchange to be queried are obtained, and the current cache information is merged with the newly obtained actual transaction data and blockchain height.

[0012] Furthermore, if there is cached information, the result of the last historical transaction traceability query of the target asset, the blockchain and block height of the latest transaction are output based on the cached information.

[0013] The present invention also provides a blockchain transaction traceability query device, comprising: A judgment module is used to determine the cached information of the transaction involved in the traceability query request based on the user's traceability query request for the target asset; A processing module, configured to determine historical transaction association information of the target asset in a pre-built transaction association tree if no cached information is available; The query module is used to determine the block where the target asset traceability query involves transactions based on historical transaction association information.

[0014] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention determines the historical transaction association information of the target asset through a pre-built transaction association tree. Ultimately, based on this historical transaction association information, it quickly determines the block where the target asset's traceability query involves transactions. This avoids querying transactions sequentially within each block, improves query speed, and reduces computing costs. This solves the problem that current traceability queries for transactions require sequentially querying transactions within each block, which takes a long time and wastes computing resources.

[0015] 2. The present invention is based on the Merkle tree of the blockchain where the transaction to be queried resides. It queries each subtree using a binary path representation until the block where the transaction to be queried resides is found. For transactions with similar paths, differential encoding is used to store the differences between similar paths, forming a binary path representation of the similar paths. This only requires storing the path string of the first transaction and the changes in the path strings of subsequent transactions relative to the previous path string. This avoids additional calculations of the query path during the path search process, thereby improving the query speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 This is a flowchart of a blockchain transaction traceability query method provided by an embodiment of the present invention; Figure 2 This is a flowchart of finding the block where the transaction to be queried is located, provided by an embodiment of the present invention; Figure 3 This is a schematic diagram comparing the query time per transaction of a blockchain transaction traceability query method provided by an embodiment of the present invention with that of an existing method under different numbers of blockchains; Figure 4 This is a schematic diagram comparing the query request throughput of a blockchain transaction traceability query method provided by an embodiment of the present invention with that of existing methods under different numbers of blockchains; Figure 5 This is a schematic diagram comparing the error rates of query results of a blockchain transaction traceability query method provided by an embodiment of the present invention and existing methods under different malicious node ratios; Figure 6 This is a schematic diagram comparing the additional storage overhead of a blockchain transaction traceability query method provided by an embodiment of the present invention with that of existing methods under different numbers of blockchains. DETAILED DESCRIPTION

[0017] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention. Example

[0018] like Figure 1 As shown, a blockchain transaction traceability query method includes: Based on the user's traceability query request for the target asset, determine the cached information of the transaction involved in the traceability query request; if cached information exists, output the result of the last traceability query of the target asset's historical transactions, the blockchain where the latest transaction is located, and the block height based on the cached information.

[0019] If there is no cached information, the historical transaction association information of the target asset is determined in the pre-built transaction association tree. It should be noted that transaction information generated in the blockchain is stored in blocks. Cross-chain transactions are recorded in the blocks of both the source chain and the target chain, respectively recording the blockchain information involved in the asset outflow and flow. Transaction association information includes intra-chain associations and cross-chain associations. The association within the transaction chain is expressed as: ; Represents assets i In the blockchain n The collection of intra-chain transaction associations; Represents assets i No. j Transactions on the blockchain n In the block, Representation and Assets i No. j The transaction is associated with Transactions on the blockchain n The block in which ? Represents assets i In the blockchain n The number of historical transactions within the period; The data structure associated with the transaction chain is represented as follows: ; Indicates the hash value of the block in which the transaction is made. Indicates the association within the predecessor chain, Indicates the association within the successor chain, Indicates the timestamp of the creation of the chain association, Represents the verification signature set of the verification node in the chain, Indicates binary representation path; The cross-chain transaction association is expressed as: ; Represents assets i The cross-chain associated set of transactions; Represents assets i A cross-chain transaction The source of blockchain, Represents assets i A cross-chain transaction The target blockchain; Represents assets i The number of cross-chain transactions; The data structure of cross-chain transaction association is represented as follows: ; Indicates the blockchain ID, Indicates the predecessor cross-chain association, Indicates subsequent cross-chain association, Indicates the timestamp of the cross-chain association creation, Represents the verification front set of the relay chain node, Indicates an intra-chain relationship.

[0020] The construction method of the pre-built transaction association tree includes: Get the asset ID of the asset corresponding to the cross-chain transaction; Based on the prefix coding B+ tree, assets are classified according to the prefix coding of the asset ID to form a transaction association tree. Specifically: Using the asset ID as the keyword, store the transaction association information of the corresponding asset into the B+ tree according to the asset ID to obtain the transaction association tree; The asset ID is a globally unique and traceable identifier for each asset. The asset ID uses a structured encoding format, and its data structure is represented as: [chain ID][asset type][timestamp][serial number]; The prefix code is extracted from the prefix field of the asset ID. The prefix field of the asset ID is: [chain ID][asset type]; For example: Asset ID: A_TK_20250523100000_00100, prefix field: A_TK; Asset ID: A_CRT_2025052310000_00100, prefix field: A_CRT; Asset ID: B_CRT_2025052310000_00100, prefix field: B_CRT; All assets starting with A will be indexed in the same B+ tree. Assets with A_TK will be indexed in a subtree starting with TK under the B+ tree starting with A. Assets with A_CRT will be indexed in a subtree starting with CRT under the B+ tree starting with A. Assets with B_CRT will be indexed in another B+ tree starting with B.

[0021] At the leaf node level of the B+ tree, each node connects to the previous and next nodes via chain pointers, forming an ordered linked list. Asset IDs are sorted in ascending or descending order within this linked list. This design supports efficient range queries because once the starting point is found, subsequent elements can be accessed linearly without repeatedly backtracking to the parent node. For example, A_TK_0001, A_TK_0002, A_TK_0003, ..., A_TK_0100 are arranged in this order in the leaf nodes of the B+ tree and connected by link pointers: A_TK_0001 → A_TK_0002 → A_TK_0003 → ... → A_TK_0100 When the user performs a range query such as A_TK_0050<= ID<= A_TK_0080, it only needs to locate the first node that is greater than or equal to A_TK_0050; read sequentially along the chain pointer until A_TK_0081 is encountered, avoiding multiple tree traversals.

[0022] Among them, when a new cross-chain transaction occurs, the asset ID of the new asset is obtained; According to the asset ID of the new asset, the transaction association information is stored in the corresponding B+ tree.

[0023] Based on historical transaction correlation information, determine the block where the target asset traceability query involves transactions. Specifically: Based on historical transaction correlation information, determine the blockchain where the transaction to be queried is located; like Figure 2 As shown in the figure, based on the Merkle tree of the exchange to be queried on the blockchain, each subtree is queried through the binary representation path until the block where the exchange to be queried is located is found. Specifically: A unique binary path is stored for each transaction in the block. The storage path of the transaction in the block is recorded by encoding the search path from the root node of the Merkle tree to a specific leaf node as a binary string (0 represents the left child node, 1 represents the right child node). For example, if the target transaction hash is in the left child node, the binary path string Path is "0", and if the target transaction hash is in the right child node, the binary path string Path is "1". The target transaction is stored in the form of a Merkle tree. Assuming that a block stores data for four transactions, the binary paths of transactions 1, 2, 3, and 4 are 00, 01, 10, and 11, respectively. The binary representation path includes: Get the path string of all transactions involved in the traceability query request; For transactions with similar paths, differential encoding is used to store the differences between similar paths, forming a binary representation of similar paths, reducing redundant information; The path difference is calculated as follows: ; Indicates the difference between the current path and the previous path; A binary path string representing the current path, A binary path string representing the previous path; Represents calculating the bit difference between two path strings; The path length is calculated using the following formula: ; Indicates transaction i The corresponding path length, represents any symbol, Indicates the total number of transactions that need to be queried in the block; Starting from the root node of the Merkle tree, search downwards along the binary representation path of the transaction to be queried, traversing the binary string from the last digit forward; If the current character bit is "0", continue searching in the left subtree of the current node; if the current character bit is "1", continue searching in the right subtree of the current node until the target child node is found; Verify whether the hash value of the transaction stored in the target child node matches the hash value of the transaction involved in the traceability query request. If so, the correct transaction has been queried.

[0024] After determining the block where the target asset traceability query involves transactions based on historical transaction association information, the cache information needs to be updated. Specifically: The cache information is represented as: ; Represents assets i Cache information, Represents stored assets i Historical transaction data, Indicates the last asset recorded i The corresponding blockchain height when the cache information is updated, Represents a record asset i The timestamp of the last update of the cached information; If the cache information is empty, search for transaction data corresponding to all historical transaction records related to the target asset, and store the transaction data found, the highest blockchain height reached, and the timestamp as cache information; If the cache information is not empty, the actual transaction data and blockchain height stored in the block of the exchange to be queried are obtained, and the current cache information is merged with the newly obtained actual transaction data and blockchain height.

[0025] Example 2 A blockchain transaction traceability query device, comprising: A judgment module is used to determine the cached information of the transaction involved in the traceability query request based on the user's traceability query request for the target asset; A processing module, configured to determine historical transaction association information of the target asset in a pre-built transaction association tree if no cached information is available; The query module is used to determine the block where the target asset traceability query involves transactions based on historical transaction association information.

[0026] In order to verify the superiority of the present invention, the following prior art was used for comparative experiments: Tracer: Tracer designs a tracing model for blockchain transactions based on accounts. This model models blockchain transaction records as a transaction graph and blockchain transaction tracking as a graph search task, improving the efficiency of blockchain transaction tracing. TRCT: TRAC aims to maintain anonymity while enabling public verification of transaction traceability. Users cannot forge relevant proofs to evade traceability, thus ensuring the security of transaction traceability. However, this model does not consider the relationship between transactions, resulting in a high transaction traceability time overhead. MFGSCOPE: MFGSCOPE uses fund flow graphs to analyze transaction behaviors and detect malicious activity to track and trace fund flows, enabling fast transaction queries with low resource overhead.

[0027] Test indicators include: Query latency represents the average query time overhead of a single transaction, let T Indicates query response time: ; Indicates the i The time required for the query, Indicates the total number of queries. Indicates the i The number of transactions queried; The additional storage overhead represents the impact of transaction query improvement on storage efficiency. O Indicates additional storage overhead: ; represents the storage requirements of the original system, Indicates the storage requirements of the improved system; Throughput refers to the maximum number of query requests that the system can process in a unit of time. H Indicates throughput: ; Indicates time The number of query requests successfully processed within a period; The error rate is the ratio of the number of error queries to the total number of queries, which is used to measure the accuracy of historical transaction query results. R Indicates the error rate: ; represents the number of error queries, and Z represents the total number of queries.

[0028] like Figure 3 and Figure 4 As shown in the figure, when the number of blockchains is 20, 40, 60, 80, and 100, the average query time and throughput per transaction show good stability and do not change significantly with the increase in the number of blockchains. The method proposed in this example is based on a prefix-coded B+ tree. Assets are classified according to the prefix code of the asset ID to form a transaction association tree. This enables the system to quickly locate the blockchain and block where the historical transactions of a specific asset are located, reducing unnecessary query operations, shortening query time, and improving the throughput of query requests. Since the blockchain where the target transaction is located can be determined in a short time, parallel queries can be initiated on multiple blockchains at the same time, thereby significantly shortening the total query time. As the number of blockchains grows, the scale of the graph in TRCT will also expand, resulting in increased query time. In addition, due to the pseudo-anonymity of blockchains, Tracer relies on transaction records to infer the relationship between accounts. This indirect approach may result in additional time overhead, especially when there is insufficient related information, making it difficult to accurately identify the entity behind it, which increases unnecessary computational complexity. Although TRCT aims to maintain user anonymity while achieving public verification of transaction traceability, in order to prevent users from forging relevant proofs to evade traceability, the scheme introduces complex encryption mechanisms. These measures usually bring about a large computational and storage burden, which in turn affects query efficiency and the overall throughput of the system. Although MFGSCOPE can achieve fast transaction queries with low resource overhead, it fails to effectively identify the relationship between transactions when faced with extremely large amounts of transaction data, making it impossible to achieve fast block positioning when querying a series of related transactions, reducing query efficiency. In summary, the method proposed in this embodiment can achieve the lowest transaction query time and the highest transaction query request throughput.

[0029] like Figure 5As shown, it should be noted that the vertical axis le-2 in the figure represents the scientific notation When the malicious node ratio is 0.1, 0.2, 0.3, and 0.4, respectively, the method proposed in this embodiment and TRAC can maintain a low error rate. The method proposed in this embodiment verifies the query results through transaction association, further improving the consistency and integrity of the query results. TRAC relies on complex cryptographic techniques to improve the security and anonymity of transaction tracking. These technologies can not only protect the transaction traceability results from tampering, but also verify the authenticity of the transaction query results, thereby reducing the error rate. Tracer tracks and traces blockchain transactions based on accounts, processing queries by constructing a transaction graph. This approach, which relies on account relationships, can be problematic in the presence of malicious nodes, as they can mislead query results by creating false account relationships or tampering with transaction records. A single error in one node can invalidate the entire query path. MFGSCOPE enables rapid transaction queries by analyzing the fund flow graph. However, in an environment with a high proportion of malicious nodes, if malicious nodes can control part of the fund flow path and deliberately create confusion, fund flow graph-based analysis can produce misleading conclusions, leading to incomplete verification and a high query error rate.

[0030] like Figure 6 As shown in the figure, when the number of blockchains is 20, 40, 60, 80, and 100, respectively, the method proposed in this embodiment has the lowest additional storage overhead. The transaction association tree of the method proposed in this embodiment only stores information with low storage overhead, such as the hash value of the transaction, the hash value of the block in which it is located, and the blockchain ID, thereby achieving low additional storage overhead. The Tracer method models blockchain transaction records as a transaction graph and uses graph search technology to trace their provenance. While this method improves tracing efficiency, the graph size rapidly expands as the number of transactions grows, leading to increased storage requirements. Furthermore, the need to maintain a large number of nodes and edges to represent relationships between accounts can lead to high storage overhead. TRCT emphasizes providing public verification of transaction traceability while maintaining user anonymity. Although it improves security, to achieve this, the model introduces a complex zero-knowledge proof mechanism, which typically imposes a significant computational and storage burden. MFGSCOPE uses a fund flow graph to analyze transaction behavior and implement fast transaction queries with low resource overhead. Despite its fast query speed, this method requires a large amount of additional storage space to store transaction information to support its efficient query capabilities.

[0031] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage CD-ROMs, optical storage, etc.) containing computer-usable program code.

[0032] The present application is described with reference to the flowcharts of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 a process or multiple processes or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0033] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A function specified in a process or multiple processes.

[0034] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 The steps of a specified function in a process or multiple processes.

[0035] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which are all protected by the present invention.

Claims

1. A blockchain transaction traceability query method, characterized in that: include: Based on the user's traceability query request for the target asset, determine the cached information of the transaction involved in the traceability query request; If there is no cached information, the historical transaction association information of the target asset is determined in the pre-built transaction association tree; Based on historical transaction association information, determine the block where the target asset traceability query involves the transaction.

2. The blockchain transaction traceability query method according to claim 1 is characterized in that: The transaction-related information includes: The transaction chain association is expressed as: ; Represents assets i In the blockchain n The collection of intra-chain transaction associations; Represents assets i No. j Transactions on the blockchain n In the block, Representation and Assets i No. j The transaction is associated with Transactions on the blockchain n The block in which ? Represents assets i In the blockchain n The number of historical transactions within the period; Among them, the data structure associated with the transaction chain is expressed as: ; Indicates the hash value of the block in which the transaction is made. Indicates the association within the predecessor chain, Indicates the association within the successor chain, Indicates the timestamp of the creation of the chain association, Represents the verification signature set of the verification node in the chain, Indicates binary representation path; Transaction cross-chain association is expressed as: ; Represents assets i The cross-chain associated set of transactions; Represents assets i A cross-chain transaction The source of blockchain, Represents assets i A cross-chain transaction The target blockchain; Represents assets i The number of cross-chain transactions; The data structure of cross-chain transaction association is represented as follows: ; Indicates the blockchain ID, Indicates the predecessor cross-chain association, Indicates subsequent cross-chain association, Indicates the timestamp of the cross-chain association creation, Represents the verification signature set of the relay chain node, Indicates an intra-chain association.

3. The blockchain transaction traceability query method according to claim 1 is characterized in that: The method for constructing the pre-constructed transaction association tree includes: Get the asset ID of the asset corresponding to the cross-chain transaction; Based on the prefix coding B+ tree, assets are classified according to the prefix coding of the asset ID to form a transaction association tree.

4. The blockchain transaction traceability query method according to claim 3 is characterized in that: The prefix-coded B+ tree classifies assets according to the prefix codes of the asset IDs to form a transaction association tree, including: using the asset ID as a keyword, storing the transaction association information of the corresponding assets in the B+ tree according to the asset ID to obtain the transaction association tree; Among them, when a new cross-chain transaction occurs, the asset ID of the new asset is obtained; According to the asset ID of the new asset, the transaction association information is stored in the corresponding B+ tree.

5. The blockchain transaction traceability query method according to claim 1 is characterized in that: Based on historical transaction association information, the block where the target asset traceability query involves the transaction is determined, including: Determine the blockchain of the transaction to be queried based on historical transaction association information; Based on the Merkle tree of the blockchain of the exchange to be queried, each subtree is queried through the binary representation path until the block where the exchange to be queried is located is found.

6. The blockchain transaction traceability query method according to claim 5 is characterized in that: The Merkle tree based on the blockchain of the exchange to be queried is used to search each subtree through the binary representation path until the block where the exchange to be queried is located is found, including: Starting from the root node of the Merkle tree, search downwards along the binary representation path of the transaction to be queried, traversing the binary string from the last digit forward; If the current character position is "0", continue searching in the left subtree of the current node; If the current character bit is "1", continue searching in the right subtree of the current node; Until the target child node is found; Verify whether the hash value of the transaction stored in the target child node matches the hash value of the transaction involved in the traceability query request. If so, the correct transaction has been queried.

7. The blockchain transaction traceability query method according to claim 6 is characterized in that: The binary representation path includes: Get the path string of all transactions involved in the traceability query request; For transactions with similar paths, differential encoding is used to store the differences between similar paths, forming a binary representation path of the similar paths; The path difference is calculated as follows: ; Indicates the difference between the current path and the previous path; A binary path string representing the current path, A binary path string representing the previous path; Represents calculating the bit difference between two path strings; The path length is calculated using the following formula: ; Indicates transaction i The corresponding path length, represents any symbol, Indicates the total number of transactions that need to be queried in the block.

8. The blockchain transaction traceability query method according to claim 5 is characterized in that: After determining the block where the target asset traceability query involves transactions based on historical transaction association information, the cache information needs to be updated, including: The cache information is represented as: ; Represents assets i Cache information, Represents stored assets i Historical transaction data, Indicates the last asset recorded i The corresponding blockchain height when the cache information is updated, Represents a record asset i The timestamp of the last update of the cached information; If the cache information is empty, search for transaction data corresponding to all historical transaction records related to the target asset, and store the transaction data found, the highest blockchain height reached, and the timestamp as cache information; If the cache information is not empty, the actual transaction data and blockchain height stored in the block of the exchange to be queried are obtained, and the current cache information is merged with the newly obtained actual transaction data and blockchain height.

9. The blockchain transaction traceability query method according to claim 1 is characterized in that: If cached information exists, the result of the last historical transaction traceability query of the target asset, the blockchain where the latest transaction is located, and the block height are output based on the cached information.

10. A blockchain transaction traceability query device, characterized in that: include: A judgment module is used to determine the cached information of the transaction involved in the traceability query request based on the user's traceability query request for the target asset; A processing module, configured to determine historical transaction association information of the target asset in a pre-built transaction association tree if no cached information is available; The query module is used to determine the block where the target asset traceability query involves transactions based on historical transaction association information.