An artificial intelligence-based blockchain abnormal transaction detection method

By building blockchain transaction graphs and using attention mechanisms and graph convolution networks for encoding, combined with feedforward neural networks, the problem of difficult to identify complex abnormal transactions in traditional methods is solved, and more efficient and accurate abnormal transaction detection is achieved, and enhanced The security of blockchain networks.

CN117495566BActive Publication Date: 2024-12-20HARBIN HARBIN CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311521960.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-15
Publication Date
2024-12-20
Estimated Expiration
2043-11-15

AI Technical Summary

Technical Problem

Traditional blockchain abnormal transaction detection methods are difficult to capture complex nonlinear and dynamic transaction models, and cannot be effectively identified in the face of new and unknown fraudulent methods, which affects the reputation and stability of the blockchain network.

Method used

Using an artificial intelligence-based method, by constructing a blockchain transaction graph, using attention mechanism and graph convolution network to encode the information of the transaction node and its surrounding nodes, combined with the feedforward neural network to perform binary classification, and predict whether the transaction is an abnormal transaction. , improves generalization ability.

Benefits of technology

Effectively identifying abnormal transactions improves the accuracy and generalization ability of detection, prevents gang behavior from affecting judgment, and enhances the security and stability of the blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117495566B_ABST
    Figure CN117495566B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of big data processing, and specifically relates to a method for detecting abnormal transactions in blockchain based on artificial intelligence, comprising: obtaining blockchain transaction data and constructing a graph structure, encoding transaction node features and features of its neighboring nodes in the graph using an Attention mechanism and a GCN model, concatenating the encoded transaction node features and neighboring node features, and performing binary classification through a feedforward neural network to predict whether the transaction is an abnormal transaction; when encoding the neighboring nodes of each transaction node, the present invention increases the field of view of the model, considers multi-hop node information around the node, and improves the accuracy of abnormal transaction identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of big data processing, and specifically relates to a method for detecting abnormal transactions in blockchain based on artificial intelligence. Background Art

[0002] In today's digital age, blockchain technology and artificial intelligence technology, as two disruptive innovations, have shown great potential in various fields. Blockchain technology, with its characteristics of decentralization, immutability, and transparency, has been widely used in finance, supply chain management, healthcare and other fields, realizing the secure storage and traceability of information. However, with the increasing popularity of blockchain applications, the problem of abnormal transactions has gradually attracted people's attention. In the blockchain network, abnormal transactions may include illegal activities such as fraud and malicious attacks. These abnormal transactions will not only bring huge economic losses to the participants, but also affect the credibility and stability of the entire blockchain network. Therefore, it has become crucial to develop an efficient and accurate method for detecting abnormal transactions.

[0003] Traditional blockchain abnormal transaction detection methods are usually based on rules and statistics, such as using pre-defined rule sets to detect abnormal transactions based on specific patterns or rules in transaction data. However, these methods have difficulty capturing complex nonlinear and dynamic transaction patterns, and cannot effectively identify new and unknown fraudulent methods. Summary of the invention

[0004] In order to solve the above technical problems, the present invention proposes a blockchain abnormal transaction detection method based on artificial intelligence, comprising:

[0005] S1. Obtain blockchain transaction data and construct blockchain transaction graph G;

[0006] The blockchain transaction data includes: transaction initiator, transaction recipient, transaction hash, address of transaction initiator, address of transaction recipient, transaction amount, transaction fee, transaction signature, transaction timestamp, block height, number of confirmations, transaction type, and transaction related information;

[0007] S2. For each transaction, extract a subgraph g from the blockchain transaction graph G with the transaction node as the center, encode the transaction node information and the neighboring information of the transaction node respectively, and obtain the transaction node feature vector h ego and the neighboring node feature vector h nei ;

[0008] S3, h ego With h nei After splicing, the data is sent to the feedforward neural network for binary classification to predict whether this transaction is an abnormal transaction.

[0009] Beneficial effects of the present invention:

[0010] The present invention constructs a blockchain transaction graph network using transaction data in the blockchain, and uses the attention mechanism and graph convolutional network to mine the information of each transaction node itself and the information of its surrounding transaction nodes. By comparing the differences between transaction nodes, it determines whether the transaction is abnormal. When encoding the information of surrounding nodes, the information of more distant nodes is taken into account to prevent gang behavior from affecting the judgment of transaction nodes, thereby improving the generalization ability of abnormal transaction detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 This is a flow chart of an artificial intelligence-based blockchain abnormal transaction detection method of the present invention. DETAILED DESCRIPTION

