A method and apparatus for identifying cross-chain transaction types in blockchain

By generating multiple relationship graphs and utilizing semantic embedding models and cross-chain transaction type identification models, the problem of insufficient accuracy in cross-chain transaction type identification in existing technologies is solved, achieving accurate identification of cross-chain transaction behavior and semantic information, and improving the effectiveness of cross-chain transaction tracking.

CN119538052BActive Publication Date: 2025-10-31SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411692545.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-10-31
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

Existing blockchain cross-chain transaction type identification technologies mainly focus on the semantic information of the contract as a whole, resulting in poor accuracy of the identification results and an inability to effectively focus on the cross-chain behavior and semantic information of a single transaction.

Method used

A multi-relationship graph of the transaction to be identified is generated using pre-set program analysis technology. A pre-set semantic embedding model encoder and a cross-chain transaction type identification model are used to identify the transaction type through a gated graph neural network and a multi-layer perceptron layer, generating cross-chain transaction type identification results.

Benefits of technology

It improves the accuracy of cross-chain transaction type identification, effectively focuses on the cross-chain behavior and semantic information of the transaction itself, and enhances the effectiveness and accuracy of cross-chain transaction tracking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538052B_ABST
    Figure CN119538052B_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for identifying cross-chain transaction types in blockchain, addressing the technical problem of poor accuracy in existing cross-chain transaction type identification technologies. The method includes acquiring the transaction to be identified and generating a multi-relationship graph based on the transaction using a pre-set program analysis technique; using a pre-set semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relationship graph; inputting the initial embedding representations of each node into a pre-set cross-chain transaction type identification model for identification, and outputting the cross-chain transaction type identification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method and apparatus for identifying cross-chain transaction types in blockchain. Background Technology

[0002] The current blockchain landscape presents a new ecosystem of multiple chains coexisting. Each chain, based on its unique technical characteristics and application scenarios, has built a diverse and symbiotic ecosystem. Along with this landscape, inter-chain interoperability has become an urgent need in the blockchain field, spurring the rapid development of cross-chain bridge technology.

[0003] Cross-chain bridges, through strategies such as sidechains, relay chains, and hash locking, enable the flow of value and information between chains, driving the development of blockchain towards a more open and interconnected direction. However, this also exacerbates regulatory challenges, creating an urgent need for efficient and reliable cross-chain transaction tracking solutions.

[0004] Most existing blockchain cross-chain transaction type identification technologies are based on traditional semantic recognition technologies to identify transaction semantics. However, these technologies are designed for smart contracts, which means that traditional semantic recognition technologies mainly focus on the semantic information of the contract as a whole and cannot effectively focus on the semantic information of a single transaction, resulting in poor accuracy of the identification results. Summary of the Invention

[0005] This invention provides a method and apparatus for identifying cross-chain transaction types in blockchain, which solves the technical problem that existing cross-chain transaction type identification technologies result in poor accuracy of identification results.

[0006] The first aspect of this invention provides a method for identifying cross-chain transaction types in blockchain, comprising:

[0007] The transaction to be identified is obtained, and a multi-relationship graph to be identified is generated based on the transaction using a pre-set program analysis technique.

[0008] A pre-set semantic embedding model encoder is used to output the initial embedding representation of multiple nodes corresponding to the multi-relationship graph to be identified based on the multi-relationship graph to be identified;

[0009] The initial embedded representation of each node is input into a pre-set cross-chain transaction type recognition model for recognition, and the cross-chain transaction type recognition result is output.

[0010] Optionally, the multi-relationship graph to be identified includes control graphs, data graphs, state graphs, and combination graphs; the pre-defined program analysis technology includes static analysis tools, variable definition-use chains, and positive dominance relationships; the step of generating the multi-relationship graph to be identified based on the transactions to be identified using the pre-defined program analysis technology includes:

[0011] The transaction to be identified is parsed, a binary code is output, and the called smart contract function is determined based on the binary code.

[0012] Static analysis tools are used to construct an initial control flow graph based on the called smart contract functions;

[0013] Based on the initial control flow graph, multiple control-dependent directed edges are determined using positive dominance relationships;

[0014] A control edge set is constructed by using multiple control-dependent directed edges and the control flow edge set in the initial control flow graph;

[0015] Construct a control graph based on the set of control edges and the set of nodes in the initial control flow graph;

[0016] The initial control flow graph is extracted using variable definition and chains, and multiple data dependency edges and multiple data flow direction edges are output.

[0017] Based on multiple data dependency edges and multiple data flow direction edges, a first set of associated nodes is determined, and a data graph is constructed using the multiple data dependency edges, multiple data flow direction edges, and the first set of associated nodes;

[0018] Based on the initial control flow graph, multiple state variable dependency edges are determined;

[0019] Based on the multiple state variable dependency edges, a second set of associated nodes is determined, and a state graph is constructed using the multiple state variable dependency edges and the second set of associated nodes;

[0020] A composite graph is constructed based on the node and edge sets in the state graph, the node and edge sets in the data graph, and the node and edge sets in the control graph.

[0021] Optionally, the step of using a pre-set semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relationship graph to be identified, based on the multi-relationship graph to be identified, includes:

[0022] Feature mapping is performed on the node set in the control graph, the node set in the data graph, the node set in the state graph, and the node set in the combined graph, respectively, to output multiple character sequences corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0023] Based on the multiple character sequences corresponding to the control chart, the multiple character sequences corresponding to the data chart, the multiple character sequences corresponding to the state chart, and the multiple character sequences corresponding to the combination chart, determine multiple new character sequences corresponding to the control chart, the multiple new character sequences corresponding to the data chart, the multiple new character sequences corresponding to the state chart, and the multiple new character sequences corresponding to the combination chart.

[0024] A pre-set semantic embedding model encoder is used to encode multiple new character sequences corresponding to the control graph, the data graph, the state graph, and the combined graph to generate initial embedding representations of multiple nodes corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0025] Optionally, the pre-built cross-chain transaction type recognition model includes a gated graph neural network, an encoder, a first multilayer perceptron layer, and a second multilayer perceptron layer; the step of inputting the initial embedded representation of each node into the pre-built cross-chain transaction type recognition model for recognition and outputting the cross-chain transaction type recognition result includes:

[0026] A gated graph neural network is used to update the initial embedding representations of multiple nodes corresponding to the control graph, the data graph, the state graph, and the combined graph, and outputs the hidden states of multiple targets corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0027] The multiple target hidden states corresponding to the control graph, the data graph, the state graph, and the combined graph are respectively fused using a max pooling layer to output the target vector representations corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0028] The target vector representations are concatenated to generate a target concatenated vector, and the target concatenated vector is used as the input of the first multilayer perceptron layer to output the target semantic representation;

