Block chain cross-chain transaction type identification method and device

By generating and processing multi-relationship graphs, the problem of poor cross-chain transaction type recognition accuracy in the prior art is solved, and higher recognition accuracy is achieved.

CN119538052AActive Publication Date: 2025-02-28SUN YAT SEN UNIV

Patent Information

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

AI Technical Summary

Technical Problem

The existing blockchain cross-chain transaction type recognition technology cannot effectively focus on the semantic information of a single transaction, resulting in poor accuracy of the recognition results.

Method used

By obtaining transactions to be identified, a preset program analysis technology is used to generate a multi-relationship diagram to be identified, and a preset semantic embedding model encoder and a cross-chain transaction type identification model are used to process the multi-relationship diagram, and the cross-chain transaction type identification result is output.

Benefits of technology

This method can effectively focus on the cross-chain behavior and semantic information of the transaction itself, and improve the accuracy of the transaction type identification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538052A_ABST
    Figure CN119538052A_ABST
Patent Text Reader

Abstract

The invention discloses a block chain cross-chain transaction type identification method and device, and is used for solving the technical problem of poor accuracy of an identification result caused by an existing block chain cross-chain transaction type identification technology. The method comprises the following steps: acquiring a to-be-identified transaction, and generating a to-be-identified multi-relation graph according to the to-be-identified transaction by adopting a preset program analysis technology; adopting a preset semantic embedding model encoder to output a plurality of node initial embedding representations corresponding to the to-be-identified multi-relation graph according to the to-be-identified multi-relation graph; and inputting the initial embedded representation of each node into a preset cross-chain transaction type identification model for identification, and outputting a cross-chain transaction type identification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and device for identifying cross-chain transaction types of blockchains. Background Art

[0002] Today, the blockchain field presents a new ecological landscape of multiple chains coexisting. Each chain has built a multi-symbiotic ecosystem based on its unique technical characteristics and application scenarios. With this pattern, inter-chain interoperability has become an urgent need in the blockchain field, giving rise to the vigorous development of cross-chain bridge technology.

[0003] Cross-chain bridges achieve the flow of value and information between chains through strategies such as side chains, relay chains, and hash locking, and promote the development of blockchain in a more open and interconnected direction. This has intensified regulatory challenges and urgently requires efficient and reliable cross-chain transaction tracking solutions.

[0004] Most of the existing blockchain cross-chain transaction type recognition technologies are based on traditional semantic recognition technologies to realize the recognition of transaction semantics, but their main targets are smart contracts. This means that traditional semantic recognition technologies mainly focus on the semantic information of the contract as a whole and cannot focus well on the semantic information of a single transaction, resulting in poor accuracy of the recognition results. Summary of the invention

[0005] The present invention provides a blockchain cross-chain transaction type identification method and device, which are used to solve the technical problem that the existing blockchain cross-chain transaction type identification technology leads to poor accuracy of identification results.

[0006] A first aspect of the present invention provides a method for identifying a cross-chain transaction type of a blockchain, comprising:

[0007] Acquire the transaction to be identified, and generate a multi-relation graph to be identified based on the transaction to be identified using a preset program analysis technology;

[0008] Using a preset semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relation graph to be identified according to the multi-relation graph to be identified;

[0009] The initial embedding representation of each of the nodes is input into a preset cross-chain transaction type recognition model for recognition, and a cross-chain transaction type recognition result is output.

[0010] Optionally, the multi-relationship graph to be identified includes a control graph, a data graph, a state graph and a combination graph; the preset program analysis technology includes a static analysis tool, a variable definition-use chain and a positive dominance relationship; the use of the preset program analysis technology to generate the multi-relationship graph to be identified according to the transaction to be identified includes:

[0011] Parsing the transaction to be identified, outputting a binary code, and determining the smart contract function to be called based on the binary code;

[0012] Use static analysis tools to build the initial control flow graph based on the smart contract function being called;

[0013] Determine a plurality of control-dependent directed edges according to the initial control flow graph using a positive dominance relationship;

[0014] Constructing a control edge set by using a plurality of the control dependency directed edges and a control flow edge set in the initial control flow graph;

[0015] Constructing a control graph according to the control edge set and the node set in the initial control flow graph;

[0016] Using a variable definition-use chain to extract data from the initial control flow graph, and outputting a plurality of data dependency edges and a plurality of data flow direction edges;

[0017] Based on the plurality of data dependency edges and the plurality of data flow direction edges, determine a first associated node set, and construct a data graph using the plurality of data dependency edges, the plurality of data flow direction edges and the first associated node set;

[0018] Based on the initial control flow graph, determining a plurality of state variable dependency edges;

[0019] Based on the plurality of state variable dependency edges, determine a second associated node set, and construct a state graph using the plurality of state variable dependency edges and the second associated node set;

[0020] A combined graph is constructed according to the node set and edge set in the state graph, the node set and edge set in the data graph, and the node set and edge set in the control graph.

[0021] Optionally, the using a preset semantic embedding model encoder to output, according to the multi-relation graph to be identified, a plurality of initial embedding representations of nodes corresponding to the multi-relation graph to be identified, comprises:

[0022] Performing feature mapping 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 combination graph, respectively, and outputting a plurality of character sequences corresponding to the control graph, a plurality of character sequences corresponding to the data graph, a plurality of character sequences corresponding to the state graph, and a plurality of character sequences corresponding to the combination graph;

[0023] Determine a plurality of new character sequences corresponding to the control diagram, a plurality of new character sequences corresponding to the data diagram, a plurality of new character sequences corresponding to the state diagram, and a plurality of new character sequences corresponding to the combination diagram based on the plurality of character sequences corresponding to the control diagram, the plurality of character sequences corresponding to the data diagram, the plurality of character sequences corresponding to the state diagram, and the plurality of character sequences corresponding to the combination diagram;

