Cross-chain transaction association method and apparatus, and computer device

By obtaining and encoding related transaction logs between different blockchains, the automated correlation of cross-blockchain transactions is achieved, the problem of transaction correlation between blockchains is solved, and the efficiency of asset liquidity and information sharing is improved.

CN119558846APending Publication Date: 2025-03-04SUN YAT SEN UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411540071.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The lack of direct connection between transactions between different blockchains and difficulty in correlation, resulting in limitations in asset liquidity, information sharing and service interoperability.

Method used

By obtaining multiple event logs of the target transaction in the first blockchain, selecting cross-chain logs related to cross-chain operations, encoding them as search information, and searching related transactions of the target transaction in the second blockchain.

Benefits of technology

It realizes the automated association of cross-blockchain transactions, ensures the traceability and transparency of cross-chain transactions, and is suitable for a variety of DeFi cross-chain bridges, with high generalization and versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119558846A_ABST
    Figure CN119558846A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of block chains, in particular to a cross-chain transaction association method and device and computer equipment. The method comprises the steps of obtaining a plurality of first event logs of a target transaction in a first block chain; a first cross-chain log related to a cross-chain operation can be selected from the multiple first event logs; the first cross-chain log can be encoded into retrieval information; and retrieving an associated transaction of the target transaction in a plurality of candidate transactions of a second block chain according to the retrieval information. According to the embodiment of the invention, transactions on different block chains can be associated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of blockchain technology, and in particular to a method, device and computer equipment for associating cross-chain transactions. Background Art

[0002] As a distributed database technology, blockchain integrates important technologies such as peer-to-peer transmission, consensus mechanism, encryption algorithm, etc., and has now been widely infiltrated into many industries. With the development of blockchain technology, a multi-chain ecosystem has gradually formed, but the isolation between chains has become a significant obstacle to asset liquidity, information sharing and service interoperability. The emergence of cross-chain technology has effectively broken through the barriers between chains, promoted the smooth flow of assets and information, and alleviated the phenomenon of information islands. Cross-chain technology refers to connecting isomorphic or heterogeneous blockchain systems to achieve information exchange between blockchains.

[0003] Through cross-chain technology, different blockchains can conduct cross-chain transactions based on business needs. However, due to the spatial isolation between different blockchains, transactions on different blockchains are not directly connected.

[0004] Therefore, how to link transactions on different blockchains is a technical problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of this specification provide a cross-chain transaction association method, apparatus, and computer device for associating transactions on different blockchains.

[0006] The embodiment of this specification provides a method for associating cross-chain transactions, including:

[0007] Obtain multiple first event logs of the target transaction in the first blockchain;

[0008] Selecting a first cross-chain log related to the cross-chain operation from the multiple first event logs;

[0009] Encoding the first cross-chain log into retrieval information;

[0010] According to the search information, a transaction associated with the target transaction is searched from a plurality of candidate transactions in the second blockchain.

[0011] The embodiment of this specification also provides a cross-chain transaction association device, including:

[0012] An acquisition unit, configured to acquire a plurality of first event logs of a target transaction in a first blockchain;

[0013] A selection unit, configured to select a first cross-chain log related to the cross-chain operation from the plurality of first event logs;

[0014] An encoding unit, configured to encode the first cross-chain log into retrieval information;

[0015] The retrieval unit is used to retrieve the associated transaction of the target transaction from multiple candidate transactions in the second blockchain according to the retrieval information.

[0016] The embodiments of this specification also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned cross-chain transaction association method when executing the computer program.

[0017] The embodiments of this specification also provide a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned cross-chain transaction association method is implemented.

[0018] The embodiments of this specification also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the above-mentioned cross-chain transaction association method.

[0019] The technical solution of the embodiment of this specification can obtain multiple first event logs of the target transaction in the first blockchain; the first cross-chain log related to the cross-chain operation can be selected from the multiple first event logs; the first cross-chain log can be encoded as retrieval information; and the related transactions of the target transaction can be retrieved from multiple candidate transactions in the second blockchain according to the retrieval information. As a result, the embodiment of this specification can effectively match the target transaction on the first blockchain and the related transactions on the second blockchain, realize the automatic association of cross-chain transactions, and provide assistance for tasks such as transaction tracking in cross-chain scenarios, so as to ensure the traceability and transparency of cross-chain transactions. The technical solution of the embodiment of this specification realizes the association of cross-chain transactions by encoding cross-chain logs, and can be applied to a variety of DeFi cross-chain bridges, with good generalization and strong versatility. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0021] Figure 1 This is a flowchart of the cross-chain transaction association method in the embodiment of this specification;

[0022] Figure 2 This is a schematic diagram of the cross-chain transaction association process in the embodiments of this specification;

[0023] Figure 3 This is a schematic diagram of the architecture of the cross-chain transaction association method in the embodiments of this specification;

[0024] Figure 4 This is a schematic diagram of the structure of the cross-chain transaction association device in the embodiment of this specification. DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, rather than all of the embodiments. The specific embodiments described herein are only used to explain the present disclosure, rather than to limit the present disclosure. Based on the described embodiments of the present disclosure, all other embodiments obtained by those of ordinary skill in the art are within the scope of protection of the present disclosure. In addition, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0026] Blockchain technology is a distributed ledger technology that ensures that data cannot be tampered with or forged through encryption algorithms and consensus mechanisms, and uses a decentralized approach to store blocks of transactions or information. Each block contains the hash value of the previous block, forming a chain structure that ensures data integrity and traceability.