[0029] The target semantic representation is input into the encoder for encoding, and the encoder vector is output.

[0030] The second multi-layer perceptron layer is used to identify the transaction type of the encoder vector, generating a cross-chain transaction type identification result.

[0031] Optionally, the encoder includes a linear layer, a one-dimensional batch normalization layer, an activation function layer, and a random dropout layer; the step of inputting the target semantic representation into the encoder for encoding and outputting an encoder vector includes:

[0032] A linear layer is used to perform a linear transformation on the target semantic representation, and the transformed semantic features are output.

[0033] The transformed semantic features are normalized by a one-dimensional batch normalization layer to generate normalized semantic features.

[0034] The normalized semantic features are nonlinearly transformed using an activation function layer to output nonlinear semantic features.

[0035] The nonlinear semantic features are used as input to the random dropout layer, and the output is an encoder vector.

[0036] Optionally, the training process of the pre-built cross-chain transaction type identification model includes:

[0037] Obtain the transactions to be trained, and use pre-set program analysis technology to generate a multi-relationship graph to be trained based on the transactions to be trained;

[0038] A pre-set semantic embedding model encoder is used to output the initial embedding representations of multiple nodes to be trained corresponding to the multi-relationship graph to be trained based on the multi-relationship graph to be trained.

[0039] The initial embedded representation of each node to be trained is input into the initial cross-chain transaction type recognition model for recognition, and the encoder vector to be trained and the cross-chain transaction type recognition result to be trained are output.

[0040] A preset initial decoder is used to reconstruct vectors based on the encoder vector to be trained, thereby generating decoder reconstruction vectors.

[0041] The target loss value is calculated using a pre-set loss function based on the decoder reconstruction vector and the cross-chain transaction type identification result to be trained;

[0042] The target loss value is used to update the network parameters of the preset initial decoder and the network parameters of the initial cross-chain transaction type identification model, and the intermediate decoder and intermediate cross-chain transaction type identification model are output, and the number of updates is counted in real time.

[0043] Determine whether the number of updates has reached a preset training threshold;

[0044] If this is achieved, the intermediate cross-chain transaction type identification model will be used as the pre-trained cross-chain transaction type identification model.

[0045] A second aspect of the present invention provides a blockchain cross-chain transaction type identification device, comprising:

[0046] The acquisition module is used to acquire the transaction to be identified and to generate a multi-relationship graph to be identified based on the transaction using a pre-set program analysis technology.

[0047] The module is used to output the initial embedding representation of multiple nodes corresponding to the multi-relationship graph to be identified based on the pre-set semantic embedding model encoder.

[0048] The identification module is used to input the initial embedded representation of each node into a preset cross-chain transaction type identification model for identification and output the cross-chain transaction type identification result.

[0049] A computer device provided in a third aspect of the present invention includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the blockchain cross-chain transaction type identification method as described in any of the preceding claims.

[0050] The fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the steps of the blockchain cross-chain transaction type identification method as described in any of the preceding claims.

[0051] The fifth aspect of the present invention provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein, when the program instructions are executed by a computer, the computer performs the steps of the blockchain cross-chain transaction type identification method as described in any of the preceding claims.

[0052] As can be seen from the above technical solutions, the present invention has the following advantages:

[0053] The above-mentioned technical solution of the present invention provides a method for identifying cross-chain transaction types in blockchain. First, the transaction to be identified is acquired, and a pre-set program analysis technique is used to generate a multi-relationship graph to be identified based on the transaction. Next, a pre-set semantic embedding model encoder is used to output initial embedding representations of multiple nodes corresponding to the multi-relationship graph. Finally, the initial embedding representations of each node are input into a pre-set cross-chain transaction type identification model for identification, and the cross-chain transaction type identification result is output. Based on the above solution, the process of generating a multi-relationship graph based on the acquired transaction using pre-set program analysis technique, and processing the multi-relationship graph based on the pre-set semantic embedding model encoder and the pre-set cross-chain transaction type identification model to output the cross-chain transaction type identification result, focuses on the transaction itself, effectively highlighting the cross-chain behavior and semantic information of the transaction, thereby improving the accuracy of the transaction type identification result. Attached Figure Description

[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is a flowchart illustrating the steps of a blockchain cross-chain transaction type identification method provided in Embodiment 1 of the present invention.

[0056] Figure 2 The flowchart shows the steps of training the pre-built cross-chain transaction type identification model provided in Embodiment 2 of the present invention.

[0057] Figure 3 This is a training framework diagram of the pre-built cross-chain transaction type identification model provided in Embodiment 2 of the present invention;

[0058] Figure 4 This is a structural block diagram of a blockchain cross-chain transaction type identification device provided in Embodiment 3 of the present invention. Detailed Implementation

[0059] This invention provides a method and apparatus for identifying cross-chain transaction types in blockchain, which addresses the technical problem of poor accuracy in existing cross-chain transaction type identification technologies.

[0060] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0061] Terminology Explanation:

[0062] Blockchain: A distributed database technology based on cryptographic principles that stores data through a chain-like block structure, ensuring the immutability, transparency, and traceability of the data.

[0063] Smart contracts: Automated execution programs deployed on blockchain platforms. Utilizing pre-defined rules and conditions, contract terms can be executed without the intervention of a trusted third party, effectively automating value transfer and information processing.

[0064] Transaction binary code: a process or product that converts transaction data into binary form through specific encoding rules, corresponding to the Input field in a transaction. It aims to achieve efficient and accurate network transmission and processing, and ensure the smooth execution of the consensus mechanism of the blockchain network.

[0065] Cross-Chain Bridge: A technical infrastructure that enables interconnection between heterogeneous blockchain networks. Through pre-defined protocols and mechanisms, it ensures the secure and efficient transfer of assets and information between different blockchains, promoting the integration and development of the Internet of Value.

[0066] Cross-chain transactions consist of two parts: deposit transactions on the source chain and withdrawal transactions on the target chain. They utilize cross-chain bridge technology to transfer assets or exchange information between two or more independent blockchain systems. This involves complex verification, conversion, and confirmation processes to ensure the atomicity and finality of the transactions.

[0067] Cross-chain transaction tracking: A method for monitoring and analyzing cross-chain transactions. It aims to use data analysis and tracking technology to achieve correct matching of source chain deposit transactions and target chain withdrawal transactions in cross-chain scenarios where physical spaces are disconnected, thereby ensuring the transparency and traceability of transactions across different blockchains.