[0024] A preset semantic embedding model encoder is used to encode multiple new character sequences corresponding to the control graph, multiple new character sequences corresponding to the data graph, multiple new character sequences corresponding to the state graph, and multiple new character sequences corresponding to the combination graph to generate 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 combination graph.

[0025] Optionally, the preset 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 initial embedding representation of each node is input into the preset cross-chain transaction type recognition model for recognition, and the cross-chain transaction type recognition result is output, including:

[0026] Using a gated graph neural network to update the states of multiple node initial embedding representations corresponding to the control graph, multiple node initial embedding representations corresponding to the data graph, multiple node initial embedding representations corresponding to the state graph, and multiple node initial embedding representations corresponding to the combination graph, and output 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 combination graph;

[0027] Through the maximum pooling layer, feature fusion is performed on the multiple target hidden states corresponding to the control graph, the multiple target hidden states corresponding to the data graph, the multiple target hidden states corresponding to the state graph, and the multiple target hidden states corresponding to the combination graph, and the target vector representation corresponding to the control graph, the target vector representation corresponding to the data graph, the target vector representation corresponding to the state graph, and the target vector representation corresponding to the combination graph are output;

[0028] Perform feature concatenation on each of the target vector representations to generate a target concatenation vector, and use the target concatenation vector as an input of a first multi-layer perceptron layer to output a target semantic representation;

[0029] Input the target semantic representation into an encoder for encoding, and output an encoder vector;

[0030] A second multi-layer perceptron layer is used to perform transaction type identification on the encoder vector to generate 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] Using a linear layer to perform a linear transformation on the target semantic representation and output a transformed semantic feature;

[0033] performing one-dimensional batch normalization on the transformed semantic features through a one-dimensional batch normalization layer to generate normalized semantic features;

[0034] Using an activation function layer to perform nonlinear transformation on the normalized semantic features and output nonlinear semantic features;

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

[0036] Optionally, the training process of the preset cross-chain transaction type recognition model includes:

[0037] Acquire the transaction to be trained, and generate a multi-relation graph to be trained based on the transaction to be trained using a preset program analysis technology;

[0038] Using a preset semantic embedding model encoder to output initial embedding representations of multiple nodes to be trained corresponding to the multi-relation graph to be trained according to the multi-relation graph to be trained;

[0039] Input the initial embedding 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 recognition result of the cross-chain transaction type to be trained;

[0040] Using a preset initial decoder to perform vector reconstruction according to the encoder vector to be trained, to generate a decoder reconstruction vector;

[0041] Calculate the target loss value using a preset loss function according to the decoder reconstruction vector and the cross-chain transaction type recognition 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, output an intermediate decoder and an intermediate cross-chain transaction type identification model, and count the number of updates in real time;

[0043] Determining whether the number of updates reaches a preset training threshold;

[0044] If achieved, the intermediate cross-chain transaction type recognition model is used as the trained preset cross-chain transaction type recognition model.

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

[0046] An acquisition module, used for acquiring transactions to be identified, and generating a multi-relationship graph to be identified based on the transactions to be identified by using a preset program analysis technology;

[0047] An adopting module is used to adopt a preset semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relation graph to be identified according to the multi-relation graph to be identified;

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

[0049] A third aspect of the present invention provides a computer device, comprising a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the blockchain cross-chain transaction type identification method as described in any one of the above items.

[0050] A fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the blockchain cross-chain transaction type identification method as described in any one of the above items are implemented.

[0051] A fifth aspect of the present invention provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, wherein when the program instructions are executed by a computer, the computer executes the steps of the blockchain cross-chain transaction type identification method as described in any one of the above items.

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

[0053] The above technical scheme of the present invention provides a blockchain cross-chain transaction type identification method, which first obtains a transaction to be identified, and uses a preset program analysis technology to generate a multi-relationship graph to be identified based on the transaction to be identified; then, a preset semantic embedding model encoder is used to output multiple node initial embedding representations corresponding to the multi-relationship graph to be identified according to the multi-relationship graph to be identified; finally, the initial embedding representation of each node is input into a preset cross-chain transaction type identification model for identification, and a cross-chain transaction type identification result is output; based on the above scheme, a preset program analysis technology is used to generate a multi-relationship graph to be identified based on the acquired transaction to be identified, and the multi-relationship graph to be identified is processed based on a preset semantic embedding model encoder and a preset cross-chain transaction type identification model, and a process of outputting a cross-chain transaction type identification result is conducted. The present invention is oriented to the transaction itself, 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present invention 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. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0055] Figure 1 A flowchart of a method for identifying cross-chain transaction types of blockchains provided in Embodiment 1 of the present invention;

[0056] Figure 2 A flowchart of the steps of the training process of the preset cross-chain transaction type identification model provided in the second embodiment of the present invention;

[0057] Figure 3 A training framework diagram of a preset cross-chain transaction type recognition 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 Example 3 of the present invention. DETAILED DESCRIPTION

[0059] The embodiments of the present invention provide a method and device for identifying cross-chain transaction types of blockchain, which are used to solve the technical problem that the accuracy of the identification results caused by the existing cross-chain transaction type identification technology of blockchain is poor.

[0060] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0061] Terminology explanation:

[0062] Blockchain: A distributed database technology designed based on cryptographic principles that stores data through a chain structure of blocks to ensure the data’s immutability, transparency, and traceability.

