Transaction chain classification method and system based on graph neural network
By constructing transaction chain data and using improved graph neural network algorithms and deep graph neural network models to classify blockchain transaction data, the accuracy and scalability issues of transaction chain classification in existing technologies are solved, achieving efficient and accurate identification of abnormal transactions and analysis of fund flows.
Patent Information
- Application Number
- CN202411796336.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-01-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies for classifying blockchain transaction chains suffer from limitations in the accuracy of classification results, data acquisition, scalability, and maintainability. They are also difficult to handle large-scale, high-dimensional transaction data and are susceptible to noise and anomalous data.
By acquiring full transaction data from the blockchain network, constructing transaction chain data, and training node feature vectors using an improved graph neural network algorithm, and assigning labels to some nodes using an address label library, target feature vectors are generated. Then, a deep graph neural network model is used to classify nodes with unknown labels and identify abnormal transaction nodes or paths.
It improves the accuracy and efficiency of blockchain transaction analysis, enabling precise identification of abnormal transaction nodes or paths, and ensuring the security and stability of the blockchain network.
Smart Images

Figure CN119272210A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain data analysis, and specifically, is a transaction chain classification method and system based on graph neural network. Background Art
[0002] The transaction chain, especially the blockchain, is a distributed database technology with the characteristics of decentralization, immutability, full traceability, anonymity, etc. These characteristics make the blockchain have broad application prospects in financial services, data storage, smart contracts and other fields. However, it also poses challenges to the classification and supervision of the transaction chain. With the rapid development of blockchain technology, the complexity and diversity of transaction chains are increasing. Traditional transaction chain classification methods are often difficult to handle large-scale, high-dimensional transaction data, and are easily affected by noise and abnormal data. Therefore, a more efficient and accurate transaction chain classification method is needed.
[0003] For example, a Chinese patent application with publication number CN118965060A discloses a blockchain address behavior classification method and system based on graph neural network, including: using blockchain address transaction data to construct an address transaction graph list corresponding to each blockchain address; the address transaction graph list includes multiple address transaction graphs, using graph neural network to learn the characteristics of each address transaction graph, and generating graph embedding features of each address transaction graph; aggregating all graph embedding features of a blockchain address and using a classification model to obtain the prediction result of blockchain address behavior classification. This technical solution provides a novel blockchain address behavior classification scheme that can accurately classify addresses in the blockchain network.
[0004] The above existing technologies all have the following problems: the accuracy of classification results is limited; the acquisition of blockchain address transaction data may be subject to various restrictions, such as data privacy, data permissions, etc.; scalability and maintainability are poor. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes a transaction chain classification method and system based on graph neural network, which obtains and preprocesses transaction data from the blockchain network to construct transaction chain data; constructs a transaction network graph, and uses an improved graph neural network algorithm to train node feature vectors; assigns labels to some nodes in combination with the address label library, and trains a deep graph neural network model to generate target feature vectors of the nodes; uses the model to classify unknown label nodes and divide them into categories according to feature vectors and similarity thresholds; analyzes the category division results, identifies abnormal transaction nodes or paths, and tracks and analyzes capital flows. The present invention improves the accuracy and efficiency of blockchain transaction analysis.
[0006] To achieve the above object, the present invention provides the following technical solutions: A transaction chain classification method based on graph neural network, comprising: Step S1: Obtaining full blockchain transaction data from the blockchain network, preprocessing the full blockchain transaction data, and constructing transaction chain data based on the preprocessed full blockchain transaction data; Step S2: construct a transaction network graph based on the preprocessed transaction chain data, and use the improved graph neural network algorithm to train the feature vectors of the nodes in the transaction network graph to generate the aggregated feature vectors of the nodes; Step S3: label some nodes in the transaction network graph using the address label library to generate a labeled transaction network graph, and use the aggregated feature vectors and corresponding labels of the nodes in the labeled transaction network graph to perform vector training on the deep graph neural network model to generate the target feature vector of the node; Step S4: Classify the unknown label nodes in the labeled transaction network graph according to the pre-trained deep graph neural network model to obtain predicted labels, and classify the predicted labels according to the target feature vector of the predicted label node and the preset similarity threshold; Step S5: Analyze the classification results, identify abnormal transaction nodes or paths, and track and analyze the flow of funds based on the analysis results; The specific steps of step S2 include: S2.1: Obtain the preprocessed transaction chain data, construct a node set and an edge set based on the preprocessed transaction chain data, and assign a unique identifier to each node; S2.2: constructing a transaction network graph according to the point set and the edge set, and converting the transaction network graph into a processing format of a graph neural network model, wherein the processing format of the graph neural network model includes an adjacency matrix and a node feature matrix; S2.3: Load the graph neural network model framework and initialize the graph neural network model parameters. Use the node feature matrix and adjacency matrix of the transaction network graph as the input data of the graph neural network model. Use the graph convolution layer to aggregate and update the node features. The formula is: ; in, represents the updated node feature matrix of the k+1th layer, and represents a nonlinear activation function, represents the adjacency matrix of the lth attention head, represents the node feature matrix of the kth layer, represents the weight matrix of the lth attention head in the kth layer, represents the bias term of the lth attention head in the kth layer, and R represents the regularization term; S2.4: Pass The feature representation of the previous layer is directly transferred to the next layer, where Represents a graph convolution operation; S2.5: After the graph neural network model is trained, the aggregated feature vector of the nodes is extracted from the graph neural network model.
[0007] Specifically, the specific steps of constructing the transaction chain data in step S1 include: S1.1: Obtain the pre-processed full blockchain transaction data, and determine the block header, block body and transaction record of the transaction chain based on the obtained pre-processed full blockchain transaction data and the characteristics of the blockchain; S1.2: Read the block height information in the transaction record, sort the transaction record according to the block height, and divide the transaction record into N blocks according to the sorted transaction record and the preset block size, wherein the block header of each block contains the hash value of the previous block; S1.3: Perform hash calculation on the block header and block body of each block to generate a unique block hash value; S1.4: Based on the block hash value and the hash value of the previous block, the blocks are linked together to form a transaction chain, and the hash value of the first block is used as the starting point of the transaction chain to verify the constructed transaction chain.
[0008] Specifically, the specific steps of step S3 include: S3.1: Obtain transaction network graph data and aggregate feature vectors of nodes, and prepare address tag library; S3.2: Based on the address label library, label propagation and label enhancement algorithms are used to assign known labels to corresponding nodes in the transaction network graph to generate a labeled transaction network graph; S3.3: Load the pre-built deep graph neural network model, use the aggregated feature vectors of the labeled nodes and the corresponding labels as training data pairs, and train the deep graph neural network model; S3.4: After the training is completed, the trained deep graph neural network model is used to extract the fusion features of the nodes in the transaction network graph to obtain the target feature vector.
[0009] Specifically, the specific steps of S3.2 include: S3.21: Prepare address tag library and use adjacency matrix to represent transaction network; S3.22: traverse the nodes in the transaction network graph, and for known nodes in the address label library, initialize their labels to the corresponding known labels, and for unknown nodes, assign them a default unknown label; S3.23: traverse the nodes in the transaction network graph, and for each node, select the label with the most occurrences in the neighboring nodes as the label of the current node. If there are cases where the number of occurrences is the same, randomly select a label; S3.24: adjusting the label allocation process according to a rule based on a graph structure, wherein the rule based on a graph structure refers to adjusting the label allocation process according to the number of neighbors of a node, the label distribution of the neighbors, and the position information of the node in the graph; S3.25: Repeat steps S3.22 to S3.24 until the label no longer changes; S3.26: Add the updated label information to the nodes of the transaction network graph to generate a labeled transaction network graph.
[0010] Specifically, the specific steps of step S4 include: S4.1: Load the pre-trained deep graph neural network model from the storage location; S4.2: Extract feature vectors of all nodes from the labeled transaction network graph, including nodes with known labels and nodes with unknown labels, and input the feature vectors of nodes with unknown labels into the pre-trained deep graph neural network model for label prediction. At the same time, output the probability or score of each node with unknown labels belonging to different categories. S4.3: Based on the probability or score output by the deep graph neural network model, select the category with the highest score as the predicted label of the unknown label node; S4.4: For each predicted label node, obtain its target feature vector according to step S3. At the same time, traverse the target feature vector set of the predicted label node and calculate the similarity between the target feature vector of the predicted label node and the target feature vector of the known label node. The formula is: in, Represents the similarity between the target feature vector A of the predicted label node and the target feature vector B of the known label node, represents the mean value of A, represents the mean of B, w represents the weight vector with the same dimensions as A and B, represents the sparsity factor, represents the sensitivity adjustment parameter, represents the 2-norm; S4.5: Set the similarity threshold h, like , the predicted label node is classified into the same category as the known label node.
[0011] A transaction chain classification system based on graph neural network, including: data collection module, transaction network graph construction module, feature vector module, model training module, classification and recognition module; The data acquisition module is used to obtain the full amount of transaction data from the blockchain network and perform preprocessing to construct transaction chain data; The transaction network graph construction module is used to construct a transaction network graph based on the preprocessed transaction chain data and convert the transaction relationship into a graph structure; The feature vector module is used to perform feature vector training on nodes in the transaction network graph using an improved graph neural network algorithm to generate aggregated feature vectors of the nodes; The model training module is used to assign labels to some nodes using the address label library, generate a labeled transaction network graph, and use the aggregated feature vectors of these labels and nodes to train the deep graph neural network model; The classification and identification module is used to classify unknown label nodes according to a pre-trained deep graph neural network model and identify abnormal transaction nodes or paths.
[0012] Specifically, the classification and identification module includes: a classification unit, a similarity calculation unit, a category division unit, an anomaly identification unit, and a tracking unit; The classification unit is used to classify unknown label nodes in the labeled transaction network graph, and assign category labels to the unknown label nodes according to the feature vectors of the nodes and the trained model; The similarity calculation unit is used to calculate the similarity between the unknown node and the known label node according to the target feature vector of the predicted label node and a preset similarity threshold; The category division unit is used to assign the unknown node to the most similar known label node category according to the similarity calculation result; The anomaly identification unit is used to identify potential abnormal transactions by comparing the feature vector of the node with a preset anomaly detection standard; The tracking unit is used to track and analyze the flow of funds based on the analysis results.
[0013] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a transaction chain classification method based on a graph neural network when executing the computer program.
[0014] Compared with the prior art, the present invention has the following beneficial effects: The present invention proposes a transaction chain classification method based on graph neural network. By obtaining full transaction data from the blockchain network, constructing transaction chain data and transaction network graph, and using an improved graph neural network algorithm to train feature vectors of nodes, the method can efficiently extract key information in the transaction network and generate aggregated feature vectors of nodes. This not only improves the speed and accuracy of data processing, but also provides strong support for subsequent classification and anomaly detection.
[0015] The present invention proposes a transaction chain classification method based on graph neural network, which uses the address tag library and deep graph neural network model to classify and predict the nodes in the transaction network graph. It can accurately identify abnormal transaction nodes or paths, and track and analyze the flow of funds based on the analysis results, which helps to timely discover and prevent potential fraud and ensure the security and stability of the blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a schematic diagram of a transaction chain classification method based on graph neural network in the present invention; Figure 2 This is a principle flow chart of a transaction chain classification method based on graph neural network of the present invention; Figure 3 A flow chart for generating target feature vectors of nodes in a transaction chain classification method based on a graph neural network according to the present invention; Figure 4 This is an architecture diagram of a transaction chain classification system based on graph neural network in the present invention. DETAILED DESCRIPTION
[0017] See also Figure 1-Figure 3 , an embodiment of the present invention provides: a transaction chain classification method based on graph neural network, comprising the following steps: Step S1: Obtaining full blockchain transaction data from the blockchain network, preprocessing the full blockchain transaction data, and constructing transaction chain data based on the preprocessed full blockchain transaction data; Furthermore, the specific steps of step S1 include: (1) Obtaining full blockchain transaction data from the blockchain network, which usually involves interacting with blockchain nodes and using API interfaces or specific data extraction tools to obtain transaction data; (2) Preprocessing, including removing invalid data, fixing data errors, filling missing values, etc., is to ensure the accuracy and completeness of the data and convert the data into a format suitable for analysis. For example, text data is converted into numerical data, or different time formats are unified into a standard time format; (3) Integrate data from multiple blockchains into a unified data source for comprehensive analysis; (4) Using a variance-based statistical method to select features from a large amount of blockchain data, wherein the variance-based statistical method is a prior art in the art and is not an inventive solution of the present application, and is not described in detail here; (5) Construct transaction chain data based on the preprocessed full blockchain transaction data. This usually involves sorting the transaction data in chronological order or block height and linking them into a chain structure. At the same time, during the construction process, it is necessary to calculate the hash value of each block, the hash value of the previous block, etc. to ensure the integrity and immutability of the transaction chain.
[0018] Step S2: construct a transaction network graph based on the preprocessed transaction chain data, and use the improved graph neural network algorithm to train the feature vectors of the nodes in the transaction network graph to generate the aggregated feature vectors of the nodes; Step S3: label some nodes in the transaction network graph using the address label library to generate a labeled transaction network graph, and use the aggregated feature vectors and corresponding labels of the nodes in the labeled transaction network graph to perform vector training on the deep graph neural network model to generate the target feature vector of the node; Step S4: Classify the unknown label nodes in the labeled transaction network graph according to the pre-trained deep graph neural network model to obtain predicted labels, and classify the predicted labels according to the target feature vector of the predicted label node and the preset similarity threshold; Step S5: Analyze the classification results, identify abnormal transaction nodes or paths, and track and analyze the flow of funds based on the analysis results.
[0019] In the present invention, a statistical-based anomaly detection method is used to identify abnormal transaction nodes or paths, wherein the statistical-based anomaly detection method is the prior art content in the field, is not the inventive solution of the present application, and is not elaborated here.
[0020] The specific steps of constructing the transaction chain data in step S1 include: S1.1: Obtain the pre-processed full blockchain transaction data. Based on the obtained pre-processed full blockchain transaction data and in combination with the characteristics of the blockchain, determine the block header, block body and transaction record of the transaction chain. The block header should contain information such as the version number, timestamp, and hash value of the previous block; the block body contains multiple transaction records. S1.2: Read the block height information in the transaction record, sort the transaction record according to the block height, and divide the transaction record into N blocks according to the sorted transaction record and the preset block size, wherein the block header of each block contains the hash value of the previous block; Furthermore, the specific steps of S1.2 include: (1) Read all transaction records, where each transaction record should contain at least one field identifying the block height to which it belongs; (2) Traverse all transaction records and extract the block height information in each record. If the transaction record does not directly contain the block height, it is necessary to query the blockchain network to obtain it; (3) According to the extracted block height information, the transaction records are sorted in descending order according to the block height; (4) Determining the number of transactions that each block can accommodate according to a preset block size, which is set in the present invention; (5) From the sorted list of transaction records, N blocks are divided in order according to the block size. Each block should contain a certain number of transaction records, and the total size does not exceed the preset block size limit; (6) For each block, generate a block header, where the block header should contain the hash value of the previous block, and for the first block, it can be a fixed starting value; (7) Store the generated blocks in the blockchain network.
[0021] S1.3: Perform hash calculation on the block header and block body of each block to generate a unique block hash value; Furthermore, the specific steps of S1.3 include: (1) Obtain the block data to be hashed, including the block header and block body. The block header usually contains the hash value, timestamp, version number, difficulty target, random number and other information of the previous block, while the block body contains all transaction records in the block; (2) Convert the block header and block body data into a byte sequence; 1) Convert the various fields in the block header from primitive data types such as integers, strings, arrays to byte sequences, which may involve splitting the data into multiple bytes, performing bit operations, or applying specific encoding schemes; 2) According to the definition of the block header data structure, the converted byte sequences are spliced together in the order of the fields, ensuring that the byte sequences of each field are correctly aligned and there are no missing or redundant bytes; 3) If the block contains transaction records, each transaction record needs to be serialized, which usually involves converting various fields of the transaction, such as transaction ID, sender address, receiver address, transaction amount, etc., into byte sequences and splicing them in the order of transaction records; 4) The byte sequences of all transaction records are spliced together to form the byte sequence of the block body.
[0022] (3) Use the SHA-256 hash algorithm to perform hash calculation on the serialized block data. Hash calculation is a one-way, deterministic process that converts input data of any length into an output of a fixed length, namely the hash value; (4) The generated hash value should meet the specific requirements of the blockchain project. If the hash value does not meet the requirements, the block data needs to be adjusted and the hash calculation needs to be re-performed, such as changing the random number; (5) The generated hash value is stored in the block header as the unique identifier of the block.
[0023] S1.4: Based on the block hash value and the hash value of the previous block, the blocks are linked together to form a transaction chain, and the hash value of the first block is used as the starting point of the transaction chain to verify the constructed transaction chain.
[0024] The specific steps of step S2 include: S2.1: Obtain the preprocessed transaction chain data, construct a node set and an edge set based on the preprocessed transaction chain data, and assign a unique identifier to each node; S2.2: constructing a transaction network graph according to the point set and the edge set, and converting the transaction network graph into a processing format of a graph neural network model, wherein the processing format of the graph neural network model includes an adjacency matrix and a node feature matrix; Furthermore, the specific steps of constructing a transaction network graph include: (1) Obtain pre-processed transaction chain data; (2) In the transaction network diagram, nodes usually represent entities in the transaction, such as transaction accounts, transaction commodities, transaction parties, etc. Based on the specific content of the transaction chain data, determine which entities should be nodes.
[0025] (3) Edges represent transaction relationships, that is, the connections between nodes. In a transaction network diagram, edges can be directed, indicating the direction of the transaction, such as from buyer to seller, or undirected, indicating that the transaction direction is not distinguished. The weight of the edge can represent attributes such as transaction amount and transaction frequency. (4) Based on the determined nodes, create a set containing all nodes and assign a unique identifier to each node; (5) Based on the transaction relationship, create a set of all edges, where each edge should contain two node identifiers, indicating the start and end points of the edge, and possible weight information; (6) Use Python's matplotlib to draw the nodes and edges into a network diagram, and check whether the nodes and edges in the network diagram are consistent with the transaction chain data.
[0026] S2.3: Load the graph neural network model framework and initialize the graph neural network model parameters. Use the node feature matrix and adjacency matrix of the transaction network graph as the input data of the graph neural network model. Use the graph convolution layer to aggregate and update the node features. The formula is: ; in, represents the updated node feature matrix of the k+1th layer, and represents a nonlinear activation function, represents the adjacency matrix of the lth attention head, represents the node feature matrix of the kth layer, represents the weight matrix of the lth attention head in the kth layer, represents the bias term of the lth attention head in the kth layer, and R represents the regularization term; It should be noted that the formula in the present invention has the advantages of enhancing the expressiveness of the model, introducing an attention mechanism to dynamically adjust the influence between nodes, and preventing overfitting through regularization terms, thereby improving the performance and generalization ability of graph neural networks when processing complex graph structure data.
[0027] S2.4: Pass The feature representation of the previous layer is directly transferred to the next layer, where Represents a graph convolution operation; S2.5: After the graph neural network model is trained, the aggregated feature vector of the nodes is extracted from the graph neural network model.
[0028] Furthermore, the specific steps of S2.5 include: (1) Input the training data into the graph neural network model, calculate the predicted value through forward propagation, calculate the gradient according to the loss function, and update the model parameters through back propagation, and repeat this process until the graph neural network model converges. The graph neural network model is the prior art content in this field and is not the inventive solution of this application, and will not be described in detail here; (2) After the graph neural network model is trained, the nodes whose features need to be extracted are input into the model. Through the layer-by-layer propagation and aggregation operations of the graph neural network model, the aggregated feature vector of the node is obtained. (3) The extracted feature vector is used for subsequent tasks such as classification, clustering, and link prediction.
[0029] The specific steps of step S3 include: S3.1: Obtain transaction network graph data and aggregate feature vectors of nodes, and prepare address tag library; S3.2: Based on the address label library, label propagation and label enhancement algorithms are used to assign known labels to corresponding nodes in the transaction network graph to generate a labeled transaction network graph; S3.3: Load the pre-built deep graph neural network model, use the aggregated feature vectors of the labeled nodes and the corresponding labels as training data pairs, and train the deep graph neural network model; S3.4: After the training is completed, the trained deep graph neural network model is used to extract the fusion features of the nodes in the transaction network graph to obtain the target feature vector.
[0030] Furthermore, the specific steps of S3.4 include: Use transaction network graph data to train the deep graph neural network model. During the training process, the deep graph neural network model will learn how to effectively extract features from the graph and predict the category or attribute of the node; After training is completed, prepare the transaction network graph data to be processed, including building the adjacency matrix or edge list of the graph and extracting the initial feature vectors of the nodes; Load the trained deep graph neural network model into memory for subsequent feature extraction tasks; Use the loaded deep graph neural network model to extract features from each node in the transaction network graph, which usually involves inputting the initial feature vector of the node into the deep graph neural network model and forward propagating through each layer of the deep graph neural network model to finally obtain the fused feature vector of the node; In a deep graph neural network, feature fusion may occur between different network layers. For example, local features of nodes may be fused with global features, or features of different modalities may be fused, and the fusion method may be concatenation or weighted summation. Feature fusion is a prior art in this field and is not an inventive solution of the present application, and will not be described in detail here. After feature extraction and fusion, the target feature vector of each node can be obtained. These feature vectors contain the location information of the node in the graph, the information of neighbor nodes, and the initial feature information of the node, which can be used for subsequent tasks such as node classification, clustering or link prediction.
[0031] The specific steps of S3.2 include: S3.21: Prepare address tag library and use adjacency matrix to represent transaction network; S3.22: traverse the nodes in the transaction network graph, and for known nodes in the address label library, initialize their labels to the corresponding known labels, and for unknown nodes, assign them a default unknown label; S3.23: traverse the nodes in the transaction network graph, and for each node, select the label with the most occurrences in the neighboring nodes as the label of the current node. If there are cases where the number of occurrences is the same, randomly select a label; S3.24: adjusting the label allocation process according to a rule based on a graph structure, wherein the rule based on a graph structure refers to adjusting the label allocation process according to the number of neighbors of a node, the label distribution of the neighbors, and the position information of the node in the graph; S3.25: Repeat steps S3.22 to S3.24 until the label no longer changes; S3.26: Add the updated label information to the nodes of the transaction network graph to generate a labeled transaction network graph.
[0032] The specific steps of step S4 include: S4.1: Load the pre-trained deep graph neural network model from the storage location; S4.2: Extract feature vectors of all nodes from the labeled transaction network graph, including nodes with known labels and nodes with unknown labels, and input the feature vectors of the nodes with unknown labels into a pre-trained deep graph neural network model to perform label prediction. At the same time, output the probability or score of each node with unknown labels belonging to different categories. The training and prediction process of the deep graph neural network model is the prior art content in this field, and is not the inventive solution of the present application, and will not be elaborated here. S4.3: Based on the probability or score output by the deep graph neural network model, select the category with the highest score as the predicted label of the unknown label node; S4.4: For each predicted label node, obtain its target feature vector according to step S3. At the same time, traverse the target feature vector set of the predicted label node and calculate the similarity between the target feature vector of the predicted label node and the target feature vector of the known label node. The formula is: in, Represents the similarity between the target feature vector A of the predicted label node and the target feature vector B of the known label node, represents the mean value of A, represents the mean of B, w represents the weight vector with the same dimensions as A and B, represents the sparsity factor, represents the sensitivity adjustment parameter, represents the 2-norm; S4.5: Set the similarity threshold h, like , the predicted label node is classified into the same category as the known label node.
[0033] See also Figure 4 Another embodiment provided by the present invention is a transaction chain classification system based on graph neural network, comprising: Data collection module, transaction network diagram construction module, feature vector module, model training module, classification and recognition module; The data collection module is used to obtain the full transaction data from the blockchain network and perform preprocessing to construct transaction chain data; The transaction network graph construction module is used to construct a transaction network graph based on the preprocessed transaction chain data and convert the transaction relationship into a graph structure, where nodes represent transaction entities, such as addresses, and edges represent transaction relationships; The feature vector module is used to train the feature vectors of nodes in the transaction network graph using the improved graph neural network algorithm to generate the aggregated feature vectors of the nodes; The model training module is used to assign labels to some nodes using the address label library, generate a labeled transaction network graph, and use these labels and the aggregated feature vectors of the nodes to train the deep graph neural network model; The classification and recognition module is used to classify unknown label nodes and identify abnormal transaction nodes or paths based on the pre-trained deep graph neural network model.
[0034] The transaction network graph construction module includes: a graph construction unit and a feature extraction unit; A graph construction unit, which is used to construct a graph structure based on the transaction chain data, where each node represents an account and the edge represents the transaction relationship between accounts; The feature extraction unit is used to extract features, such as timestamps, for each node and edge in the graph to form an initial feature vector of the node.
[0035] The model training module includes: label mapping unit, model training unit, and model verification unit; The label mapping unit is used to assign labels to some nodes in the transaction network graph according to the address label library; A model training unit, used to train the deep graph neural network model using the node data with labels to generate a target feature vector; The model validation unit is used to evaluate the model performance using the validation set to ensure that the model has good generalization ability.
[0036] The classification and recognition module includes: classification unit, similarity calculation unit, category division unit, anomaly recognition unit, and tracking unit; The classification unit is used to classify unknown label nodes in the labeled transaction network graph and assign category labels to unknown label nodes based on the node's feature vector and the trained model; A similarity calculation unit, used to calculate the similarity between the unknown node and the known label node according to the target feature vector of the predicted label node and a preset similarity threshold; A category division unit is used to assign unknown nodes to the most similar known label node category based on similarity calculation results; An abnormality identification unit is used to identify abnormal transaction nodes or paths according to the classification results, and identify potential abnormal transactions by comparing the feature vectors of the nodes with the preset abnormality detection criteria; The tracking unit is used to track and analyze the flow of funds based on the analysis results. Usually, after identifying abnormal transactions, the flow of funds is further tracked and analyzed to reveal potential risks.
[0037] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a transaction chain classification method based on a graph neural network are implemented. For details, please refer to the above method embodiment, which will not be repeated here.
[0038] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0039] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0040] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in the field may also change, modify, replace and modify the above-mentioned embodiments without departing from the purpose and scope of protection of the present invention, and all of these are within the protection of the present invention.
[0041] If the disclosed technical solution involves personal information, the product using the disclosed technical solution has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the disclosed technical solution involves sensitive personal information, the product using the disclosed technical solution has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A transaction chain classification method based on graph neural network, characterized in that: include: Step S1: Obtaining full blockchain transaction data from the blockchain network, preprocessing the full blockchain transaction data, and constructing transaction chain data based on the preprocessed full blockchain transaction data; Step S2: construct a transaction network graph based on the preprocessed transaction chain data, and use the improved graph neural network algorithm to train the feature vectors of the nodes in the transaction network graph to generate the aggregated feature vectors of the nodes; Step S3: label some nodes in the transaction network graph using the address label library to generate a labeled transaction network graph, and use the aggregated feature vectors and corresponding labels of the nodes in the labeled transaction network graph to perform vector training on the deep graph neural network model to generate the target feature vector of the node; Step S4: Classify the unknown label nodes in the labeled transaction network graph according to the pre-trained deep graph neural network model to obtain predicted labels, and classify the predicted labels according to the target feature vector of the predicted label node and the preset similarity threshold; Step S5: Analyze the classification results, identify abnormal transaction nodes or paths, and track and analyze the flow of funds based on the analysis results; The specific steps of step S2 include: S2.1: Obtain the preprocessed transaction chain data, construct a node set and an edge set based on the preprocessed transaction chain data, and assign a unique identifier to each node; S2.2: constructing a transaction network graph according to the point set and the edge set, and converting the transaction network graph into a processing format of a graph neural network model, wherein the processing format of the graph neural network model includes an adjacency matrix and a node feature matrix; S2.3: Load the graph neural network model framework and initialize the graph neural network model parameters. Use the node feature matrix and adjacency matrix of the transaction network graph as the input data of the graph neural network model. Use the graph convolution layer to aggregate and update the node features. The formula is: ; in, represents the updated node feature matrix of the k+1th layer, and represents a nonlinear activation function, represents the adjacency matrix of the lth attention head, represents the node feature matrix of the kth layer, represents the weight matrix of the lth attention head in the kth layer, represents the bias term of the lth attention head in the kth layer, and R represents the regularization term; S2.4: Pass The feature representation of the previous layer is directly transferred to the next layer, where Represents a graph convolution operation; S2.5: After the graph neural network model is trained, the aggregated feature vector of the node is extracted from the graph neural network model.
2. A transaction chain classification method based on graph neural network as claimed in claim 1, characterized in that: The specific steps of constructing the transaction chain data in step S1 include: S1.1: Obtain the pre-processed full blockchain transaction data, and determine the block header, block body and transaction record of the transaction chain based on the obtained pre-processed full blockchain transaction data and the characteristics of the blockchain; S1.2: Read the block height information in the transaction record, sort the transaction record according to the block height, and divide the transaction record into N blocks according to the sorted transaction record and the preset block size, wherein the block header of each block contains the hash value of the previous block; S1.3: Perform hash calculation on the block header and block body of each block to generate a unique block hash value; S1.4: Based on the block hash value and the hash value of the previous block, the blocks are linked together to form a transaction chain, and the hash value of the first block is used as the starting point of the transaction chain to verify the constructed transaction chain.
3. A transaction chain classification method based on graph neural network as claimed in claim 2, characterized in that: The specific steps of step S3 include: S3.1: Obtain transaction network graph data and aggregate feature vectors of nodes, and prepare address tag library; S3.2: Based on the address label library, label propagation and label enhancement algorithms are used to assign known labels to corresponding nodes in the transaction network graph to generate a labeled transaction network graph; S3.3: Load the pre-built deep graph neural network model, use the aggregated feature vectors of the labeled nodes and the corresponding labels as training data pairs, and train the deep graph neural network model; S3.4: After the training is completed, the trained deep graph neural network model is used to extract the fusion features of the nodes in the transaction network graph to obtain the target feature vector.
4. A transaction chain classification method based on graph neural network as claimed in claim 3, characterized in that: The specific steps of S3.2 include: S3.21: Prepare address tag library and use adjacency matrix to represent transaction network; S3.22: traverse the nodes in the transaction network graph, and for known nodes in the address label library, initialize their labels to the corresponding known labels, and for unknown nodes, assign them a default unknown label; S3.23: traverse the nodes in the transaction network graph, and for each node, select the label with the most occurrences in the neighboring nodes as the label of the current node. If there are cases where the number of occurrences is the same, randomly select a label; S3.24: adjusting the label allocation process according to a rule based on a graph structure, wherein the rule based on a graph structure refers to adjusting the label allocation process according to the number of neighbors of a node, the label distribution of the neighbors, and the position information of the node in the graph; S3.25: Repeat steps S3.22 to S3.24 until the label no longer changes; S3.26: Add the updated label information to the nodes of the transaction network graph to generate a labeled transaction network graph.
5. A transaction chain classification method based on graph neural network as claimed in claim 4, characterized in that: The specific steps of step S4 include: S4.1: Load the pre-trained deep graph neural network model from the storage location; S4.2: Extract feature vectors of all nodes from the labeled transaction network graph, including nodes with known labels and nodes with unknown labels, and input the feature vectors of nodes with unknown labels into the pre-trained deep graph neural network model for label prediction. At the same time, output the probability or score of each node with unknown labels belonging to different categories. S4.3: Based on the probability or score output by the deep graph neural network model, select the category with the highest score as the predicted label of the unknown label node; S4.4: For each predicted label node, obtain its target feature vector according to step S3. At the same time, traverse the target feature vector set of the predicted label node and calculate the similarity between the target feature vector of the predicted label node and the target feature vector of the known label node. The formula is: in, Represents the similarity between the target feature vector A of the predicted label node and the target feature vector B of the known label node, represents the mean value of A, represents the mean of B, w represents the weight vector with the same dimensions as A and B, represents the sparsity factor, represents the sensitivity adjustment parameter, represents the 2-norm; S4.5: Set the similarity threshold h, like , the predicted label node is classified into the same category as the known label node.
6. A transaction chain classification system based on graph neural network, which is used to implement a transaction chain classification method based on graph neural network as described in any one of claims 1 to 5, characterized in that: include: Data collection module, transaction network diagram construction module, feature vector module, model training module, classification and recognition module; The data acquisition module is used to obtain the full amount of transaction data from the blockchain network and perform preprocessing to construct transaction chain data; The transaction network graph construction module is used to construct a transaction network graph based on the preprocessed transaction chain data and convert the transaction relationship into a graph structure; The feature vector module is used to perform feature vector training on nodes in the transaction network graph using an improved graph neural network algorithm to generate aggregated feature vectors of the nodes; The model training module is used to assign labels to some nodes using the address label library, generate a labeled transaction network graph, and use the aggregated feature vectors of these labels and nodes to train the deep graph neural network model; The classification and identification module is used to classify unknown label nodes according to a pre-trained deep graph neural network model and identify abnormal transaction nodes or paths.
7. A transaction chain classification system based on graph neural network as claimed in claim 6, characterized in that: The classification and identification module includes: a classification unit, a similarity calculation unit, a category division unit, an anomaly identification unit, and a tracking unit; The classification unit is used to classify unknown label nodes in the labeled transaction network graph, and assign category labels to the unknown label nodes according to the feature vectors of the nodes and the trained model; The similarity calculation unit is used to calculate the similarity between the unknown node and the known label node according to the target feature vector of the predicted label node and a preset similarity threshold; The category division unit is used to assign the unknown node to the most similar known label node category according to the similarity calculation result; The anomaly identification unit is used to identify potential abnormal transactions by comparing the feature vector of the node with a preset anomaly detection standard; The tracking unit is used to track and analyze the flow of funds according to the analysis results.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of a transaction chain classification method based on graph neural network described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Block chain transaction topological graph analysis method and device based on graph neural network
CN113657896A
Group discovery method based on depth map convolutional network
CN113989544A
Microservice call chain anomaly detection method and device based on graph convolutional neural network
CN115185736A
Block chain-based asset processing traceability method and system
CN118505398A
Charging pile power distribution control method, system and equipment
CN118636728A
Cited By
Detection method and system for parasitic chain in IOTA network
CN119743330A
Financial case fund flow traceability analysis method
CN120106956A
Account identification method and system based on entity clustering and pre-training
CN121030261A