[0068] A Ponzi scheme is an economic crime characterized by using funds from new investors to pay returns to existing investors, creating the illusion of high profitability and enticing more people to participate. This model relies on an ever-expanding investor base to maintain cash flow, rather than on actual profitable business operations or asset appreciation.

[0069] Abstract Syntax Tree (AST): A structured representation of programming language source code. It uses a tree-like data structure to show the syntactic structure and logical relationships of a program, providing a foundation for compilers to perform syntax checking, semantic analysis, and code optimization.

[0070] Control Flow Graph (CFG): A graphical model used in software engineering to visualize the control flow of a program. Nodes represent basic code blocks, and edges represent control transfer relationships, making it easier to understand and analyze the program's execution path, loops, and conditional branching logic.

[0071] Graph Neural Networks (GNNs) are deep learning models that process graph data. They can learn feature representations of nodes, edges, and graphs, capture structural information through information transfer mechanisms, and are applied to graph analysis tasks such as node classification and graph classification. They represent a significant advancement in the field of graph data.

[0072] Please see Figure 1 , Figure 1 The flowchart illustrates the steps of a blockchain cross-chain transaction type identification method provided in Embodiment 1 of the present invention.

[0073] This invention provides a method for identifying cross-chain transaction types in blockchain, comprising:

[0074] Step 101: Obtain the transactions to be identified and generate a multi-relationship graph based on the transactions using pre-set program analysis technology.

[0075] The multiple relationship diagrams to be identified include control diagrams, data diagrams, state diagrams, and combination diagrams.

[0076] Pre-defined program analysis techniques include static analysis tools, variable definition-usage chains, and positive dominance relationships; the static analysis tool is Slither, a static analysis tool for the Solidity language.

[0077] It should be noted that, based on a given transaction tx to be identified, the interface provided by a third-party web3 client library is used to parse the transaction's input binary code to obtain information about the smart contract function f to be called, including but not limited to the function name, parameter names, and parameter types. Using a function selector parsed from the input binary code, the corresponding function signature is matched in the contract source code, and the location of the called function in the source code is quickly determined based on the function signature. Static analysis techniques are used to construct a multi-relationship graph corresponding to the source code of the called function.

[0078] Specifically, the process of generating a multi-relationship graph to be identified based on the transaction to be identified using pre-set program analysis technology can be achieved by executing the following sub-steps S11 to S110:

[0079] Step S11: Parse the transaction to be identified, output binary code, and determine the called smart contract function based on the binary code;

[0080] Step S12: Use static analysis tools to construct an initial control flow graph based on the called smart contract function;

[0081] Step S13: Using positive dominance relationships, determine multiple control dependency directed edges based on the initial control flow graph;

[0082] Step S14: Construct a control edge set using multiple control-dependent directed edges and the control flow edge set in the initial control flow graph;

[0083] Step S15: Construct a control graph based on the control edge set and the node set in the initial control flow graph;

[0084] It should be noted that the control flow graph (CFG) of the called smart contract function is constructed using Slither, a static analysis tool for the Solidity language. This initial control flow graph (CFG) is where each node represents a statement, and the set of nodes is denoted as N. c That is, the set of nodes N in the initial control flow graph. c Each edge represents the control flow between statements, and the set of edges formed by the control flow is denoted as E. cf That is, the set of control flow edges E in the initial control flow graph. cf We use forward dominance relations to obtain directed edges with control dependencies. These edges represent control dependencies between nodes, denoted as E. cd That is, the set of edges E consisting of multiple control-dependent directed edges. cd Using E cf and E cd Construct the control edge set E c and specify E c All edges in the array are of type T c Based on N c and E c Constructing control chart G c .

[0085] Step S16: Use variable definition - use chains to extract data from the initial control flow graph, and output multiple data dependency edges and multiple data flow direction edges;

[0086] Step S17: Based on multiple data dependency edges and multiple data flow direction edges, determine the first set of associated nodes, and construct a data graph using multiple data dependency edges, multiple data flow direction edges, and the first set of associated nodes;

[0087] It should be noted that, based on CFG, the data dependency edges E are extracted using variable definition-use chains. dd and the direction edge E of the data flow df That is, multiple data-dependent edges E dd and multiple data flow direction edges E df , by E dd and E df The set of nodes obtained through association is denoted as N. d That is, the first set of associated nodes N d Using E dd and E df Construct edge set E d and specify E d All edges in the array are of type T d Based on N d and E d Constructing the data graph G d .

[0088] Step S18: Based on the initial control flow graph, determine multiple state variable dependency edges;

[0089] Step S19: Based on multiple state variable dependent edges, determine the second set of associated nodes, and construct the state graph using multiple state variable dependent edges and the second set of associated nodes;

[0090] It should be noted that, based on CFG, multiple state variable dependency edges are constructed, and the edge set E is composed of these multiple state variable dependency edges. s and specify E s All edges in the array are of type T s A state variable dependency edge points from a statement that reads the state variable to a statement that writes to that state variable, via E. s The set of nodes obtained through association is denoted as N. s That is, the second set of associated nodes N s Using N s and E s Constructing the state diagram G s .

[0091] Step S110: Construct a composite graph based on the node and edge sets in the state graph, the node and edge sets in the data graph, and the node and edge sets in the control graph.

[0092] It should be noted that the control chart G is taken. cData graph G d and state diagram G s The union of all vertex sets and edge sets is used to construct the vertex set N of the composite graph. m and edge set E m Among them, edge set E m The edge types in the include T c T d and T s Using N m and E m Constructing the composite graph G m .

[0093] It is worth mentioning that, for ease of discussion, this invention represents each perspective as follows:

[0094] ;

[0095] in, The graph to be identified is a multi-relationship graph, i=1,2,3,4; Let i be the set of nodes corresponding to the i-th type of graph; Let i be the set of edges corresponding to the i-th type of graph; For control charts; For data visualization; This is a state diagram; This is a composite image.

[0096] Step 102: Using a pre-set semantic embedding model encoder, output the initial embedding representation of multiple nodes corresponding to the multi-relationship graph to be identified.

[0097] It should be noted that, considering that the input form acceptable to graph neural network models is vector, this invention first uses graph G... i Mapping all node features to a low-dimensional vector space yields the character sequence s corresponding to the code statement of node u. u Regarding node embedding representation initialization, to obtain node embedding representations with certain structural semantic information, this invention uses a pre-trained Infercode semantic embedding model encoder (pre-built semantic embedding model encoder) based on AST, which effectively supports the Solidity language. The character sequence s corresponding to the code statement of node u is then used. u Construct a new character sequence.

[0098] Specifically, step 102 may include the following sub-steps S21-S23:

[0099] Step S21: Perform feature mapping on the node set in the control chart, the node set in the data chart, the node set in the state chart, and the node set in the combination chart respectively, and output multiple character sequences corresponding to the control chart, the data chart, the state chart, and the combination chart.

[0100] It should be noted that feature mapping is performed on all nodes in the control chart, data chart, state chart, and combination chart, and the character sequence corresponding to each node in each chart is output.

[0101] Step S22: Based on the multiple character sequences corresponding to the control chart, the multiple character sequences corresponding to the data chart, the multiple character sequences corresponding to the state chart, and the multiple character sequences corresponding to the combination chart, determine the multiple new character sequences corresponding to the control chart, the multiple new character sequences corresponding to the data chart, the multiple new character sequences corresponding to the state chart, and the multiple new character sequences corresponding to the combination chart.

[0102] It should be noted that the processing of the new character sequence can be represented as follows:

[0103] ;

[0104] in, The new character sequence corresponding to node u; Used as a separator for the first character sequence; The character sequence corresponding to node u; Used as a separator for the second character sequence.

[0105] Step S23: Use a pre-set semantic embedding model encoder to encode multiple new character sequences corresponding to the control chart, multiple new character sequences corresponding to the data chart, multiple new character sequences corresponding to the state chart, and multiple new character sequences corresponding to the combination chart, to generate initial embedding representations of multiple nodes corresponding to the control chart, multiple initial embedding representations of multiple nodes corresponding to the data chart, multiple initial embedding representations of multiple nodes corresponding to the state chart, and multiple initial embedding representations of multiple nodes corresponding to the combination chart.

[0106] It should be noted that all the new character sequences corresponding to each graph are input into the pre-trained Infercode model encoder to obtain the initial embedding representation of each node; the processing of the initial embedding representation of nodes can be represented as follows:

[0107] ;

[0108] in, This is the initial embedding representation of the node corresponding to node u; For pre-built semantic embedding model encoder; The new character sequence corresponding to node u; is the hidden layer dimension of the encoder; These are the pre-training parameters for the pre-set semantic embedding model encoder.

[0109] It's worth noting that, regarding the initialization of edge embedding representation, edges with the same direction between two nodes are first merged into a joint semantic edge. To preserve multiple semantic combinations between two nodes, a 3D one-hot vector is used to encode multi-semantic edges. Each dimension represents T. c T d and T s Suppose there are two nodes u and v. If there are three types of directed edges from u to v, then the one-hot vector of the merged joint semantic edge is [1,1,1].

[0110] Step 103: Input the initial embedded representation of each node into the pre-set cross-chain transaction type recognition model for recognition, and output the cross-chain transaction type recognition result.

[0111] The pre-built cross-chain transaction type recognition model includes a gated graph neural network, an encoder, and a multilayer perceptron (MLP) layer, which includes a first multilayer perceptron layer and a second multilayer perceptron layer.

[0112] It should be noted that gated neural networks have certain advantages in analyzing multi-dimensional relational graphs of code, mainly reflected in their ability to efficiently handle complex structures and long-term dependencies. The gating mechanism of this network not only effectively captures and maintains the deep dependency logic structure in the code execution trajectory, but also exhibits high flexibility, adapting to diverse forms and non-linear complexities of control flow graphs, especially when dealing with advanced organizational forms such as tree structures. Therefore, in the design of the cross-chain semantic extraction network, a gated graph neural network was chosen as the main component, with a multi-view relational graph as input, aiming to achieve effective semantic detection.

[0113] Specifically, step 103 may include the following sub-steps S31-S35:

[0114] Step S31: Use a gated graph neural network to update the initial embedding representations of multiple nodes corresponding to the control graph, the data graph, the state graph, and the combined graph, and output the hidden states of multiple targets corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0115] It should be noted that the initial embedding representation of each node in each graph (i.e., control graph, data graph, state graph, and composite graph) is input into the gated graph neural network for state updates, resulting in the final hidden state (target hidden state) for each node in each graph. The processing of the gated graph neural network can be represented as follows:

[0116] ;

[0117] ;

[0118] ;

[0119] in, This represents the information that node u receives from node v during the t-th iteration. This is a message passing function that depends on the edge type of e; Let be the hidden state of node v starting from iteration t-1; e is the edge connecting node u and node v; Let i be the set of edges corresponding to the i-th type of graph; The aggregated information received by node u; This is the average pooling function; Let u be the set of neighbors of node u; For gate-through loop unit; Let be the hidden state of node u at iteration t. When t=T, we obtain the target hidden state corresponding to node u. ; Let v be the hidden state of node v during iteration t-1.

[0120] Step S32: Perform feature fusion on multiple target hidden states corresponding to the control graph, multiple target hidden states corresponding to the data graph, multiple target hidden states corresponding to the state graph, and multiple target hidden states corresponding to the combined graph through the max pooling layer, and output the target vector representations corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0121] It should be noted that in a gated graph neural network, after T iterations of the initial node embeddings, the hidden states will contain sufficient information about the given graph. Therefore, in the final iteration, the hidden states of the nodes are obtained, and max pooling is used to fuse their features to obtain the graph G. i The final vector representation (target vector representation) can be represented as follows:

[0122] ;

[0123] in, Let the target vector of the i-th graph be represented; This is the max pooling layer; The hidden state of the target corresponding to node u; Let be the set of nodes corresponding to the i-th type of graph.

[0124] Step S33: Perform feature concatenation on each target vector representation to generate a target concatenated vector, and use the target concatenated vector as the input of the first multilayer perceptron layer to output the target semantic representation;

[0125] It should be noted that, in order to extract the overall semantic representation of a transaction, the representations from all graphs are concatenated and input into the MLP neural network layer. The output of the MLP is used as the final semantic representation of the transaction. Specifically, feature concatenation is performed on the target vector representations corresponding to the control graph, the data graph, the state graph, and the combined graph, outputting a target concatenated vector. This target concatenated vector is then used as the input to the first multilayer perceptron layer, outputting the target semantic representation. The processing of the target semantic representation can be represented as follows:

[0126] ;

[0127] Where z is the target semantic representation; This represents the target vector corresponding to the control chart; This is the first multilayer perceptron layer, which includes a nonlinear layer and a Sigmoid activation function layer. For feature splicing; The target vector representation corresponding to the data graph; This is the target vector representation corresponding to the state diagram; This is the target vector representation corresponding to the composite graph.

[0128] Step S34: Input the target semantic representation into the encoder for encoding, and output the encoder vector;

[0129] It should be noted that the source code semantic features (target semantic representation) of the transaction to be identified are input into the encoder, which consists of a linear layer, a one-dimensional batch normalization layer, an activation function layer (ReLU activation function layer), and a dropout layer.