[0063] Smart contract: An automatically executed program deployed on a blockchain platform. Using preset rules and conditions, the contract terms can be executed without the intervention of a trusted third party, which can effectively realize the automation of value transfer and information processing.

[0064] Transaction binary code: A process or product that converts transaction data into binary form through specific encoding rules. It corresponds to the Input field in the transaction and aims to achieve efficient and accurate network transmission and processing, ensuring 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 preset protocols and mechanisms, it ensures the safe and efficient transfer of assets and information between different blockchains, and promotes the integration and development of the value Internet.

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

[0067] Cross-chain transaction tracking: A means of monitoring and analyzing cross-chain transactions. It aims to achieve the correct matching of source chain deposit transactions and target chain withdrawal transactions in cross-chain transactions in cross-chain scenarios where the physical space is separated from each other through data analysis and tracking technology, ensuring the transparency and traceability of transactions between different blockchains.

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

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

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

[0071] Graph Neural Networks (GNNs): A deep learning model for processing graph data that can learn the feature representations of nodes, edges, and graphs, capture structural information through information transmission mechanisms, and is applied to graph analysis tasks such as node classification and graph classification. It is an important development in the field of graph data.

[0072] See also Figure 1 , Figure 1 A flowchart of the steps of a blockchain cross-chain transaction type identification method provided in Example 1 of the present invention.

[0073] The present invention provides a method for identifying cross-chain transaction types of blockchain, comprising:

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

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

[0076] The preset program analysis technologies include static analysis tools, variable definition-use 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 the given transaction tx to be identified, the interface provided by the third-party library of the web3 client is used to parse the transaction input binary code to obtain the information of the smart contract function f called by the transaction, including but not limited to the function name, parameter name and parameter type, etc. Through the function selector parsed from the input binary code, the corresponding function signature is matched in the contract source code, and the position of the called function in the source code is quickly located according to the function signature. Static analysis technology is 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 according to the transaction to be identified by using the preset 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 a binary code, and determine the smart contract function to be called based on the binary code;

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

[0081] Step S13, using the positive dominance relationship to determine multiple control dependency directed edges according to the initial control flow graph;

[0082] Step S14, constructing a control edge set by using a plurality of control dependency directed edges and a control flow edge set in the initial control flow graph;

[0083] Step S15: construct a control graph according to the control edge set and the node set in the initial control flow graph;

[0084] It should be noted that the static analysis tool Slither of Solidity language is used to construct the control flow graph (CFG) of the called smart contract function, that is, the initial control flow graph CFG. In CFG, each node represents a statement, and the point set composed of nodes is recorded as N. c , that is, the node set N in the initial control flow graph c , each edge represents the control flow between statements, and the edge set consisting of control flow is denoted as E cf , that is, the control flow edge set E in the initial control flow graph cf , using forward dominance relations to obtain control dependency directed edges, which represent the control dependency relations between nodes, denoted by E cd , that is, the edge set E consisting of multiple control-dependent directed edges cd , use E cf and E cd Construct the control edge set E c , and specify E c All edges in the c Based on N c and E c Construct control chart G c .

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

[0086] Step S17: determining a first associated node set based on the multiple data dependency edges and the multiple data flow direction edges, and constructing a data graph using the multiple data dependency edges, the multiple data flow direction edges and the first associated node set;

[0087] It should be noted that based on CFG, the data dependency edge E is extracted with the help of variable definition-use chain. dd and the direction of data flow edge E df , that is, multiple data dependency edges E dd and multiple data flow direction edges E df , by E dd and E df The set of nodes obtained by association is recorded as N d , that is, the first associated node set N d , use E dd and E df Construct edge set E d , and specify E d All edges in the d Based on N d and E d Constructing data graph G d .

[0088] Step S18: determining a plurality of state variable dependency edges based on the initial control flow graph;

[0089] Step S19: determining a second associated node set based on a plurality of state variable dependent edges, and constructing a state graph using the plurality of state variable dependent edges and the second associated node set;

[0090] It should be noted that, based on CFG, multiple state variable dependency edges are constructed, and the edge set E is composed of multiple state variable dependency edges. s , and specify E s All edges in the s The state variable dependency edge points from the statement that reads the state variable to the statement that writes the state variable, represented by E s The set of nodes obtained by association is recorded as N s , that is, the second associated node set N s , using N s and E s Construct state diagram G s .

[0091] Step S110: construct a combined graph according to the node set and edge set in the state graph, the node set and edge set in the data graph, and the node set and edge set in the control graph.

[0092] It should be noted that, taking the control chart G c、Data graph G d And the state diagram G s The union of all point sets and edge sets in the composite graph is constructed respectively. m and edge set E m Among them, the edge set E m The edge types in include T c , T d and T s . Use N m and E m Construct the combined graph G m .

[0093] It is worth mentioning that, for the convenience of discussion, the present invention represents the graph of each viewing angle as follows:

[0094] ;

[0095] in, is the multi-relation graph to be identified, i=1,2,3,4; is the node set corresponding to the i-th graph; is the edge set corresponding to the i-th graph; is a control chart; is a data graph; is a state diagram; For the combination diagram.

[0096] Step 102: Use a preset semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relationship graph to be identified according to the multi-relationship graph to be identified.

[0097] It should be noted that, considering that the acceptable input form of the graph neural network model is a vector, the present invention first converts the graph G i All node features in are mapped to the low-dimensional vector space, and the character sequence s corresponding to the code statement of node u is obtained. u In terms of node embedding representation initialization, in order to obtain a node embedding representation with certain structural semantic information, the present invention uses the pre-trained Infercode semantic embedding model encoder (pre-set semantic embedding model encoder) based on AST, which can effectively support the Solidity language. u Constructs a new character sequence.

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