[0012] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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.

[0013] An artificial intelligence-based blockchain abnormal transaction detection method, such as Figure 1 As shown, including:

[0014] S1. Obtain blockchain transaction data and construct blockchain transaction graph G;

[0015] The blockchain transaction data includes: transaction initiator, transaction recipient, transaction hash, address of transaction initiator, address of transaction recipient, transaction amount, transaction fee, transaction signature, transaction timestamp, block height, number of confirmations, transaction type, and transaction related information;

[0016] S2. For each transaction, extract a subgraph g from the blockchain transaction graph G with the transaction node as the center, encode the transaction node information and the neighboring information of the transaction node respectively, and obtain the transaction node feature vector h ego and the neighboring node feature vector h nei ;

[0017] S3, h ego With h nei After splicing, the data is sent to the feedforward neural network for binary classification to predict whether this transaction is an abnormal transaction.

[0018] Construct the blockchain financial graph G, including:

[0019] The transaction initiator and the transaction receiver in the blockchain transaction are taken as graph nodes, and the two nodes are connected into an edge according to their addresses, and the transaction hash, transaction amount, transaction fee, transaction signature, transaction timestamp, block height, number of confirmations, transaction type, and transaction association information are taken as the initial feature vector of each node. The graph node includes:

[0020] v i ={x1,x2,…,x n}

[0021] Among them, v i represents the i-th graph node, x i represents the i-th element of the graph node feature vector, and n represents the dimension of the graph node feature vector.

[0022] For each transaction, a subgraph g is extracted from the blockchain transaction graph G with the transaction node as the center, including:

[0023] Extract all nodes with path r around the node to form a subgraph g, where the determination of path r includes:

[0024]

[0025] Where N is the number of nodes in the graph, V k Represents the kth node in the graph, Degree(V k ) represents the degree of the kth node.

[0026] Using the Attention mechanism and the GCN model, we encode the transaction node information and the transaction node neighbor information respectively to obtain the node feature vector h egi and the neighboring node feature vector h nei ,include:

[0027] Step 1: Concatenate all nodes in subgraph g to obtain the feature vector h of the node sequence of graph g v .

[0028] All nodes in the subgraph g are concatenated to obtain the feature vector h of the node sequence of graph g. v ,include:

[0029] h v =[v0,v1,…,v |V| ]

[0030] Among them, v i represents the i-th node in the subgraph g, with a dimension of 1×n, h v The feature vector representing the node sequence of graph g has a dimension of |V|×n, where |V| represents the number of nodes in subgraph g and n represents the dimension of the graph node feature vector.

[0031] Step 2: Use the Attention mechanism to encode the node information and obtain the feature vector h of the transaction node ego .

[0032] Step 3: Construct the adjacency matrix M based on the connection status of each node in graph g adj , whose dimension is |V|×|V|, |V| represents the number of nodes in the subgraph g. If the i-th node v i With the jth node v in the graph j If there is an edge between them, then A adj [i, j] = 1, otherwise A adj [i, j]=0.

[0033] Step 4: Use the Flody algorithm to calculate the adjacency matrix M. adj Calculate the distance matrix M of subgraph g dis , whose dimension is |V|×|V|, M dis [i, j] represents node v i With node v j The shortest path distance.

[0034] Step 5: Use the adjacency matrix M adj and the distance matrix M dis , the neighboring node information of the transaction node is encoded through the GCN model to obtain the neighboring node feature vector h nei .

[0035] Use the Attention mechanism to encode the node information and obtain the feature vector h of the transaction node. ego ,include:

[0036] Set all elements except the diagonal in the identity matrix I to negative infinity, so that each node only pays attention to its own information and ignores the information of surrounding nodes, and obtains the mask matrix E, including:

[0037]

[0038] Encode the information of each node in graph g, and the calculation formula is as follows:

[0039]

[0040] Among them, h ego represents the feature vector of the transaction node, with a dimension of 1×n. W1 and W2 represent the first and second feature conversion matrices with dimensions of n×128, respectively. W3 represents the third feature conversion matrix with a dimension of n×n. ⊙ represents the element-by-element multiplication operation. |V| represents the number of nodes in the subgraph g. h vrepresents the feature vector of the node sequence of graph g, T represents matrix transpose, E represents the identity matrix, and n represents the dimension of the graph node feature vector.