[0130] Specifically, step S34 may include the following sub-steps:

[0131] Step S341: Perform a linear transformation on the target semantic representation using a linear layer, and output the transformed semantic features;

[0132] Step S342: Perform one-dimensional batch normalization on the transformed semantic features through a one-dimensional batch normalization layer to generate normalized semantic features;

[0133] Step S343: Apply an activation function layer to perform a nonlinear transformation on the normalized semantic features and output nonlinear semantic features;

[0134] Step S344: Use the nonlinear semantic features as input to the random dropout layer and output the encoder vector.

[0135] It should be noted that the encoder's processing procedure can be represented as follows:

[0136] ;

[0137] in, This is the encoder vector; For encoder; Z represents the random dropout layer in the encoder; z represents the target semantic representation. For ReLU activation function layer; This is a one-dimensional batch normalization layer in the encoder; These are the first input linear layer parameters of the encoder; These are the second input linear layer parameters of the encoder; represents the encoder's drop probability.

[0138] Step S35: Use the second multi-layer perceptron layer to identify the transaction type of the encoder vector and generate the cross-chain transaction type identification result.

[0139] It should be noted that the second multi-layer perceptron layer is used to identify the transaction type of the encoder vector, generating cross-chain transaction type identification results (transaction classification results). The relationship between the transaction to be identified and the transaction to be paired mainly includes the following three cases, that is, the cross-chain transaction type identification results are divided into three cases: 1) When the cross-chain transaction type identification result indicates that the transaction to be identified is a non-cross-chain transaction, the matching transaction is set to itself; 2) When the cross-chain transaction type identification result indicates that the transaction to be identified is a source chain deposit transaction, the matching transaction is set to a target chain withdrawal transaction; 3) When the cross-chain transaction type identification result indicates that the transaction to be identified is a target chain withdrawal transaction, the matching transaction is set to a source chain deposit transaction.

[0140] Furthermore, the processing flow of the second multilayer perceptron can be represented as follows:

[0141] ;

[0142] in, Results of cross-chain transaction type identification; This is the second multilayer perceptron layer; This is the encoder vector; This is a Softmax activation function layer; For ReLU activation function layer; The first output parameter of the second multilayer perceptron layer; The first input parameter for the second multilayer perceptron layer; This is the second input parameter for the second multilayer perceptron layer; This is the second output parameter of the second multilayer perceptron layer.

[0143] As a comparison of technical effects, existing technologies can be used as a reference. Cross-chain semantic recognition, as the primary step in tracking technology, aims to extract and identify the semantics of cross-chain transactions by analyzing relevant data and behaviors. This provides crucial information for downstream tasks such as cross-chain transaction tracking, thereby improving the effectiveness and accuracy of cross-chain transaction tracking. It is evident that cross-chain semantic recognition, as a vital technology in cross-chain security defense, lays the foundation for effective regulation and risk control. Most existing blockchain semantic recognition technologies are geared towards single-chain scenarios or specific financial security issues, such as Ponzi schemes and contract vulnerabilities on the blockchain. Regarding the semantic issues of blockchain smart contracts, existing blockchain semantic recognition technologies propose a static analysis tool based on machine learning to effectively extract the semantics of contract vulnerabilities. In identifying the transaction semantics of blockchain Ponzi schemes, existing blockchain semantic recognition technologies define a new code representation called slicetransaction property graph (sTPG). By representing the transaction-related semantics of smart contracts as a graph, graph neural network technology is used to learn potential Ponzi transaction patterns from it. In the problem of transaction semantic recognition, existing blockchain semantic recognition technology uses a network semantic representation method based on transaction transfer motifs, which can capture transaction semantic information in real-time transaction data workflow.

[0144] Based on the above, existing semantic recognition technologies primarily target smart contracts, such as contract vulnerability analysis, and lack analysis of individual transactions. This means that existing semantic recognition technologies mainly focus on the semantic information of the contract as a whole, and cannot effectively focus on the semantic information of a single transaction. Furthermore, existing transaction semantic recognition technologies are mainly designed for specific blockchain security issues, lacking general applicability. While these technologies can achieve good results in identifying blockchain financial security issues such as Ponzi schemes, their highly specialized methods and limited logical processing capabilities make them difficult to effectively detect the semantic information corresponding to cross-chain behavior. Moreover, existing transaction semantic recognition technologies are mainly applied to single-chain scenarios, while actual cross-chain application scenarios are more complex than single-chain scenarios. This means that when single-chain transaction semantic recognition technologies are migrated and applied to cross-chain scenarios, they are prone to problems such as low recognition rates and insufficient compatibility due to incomplete information consideration.

[0145] To address the aforementioned issues, this invention proposes a method for identifying cross-chain transaction types in blockchain. It designs a multi-view semantic extraction process for constructing the control flow graph of transaction function source code and a novel cross-chain semantic detection framework. The framework encodes transaction matching pair information, enabling effective detection of cross-chain behavior from multiple perspectives. A transaction matching information fusion algorithm categorizes source chain deposit transactions, target chain withdrawal transactions, and non-cross-chain transactions. Furthermore, the integration of cross-chain transaction pair information further enhances cross-chain semantic recognition, assisting downstream tasks such as cross-chain transaction tracking.

[0146] In summary, compared with existing methods for semantic recognition of smart contracts, this invention focuses on cross-chain transactions themselves, effectively concentrating on the cross-chain behavior and semantic information of the transaction itself. Furthermore, compared with existing semantic recognition methods targeting specific problems, this invention considers the fusion of transaction matching information in a cross-chain context, enhancing the stability and reliability of the method. Moreover, compared with existing semantic recognition methods oriented towards single chains, this invention is designed for cross-chain application scenarios, providing accurate semantic information for downstream tasks such as cross-chain transaction tracking.

[0147] In this embodiment of the invention, a method for identifying cross-chain transaction types in blockchain is provided. First, the transaction to be identified is acquired, and a pre-defined program analysis technique is used to generate a multi-relationship graph to be identified based on the transaction. Next, a pre-defined semantic embedding model encoder is used to output initial embedding representations of multiple nodes corresponding to the multi-relationship graph. Finally, the initial embedding representations of each node are input into a pre-defined cross-chain transaction type identification model for identification, and the cross-chain transaction type identification result is output. Based on the above scheme, the process of generating a multi-relationship graph based on the acquired transaction using pre-defined program analysis technique, and processing the multi-relationship graph based on the pre-defined semantic embedding model encoder and the pre-defined cross-chain transaction type identification model to output the cross-chain transaction type identification result, is transaction-oriented and can effectively focus on the cross-chain behavior and semantic information of the transaction itself, thereby improving the accuracy of the transaction type identification result.