[0027] Cross-chain technology refers to connecting homogeneous or heterogeneous blockchain systems to achieve information exchange between blockchains. Through cross-chain technology, cross-chain transactions can be carried out between different blockchains based on business needs. A cross-chain transaction is a blockchain transaction involving the transfer of assets or information between different blockchains. A cross-chain transaction can include transactions on multiple different blockchains. For example, a cross-chain transaction can include a deposit transaction on the source chain and a withdrawal transaction on the target chain.

[0028] Cross-chain technology can be implemented based on cross-chain bridges. Cross-chain bridges are a technical architecture that enables the interaction of assets and information between different blockchains. By establishing communication protocols and trust verification mechanisms between multiple blockchains, cross-chain bridges enable users to initiate transactions on one chain (which can be called the source chain) and affect the status of another chain (which can be called the target chain), thereby promoting the circulation and interoperability of value and data between different blockchains. Cross-chain bridges can include centralized cross-chain bridges (CeFi bridges) and decentralized cross-chain bridges (DeFi bridges). Centralized cross-chain bridges are a technical architecture based on trust institutions, and the digital assets and transaction information involved are hosted by centralized entities. In centralized cross-chain bridges, centralized entities maintain internal ledger systems to record the cross-chain asset transfer process. Decentralized cross-chain bridges are a technical architecture based on trust codes, and the digital assets and transaction information involved are stored in the blockchain, without the need for hosting by centralized entities. The execution of cross-chain transactions is automatically implemented by smart contracts, and important information related to cross-chain asset transfers is recorded in the transaction event log.

[0029] Cross-chain transactions involve different blockchains. Due to the spatial isolation between different blockchains, transactions on different blockchains are not directly connected. It is difficult to directly associate transactions on different blockchains based on transaction event logs. For example, the transaction event log of a deposit transaction on a certain blockchain may contain the sender address and the receiver address, but because there are many transactions involving the receiver address on another blockchain, it is difficult to directly locate the corresponding withdrawal transaction on another blockchain based on the receiver address in the transaction event. Therefore, it is necessary to use a cross-chain transaction association method to associate transactions on different blockchains. For example, the source chain deposit transaction and the target chain withdrawal transaction that are separated from each other in physical space are associated. Cross-chain transaction association can ensure the traceability and transparency of transactions between chains, and help track and combat illegal transactions between chains.

[0030] In the related art, the cross-chain transaction association method based on the centralized cross-chain bridge is only for the centralized financial cross-chain bridge service, and is highly dependent on the internal application programming interface of the centralized platform. This type of method is difficult to widely support the transaction association of multiple cross-chain bridges, for example, it is difficult to support various cross-chain transaction associations based on decentralized cross-chain bridges. The cross-chain transaction association method based on the decentralized cross-chain bridge relies on expert rules, and different expert rules need to be designed for different cross-chain bridges in advance. On the one hand, the cross-chain transactions executed by different cross-chain bridges have different characteristics. For example, the cross-chain transactions executed by different cross-chain bridges have different naming methods for the corresponding recipient addresses in the transaction event logs. The expert rules designed for a certain cross-chain bridge are often only applicable to the cross-chain bridge and are difficult to apply to other cross-chain bridges. Therefore, the above-mentioned association method relying on expert rules lacks generalization. On the other hand, designing expert rules requires high labor costs, and it is difficult to effectively solve the cross-chain transaction associations that lack expert rules.

[0031] To solve at least one of the above technical problems or similar technical problems, the embodiments of this specification provide a method, apparatus and computer device for associating cross-chain transactions.

[0032] The following is an introduction to a cross-chain transaction system provided by an embodiment of this specification. The cross-chain transaction system can be implemented based on a decentralized cross-chain bridge. The cross-chain transaction system may include a terminal device, a first blockchain network, a second blockchain network, and a relay device. The terminal device is a user-oriented device, including but not limited to a smart phone, a desktop computer, a laptop computer, a server, etc. The first blockchain network may be formed by a plurality of node devices through a consensus mechanism. The second blockchain network may be formed by a plurality of node devices through a consensus mechanism. The relay device may deploy smart contracts on the first blockchain network and the second blockchain network, respectively, to realize information exchange between the first blockchain network and the second blockchain network.

[0033] The first blockchain network may be a source chain, and the second blockchain network may be a target chain. The execution process of the cross-chain transaction may include: depositing virtual resources in the source chain, communicating with the relay device, and extracting virtual resources from the target chain. The terminal device may send deposit transaction data to the node device of the source chain according to the user operation. The node device of the source chain may execute a deposit transaction through a smart contract based on the deposit transaction data to lock the virtual resources (such as assets) sent by the user; and may broadcast a virtual resource locking event. The relay device may monitor the virtual resource locking event of the source chain; after monitoring the virtual resource locking event, the deposit transaction may be confirmed based on the virtual resource locking event; after confirming that the deposit transaction is valid in the source chain, the withdrawal transaction data may be sent to the node device of the target chain based on the virtual resource locking event. The node device of the target chain may execute a withdrawal transaction through a smart contract based on the withdrawal transaction data to extract the virtual resources to the address on the target chain specified by the user.