[0099] Step S21, 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 combination graph, and multiple character sequences corresponding to the control graph, multiple character sequences corresponding to the data graph, multiple character sequences corresponding to the state graph, and multiple character sequences corresponding to the combination graph are output;

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

[0101] Step S22, based on the multiple character sequences corresponding to the control diagram, the multiple character sequences corresponding to the data diagram, the multiple character sequences corresponding to the state diagram, and the multiple character sequences corresponding to the combination diagram, determine multiple new character sequences corresponding to the control diagram, the multiple new character sequences corresponding to the data diagram, the multiple new character sequences corresponding to the state diagram, and the multiple new character sequences corresponding to the combination diagram;

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

[0103] ;

[0104] in, is the new character sequence corresponding to node u; The first character sequence is separated by a marker; is the character sequence corresponding to node u; Separate marker for the second character sequence.

[0105] Step S23, use a preset semantic embedding model encoder to encode multiple new character sequences corresponding to the control graph, multiple new character sequences corresponding to the data graph, multiple new character sequences corresponding to the state graph, and multiple new character sequences corresponding to the combination graph, to generate 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 combination graph.

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

[0107] ;

[0108] in, is the initial node embedding representation corresponding to node u; Preset semantic embedding model encoder; is the new character sequence corresponding to node u; is the hidden dimension of the encoder; Pre-trained parameters for the encoder of the pre-set semantic embedding model.

[0109] It is worth mentioning that for the initialization of edge embedding representation, the edges with the same direction between two nodes are first merged into a joint semantic edge. In order to retain multiple semantic combinations between two nodes, a 3-dimensional unique hot vector is used here to encode the multi-semantic edge. Each dimension represents T c , T d and T s Assume that there are two nodes u and v. If there are three types of directed edges from u to v, the one-hot vector of the merged joint semantic edge is [1, 1, 1].

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

[0111] The preset cross-chain transaction type recognition model includes a gated graph neural network, an encoder and a multi-layer perceptron layer (MLP layer, Multilayer Perceptron), and the multi-layer perceptron layer includes a first multi-layer perceptron layer and a second multi-layer perceptron layer.

[0112] It should be noted that the gated neural network has certain advantages in analyzing the multi-dimensional association graph of the code, which is mainly reflected in its ability to efficiently deal with 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 shows a high degree of flexibility and can adapt to the diverse forms and nonlinear complexity of the control flow graph, especially when dealing with advanced organizational forms such as tree structures. Therefore, in the design of the cross-chain semantic extraction network, the gated graph neural network is chosen as the main body and the multi-view relationship graph is used as the input to achieve effective semantic detection.

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

[0114] Step S31, using a gated graph neural network to update the states of multiple node initial embedding representations corresponding to the control graph, multiple node initial embedding representations corresponding to the data graph, multiple node initial embedding representations corresponding to the state graph, and multiple node initial embedding representations corresponding to the combination graph, and output 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 combination graph;

[0115] It should be noted that the initial node embedding representation corresponding to each node in each graph (i.e., control graph, data graph, state graph, and combination graph) is input into the gated graph neural network for state update to obtain the final hidden state (target hidden state) corresponding to each node in each graph; the processing process of the gated graph neural network can be expressed as:

[0116] ;

[0117] ;

[0118] ;

[0119] in, is the information received by node u from node v at the tth iteration; is the message passing function, which depends on the edge type of e; is the hidden state of node v starting from iteration t-1; e is the edge connecting node u and node v; is the edge set corresponding to the i-th graph; is the aggregate information received by node u; is the average pooling function; is the neighbor set of node u; It is a gate circulation unit; is the hidden state of node u at iteration t. When t=T, the target hidden state corresponding to node u is obtained. ; is the hidden state of node v at iteration t-1.

[0120] Step S32, performing feature fusion on the multiple target hidden states corresponding to the control graph, the multiple target hidden states corresponding to the data graph, the multiple target hidden states corresponding to the state graph, and the multiple target hidden states corresponding to the combination graph through the maximum pooling layer, and outputting the target vector representation corresponding to the control graph, the target vector representation corresponding to the data graph, the target vector representation corresponding to the state graph, and the target vector representation corresponding to the combination graph;

[0121] It should be noted that after T iterations of the initial embedding representation of the node in the gated graph neural network, the hidden state will contain enough information for the given graph. Therefore, in the last iteration, the hidden state of the node is obtained and the maximum pooling is used to fuse their features to obtain the graph G i The final vector representation (target vector representation) of , where the processing flow of the target vector representation can be expressed as:

[0122] ;

[0123] in, is the target vector representation of the i-th graph; is the maximum pooling layer; is the target hidden state corresponding to node u; is the node set corresponding to the i-th graph.

[0124] Step S33, performing feature concatenation on each target vector representation to generate a target concatenation vector, and using the target concatenation vector as the input of the first multi-layer perceptron layer to output the target semantic representation;

[0125] It should be noted that in order to extract the overall semantic representation of the transaction, the representations from all graphs are connected here and input into the MLP neural network layer, and the output of the MLP is used as the final semantic representation of the transaction. Specifically, the target vector representation corresponding to the control graph, the target vector representation corresponding to the data graph, the target vector representation corresponding to the state graph, and the target vector representation corresponding to the combination graph are feature concatenated to output the target concatenated vector, which is used as the input of the first multi-layer perceptron layer to output the target semantic representation; the processing process of the target semantic representation can be expressed as:

[0126] ;

