# 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
With \(p\) supervised nodes, the loss function for GNN training incorporates true values \(t_{i}\) and predicted values \(o_{i}\), and leverages a gradient descent strategy with the following steps: The state \(h^{t}_{v}\) is iteratively updated according to Equation (24) for \(T\) cycles until it approaches the fixed-point solution near Equation (26), at which point the obtained \(H\) will be close to the fixed-point solution \(H^{T}\approx H\). During backpropagation, the gradient of the weight \(W\) is calculated from the loss, and then \(W\) is continuously updated based on the gradient computed in the previous step. After \(T\) cycles, the gradient with respect to \(h^{0}_{v}\) is obtained, which is then used to update the model parameters. The framework for anomaly detection in transaction data based on GNNs is a technique for identifying and locating abnormal information in transaction data, which plays a significant role in fields like finance, e-commerce, and insurance. The process flow of the GNN-based transaction data anomaly detection model can be broadly divided into the following:  
1. Data Preprocessing: Initially, transaction data are converted into graph data where nodes represent transaction entities (e.g., users, merchants, banks, etc.) and edges represent transaction relationships (e.g., payments, transfers, refunds, etc.). Attributes of nodes and edges represent transaction characteristics (e.g., amount, time, frequency, type, etc.). 2. Graph Neural Networks: Subsequently, GNNs are employed for feature extraction and representation learning of the graph data. Utilizing the attribute information and structural information of nodes and edges, low-dimensional vector representations for each node and edge are obtained. 3. Anomaly Scoring: The vector representations of each node and edge are then assessed using an anomaly scoring function to compute their level of anomaly. Candidates for abnormal transactions are selected based on certain thresholds or ranking methods. 4. Anomaly Interpretation: Finally, the anomaly interpretation module explains the candidate nodes and edges involved in abnormal transactions. This analysis includes the causes and effects of anomalies, providing visual and interpretable results to help users understand and address abnormal transactions. The detailed design of the detection model includes the following:  
* Input: Transaction data forms an attribute graph G = (V, E, X). Nodes V denote transaction entities, while edges E depict the relationships between them. X is the node attribute matrix representing transaction features like amount, time, frequency, type, etc. * Output: An anomaly score S \(\in\) R\({}^{|V|}\) for each node, indicating the degree of anomaly. A higher score suggests a higher likelihood of anomaly. * Model Structure: The model has three parts: the graph neural network, the anomaly scoring function, and the loss function. * Graph Neural Network: The graph neural network extracts feature representations from the graph data. Various types of GNNs can be used. Assuming GCN as an example, the GNN formula is as follows: \[H^{(l+1)}=\sigma(\widetilde{D}^{\sim-\frac{1}{2}\sim\infty-\frac{1}{2}}H^{(l) }W^{(l)})\] (30) Here, \(H^{(l)}\in R^{|V|\times d_{l}}\) is the node feature matrix at layer I, \(H^{(0)}=X\) is the feature dimension of layer I, \(W^{(l)}\in R^{d_{l}\times d_{l+1}}\) is the trainable weight matrix at layer I, \(\widetilde{A}=A+l\) is the adjacency matrix with self-loops, \(\widetilde{D}\) is the degree matrix of \(\widetilde{A}\), and \(\sigma\) is an activation function like ReLU. After L layers of the GNN, the final node feature representation \(H^{(L)}\in R^{|V|\times d_{L}}\) is obtained. * Anomaly Scoring Function: The anomaly scoring function computes the anomaly score based on the node's feature representation. Various types of scoring functions can be used, such as those based on reconstruction error, distance, or density.