[0034] The source chain and the target chain are spatially isolated, so that the deposit transaction of the source chain has no direct connection with the withdrawal transaction of the target chain. The inventors consider that the node device of the source chain will generate one or more event logs when executing a deposit transaction, and the node device of the target chain will also generate one or more event logs when executing a withdrawal transaction. The event log can reflect the message transmission during the execution of the cross-chain transaction. The source chain deposit transaction and the target chain withdrawal transaction can be effectively associated through the event log.

[0035] The following describes a cross-chain transaction association method provided by an embodiment of this specification. The cross-chain transaction association method can be applied to an association device. The association device may include a server. The server may be a single server or a distributed server cluster formed by multiple servers. Figure 1 and Figure 2 The association method comprises the following steps.

[0036] Step 11: Obtain multiple first event logs of the target transaction in the first blockchain.

[0037] In some embodiments, the first blockchain is a blockchain corresponding to the first blockchain network. The first blockchain may be a source chain. The target transaction may be a cross-chain transaction to be associated on the first blockchain. The target transaction may include a deposit transaction, etc. The first event log is a transaction event log of the target transaction in the first blockchain. The transaction event log may be a permanent record of the details of each transaction recorded on the blockchain. For example, the transaction event log includes, but is not limited to: the timestamp of the transaction, the sender address of the transaction, the receiver address of the transaction, the amount of the transaction, and possible incidental information or the result of the execution of the smart contract. The multiple first event logs may include all transaction event logs of the target transaction. Alternatively, the multiple first event logs may also include partial transaction event logs of the target transaction.

[0038] In some embodiments, the associated device may obtain identification information of the target transaction; and may query multiple first event logs of the target transaction based on the identification information. The identification information is used to identify the transaction on the blockchain. For example, the identification information may include a hash value of the transaction, etc. The associated device may obtain the identification information of the target transaction input by the user. Alternatively, the associated device may also receive the identification information of the target transaction sent by the terminal device. The terminal device is a user-oriented device, including but not limited to a smart phone, a desktop computer, a laptop computer, a server, etc. For example, the terminal device may provide an association interface for cross-chain transactions. The user may enter the identification information of the target transaction in the association interface. The terminal device may obtain the identification information input by the user, and may send an association request carrying the identification information to the associated device. The associated device may receive the association request; and may query multiple first event logs corresponding to the identification information based on the data access interface provided by the first blockchain. For example, the associated device may query JSON format data based on the identification information; and may parse multiple first event logs from the JSON format data.

[0039] Step 12: Select a first cross-chain log related to the cross-chain operation from the multiple first event logs.

[0040] In some embodiments, the target transaction may have multiple first event logs. Some of the multiple first event logs are related to cross-chain operations, and the other part is not related to cross-chain operations. For this reason, the first event log related to the cross-chain operation can be selected from the multiple first event logs as the first cross-chain log. The first cross-chain log records information related to the cross-chain operation. The number of the first cross-chain logs is one or more.

[0041] In some embodiments, a log representation sequence of multiple first event logs may be obtained; the log representation sequence may be processed using an attention mechanism; the cross-chain scores of the multiple first event logs may be obtained based on the processed log representation sequence; and the first cross-chain log related to the cross-chain operation may be selected from the multiple first event logs based on the cross-chain score.

[0042] The first event log may be encoded to obtain an embedded representation of the first event log. A log representation sequence may be constructed based on the embedded representations of the multiple first event logs. The log representation sequence includes the embedded representations of the multiple first event logs. The log representation sequence may be processed using a self-attention mechanism to fuse the multiple first event logs. The processed log representation sequence includes the processed embedded representations of the multiple first event logs. The processed embedded representation of each first event log fuses the information of one or more other first event logs. The cross-chain scores of the multiple first event logs may be determined based on the processed log representation sequence. The cross-chain score is used to indicate the degree to which the transaction event log is related to the cross-chain operation. The larger the cross-chain score, the higher the degree to which the transaction event log is related to the cross-chain operation. A set number of first cross-chain logs with the highest cross-chain score may be selected from the multiple first event logs. The set number may be 1. Alternatively, the set number may also be a natural number greater than 1.

[0043] See also Figure 2 . The above process of selecting the first cross-chain log from the multiple first event logs can also be implemented through a cross-chain event log positioning network. The cross-chain event log positioning network can locate the first cross-chain log related to the cross-chain operation in the multiple first event logs of the target transaction. The cross-chain event log positioning network may include an encoding layer, an attention layer, and a prediction layer. The encoding layer is used to encode the first event log. For example, the first event log can be input into the encoding layer to obtain an embedded representation of the first event log. The attention layer is used to fuse the multiple first event logs using a self-attention mechanism. For example, a log representation sequence can be constructed based on the embedded representation of the multiple first event logs. The log representation sequence can be input into the attention layer to obtain a processed log representation sequence. The prediction layer is used to predict the degree to which the first event log is related to the cross-chain operation. For example, the processed log representation sequence can be input into the prediction layer to obtain the cross-chain score of the multiple first event logs.

[0044] The following is a specific scenario example.