[0148] For better explanation, refer to Figure 2 The flowchart of the training process of the pre-built cross-chain transaction type identification model provided in Embodiment 2 of the present invention includes the following steps:

[0149] Step 201: Obtain the transactions to be trained, and use pre-set program analysis technology to generate a multi-relationship graph to be trained based on the transactions to be trained.

[0150] It should be noted that you should refer to [link / reference]. Figure 3The initial cross-chain transaction type recognition model's training and detection phases are similar. During training, the transactions to be trained are first parsed to obtain their binary code, and the source code corresponding to the transaction functions is acquired. Four semantic relationship graphs—control graph, data graph, state graph, and combination graph—are constructed based on static analysis techniques for model training. Next, a gated graph neural network model is used to extract cross-chain semantic representations from these graphs. Finally, an encoder-decoder network framework is used to fuse transaction matching information. In the detection phase, the pre-built cross-chain transaction type recognition model obtained during training is applied to detect and extract cross-chain semantics from transactions. Transactions are mapped to three possible categories: source chain deposit transactions, target chain withdrawal transactions, and non-cross-chain transactions. Specifically, the semantic representation of the transaction is obtained and then input into the encoder module of the encoder-decoder network framework to obtain a transaction representation with fused pairing information. Finally, the transaction representation is input into the MLP (Multi-Level Processing) to perform category mapping, thereby achieving cross-chain transaction semantic recognition.

[0151] It is worth mentioning that, during the training phase, this invention uses the source code semantic features z of the transaction to be identified as input, the source code semantic features z* of the transaction to be paired as the reconstruction target, and the transaction type to be identified as the classification target to complete the training of the model.

[0152] Step 202: Using a pre-set semantic embedding model encoder, output the initial embedding representations of multiple nodes to be trained corresponding to the multi-relationship graph to be trained.

[0153] Step 203: Input the initial embedded representation of each node to be trained into the initial cross-chain transaction type recognition model for recognition, and output the encoder vector to be trained and the cross-chain transaction type recognition result to be trained.

[0154] Step 204: Use a preset initial decoder to reconstruct vectors based on the encoder vectors to be trained, and generate decoder reconstruction vectors.

[0155] It should be noted that the encoded information (the encoder vector to be trained) is input into a preset initial decoder. This preset initial decoder has a similar structure to the encoder, except that the last layer of the network structure is a linear layer used to control the output dimension. The processing flow of the preset initial decoder can be represented as follows:

[0156] ;

[0157] in, The vector reconstructed by the decoder; Pre-set initial decoder; This is the encoder vector; These are the parameters of the first output linear layer of the decoder; This is a one-dimensional batch normalization layer in the decoder; These are the parameters of the first input linear layer of the decoder; These are the second input linear layer parameters for the decoder; The probability of the decoder dropping data; These are the parameters of the second output linear layer of the decoder; Z represents the random dropout layer in the decoder; z represents the target semantic representation. This is a ReLU activation function layer.

[0158] Step 205: Calculate the target loss value using a preset loss function based on the decoder reconstruction vector and the cross-chain transaction type identification results to be trained.

[0159] It should be noted that this invention considers transaction reconstruction and transaction classification, and sets up joint training and loss weighting, wherein the pre-set loss function can be expressed as:

[0160] ;

[0161] in, The target loss value; This is the first hyperparameter, used to adjust the relative importance of the two loss functions; To reconstruct the loss value; This is the second hyperparameter, used to adjust the relative importance of the two loss functions; This is the classification loss value; The mean squared error loss value; M is the number of samples; D is the dimension of the reconstructed vector; The value of the real reconstructed target vector in the j-th dimension; Let be the value of the decoder-reconstructed vector in the j-th dimension; C is the cross-entropy loss value; C is the number of classification categories. This represents the true value of the real label vector in class c. The predicted value for the transaction type (the cross-chain transaction type identification result to be trained) in class c.

[0162] Step 206: Update the network parameters of the preset initial decoder and the network parameters of the initial cross-chain transaction type identification model using the target loss value, output the intermediate decoder and the intermediate cross-chain transaction type identification model, and count the number of updates in real time.

[0163] Step 207: Determine whether the number of updates has reached the preset training threshold.

[0164] Step 208: If the goal is achieved, use the intermediate cross-chain transaction type recognition model as the pre-trained cross-chain transaction type recognition model.

[0165] It should be noted that after updating the network parameters of the preset initial decoder and the network parameters of the initial cross-chain transaction type recognition model based on the target loss value, it is determined whether the number of updates has reached the preset training threshold. If the number of updates has reached the preset training threshold, the intermediate cross-chain transaction type recognition model is used as the trained preset cross-chain transaction type recognition model. If the number of updates has not reached the preset training threshold, the intermediate decoder is used as the new preset initial decoder, the intermediate cross-chain transaction type recognition model is used as the new initial cross-chain transaction type recognition model, and step 202 is executed until the number of updates reaches the preset training threshold. The intermediate cross-chain transaction type recognition model determined when the number of updates reaches the preset training threshold is used as the trained preset cross-chain transaction type recognition model, and the intermediate decoder determined when the number of updates reaches the preset training threshold is used as the target decoder.

[0166] In this embodiment of the invention, the training transactions are parsed to obtain the training binary code, the source code corresponding to the training transaction function is obtained, and four semantic relationship graphs—control graph, data graph, state graph, and combination graph—are constructed based on static analysis techniques for model training. Next, a gated graph neural network model is used to extract cross-chain semantic representations from the semantic relationship graphs. Finally, an encoder-decoder network framework is used to fuse transaction matching information, completing the training of a pre-set cross-chain transaction type recognition model. This invention enhances transaction pairing information through an encoder-decoder network architecture, improving the distinguishability between cross-chain and non-cross-chain transactions, and achieving effective classification of source chain deposit transactions, target chain withdrawal transactions, and non-cross-chain transactions.

[0167] Please see Figure 4 , Figure 4 This is a structural block diagram of a blockchain cross-chain transaction type identification device provided in Embodiment 3 of the present invention.

[0168] This invention provides a blockchain cross-chain transaction type identification device, comprising:

[0169] The acquisition module 401 is used to acquire the transaction to be identified and to generate a multi-relationship graph to be identified based on the transaction using a pre-set program analysis technology.

[0170] Module 402 is used to output the initial embedding representation of multiple nodes corresponding to the multi-relationship graph to be identified based on the multi-relationship graph to be identified using a pre-set semantic embedding model encoder.