[0041] Using the adjacency matrix M adj and the distance matrix M dis , the neighboring node information of the transaction node is encoded through the GCN model to obtain the neighboring node feature vector h nei ,include:

[0042] Through the distance matrix M dis , get the 2-hop adjacency matrix of graph g The calculation formula is as follows:

[0043]

[0044] In order to make each node pay attention to the surrounding nodes instead of the node itself during message transmission, the adjacency matrix M needs to be adj and the 2-hop adjacency matrix The diagonal elements of are set to 0, and the calculation formula for encoding node neighbor information using the GCN model is as follows:

[0045]

[0046]

[0047] The dimension of the M matrix is ​​|V|×|V|, the diagonal elements are 0, and the remaining elements are 1. Its function is to exclude the node's own information when the model transmits neighboring information. Indicates M adj +E's degree matrix, express The degree matrix, I represents the identity matrix, h nei Represents the feature vector of neighboring nodes. The feature vector of each node comes from the nodes around it, and the dimension is 1×n.

[0048] h ego With h nei After splicing, the data is sent to the feedforward neural network for binary classification to predict whether this transaction is an abnormal transaction. The formula is as follows:

[0049] Output = argmax(W out [h ego ,h nei ])

[0050] Among them, Output represents the binary classification prediction result output by the feedforward neural network, Output = 0 means that this transaction is not an abnormal transaction, and Output = 1 means that this transaction is an abnormal transaction; W outRepresents the feature transformation matrix, with a dimension of 2n×2, [h ego ,h nei ] means concatenating the transaction node feature vector and the neighboring node feature vector in the hidden layer dimension, with a dimension of 1×2n. out The feature vector [h ego ,h nei ] is mapped to a one-dimensional vector, which contains two eigenvalues. argmax() represents the argmax function and outputs the subscript of the maximum eigenvalue in the one-dimensional vector.

[0051] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A blockchain abnormal transaction detection method based on artificial intelligence, characterized in that: include: S1. Obtain blockchain transaction data and construct blockchain transaction graph G; The blockchain transaction data includes: transaction initiator, transaction recipient, transaction hash, address of transaction initiator, address of transaction recipient, transaction amount, transaction fee, transaction signature, transaction timestamp, block height, number of confirmations, transaction type, and transaction related information; S2. For each transaction, extract a subgraph g from the blockchain transaction graph G with the transaction node as the center, encode the transaction node information and the neighboring information of the transaction node respectively, and obtain the transaction node feature vector h ego and the neighboring node feature vector h nei ; S21: Concatenate all nodes in subgraph g to obtain the feature vector h of the node sequence of subgraph g v ; S22: Set all elements except the diagonal in the identity matrix I to negative infinity, so that each node only pays attention to its own information and ignores the information of surrounding nodes, and obtain the mask matrix E. According to the mask matrix E and the feature vector h of the node sequence of the subgraph g v Use the Attention mechanism to encode node information and obtain the feature vector h of the transaction node ego ; S23: Construct the adjacency matrix M according to the connection status of each node in the subgraph g adj , whose dimension is |V|×|V|, |V| represents the number of nodes in the subgraph g. If the i-th node v i With the jth node v in the graph j If there is an edge between them, then A adj [i,j]=1, otherwise A adj [i,j]=0; S24: Using the Flody algorithm, according to the adjacency matrix M adj Calculate the distance matrix M of subgraph g dis , whose dimension is |V|×|V|, M dis [i,j] represents node v i With node v j The shortest path distance; S25: Using the adjacency matrix M adj and the distance matrix M dis , the neighboring node information of the transaction node is encoded through the GCN model to obtain the neighboring node feature vector h nei ; S3, h ego With h nei After splicing, the data is sent to the feedforward neural network for binary classification to predict whether this transaction is an abnormal transaction.

2. According to claim 1, a method for detecting abnormal transactions in blockchain based on artificial intelligence is characterized in that: Construct the blockchain transaction graph G, including: The transaction initiator and transaction receiver in the blockchain transaction are taken as graph nodes, and the two nodes are connected into an edge according to their addresses. The transaction hash, transaction amount, transaction fee, transaction signature, transaction timestamp, block height, confirmation number, transaction type, and transaction association information are taken as the feature vector of each node to obtain the blockchain transaction graph G.