[0045] The number of the plurality of first event logs is m. i represents the i-th first event log among the m first event logs, 1≤i≤m. EL can be constructed i The corresponding character sequence x i .x i =[[CLS];s i ; [ESP]]. Among them, [CLS] and [ESP] represent character sequence separation marks. i Indicates EL iA sequence formed by the contents (such as characters) in .

[0046] The encoder may include a pre-trained model. The pre-trained model may include CodeBert, GraphCodeBert, etc. i Input the encoder to get the embedding representation e of the i-th first event log i . Among them, d model represents the hidden dimension of the encoder, θ enc represents the pre-trained parameters of the encoder. The log representation sequence of the m first event logs can be represented as E. E = {e1, e2, ..., e m}.

[0047] The self-attention mechanism can be used to process the log representation sequence E to obtain the processed log representation sequence The self-attention mechanism can be expressed as in, represents the attention query matrix, represents the key matrix, represents the value matrix, D f Denotes the dimension of the embedding representation after processing the first event log.

[0048] The prediction layer may include an MLP (Multilayer Perceptron) layer and a Softmax layer. The processed log representation sequence Perform vector concatenation operation to obtain You can Input MLP layer to convert Map to a specified dimensional (eg, m-dimensional) space, and use a Softmax layer to obtain the cross-chain scores of the multiple first event logs. Among them, θ mlp represents the model parameters of the MLP layer, z i Represents the cross-chain score of the i-th first event log. 1≤i≤m.

[0049] Step 13: Encode the first cross-chain log into retrieval information.

[0050] In some embodiments, a first cross-chain log related to the cross-chain operation is selected from multiple first event logs of the target transaction, and the first cross-chain log is encoded as retrieval information. This can eliminate the interference of transaction event logs that are not related to the cross-chain operation. The retrieval information can accurately express the retrieval requirements, so that the associated transactions of the target transaction can be accurately retrieved.

[0051] In some embodiments, the first cross-chain log may include information such as event identifiers, parameter lists, and parameter values ​​for recording the transaction process. The first cross-chain log may include multiple key-value pairs. Each of the key-value pairs (also referred to as parameters) may include corresponding key data (also referred to as parameter names) and value data (also referred to as parameter values). The key representation sequence of the key data in the multiple key-value pairs may be obtained; the value representation sequence of the value data in the multiple key-value pairs may be obtained; the key representation sequence and the value representation sequence may be processed using an attention mechanism to obtain the retrieval information (query).

[0052] The key data may be encoded to obtain an embedded representation of the key data. A key representation sequence may be constructed based on the embedded representations of the key data in the multiple key-value pairs. The key representation sequence includes the embedded representations of the key data in the multiple key-value pairs. The value data may be encoded to obtain an embedded representation of the value data. A value representation sequence may be constructed based on the embedded representations of the value data in the multiple key-value pairs. The value representation sequence includes the embedded representations of the value data in the multiple key-value pairs. The key representation sequence and the value representation sequence may be spliced ​​to obtain a key-value pair representation sequence. For example, the embedded representation of each key data may be obtained from the key representation sequence, the embedded representation of the corresponding value data may be obtained from the value representation sequence, and the embedded representation of the key data may be spliced ​​with the embedded representation of the value data to obtain the embedded representation of the corresponding key-value pair. A key-value pair representation sequence may be constructed based on the embedded representations of the multiple key-value pairs. The key-value pair representation sequence includes the embedded representations of the multiple key-value pairs. The embedded representation of each key-value pair includes the embedded representation of the key data in the key-value pair and the embedded representation of the value data in the key-value pair. The key-value pair representation sequence can be processed using a multi-head attention mechanism to fuse the multiple key-value pairs to obtain retrieval information. The retrieval information may include a feature vector, etc. The retrieval information is used to represent the features of the target transaction.

[0053] See also Figure 2. The above-mentioned process of encoding the first cross-chain log into retrieval information can also be implemented by a cross-chain encoding network. The cross-chain encoding network may include a key encoder, a value encoder, and a key-value fusion layer. The key encoder is used to encode key data. For example, the key data can be input into the key encoder to obtain an embedded representation of the key data. The value encoder is used to encode the value data. For example, the value data can be input into the value encoder to obtain an embedded representation of the value data. The key-value fusion layer is used to fuse the multiple key-value pairs using a multi-head attention mechanism. The key-value fusion layer may include a Transformer model, etc. For example, a key representation sequence can be constructed based on the embedded representation of the key data in the multiple key-value pairs. A value representation sequence can be constructed based on the embedded representation of the value data in the multiple key-value pairs. The key representation sequence and the value representation sequence can be spliced ​​to obtain a key-value pair representation sequence. The key-value pair representation sequence can be input into the key-value fusion layer to obtain the retrieval information.

[0054] The following is a specific scenario example.