[0171] The identification module 403 is used to input the initial embedded representation of each node into the preset cross-chain transaction type identification model for identification and output the cross-chain transaction type identification result.

[0172] Furthermore, the multi-relationship diagrams to be identified include control charts, data diagrams, state diagrams, and combination diagrams; the pre-defined analysis techniques include static analysis tools, variable definition-use chains, and positive dominance relationships; the acquisition module 401 is specifically used for:

[0173] The transaction to be identified is parsed, a binary code is output, and the called smart contract function is determined based on the binary code.

[0174] Static analysis tools are used to construct an initial control flow graph based on the called smart contract functions;

[0175] Based on the initial control flow graph, multiple control-dependent directed edges are determined using positive dominance relationships;

[0176] A control edge set is constructed by using multiple control-dependent directed edges and the control flow edge set in the initial control flow graph.

[0177] Construct a control graph based on the set of control edges and the set of nodes in the initial control flow graph;

[0178] The initial control flow graph is extracted using variable definition and chains, and multiple data dependency edges and multiple data flow direction edges are output.

[0179] Based on multiple data dependency edges and multiple data flow direction edges, the first set of associated nodes is determined, and a data graph is constructed using the multiple data dependency edges, multiple data flow direction edges, and the first set of associated nodes.

[0180] Based on the initial control flow graph, determine multiple state variable dependency edges;

[0181] Based on multiple state variable dependent edges, a second set of associated nodes is determined, and a state graph is constructed using multiple state variable dependent edges and the second set of associated nodes.

[0182] Construct a composite graph based on the node and edge sets in the state graph, the data graph, and the control graph.

[0183] Furthermore, module 402 is used specifically for:

[0184] Feature mapping is performed on the node sets in the control chart, data chart, state chart, and combination chart respectively, and multiple character sequences corresponding to the control chart, data chart, state chart, and combination chart are output.

[0185] Based on multiple character sequences corresponding to control charts, data charts, state charts, and combination charts, determine multiple new character sequences corresponding to control charts, data charts, state charts, and combination charts.

[0186] A pre-set semantic embedding model encoder is used to encode multiple new character sequences corresponding to the control chart, data chart, state chart, and combination chart, generating initial embedding representations of multiple nodes corresponding to the control chart, data chart, state chart, and combination chart.

[0187] Furthermore, the pre-built cross-chain transaction type recognition model includes a gated graph neural network, an encoder, a first multi-layer perceptron layer, and a second multi-layer perceptron layer; the recognition module 403 includes:

[0188] The first submodule is used to update the state of multiple initial embedding representations of nodes corresponding to the control graph, multiple initial embedding representations of nodes corresponding to the data graph, multiple initial embedding representations of nodes corresponding to the state graph, and multiple initial embedding representations of nodes corresponding to the combined graph using a gated graph neural network, and output multiple hidden states of targets corresponding to the control graph, multiple hidden states of targets corresponding to the data graph, multiple hidden states of targets corresponding to the state graph, and multiple hidden states of targets corresponding to the combined graph.

[0189] The second submodule is used to perform feature fusion on multiple target hidden states corresponding to the control graph, multiple target hidden states corresponding to the data graph, multiple target hidden states corresponding to the state graph, and multiple target hidden states corresponding to the combined graph through the max pooling layer, and output the target vector representations corresponding to the control graph, the data graph, the state graph, and the combined graph.

[0190] The third submodule is used to perform feature concatenation on the representations of each target vector to generate a target concatenated vector, and uses the target concatenated vector as the input of the first multilayer perceptron layer to output the target semantic representation;

[0191] The fourth submodule is used to input the target semantic representation into the encoder for encoding and output the encoder vector;

[0192] The fifth submodule is used to identify the transaction type of the encoder vector using the second multi-layer perceptron layer and generate cross-chain transaction type identification results.

[0193] Furthermore, the encoder includes a linear layer, a one-dimensional batch normalization layer, an activation function layer, and a random dropout layer; the fourth submodule is specifically used for:

[0194] A linear layer is used to perform a linear transformation on the target semantic representation, and the transformed semantic features are output.

[0195] The transformed semantic features are normalized by performing one-dimensional batch normalization on the one-dimensional batch normalization layer to generate normalized semantic features;

[0196] An activation function layer is used to perform a nonlinear transformation on the normalized semantic features, and the nonlinear semantic features are output.

[0197] The nonlinear semantic features are used as input to the random dropout layer, and the output is an encoder vector.

[0198] In one alternative embodiment, the apparatus further includes:

[0199] The first module is used to acquire the transactions to be trained and to generate a multi-relationship graph to be trained based on the transactions using pre-set program analysis technology.

[0200] The second module is used to use a pre-set semantic embedding model encoder to output the initial embedding representation of multiple nodes to be trained in the multi-relationship graph to be trained, based on the multi-relationship graph to be trained.

[0201] The third module is used to input the initial embedded representation of each node to be trained into the initial cross-chain transaction type recognition model for recognition, and output the encoder vector to be trained and the cross-chain transaction type recognition result to be trained.

[0202] The fourth module is used to reconstruct the decoder vector based on the encoder vector to be trained using a preset initial decoder.

[0203] The fifth module is used to calculate the target loss value based on the decoder reconstruction vector and the cross-chain transaction type recognition result to be trained, using a preset loss function;

[0204] The sixth module is used to update the network parameters of the pre-set initial decoder and the network parameters of the initial cross-chain transaction type identification model using the target loss value, output the intermediate decoder and the intermediate cross-chain transaction type identification model, and count the number of updates in real time.

[0205] The seventh module is used to determine whether the number of updates has reached the preset training threshold;

[0206] The eighth module is used to, if necessary, use the intermediate cross-chain transaction type recognition model as a pre-trained cross-chain transaction type recognition model.

[0207] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, modules, and sub-modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0208] This invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program; when the computer program is executed by the processor, the processor performs the steps of the blockchain cross-chain transaction type identification method as described in any of the above embodiments.

[0209] This invention also provides a computer-readable storage medium storing a computer program / instructions thereon, which, when executed by a processor, implements the steps of the blockchain cross-chain transaction type identification method as described in any of the above embodiments.

[0210] This invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the blockchain cross-chain transaction type identification method as described in any of the above embodiments.