[0127] Among them, z is the target semantic representation; is the target vector representation corresponding to the control chart; is a first multi-layer perceptron layer, the first multi-layer perceptron layer includes a nonlinear layer and a Sigmoid activation function layer; For feature stitching; is the target vector representation corresponding to the data graph; is the target vector representation corresponding to the state diagram; is the target vector representation corresponding to the combined graph.

[0128] Step S34, input the target semantic representation to 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 (1D Batch Normalization), 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, using a linear layer to perform a linear transformation on the target semantic representation, and outputting the transformed semantic features;

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

[0133] Step S343: using an activation function layer to perform nonlinear transformation on the normalized semantic features, and outputting nonlinear semantic features;

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

[0135] It should be noted that the processing of the encoder can be expressed as:

[0136] ;

[0137] in, is the encoder vector; For encoder; is the random dropout layer in the encoder; z is the target semantic representation; It is the ReLU activation function layer; is the 1D batch normalization layer in the encoder; is the first input linear layer parameter of the encoder; The second input linear layer parameters of the encoder; is the drop probability of the encoder.

[0138] Step S35: Use the second multi-layer perceptron layer to identify the transaction type of the encoder vector and generate a 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 to generate a cross-chain transaction type identification result (transaction classification result), where the relationship between the transaction to be identified and the transaction to be matched mainly includes the following three situations, that is, the cross-chain transaction type identification result is divided into three situations: 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 the 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 the source chain deposit transaction.

[0140] Furthermore, the processing flow of the second multi-layer perceptron layer can be expressed as:

[0141] ;

[0142] in, Identify the results of cross-chain transaction types; is the second multi-layer perceptron layer; is the encoder vector; It is the Softmax activation function layer; It is the ReLU activation function layer; is the first output parameter of the second multi-layer perceptron layer; is the first input parameter of the second multi-layer perceptron layer; is a second input parameter of the second multi-layer perceptron layer; is the second output parameter of the second multi-layer perceptron layer.

[0143] As a comparison of technical effects, it can be combined with existing technologies for reference. As the primary link of tracking technology, cross-chain semantic recognition aims to extract and identify cross-chain transaction semantics through analysis of cross-chain transaction-related data and behaviors, and provide important information for downstream tasks such as cross-chain transaction tracking, so as to improve the effectiveness and accuracy of cross-chain transaction tracking. It can be seen that cross-chain semantic recognition, as an important technology for cross-chain security defense, lays the foundation for effective supervision and risk control. Most of the existing blockchain semantic recognition technologies are oriented to single-chain scenarios or specific financial security issues, such as Ponzi schemes and contract vulnerabilities on blockchains. On the issue of blockchain smart contract semantics, the existing blockchain semantic recognition technology proposes a static analysis tool based on machine learning to effectively extract contract vulnerability semantics. On the issue of identifying the transaction semantics of blockchain Ponzi schemes, the existing blockchain semantic recognition technology defines a new code representation called slice transaction property graph (sTPG). By representing the transaction-related semantics of smart contracts as a graph, the graph neural network technology is used to learn the potential Ponzi transaction pattern from it. In the problem of transaction semantic recognition, the existing blockchain semantic recognition technology uses a motif network semantic representation method based on transaction transfer, which can capture transaction semantic information in real-time transaction data workflows.

[0144] Based on the above foundation, the main body of existing semantic recognition technology is smart contracts, such as contract vulnerability analysis, and lacks analysis of individual transactions. This means that the existing semantic recognition technology mainly focuses on the semantic information of the contract as a whole, and cannot focus well on the semantic information of a single transaction; the existing transaction semantic recognition technology is mainly designed for a specific blockchain security issue and lacks a certain degree of versatility. This makes the existing technology able to achieve good results in identifying blockchain financial security issues such as Ponzi schemes, but due to the strong specificity of the method and its limitations in logical processing, it is difficult to effectively detect the semantic information corresponding to cross-chain behavior; the application scenarios of existing transaction semantic recognition technology are mainly oriented to single chains, and the actual cross-chain application scenarios are more complex than single-chain application scenarios, which means that when the transaction semantic recognition technology under a single chain is migrated and applied to cross-chain scenarios, it is easy to have problems such as low recognition rate and insufficient compatibility due to incomplete information consideration.

[0145] In response to the above problems, the present invention proposes a blockchain cross-chain transaction type identification method, designs a multi-view semantic extraction process for constructing a control flow graph of the transaction function source code and a new cross-chain semantic detection framework, and encodes the transaction matching information. The framework can effectively detect cross-chain behaviors from multiple perspectives, and classify source chain deposit transactions, target chain withdrawal transactions, and non-cross-chain transactions through a transaction matching information fusion algorithm. At the same time, the integration of cross-chain transaction pair information can further enhance the recognition of cross-chain semantics and provide assistance for downstream tasks such as cross-chain transaction tracking.

[0146] In summary, compared with the existing methods for semantic recognition of smart contracts, the present invention is oriented to cross-chain transactions themselves, and can effectively focus on the cross-chain behavior and semantic information of the transaction itself. At the same time, compared with the existing semantic recognition methods for specific problems, the present invention considers the fusion of transaction matching information in the cross-chain context, and enhances the stability and reliability of the method. In addition, compared with the existing semantic recognition methods for single chains, the present invention is oriented to cross-chain application scenarios, and can provide accurate semantic information for downstream tasks such as cross-chain transaction tracking.