[0055] The first cross-chain log may include n key-value pairs. The data types of the n key-value pairs may include address types, numerical types, character types, etc. The key data in the n key-value pairs may form a key data sequence K={k1, k2, ..., k n The value data in the n key-value pairs can form a value data sequence V = {v1, v2, ..., v n}.

[0056] The key encoder may include a pre-trained model. The pre-trained model may include CodeBert, GraphCodeBert, etc. The data type of the key data may be a character type. The key data sequence K may be input into the key encoder to obtain a key representation sequence in, D kIndicates the dimension size. 1≤i≤n. The data type of the value data may include address type, numerical type, character type, and the like. For each value data in the value data sequence, the data type of the value data may be identified; if the data type of the value data is an address type, the length of the value data may be normalized by an encryption algorithm such as SHA-256, and the normalized value data may be converted into a numerical vector to obtain an embedded representation of the value data with a fixed length; if the data type of the value data is a numerical type, an alignment operation such as zero padding may be performed to obtain an embedded representation of the value data with a fixed length; if the data type of the value data is a character type, the value data may be input into a value encoder to obtain an embedded representation of the value data with a fixed length. The value encoder may include a pre-trained model. The pre-trained model may include CodeBert, GraphCodeBert, and the like. In this way, different encoding strategies may be adopted for encoding according to the data type of the value data. A value representation sequence may be constructed according to the embedded representations of each value data in the value data sequence. in, D v Indicates the dimension size, 1≤i≤n.

[0057] Different regular expressions can be constructed as recognition templates for different data types. The value data can be matched with the recognition templates in the template set; the data type corresponding to the matched recognition template can be used as the data type of the value data. The template set can include multiple recognition templates, each of which can correspond to a data type.

[0058] The key can be represented as a sequence K and the value can be represented as a sequence Splice to get the key-value pair representation sequence in, i∈[1,n].

[0059] The key-value pair representation sequence KV can be input into the key-value fusion layer to obtain the retrieval information q. The key-value fusion layer may include a multi-head attention layer, a linear transformation layer and a pooling layer. The multi-head attention layer may include h attention heads. Q s , K s and V s denote the attention query matrix, key matrix, and value matrix of the multi-head attention layer respectively. si , K si and V si denote the attention query matrix, key matrix, and value matrix of the i-th attention head, respectively. Atten i (Qsi ,K si ,V si ) represents the output of the i-th attention head among the h attention heads. By dividing The gradient vanishing problem caused by the dot product operation can be avoided. The outputs of the h attention heads can be concatenated, and the concatenated result can be input into the linear transformation layer to obtain the output of the linear transformation layer. and Represents the parameters of the linear transformation layer, and Concat represents the column-by-column concatenation operation. The output of the linear transformation layer MultiHead(Q s ,K s ,V s ) can be expressed as O s =[o s1 ,o s2 ,…,o sn ]. The output O of the linear transformation layer can be s Input the pooling layer to obtain the feature vector q as the retrieval information. The pooling layer can be used to transform the output of the linear transformation layer s Perform average pooling to get

[0060] Step 14: According to the search information, retrieve associated transactions of the target transaction from multiple candidate transactions in the second blockchain.

[0061] In some embodiments, the second blockchain is a blockchain corresponding to the second blockchain network. The second blockchain may be a target blockchain. The candidate transaction may be a cross-chain transaction on the second blockchain to be associated with the target transaction. The candidate transaction may include a withdrawal transaction, etc. Multiple transactions may be obtained from the second blockchain as candidate transactions.

[0062] In some embodiments, all transactions in the second blockchain may be obtained as candidate transactions.

[0063] Alternatively, the transaction time of the target transaction in the first blockchain can be obtained; the time interval can be determined based on the transaction time of the target transaction; and the transactions whose transaction time in the second blockchain is within the time interval can be obtained as candidate transactions. This can reduce the number of candidate transactions, thereby reducing the search scope of associated transactions and improving the efficiency of cross-chain transaction association.

[0064] The transaction time of the target transaction can be queried according to the identification information of the target transaction. For example, the transaction timestamp corresponding to the identification information can be queried according to the data access interface provided by the first blockchain. The transaction timestamp indicates the transaction time. Specifically, for example, JSON format data can be queried according to the identification information; the transaction time can be parsed from the JSON format data.

[0065] The transaction time may be subtracted from the first set time to obtain the start time. The transaction time may be added to the second set time to obtain the end time. The time interval may be an interval formed by the start time and the end time. The first set time and the second set time may be determined based on the time difference between the target transaction and its associated transaction. The first set time and the second set time may be empirical values. For example, the first set time may be 0, 30 minutes, or 1 hour, etc. The second set time may be 0, 30 minutes, 45 minutes, or 1 hour, etc.

[0066] One or more transactions whose transaction time is within the time interval may be queried as candidate transactions. For example, identification information of candidate transactions whose transaction time is within the time interval may be queried according to the data access interface provided by the second blockchain. The identification information is used to identify transactions on the blockchain. For example, the identification information may include a hash value of the transaction, etc.

[0067] In some embodiments, for each candidate transaction in the plurality of candidate transactions, a plurality of second event logs of the candidate transaction in the second blockchain can be obtained, a second cross-chain log related to the cross-chain operation can be selected from the plurality of second event logs, and the second cross-chain log can be encoded to obtain feature information of the candidate transaction. Thus, the association score between the target transaction and the plurality of candidate transactions can be determined based on the retrieval information and the feature information; and the associated transaction of the target transaction can be selected from the plurality of candidate transactions based on the association score.

[0068] According to the data access interface provided by the second blockchain, multiple second event logs corresponding to the identification information of the candidate transaction can be queried. For example, JSON format data can be queried according to the identification information; multiple second event logs can be parsed from the JSON format data. The second event log is the transaction event log of the candidate transaction in the second blockchain. The multiple second event logs may include all transaction event logs of the candidate transaction, or may also include partial transaction event logs of the candidate transaction. Some of the multiple second event logs are related to cross-chain operations, and the other part is not related to cross-chain operations. For this purpose, the second event log related to the cross-chain operation can be selected from the multiple second event logs as the second cross-chain log. The second cross-chain log records information related to the cross-chain operation. The number of the second cross-chain logs is one or more.

[0069] A log representation sequence of the multiple second event logs can be obtained; the log representation sequence can be processed using an attention mechanism; the cross-chain scores of the multiple second event logs can be obtained based on the processed log representation sequence; and the second cross-chain log related to the cross-chain operation can be selected from the multiple second event logs based on the cross-chain score.

[0070] The second event log can be encoded to obtain an embedded representation of the second event log. A log representation sequence can be constructed based on the embedded representations of the multiple second event logs. The log representation sequence includes the embedded representations of the multiple second event logs. The log representation sequence can be processed using a self-attention mechanism to fuse the multiple second event logs. The processed log representation sequence includes the processed embedded representations of the multiple second event logs. The processed embedded representation of each second event log fuses the information of one or more other second event logs. The cross-chain scores of the multiple second event logs can be determined based on the processed log representation sequence. The cross-chain score is used to indicate the degree to which the transaction event log is related to the cross-chain operation. The higher the cross-chain score, the higher the degree to which the transaction event log is related to the cross-chain operation. A set number of second cross-chain logs with the highest cross-chain scores can be selected from the multiple second event logs.

[0071] The above process of selecting the second cross-chain log from multiple second event logs can also be implemented through the cross-chain event log positioning network. The specific process can be found in the process of selecting the first cross-chain log from multiple first event logs. I will not repeat it here.

[0072] The second cross-chain log related to the cross-chain operation is selected from multiple second event logs of the candidate transaction, and the second cross-chain log is encoded as feature information. This can eliminate the interference of transaction event logs that are not related to the cross-chain operation. The feature information can accurately represent the characteristics of the candidate transaction, which is conducive to accurately retrieving the associated transactions of the target transaction based on the feature information.

[0073] The second cross-chain log may include multiple key-value pairs. Each of the key-value pairs (also referred to as parameters) may include corresponding key data (also referred to as parameter name) and value data (also referred to as parameter value). The key representation sequence of the key data in the multiple key-value pairs may be obtained; the value representation sequence of the value data in the multiple key-value pairs may be obtained; and the key representation sequence and the value representation sequence may be processed using an attention mechanism to obtain the feature information.

[0074] The key data may be encoded to obtain an embedded representation of the key data. A key representation sequence may be constructed based on the embedded representations of the key data in the multiple key-value pairs. The key representation sequence includes the embedded representations of the key data in the multiple key-value pairs. The value data may be encoded to obtain an embedded representation of the value data. A value representation sequence may be constructed based on the embedded representations of the value data in the multiple key-value pairs. The value representation sequence includes the embedded representations of the value data in the multiple key-value pairs. The key representation sequence and the value representation sequence may be spliced ​​to obtain a key-value pair representation sequence. For example, the embedded representation of each key data may be obtained from the key representation sequence, the embedded representation of the corresponding value data may be obtained from the value representation sequence, and the embedded representation of the key data may be spliced ​​with the embedded representation of the value data to obtain the embedded representation of the key-value pair. A key-value pair representation sequence may be constructed based on the embedded representations of the multiple key-value pairs. The key-value pair representation sequence includes the embedded representations of the multiple key-value pairs. The embedded representation of each key-value pair includes the embedded representation of the key data in the key-value pair and the embedded representation of the value data in the key-value pair. The key-value pair representation sequence may be processed using a multi-head attention mechanism to fuse the multiple key-value pairs to obtain feature information. The feature information may include a feature vector, etc. The feature information is used to represent the features of the candidate transaction.

[0075] The above process of encoding the second cross-chain log into feature information can also be implemented through the cross-chain coding network. The specific process can be referred to the process of encoding the first cross-chain log into retrieval information. I will not repeat it here.

[0076] In some embodiments, for each of the multiple candidate transactions, a correlation score between the target transaction and the candidate transaction can be calculated based on the search information and the characteristic information of the candidate transaction. The correlation score is used to indicate the degree of correlation between the candidate transaction and the target transaction. The larger the correlation score, the higher the degree of correlation between the candidate transaction and the target transaction. One or more candidate transactions with the highest correlation scores can be selected from the multiple candidate transactions as associated transactions.

[0077] See also Figure 2 . The above process of selecting the associated transaction of the target transaction from multiple candidate transactions can also be implemented by a ranking learning network. Ranking learning (Learning-to-rank) is an information processing technology that optimizes the ranking process of information or document collections by integrating machine learning methods, aiming to improve the relevance of retrieval results and enhance user experience satisfaction. The ranking learning network is used to calculate the relevance ranking of multiple candidate transactions, and select the associated transaction of the target transaction from the multiple candidate transactions according to the ranking. The ranking learning network may include a Siamese Network (SN) layer, a normalization layer (Layer Normalization) and a feed-forward network (row-wise feed-forward, rFF) layer. The twin-tower neural network layer is used to fuse the retrieval information with the feature information. For example, the retrieval information and the feature information of the multiple candidate transactions can be input into the twin-tower neural network layer to obtain the associated embedding representation of the multiple candidate transactions. The normalization layer is used to normalize the associated embedding representation. For example, the associated embedding representation of the multiple candidate transactions can be input into the normalization layer to obtain the normalized associated embedding representation of the multiple candidate transactions. The feed-forward network layer is used to determine the association score between the target transaction and the candidate transaction. For example, the normalized association embedding representation of the multiple candidate transactions can be input into a feed-forward network layer to obtain the association scores between the target transaction and the multiple candidate transactions. The multiple candidate transactions can be sorted according to the association scores, and one or more candidate transactions with the highest association scores are selected as the associated transactions of the target transaction.

[0078] The following is a specific scenario example.

[0079] The plurality of candidate transactions may include {t1, t2, ..., t N} and other N candidate transactions. The characteristic information of the N candidate transactions can be expressed as {d1, d2, …, d N The search information q can be combined with the characteristic information {d1, d2, ..., d N} Input the double-tower neural network layer to obtain the associated embedding representation P of the N candidate transactions. P = {p1, p2, ..., pN}. p i Represents the associated embedding representation of the i-th candidate transaction. i∈[1,N]. Among them, f(·;θ sn ) represents the double-tower neural network layer, θ sn represents the network parameters, represents the fully connected layer in the double-tower neural network layer, is the parameter of the fully connected layer. The associated embedding representation P of the N candidate transactions can be input into the normalization layer to obtain the normalized associated embedding representation of the multiple candidate transactions. represents the normalized associated embedding representation of the i-th candidate transaction. Among them, μ i Represents vector p i The mean value, σ i 2 Represents vector p i The variance of , γ and β represent the scaling and translation parameters of the normalization layer, and ∈ is a constant used to prevent division by zero. Input the feedforward network layer to get the relevance score of the i-th candidate transaction i . Among them, W1 and W2 are weight matrices, b1 and b2 are bias terms, ReLU is the activation function of the hidden layer in the feedforward network layer, which is used to introduce nonlinearity, and Sigmoid is used to map the output to the (0,1) interval to represent the association score.

[0080] In some embodiments, the target transaction and its associated transactions may constitute a cross-chain transaction. The associated device may send the associated transaction to the terminal device. The terminal device may receive and display the associated transaction. For example, the associated device may send the identification information (e.g., hash value) of the associated transaction to the terminal device. The terminal device may receive and display the identification information of the associated transaction on the associated interface. Thus, the user may obtain the associated transaction of the target transaction by inputting the identification information of the target transaction on the terminal device.

[0081] The technical solution of the embodiment of this specification can obtain multiple first event logs of the target transaction in the first blockchain; can select the first cross-chain log related to the cross-chain operation from the multiple first event logs; can encode the first cross-chain log as retrieval information; can retrieve the associated transactions of the target transaction from multiple candidate transactions in the second blockchain according to the retrieval information. Therefore, the embodiment of this specification can effectively match the target transaction on the first blockchain with the associated transactions on the second blockchain, realize the automatic association of cross-chain transactions, and provide assistance for tasks such as transaction tracking in cross-chain scenarios, so as to ensure the traceability and transparency of cross-chain transactions.

[0082] The technical solution of the embodiment of this specification can solve the problem of realizing effective association between source chain deposit transactions and target chain withdrawal transactions in the DeFi cross-chain bridge application scenario. The technical solution of the embodiment of this specification provides a cross-chain transaction association framework based on the DeFi bridge. The framework designs a method for locating cross-chain key event logs, and designs an encoder based on key-value pairs, which realizes the effective association between source chain deposit transactions and target chain withdrawal transactions through a ranking learning-based method.

[0083] The technical solution of the embodiment of this specification is aimed at the DeFi cross-chain bridge, does not need to rely on centralized institutions, and can effectively realize efficient and automated cross-chain transaction association tasks in the DeFi cross-chain scenario, thereby realizing the association between the source chain deposit transaction and the target chain deposit transaction. Compared with the cross-chain transaction association method based on the centralized cross-chain bridge in the above-mentioned related technology, the technical solution of the embodiment of this specification is based on open and transparent blockchain transaction data, does not need to rely on a third-party centralized platform, and has strong versatility. Compared with the cross-chain transaction association method based on the decentralized cross-chain bridge in the above-mentioned related technology, the technical solution of the embodiment of this specification realizes the automation of cross-chain transaction association through key information encoding, effectively reduces labor costs, and improves the generalization of the method.

[0084] The cross-chain transaction association method of the embodiment of this specification is applied to specific scenarios, which can be referred to Figure 3 . Figure 3 The architecture of the cross-chain transaction association method is shown. The architecture may include a view layer, a business layer, an algorithm layer, and a data layer. The embodiment of this specification can obtain the JSON format data required for cross-chain transaction association based on the Web3 PRC service and the data interface access service provided by blockchain browsers such as Ethersacn and Bscscan. The JSON format data can be stored in a database such as MongoDB, and the database cache such as Redis can be used to provide the necessary data support for the algorithm layer. At the business layer, services can be built based on load balancing technologies such as Nginx and frameworks such as Django. At the view layer, services such as cross-chain transaction monitoring, cross-chain transaction query, and user cross-chain transaction statistics can be provided to users. The cross-chain transaction association method can be implemented at the algorithm layer.

[0085] See also Figure 4 The embodiment of this specification also provides a cross-chain transaction association device, including:

[0086] An acquisition unit 41 is used to acquire multiple first event logs of target transactions in a first blockchain;

[0087] A selection unit 42, configured to select a first cross-chain log related to the cross-chain operation from the plurality of first event logs;

[0088] An encoding unit 43, configured to encode the first cross-chain log into retrieval information;

[0089] The retrieval unit 44 is used to retrieve the associated transaction of the target transaction from multiple candidate transactions in the second blockchain according to the retrieval information.

[0090] The embodiments of this specification also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned cross-chain transaction association method when executing the computer program.

[0091] The embodiments of this specification also provide a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned cross-chain transaction association method is implemented.

[0092] The embodiments of this specification also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the above-mentioned cross-chain transaction association method.

[0093] Those skilled in the art will appreciate that this specification may be provided as a method, system, or computer program product. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification 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-ROM, optical storage, etc.) containing computer-usable program code.

[0094] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products of the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. The computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0095] The various functional units in the embodiments of this specification may be integrated into one processing unit, or each functional unit may exist physically separately, or two or more functional units may be integrated into one processing unit.