[0211] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0212] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0213] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for identifying cross-chain transaction types in blockchain, characterized in that, include: The transaction to be identified is obtained, and a multi-relationship graph to be identified is generated based on the transaction using a pre-set program analysis technique. A pre-set semantic embedding model encoder is used to output the initial embedding representation of multiple nodes corresponding to the multi-relationship graph to be identified based on the multi-relationship graph to be identified; The initial embedded representation of each node is input into a pre-set cross-chain transaction type recognition model for recognition, and the cross-chain transaction type recognition result is output. The multi-relationship diagrams to be identified include control diagrams, data diagrams, state diagrams, and combination diagrams; the pre-set program analysis techniques include static analysis tools, variable definition-use chains, and positive dominance relationships; The step of generating a multi-relationship graph to be identified based on the transaction to be identified using pre-set program analysis technology includes: The transaction to be identified is parsed, a binary code is output, and the called smart contract function is determined based on the binary code. Static analysis tools are used to construct an initial control flow graph based on the called smart contract functions; Based on the initial control flow graph, multiple control-dependent directed edges are determined using positive dominance relationships; A control edge set is constructed by using multiple control-dependent directed edges and the control flow edge set in the initial control flow graph; Construct a control graph based on the set of control edges and the set of nodes in the initial control flow graph; The initial control flow graph is extracted using variable definition and chains, and multiple data dependency edges and multiple data flow direction edges are output. Based on multiple data dependency edges and multiple data flow direction edges, a first set of associated nodes is determined, and a data graph is constructed using the multiple data dependency edges, multiple data flow direction edges, and the first set of associated nodes; Based on the initial control flow graph, multiple state variable dependency edges are determined; Based on the multiple state variable dependency edges, a second set of associated nodes is determined, and a state graph is constructed using the multiple state variable dependency edges and the second set of associated nodes; A composite graph is constructed based on the node and edge sets in the state graph, the node and edge sets in the data graph, and the node and edge sets in the control graph.

2. The blockchain cross-chain transaction type identification method according to claim 1, characterized in that, The step of using a pre-set semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relationship graph to be identified, based on the multi-relationship graph to be identified, includes: Feature mapping is performed on the node set in the control graph, the node set in the data graph, the node set in the state graph, and the node set in the combined graph, respectively, to output multiple character sequences corresponding to the control graph, the data graph, the state graph, and the combined graph. Based on the multiple character sequences corresponding to the control chart, the multiple character sequences corresponding to the data chart, the multiple character sequences corresponding to the state chart, and the multiple character sequences corresponding to the combination chart, determine multiple new character sequences corresponding to the control chart, the multiple new character sequences corresponding to the data chart, the multiple new character sequences corresponding to the state chart, and the multiple new character sequences corresponding to the combination chart. A pre-set semantic embedding model encoder is used to encode multiple new character sequences corresponding to the control graph, the data graph, the state graph, and the combined graph to generate initial embedding representations of multiple nodes corresponding to the control graph, the data graph, the state graph, and the combined graph.

3. The blockchain cross-chain transaction type identification method according to claim 2, characterized in that, The pre-built cross-chain transaction type recognition model includes a gated graph neural network, an encoder, a first multilayer perceptron layer, and a second multilayer perceptron layer; the step of inputting the initial embedded representation of each node into the pre-built cross-chain transaction type recognition model for recognition and outputting the cross-chain transaction type recognition result includes: A gated graph neural network is used to update the initial embedding representations of multiple nodes corresponding to the control graph, the data graph, the state graph, and the combined graph, and outputs the hidden states of multiple targets corresponding to the control graph, the data graph, the state graph, and the combined graph. The multiple target hidden states corresponding to the control graph, the data graph, the state graph, and the combined graph are respectively fused using a max pooling layer to output the target vector representations corresponding to the control graph, the data graph, the state graph, and the combined graph. The target vector representations are concatenated to generate a target concatenated vector, and the target concatenated vector is used as the input of the first multilayer perceptron layer to output the target semantic representation; The target semantic representation is input into the encoder for encoding, and the encoder vector is output. The second multi-layer perceptron layer is used to identify the transaction type of the encoder vector, generating a cross-chain transaction type identification result.

4. The blockchain cross-chain transaction type identification method according to claim 3, characterized in that, The encoder includes a linear layer, a one-dimensional batch normalization layer, an activation function layer, and a random dropout layer; the process of inputting the target semantic representation into the encoder for encoding and outputting an encoder vector includes: A linear layer is used to perform a linear transformation on the target semantic representation, and the transformed semantic features are output. The transformed semantic features are normalized by a one-dimensional batch normalization layer to generate normalized semantic features. The normalized semantic features are nonlinearly transformed using an activation function layer to output nonlinear semantic features. The nonlinear semantic features are used as input to the random dropout layer, and the output is an encoder vector.

5. The blockchain cross-chain transaction type identification method according to claim 1, characterized in that, The training process of the pre-built cross-chain transaction type identification model includes: Obtain the transactions to be trained, and use pre-set program analysis technology to generate a multi-relationship graph to be trained based on the transactions to be trained; A pre-set semantic embedding model encoder is used to output the initial embedding representations of multiple nodes to be trained corresponding to the multi-relationship graph to be trained based on the multi-relationship graph to be trained. The initial embedded representation of each node to be trained is input into the initial cross-chain transaction type recognition model for recognition, and the encoder vector to be trained and the cross-chain transaction type recognition result to be trained are output. A preset initial decoder is used to reconstruct vectors based on the encoder vector to be trained, thereby generating decoder reconstruction vectors. The target loss value is calculated using a pre-set loss function based on the decoder reconstruction vector and the cross-chain transaction type identification result to be trained; The target loss value is used to update the network parameters of the preset initial decoder and the network parameters of the initial cross-chain transaction type identification model, and the intermediate decoder and intermediate cross-chain transaction type identification model are output, and the number of updates is counted in real time. Determine whether the number of updates has reached a preset training threshold; If this is achieved, the intermediate cross-chain transaction type identification model will be used as the pre-trained cross-chain transaction type identification model.

6. A blockchain cross-chain transaction type identification device, applied to the blockchain cross-chain transaction type identification method of claim 1, characterized in that, include: The acquisition module is used to acquire the transaction to be identified and to generate a multi-relationship graph to be identified based on the transaction using a pre-set program analysis technology. The module is used to output the initial embedding representation of multiple nodes corresponding to the multi-relationship graph to be identified based on the pre-set semantic embedding model encoder. The identification module is used to input the initial embedded representation of each node into a preset cross-chain transaction type identification model for identification and output the cross-chain transaction type identification result.

7. A computer device, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to perform the steps of the blockchain cross-chain transaction type identification method as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the blockchain cross-chain transaction type identification method as described in any one of claims 1-5.

9. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, wherein when the program instructions are executed by a computer, the computer performs the blockchain cross-chain transaction type identification method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Cross-chain service processing method and device based on relay chain, equipment and storage medium

    CN116546033A

  • Block chain-oriented digital content collection method and device, equipment and storage medium

    CN118364031A