# Research on Blockchain Transaction Privacy Protection Methods Based on Deep Learning
## 3 Deep Learning-Based Blockchain Transaction Privacy Protection Model
### Transaction Data Privacy Protection  
When \(AID_{s}\) transacts with \(AID_{r}\), without loss of generality, suppose the structure of the transaction is as shown in Figure 5.  
In this transaction, there are two inputs with amounts \(v_{in1}\) and \(v_{in2}\) and two outputs: one for the transaction with \(AID_{r}\), amounting to \(v_{out1}\), and the other returning change to oneself, amounting to \(v_{out2}\). Additionally, the \(v_{fe}\) portion is the transaction fee, serving as the miner's fee for packaging the transaction.  
Our approach primarily employs Pedersen commitments to ensure the privacy protection of transaction amounts \((v_{in1},v_{in2},v_{out1},v_{out2})\) while the transaction fees \(v_{fe}\) are publicly disclosed. For the transaction inputs, it is necessary to introduce previous outputs, represented as  
\[P_{in1}=a_{1}G+v_{in1}H \tag{2}\]  
\[P_{in2}=a_{2}G+v_{in2}H \tag{3}\]  
where \((a_{1},v_{in1})\) and \((a_{2},v_{in2})\) can be decrypted by \(AID_{s}\) using the private key \(Sk_{s}\).  
The sender \(AID_{s}\) sets \(b_{1}\) and \(b_{2}\), then calculates  
\[P_{out1}=b_{1}G+v_{out1}H \tag{4}\]  
\[P_{out2}=b_{2}G+v_{out2}H \tag{5}\]  
\[P_{fee}=v_{fe}G \tag{6}\]  
\(P_{out1}\) and \(P_{out2}\) are primarily used to facilitate the miner's verification of the transaction's legitimacy. To enable the receiver to obtain \((b_{1},v_{out1})\) and \((b_{2},v_{out2})\), it needs to be encrypted using the public keys of both receiver and sender, resulting in  
\[C_{out1}=IBC.Enc(AID_{r},(b_{1},v_{out1})) \tag{7}\]  
\[C_{out2}=IBC.Enc(AID_{s},(b_{1},v_{out2})) \tag{8}\]  
To ensure the transaction's legality, it must be verified that  
\[v_{in1}+v_{in2}=v_{out1}+v_{out2}+v_{fee} \tag{9}\]  
Consequently, the following can be calculated:  
\[(P_{in1}+P_{in2})-\left(P_{out1}+P_{out2}+P_{fee}\right)=(a_{1}+a_{2}-b_{1}-b_ {2})H \tag{10}\]  
Figure 5: UTXO Transaction Structure.  
Define the transaction's public key as  
\[Pk_{Tx}=(a_{1}+a_{2}-b_{1}-b_{2})H \tag{11}\]  
The transaction's private key is  
\[Sk_{Tx}=(a_{1}+a_{2}-b_{1}-b_{2}) \tag{12}\]  
The entire transaction is defined as  
\[M_{Tx}=\{P_{\text{in1}},P_{\text{in2}},(P_{\text{out1}},C_{\text{out1}}),(P_{ \text{out2}},C_{\text{out2}}),\text{v}_{\text{fee}}\} \tag{13}\]  
The transaction is signed using the SM9 signature algorithm, resulting in  
\[Sig_{Tx}=IBC.Sign(SK_{Tx},M_{Tx}) \tag{14}\]  
Additionally, it is necessary to verify the transaction amount range to prevent negative values; Bulletproofs can achieve this. Due to the complexity involved, this paper will not elaborate further, but Reference [15] can be consulted for more information. The final transaction is  
\[Tx=\left\{M_{Tx},Sig_{Tx},P_{range}\right\} \tag{15}\]  
where \(P_{range}\) encompasses details verifying the range of the transaction value. \(Tx\) is broadcast across the network and after miners verify its legitimacy, it is incorporated into blocks and documented in the blockchain ledger via consensus protocols. The receiver can acknowledge the transaction using \(AID_{r}\) and then decrypt \(C_{out1}\) using their private key \(Sk_{r}\) to obtain transaction information, thereby completing the entire process of the transaction while concealing the amount of the transaction.