[0096] Those skilled in the art will understand that the description of each embodiment in this specification has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. In addition, it is understood that after reading this specification, those skilled in the art can think of any combination of some or all of the embodiments listed in this specification without creative work, and these combinations are also within the scope of disclosure and protection of this specification.

[0097] Although the present specification is described by way of examples, it is known to those skilled in the art that the above examples are only used to help understand the core idea of ​​the present specification. It is understood by those skilled in the art that there are many variations and changes in the present specification. It is hoped that the appended claims include these variations and changes without departing from the spirit of the present specification.

Claims

1. A cross-chain transaction association method, characterized in that: include: Obtain multiple first event logs of the target transaction in the first blockchain; Selecting a first cross-chain log related to the cross-chain operation from the multiple first event logs; Encoding the first cross-chain log into retrieval information; According to the search information, a transaction associated with the target transaction is searched from a plurality of candidate transactions in the second blockchain.

2. The method according to claim 1, characterized in that The selecting a first cross-chain log related to the cross-chain operation from the multiple first event logs includes: Obtaining a log representation sequence of the plurality of first event logs; Using an attention mechanism to process the log representation sequence; Obtaining cross-chain scores of the plurality of first event logs according to the processed log representation sequence; According to the cross-chain score, a first cross-chain log related to the cross-chain operation is selected from the multiple first event logs.