[0147] In an embodiment of the present invention, the present invention provides a blockchain cross-chain transaction type identification method, which first obtains a transaction to be identified, and uses a preset program analysis technology to generate a multi-relationship graph to be identified based on the transaction to be identified; then, a preset semantic embedding model encoder is used to output multiple node initial embedding representations corresponding to the multi-relationship graph to be identified based on the multi-relationship graph to be identified; finally, the initial embedding representation of each node is input into a preset cross-chain transaction type identification model for identification, and a cross-chain transaction type identification result is output; based on the above scheme, a preset program analysis technology is used to generate a multi-relationship graph to be identified based on the acquired transaction to be identified, and the multi-relationship graph to be identified is processed based on the preset semantic embedding model encoder and the preset cross-chain transaction type identification model, and the process of outputting the cross-chain transaction type identification result is oriented to the transaction itself, 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 , a flowchart of the steps of the training process of the preset cross-chain transaction type identification model provided in the second embodiment of the present invention, the process may include the following steps:

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

[0150] Please note that Figure 3, the training phase of the initial cross-chain transaction type recognition model is similar to the detection phase. In the model training phase, the training transaction to be trained is first parsed to obtain the binary code to be trained, the source code corresponding to the training transaction function is obtained, and four semantic relationship graphs, namely the control graph, data graph, state graph, and combination graph, are constructed based on static analysis technology for model training. Secondly, the cross-chain semantic representation in the semantic relationship graph is extracted by the gated graph neural network model. Finally, the encoder-decoder network framework is used to realize the fusion of transaction matching information. In the detection phase, the present invention applies the preset cross-chain transaction type recognition model obtained in the training phase to detect and extract the cross-chain semantics of the transaction, and maps the transaction to three possible categories: source chain deposit transaction, target chain withdrawal transaction, and non-cross-chain transaction. Specifically, the semantic representation of the transaction is obtained, and then the semantic representation is input into the encoder module in the encoder-decoder network framework to obtain the transaction representation of the fused matching information. Finally, the transaction representation is input into the MLP, and the transaction is mapped into categories to realize cross-chain transaction semantic recognition.

[0151] It is worth mentioning that, during the training phase, the present invention uses the source code semantic feature z of the transaction to be identified for model training as input, the source code semantic feature z* of the transaction to be matched 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: Use a preset semantic embedding model encoder to output initial embedding representations of multiple nodes to be trained corresponding to the multi-relation graph to be trained according to the multi-relation graph to be trained.

[0153] Step 203: Input the initial embedding 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 perform vector reconstruction according to the encoder vector to be trained to generate a decoder reconstruction vector.

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

[0156] ;

[0157] in, Reconstruct vector for decoder; To preset the initial decoder; is the encoder vector; are the parameters of the first output linear layer of the decoder; is the 1D batch normalization layer in the decoder; The first input linear layer parameters of the decoder; The second input linear layer parameters of the decoder; is the discard probability of the decoder; are the parameters of the second output linear layer of the decoder; is the random dropout layer in the decoder; z is the target semantic representation; It is the ReLU activation function layer.

[0158] Step 205: Use a preset loss function to calculate a target loss value based on the decoder reconstruction vector and the cross-chain transaction type recognition result to be trained.

[0159] It should be noted that the present invention considers transaction reconstruction and transaction classification, and sets joint training and loss weighting, wherein the preset loss function can be expressed as:

[0160] ;

[0161] in, is the target loss value; is the first hyperparameter, used to adjust the relative importance of the two loss functions; is the reconstruction loss value; is the second hyperparameter, used to adjust the relative importance of the two loss functions; is the classification loss value; is the mean square error loss value; M is the number of samples; D is the dimension of the reconstruction vector; is the value of the real reconstructed target vector in the jth dimension; Reconstruct the value of the decoder vector in the jth dimension; is the cross entropy loss value; C is the number of classification categories; is the true value of the true label vector in class c; The predicted value of the transaction type (the result of the cross-chain transaction type identification to be trained) in the cth category.

[0162] Step 206: Use the target loss value to update the network parameters of the preset initial decoder and the network parameters of the initial cross-chain transaction type identification model, 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 reaches a preset training threshold.

[0164] Step 208: If reached, the intermediate cross-chain transaction type recognition model is used as the trained preset cross-chain transaction type recognition model.

[0165] It should be noted that after the network parameters of the preset initial decoder and the network parameters of the initial cross-chain transaction type recognition model are updated based on the target loss value, it is determined whether the number of updates reaches the preset training threshold. If the number of updates reaches 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 does not reach 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 the process jumps to execute step 202 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 an embodiment of the present invention, the transaction to be trained for training is parsed to obtain the binary code to be trained, the source code corresponding to the transaction function to be trained is obtained, and four semantic relationship diagrams, namely, control diagram, data diagram, state diagram, and combination diagram, are constructed based on static analysis technology for model training. Secondly, the cross-chain semantic representation in the semantic relationship diagram is extracted through the gated graph neural network model. Finally, the encoder-decoder network framework is used to realize the fusion of transaction matching information and complete the training of the preset cross-chain transaction type recognition model. The present invention enhances transaction pairing information through the encoder-decoder network architecture, improves the distinction between cross-chain transactions and non-cross-chain transactions, and realizes the effective classification of source chain deposit transactions, target chain withdrawal transactions, and non-cross-chain transactions.

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

[0168] The present 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 generate a multi-relationship graph to be identified based on the transaction to be identified using a preset program analysis technology;

[0170] Adopting module 402, for adopting a preset semantic embedding model encoder to output a plurality of initial embedding representations of nodes corresponding to the multi-relation graph to be identified according to the multi-relation graph to be identified;

[0171] The identification module 403 is used to input the initial embedding representation of each node into a 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 diagrams, data diagrams, state diagrams, and combination diagrams; the preset program analysis techniques include static analysis tools, variable definition-use chains, and positive dominance relationships; the acquisition module 401 is specifically used for:

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