3. According to claim 2, a method for detecting abnormal transactions in blockchain based on artificial intelligence is characterized in that: The graph nodes of the blockchain transaction graph G include: v i ={x1,x2,…,x n } Among them, v i represents the i-th graph node, x n Represents the nth element of the graph node feature vector, where n represents the dimension of the graph node feature vector.

4. According to claim 1, a method for detecting abnormal transactions in blockchain based on artificial intelligence is characterized in that: Concatenate all nodes in subgraph g to obtain the feature vector h of the node sequence of subgraph g v ,include: h v =[v0,v1,…,v |V| ] Among them, v i represents the i-th node in the subgraph g, with a dimension of 1×n, h v The feature vector representing the node sequence of graph g has a dimension of |V|×n, where |V| represents the number of nodes in subgraph g and n represents the dimension of the graph node feature vector.

5. According to the artificial intelligence-based blockchain abnormal transaction detection method of claim 1, it is characterized in that: According to the mask matrix E and the feature vector h of the node sequence of the subgraph g v Use the Attention mechanism to encode node information and obtain the feature vector h of the transaction node ego ,include: Among them, h ego represents the feature vector of the transaction node, with a dimension of 1×n. W1 and W2 represent the first and second feature conversion matrices with dimensions of n×128, respectively. W3 represents the third feature conversion matrix with a dimension of n×n. ⊙ represents the element-by-element multiplication operation. |V| represents the number of nodes in the subgraph g. h v represents the feature vector of the node sequence of graph g, T represents the matrix transpose, E represents the mask matrix, and n represents the dimension of the graph node feature vector.

6. According to claim 1, a method for detecting abnormal transactions in blockchain based on artificial intelligence is characterized in that: Using the adjacency matrix M adj and the distance matrix M dis , the neighboring node information of the transaction node is encoded through the GCN model to obtain the neighboring node feature vector h nei ,include: Through the distance matrix M dis Construct the 2-hop adjacency matrix of subgraph g The adjacency matrix M adj and the 2-hop adjacency matrix The diagonal elements of are set to 0, so that each node does not pay attention to the node itself when passing messages, but only pays attention to the information of surrounding nodes; According to the adjacency matrix M adj and the 2-hop adjacency matrix Use the GCN model to encode node neighbor information and obtain the neighboring node feature vector h nei .

7. The method for detecting abnormal transactions in blockchain based on artificial intelligence according to claim 6 is characterized in that: Through the distance matrix M dis Construct the 2-hop adjacency matrix of subgraph g include Among them, M dis [i,j] represents node v i With node v j The shortest path distance.

8. The method for detecting abnormal transactions in blockchain based on artificial intelligence according to claim 6 is characterized in that: According to the adjacency matrix M adj and the 2-hop adjacency matrix Use the GCN model to encode node neighbor information and obtain the neighboring node feature vector h nei ,include: Among them, h nei Represents the feature vector of neighboring nodes. The feature vector of each node comes from the nodes around it, with a dimension of 1×n. Indicates M adj +E's degree matrix, express The degree matrix of the graph is , I represents the identity matrix, M represents the matrix that excludes the node’s own information when the model transmits neighboring information, its diagonal elements are 0, the remaining elements are 1, the matrix dimension is |V|×|V|, and n represents the dimension of the graph node feature vector.

9. The method for detecting abnormal transactions in blockchain based on artificial intelligence according to claim 1 is characterized in that: h ego With h nei After concatenation, the data is sent to the feedforward neural network for binary classification to predict whether the transaction is an abnormal transaction, including: Output=argmax(W out [h ego ,h nei ]) Among them, Output represents the binary classification prediction result output by the feedforward neural network, Output = 0 means that this transaction is not an abnormal transaction, and Output = 1 means that this transaction is an abnormal transaction; W out Represents the feature transformation matrix, with a dimension of 2n×2, [h ego ,h nei ] means that the transaction node feature vector h ego and the neighboring node feature vector h nei The concatenation is performed in the hidden layer dimension, and the dimension is 1×2n; argmax( ) represents the argmax function, and n represents the dimension of the graph node feature vector.