3. The method according to claim 1, characterized in that The first cross-chain log includes multiple key-value pairs; The encoding of the first cross-chain log into retrieval information includes: Obtain a key representation sequence of key data in the plurality of key-value pairs; Obtain a value representation sequence of the value data in the plurality of key-value pairs; The key representation sequence and the value representation sequence are processed using an attention mechanism to obtain the retrieval information.

4. The method according to claim 3, characterized in that The method of using the attention mechanism to process the key representation sequence and the value representation sequence includes: Concatenate the key representation sequence and the value representation sequence to obtain a key-value pair representation sequence of the plurality of key-value pairs; The key-value pair representation sequence is input into a converter implemented based on a multi-head attention mechanism to obtain the retrieval information.

5. The method according to claim 1, characterized in that The method further comprises: Determine a time interval according to the transaction time of the target transaction in the first blockchain; Transactions in the second blockchain whose transaction times are within the time interval are obtained as candidate transactions.

6. The method according to claim 1, characterized in that The step of retrieving an associated transaction of the target transaction from a plurality of candidate transactions on the second blockchain includes: Obtain multiple second event logs of the candidate transaction in the second blockchain; Selecting a second cross-chain log related to the cross-chain operation from the multiple second event logs; Encoding the second cross-chain log to obtain characteristic information of the candidate transaction; Determine the correlation score between the target transaction and the candidate transaction based on the search information and the feature information; According to the association score, an associated transaction of the target transaction is selected from the multiple candidate transactions.

7. The method according to claim 6, characterized in that The selecting a second cross-chain log related to the cross-chain operation from the plurality of second event logs includes: Obtaining a log representation sequence of the plurality of second event logs; Using an attention mechanism to process the log representation sequence; Obtaining cross-chain scores of the plurality of second event logs according to the processed log representation sequence; According to the cross-chain score, a second cross-chain log related to the cross-chain operation is selected from the multiple second event logs.

8. The method according to claim 1, characterized in that The target transaction includes a deposit transaction, the associated transaction includes a withdrawal transaction, and the deposit transaction and the withdrawal transaction are implemented based on a decentralized cross-chain bridge.

9. A cross-chain transaction association device, characterized in that: include: An acquisition unit, configured to acquire a plurality of first event logs of a target transaction in a first blockchain; A selection unit, configured to select a first cross-chain log related to the cross-chain operation from the plurality of first event logs; An encoding unit, configured to encode the first cross-chain log into retrieval information; The retrieval unit is used to retrieve the associated transaction of the target transaction from multiple candidate transactions in the second blockchain according to the retrieval information.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.