[0174] Use static analysis tools to build the initial control flow graph based on the smart contract function being called;

[0175] Using positive dominance relations, multiple control-dependent directed edges are determined according to the initial control flow graph;

[0176] A control edge set is constructed by using a plurality of control dependency directed edges and a control flow edge set in an initial control flow graph;

[0177] Construct a control graph according to the control edge set and the node set in the initial control flow graph;

[0178] The variable definition-use chain is used to extract data from the initial control flow graph, and multiple data dependency edges and multiple data flow direction edges are output;

[0179] Determine a first associated node set based on a plurality of data dependency edges and a plurality of data flow direction edges, and construct a data graph using the plurality of data dependency edges, the plurality of data flow direction edges and the first associated node set;

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

[0181] Determine a second associated node set based on the plurality of state variable dependent edges, and construct a state graph using the plurality of state variable dependent edges and the second associated node set;

[0182] A composite graph is constructed according to the node set and edge set in the state graph, the node set and edge set in the data graph, and the node set and edge set in the control graph.

[0183] Further, module 402 is used to:

[0184] Perform feature mapping 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 combination graph, respectively, and output multiple character sequences corresponding to the control graph, multiple character sequences corresponding to the data graph, multiple character sequences corresponding to the state graph, and multiple character sequences corresponding to the combination graph;

[0185] Determine multiple new character sequences corresponding to the control diagram, multiple new character sequences corresponding to the data diagram, multiple new character sequences corresponding to the state diagram, and multiple new character sequences corresponding to the combination diagram based on multiple character sequences corresponding to the control diagram, multiple character sequences corresponding to the data diagram, multiple character sequences corresponding to the state diagram, and multiple character sequences corresponding to the combination diagram;

[0186] A preset semantic embedding model encoder is used to encode multiple new character sequences corresponding to the control graph, multiple new character sequences corresponding to the data graph, multiple new character sequences corresponding to the state graph, and multiple new character sequences corresponding to the combination graph to generate 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 combination graph.

[0187] Furthermore, the preset 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 use a gated graph neural network to update the states of multiple node initial embedding representations corresponding to the control graph, multiple node initial embedding representations corresponding to the data graph, multiple node initial embedding representations corresponding to the state graph, and multiple node initial embedding representations corresponding to the combination graph, and output 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 combination graph;

[0189] The second submodule is used to perform feature fusion on the multiple target hidden states corresponding to the control graph, the multiple target hidden states corresponding to the data graph, the multiple target hidden states corresponding to the state graph, and the multiple target hidden states corresponding to the combination graph through the maximum pooling layer, and output the target vector representation corresponding to the control graph, the target vector representation corresponding to the data graph, the target vector representation corresponding to the state graph, and the target vector representation corresponding to the combination graph;

[0190] The third submodule is used to perform feature concatenation on each target vector representation to generate a target concatenation vector, and use the target concatenation vector as the input of the first multi-layer 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 use the second multi-layer perceptron layer to identify the transaction type of the encoder vector and generate a cross-chain transaction type identification result.

