# Research on Blockchain Transaction Privacy Protection Methods Based on Deep Learning
## 3 Deep Learning-Based Blockchain Transaction Privacy Protection Model
### Anomaly Transaction Data Detection Based on Graph Neural Networks  
Anomaly detection is a method used to identify behaviors that deviate from the expected norm. The task of graph-based anomaly detection aims to uncover nodes, edges, or subgraphs within a network that exhibit significantly outlier characteristics. Anomaly detection of transaction data using GNNs is particularly useful in identifying fraudulent activities, money laundering and other anomalous patterns in financial transactions. This method is especially adept at handling complex financial networks, where transaction relationships can be modeled as graph structures, with nodes representing participants (such as individuals and companies) and edges representing transactions. In this application, the GNNs' role is to leverage the structural information of the graph to learn underlying patterns within transaction data. Traditional fraud detection methods typically rely on rules or simple machine learning models that may not be able to capture complex non-linear fraud patterns. In contrast, GNNs can more effectively identify anomalous patterns by considering the relationships between nodes and transaction patterns in the transaction network. The general design process for GNNs is divided into four parts, as illustrated in the following Figure 6:First, identify the graph structure relevant to the specific context and represent the data in graphical format. Next, determine the type of graph, such as directed/undirected or homogenous/heterogeneous. Subsequently, develop a loss function. Depending on the graph learning task, prediction types can be categorized at various levels: node, edge, community, or graph-wide. Finally, establish computational modules and train the model. The propagation module facilitates information exchange between nodes, enabling the aggregation of information to capture the graph's characteristics and topological details. The sampling module is responsible for graph sampling. For higher-dimensional subgraph representations, the pooling module can extract node information. In a graph structure, each node is defined by its own features as well as the features of its connected neighbors. GNNs learn a state-embedding vector \(h_{v}\in R^{s}\) for each node. This vector incorporates information from neighboring nodes. The node's state vector (denoted as \(h_{v}\)) can be utilized to generate an output \(O_{v}\). Suppose \(f(\cdot)\) is a function with parameters shared by all nodes, called the local transition function. This function updates node states based on neighboring node information. The local output function \(g(\cdot)\) defines how the output is generated. \[h_{v}=f\Big{(}x_{v},x_{co[v]},h_{ne[v]^{\prime}},x_{ne[v]}\Big{)} \tag{24}\]  
\[o_{v}=g(h_{v},x_{v}) \tag{25}\]  
\(x_{v}\) denotes the feature vector of \(v\), \(x_{co[v]}\) denotes the feature vector of the edges linked to \(v\), \(h_{ne[v]}\) symbolizes the state vector for \(v\)'s adjacent nodes, and \(x_{ne[v]}\) indicates the feature vector for \(v\)'s adjacent nodes. Suppose we assemble vectors of various types into their respective composite vectors. These composite vectors can be denoted as \(H\) for the state vectors, \(O\) for the output vectors, \(X\) for the feature vectors, and \(X_{N}\) for the node features. This aggregation makes the representation more compact:  
\[H=F(H,X) \tag{26}\]  
\[O=G(H,X_{N}) \tag{27}\]  
\(F\) and \(G\) represent the global transition and output functions, respectively. They are obtained by stacking the node-wise functions \(f\) and \(g\) for all nodes in the graph. GNN iteratively computes state parameters using a traditional method based on the Banach fixed-point theorem. \[H^{t+1}=F\big{(}H^{t},X\big{)} \tag{28}\]  
where \(H_{t}\) represents the tensor of \(H\) at the \(t\)-th iteration cycle. Supervised learning is conducted using target information; the loss function is defined as follows:  
\[loss=\sum_{i=1}^{p}(t_{i}-o_{i}) \tag{29}\]  
Figure 6: General GNN Design Process.