[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 output the transformed semantic features;

[0195] Performing one-dimensional batch normalization on the transformed semantic features through a one-dimensional batch normalization layer to generate normalized semantic features;

[0196] The activation function layer is used to perform nonlinear transformation on the normalized semantic features and output nonlinear semantic features;

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

[0198] In an optional embodiment, the device further comprises:

[0199] The first module is used to obtain the transactions to be trained, and use the preset program analysis technology to generate the multi-relationship graph to be trained according to the transactions to be trained;

[0200] The second module is used to use a preset semantic embedding model encoder to output initial embedding representations of multiple nodes to be trained corresponding to the multi-relation graph to be trained according to the multi-relation graph to be trained;

[0201] The third module is used to input the initial embedding 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 recognition result of the cross-chain transaction type to be trained;

[0202] A fourth module is used to use a preset initial decoder to perform vector reconstruction according to the encoder vector to be trained, and generate a decoder reconstruction vector;

[0203] The fifth module is used to calculate the target loss value according to 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 preset initial decoder and the network parameters of the initial cross-chain transaction type recognition model using the target loss value, output the intermediate decoder and the intermediate cross-chain transaction type recognition model, and count the number of updates in real time;

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

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

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

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

[0209] An embodiment of the present invention also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the blockchain cross-chain transaction type identification method as in any of the above embodiments are implemented.

[0210] An embodiment of the present 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 in any of the above embodiments.

[0211] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

[0213] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions 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 of blockchain, characterized in that: include: Acquire the transaction to be identified, and generate a multi-relation graph to be identified based on the transaction to be identified using a preset program analysis technology; Using a preset semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relation graph to be identified according to the multi-relation graph to be identified; The initial embedding representation of each of the nodes is input into a preset cross-chain transaction type recognition model for recognition, and a cross-chain transaction type recognition result is output.

2. The blockchain cross-chain transaction type identification method according to claim 1 is characterized in that: The multi-relationship diagrams to be identified include control diagrams, data diagrams, state diagrams and combination diagrams; the preset program analysis techniques include static analysis tools, variable definition-use chains and positive dominance relationships; The method of using a preset program analysis technology to generate a multi-relationship graph to be identified according to the transaction to be identified includes: Parsing the transaction to be identified, outputting a binary code, and determining the smart contract function to be called based on the binary code; Use static analysis tools to build the initial control flow graph based on the smart contract function being called; Determine a plurality of control-dependent directed edges according to the initial control flow graph using a positive dominance relationship; Constructing a control edge set by using a plurality of the control dependency directed edges and a control flow edge set in the initial control flow graph; Constructing a control graph according to the control edge set and the node set in the initial control flow graph; Using a variable definition-use chain to extract data from the initial control flow graph, and outputting a plurality of data dependency edges and a plurality of data flow direction edges; Based on the plurality of data dependency edges and the plurality of data flow direction edges, determine a first associated node set, and construct a data graph using the plurality of data dependency edges, the plurality of data flow direction edges and the first associated node set; Based on the initial control flow graph, determining a plurality of state variable dependency edges; Based on the plurality of state variable dependency edges, determine a second associated node set, and construct a state graph using the plurality of state variable dependency edges and the second associated node set; A combined graph is constructed according to the node set and edge set in the state graph, the node set and edge set in the data graph, and the node set and edge set in the control graph.

3. The blockchain cross-chain transaction type identification method according to claim 2 is characterized in that: The method of using a preset semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relation graph to be identified according to the multi-relation graph to be identified includes: Performing feature mapping 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 combination graph, respectively, and outputting a plurality of character sequences corresponding to the control graph, a plurality of character sequences corresponding to the data graph, a plurality of character sequences corresponding to the state graph, and a plurality of character sequences corresponding to the combination graph; Determine a plurality of new character sequences corresponding to the control diagram, a plurality of new character sequences corresponding to the data diagram, a plurality of new character sequences corresponding to the state diagram, and a plurality of new character sequences corresponding to the combination diagram based on the plurality of character sequences corresponding to the control diagram, the plurality of character sequences corresponding to the data diagram, the plurality of character sequences corresponding to the state diagram, and the plurality of character sequences corresponding to the combination diagram; A preset semantic embedding model encoder is used to encode multiple new character sequences corresponding to the control graph, multiple new character sequences corresponding to the data graph, multiple new character sequences corresponding to the state graph, and multiple new character sequences corresponding to the combination graph to generate 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 combination graph.

4. The blockchain cross-chain transaction type identification method according to claim 3 is characterized in that: The preset 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 initial embedding representation of each node is input into the preset cross-chain transaction type recognition model for recognition, and the cross-chain transaction type recognition result is output, including: Using a gated graph neural network to update the states of multiple node initial embedding representations corresponding to the control graph, multiple node initial embedding representations corresponding to the data graph, multiple node initial embedding representations corresponding to the state graph, and multiple node initial embedding representations corresponding to the combination graph, and output 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 combination graph; Through the maximum pooling layer, feature fusion is performed on the multiple target hidden states corresponding to the control graph, the multiple target hidden states corresponding to the data graph, the multiple target hidden states corresponding to the state graph, and the multiple target hidden states corresponding to the combination graph, and the target vector representation corresponding to the control graph, the target vector representation corresponding to the data graph, the target vector representation corresponding to the state graph, and the target vector representation corresponding to the combination graph are output; Perform feature concatenation on each of the target vector representations to generate a target concatenation vector, and use the target concatenation vector as an input of a first multi-layer perceptron layer to output a target semantic representation; Input the target semantic representation into an encoder for encoding, and output an encoder vector; A second multi-layer perceptron layer is used to perform transaction type identification on the encoder vector to generate a cross-chain transaction type identification result.

5. The blockchain cross-chain transaction type identification method according to claim 4 is 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 target semantic representation is input to the encoder for encoding, and an encoder vector is output, including: Using a linear layer to perform a linear transformation on the target semantic representation and output a transformed semantic feature; performing one-dimensional batch normalization on the transformed semantic features through a one-dimensional batch normalization layer to generate normalized semantic features; Using an activation function layer to perform nonlinear transformation on the normalized semantic features and output nonlinear semantic features; The nonlinear semantic features are used as input to the random dropout layer, and an encoder vector is output.

6. The blockchain cross-chain transaction type identification method according to claim 1 is characterized in that: The training process of the preset cross-chain transaction type recognition model includes: Acquire the transaction to be trained, and generate a multi-relation graph to be trained based on the transaction to be trained using a preset program analysis technology; Using a preset semantic embedding model encoder to output initial embedding representations of multiple nodes to be trained corresponding to the multi-relation graph to be trained according to the multi-relation graph to be trained; Input the initial embedding 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 recognition result of the cross-chain transaction type to be trained; Using a preset initial decoder to perform vector reconstruction according to the encoder vector to be trained, to generate a decoder reconstruction vector; Calculate the target loss value using a preset loss function according to the decoder reconstruction vector and the cross-chain transaction type recognition 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, output an intermediate decoder and an intermediate cross-chain transaction type identification model, and count the number of updates in real time; Determining whether the number of updates reaches a preset training threshold; If achieved, the intermediate cross-chain transaction type recognition model is used as the trained preset cross-chain transaction type recognition model.

7. A blockchain cross-chain transaction type identification device, characterized in that: include: An acquisition module, used for acquiring transactions to be identified, and using a preset program analysis technology to generate a multi-relationship graph to be identified based on the transactions to be identified; An adopting module is used to adopt a preset semantic embedding model encoder to output initial embedding representations of multiple nodes corresponding to the multi-relation graph to be identified according to the multi-relation graph to be identified; The identification module is used to input the initial embedding representation of each node into a preset cross-chain transaction type identification model for identification, and output a cross-chain transaction type identification result.

8. A computer device, characterized in that: It includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the blockchain cross-chain transaction type identification method as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the blockchain cross-chain transaction type identification method as described in any one of claims 1 to 6 is implemented.

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

Citation Information

Patent Citations

  • Cross-chain transaction method for block chain heterogeneous chain

    CN112150284A

  • 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

Cited By

  • Administrative institution internal control information processing method and system based on big data analysis

    CN119989421A