A privacy transaction method, device and system

The elliptic curve encryption algorithm is used to calculate the hidden amount in UTXO transactions, and the blinding factor and remainder are used to ensure the legality of the transaction. This solves the problem of privacy leakage caused by the clear text disclosure of the transaction amount, and achieves both privacy protection and legality verification of the amount.

CN112819467BActive Publication Date: 2024-09-06CHINA ACADEMY OF INFORMATION & COMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110199253.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-23
Publication Date
2024-09-06
Estimated Expiration
2041-02-23

AI Technical Summary

Technical Problem

The clear disclosure of the transaction amount in UTXO transactions leads to the risk of user privacy leakage, and third parties can easily obtain the transaction amount on the account address.

Method used

The elliptic curve encryption algorithm is used to calculate the input hidden amount, output hidden amount and change hidden amount. The blinding factor is used to hide the amount, and the remainder is used to ensure the legality of the transaction and avoid the amount being disclosed in plain text.

Benefits of technology

It realizes the privacy protection of the transaction amount, prevents third parties from directly obtaining the clear text of the amount, and at the same time ensures the normal verification of transaction legality and avoids privacy leaks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112819467B
    Figure CN112819467B
Patent Text Reader

Abstract

The embodiment of the present application provides a privacy transaction method, device and system, which includes: obtaining the input amount v1, output amount v2 and change amount v3 of this transaction; calculating the input hidden amount C1, output hidden amount C2, change hidden amount C3 and remainder C4; packaging the input hidden amount, output hidden amount, change hidden amount and remainder into a transaction, and sending the packaged transaction to the blockchain network. In this technical solution, the formula C=r*G+v*H is used to hide the transaction amount. At the same time, since the remainder C4 of the transaction is also calculated, the transaction satisfies: if the input amount v1=output amount v2+change amount v3, then the equation C1=C2+C3+C4 holds. Therefore, this embodiment can hide the transaction amount without affecting the normal verification of the legality of the transaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of currency transaction, and in particular, to a privacy transaction method, device and system. Background Art

[0002] UTXO (Unspent Transaction Outputs) is one of the core concepts of transactions and verification, and is often used in blockchain systems. Transactions form a set of chain structures, and all legal transactions can be traced back to the output of one or more previous transactions. The end of these chains is the current unspent transaction output. Figure 1 The current structure diagram of UTXO transaction is shown. The input of a UTXO transaction includes: input account address and balance in the account (i.e. input amount), and the output includes: output account address and output amount, change account address and change amount. The sum of output amount and change amount must be equal to input amount for it to be a legal UTXO transaction.

[0003] The shortcoming of UTXO transactions is that in order to verify whether the input amount is equal to the sum of the output amount and the change amount, the amount in each transaction is disclosed in plain text. Therefore, participants in the blockchain network can easily obtain the amount of each transaction on each account address, which poses a great risk of privacy leakage to users. Summary of the invention

[0004] The embodiments of the present application provide a privacy transaction method, device and system to solve the privacy leakage risk caused by the explicit disclosure of transaction amounts in the prior art.

[0005] According to a first aspect of an embodiment of the present application, a privacy transaction method is provided, comprising: obtaining an input amount v1, an output amount v2, and a change amount v3 of the transaction; calculating an input hidden amount C1, an output hidden amount C2, a change hidden amount C3, and a remainder C4, where C1= r1 G + v1 H, C2 = r2 G+ v2 H, C3 = r3 G+ v3 H, C4 = r4 G; r1, r2 and r3 are blinding factors obtained according to random numbers, r4=r1-r2-r3, G and H are base points of subgroups on the first elliptic curve and the second elliptic curve respectively; the input hidden amount, the output hidden amount, the change hidden amount and the remainder are packaged into a transaction, and the packaged transaction is sent to the blockchain network.

[0006] According to a second aspect of an embodiment of the present application, a privacy transaction method is provided, comprising: determining a target transaction from a blockchain network; calculating a blinding factor r2 of the target transaction according to a public key P1 of a transaction initiator, wherein r2=Hash(d2 P1), d2 is the private key of the transaction recipient, and Hash(.) is a hash operation; the hidden amount C2' to be verified is calculated according to the transaction amount v2 corresponding to the target transaction and the blinding factor r2, where C2'= r2 G+ v2 H, G and H are the base points of the subgroups on the first elliptic curve and the second elliptic curve respectively; when the output hidden amount C2' to be verified is the same as the output hidden amount C2 in the target transaction, it is confirmed that the output amount of the target transaction is correct.

[0007] According to a third aspect of an embodiment of the present application, a privacy transaction device is provided, including: an amount acquisition module, used to obtain the input amount v1, output amount v2 and change amount v3 of this transaction; an amount hiding module, used to calculate the input hidden amount C1, output hidden amount C2, change hidden amount C3 and remainder C4, where C1= r1 G + v1 H, C2=r2 G+ v2 H, C3 = r3 G+ v3 H, C4 = r4 G; r1, r2 and r3 are blinding factors obtained according to random numbers, r4=r1-r2-r3, G and H are base points of subgroups on the first elliptic curve and the second elliptic curve respectively; a transaction generation module is used to package the input hidden amount, the output hidden amount, the change hidden amount and the remainder into a transaction, and send the packaged transaction to the blockchain network.

[0008] According to a fourth aspect of an embodiment of the present application, a privacy transaction device is provided, comprising: a transaction determination module, configured to determine a target transaction from a blockchain network; a blinding factor calculation module, configured to calculate a blinding factor r2 of the target transaction according to a public key P1 of a transaction initiator, wherein r2= Hash(d2 P1), d2 is the private key of the transaction recipient, and Hash(.) is a hash operation; an amount calculation module is used to calculate the hidden amount C2' of the output to be verified according to the transaction amount v2 corresponding to the target transaction and the blinding factor r2, where C2'= r2 G+ v2 H, G and H are base points of subgroups on the first elliptic curve and the second elliptic curve respectively; an amount verification module is used to confirm that the output amount of the target transaction is correct when the output hidden amount C2' to be verified is the same as the output hidden amount C2 in the target transaction.

[0009] According to a fifth aspect of an embodiment of the present application, a private transaction system is provided, comprising: a transaction initiator and a transaction recipient; wherein the transaction initiator is used to execute the private transaction method described in the first aspect; and the transaction recipient is used to execute the private transaction method described in the second aspect.

[0010] Compared with the prior art, the privacy transaction method, device and system provided by this application use the formula C = r G + v H achieves the hiding of transaction amount. When constructing a transaction, the input hidden amount C1 is used to replace the input amount v1, the output hidden amount C2 is used to replace the output amount v2, and the change hidden amount C3 is used to replace the change amount v3. In this way, a third party cannot directly obtain the plain text of the amount from the transaction, thus protecting the transaction privacy of the user. At the same time, this embodiment also calculates the remainder C4 of the transaction, so that the transaction satisfies: if the input amount v1 = the output amount v2 + the change amount v3, then the equation C1 = C2 + C3 + C4 holds. Therefore, this embodiment can hide the transaction amount without affecting the normal verification of the legality of the transaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0012] Figure 1 The existing structural diagram of UTXO transaction is shown;

[0013] Figure 2 A flowchart of the privacy transaction method provided by this embodiment is shown;

[0014] Figure 3 A schematic diagram of the structure of the UTXO transaction provided in this embodiment is shown;

[0015] Figure 4 Another structural schematic diagram of the UTXO transaction provided in this embodiment is shown;

[0016] Figure 5 Another structural schematic diagram of the UTXO transaction provided in this embodiment is shown;

[0017] Figure 6A flowchart of transaction legitimacy verification in the privacy transaction method provided in this embodiment is shown;

[0018] Figure 7 Another flow chart of the privacy transaction method provided by this embodiment is shown;

[0019] Figure 8 Another flow chart after step S330 in the privacy transaction method provided in this embodiment is shown;

[0020] Fig. 9 A schematic diagram of a private transaction device provided in this embodiment is shown;

[0021] Fig.10 A schematic diagram of another private transaction device provided by this embodiment is shown. DETAILED DESCRIPTION

[0022] The following is a detailed description of the exemplary embodiments of the present application in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0023] In existing UTXO transactions, the transaction amount is disclosed in order to verify whether the input amount is equal to the sum of the output amount and the change amount. However, during actual verification, the specific amount is not important. As long as it can be verified that the input amount is equal to the sum of the output amount and the change amount, the legality of the transaction can be proved. Therefore, an embodiment of the present application provides a privacy transaction method, which converts the amount in the UTXO transaction into ciphertext, which can encrypt and hide the transaction amount without affecting the normal verification of the legality of the transaction.

[0024] The two parties in a transaction are called the transaction initiator and the transaction receiver. Figure 2 The flowchart of the privacy transaction method provided by this embodiment is shown. The specific steps of the process are performed by the transaction initiator. Figure 2 , assuming a transfer transaction, where a sum of money is transferred from the initiator's account to the receiver's account, the specific process executed by the transaction initiator when constructing the UTXO transaction is as follows:

[0025] Step S110: Obtain the input amount, output amount and change amount of this transaction.

[0026] Step S120: Calculate the input hidden amount, output hidden amount, change hidden amount and remainder.

[0027] Step S130: Pack the input hidden amount, output hidden amount, change hidden amount and remainder into a transaction, and send the packaged transaction to the blockchain network.

[0028] Figure 3 The structural diagram of the UTXO transaction provided in this embodiment is shown below. Figure 3 The above process is described in detail.

[0029] First, each node in the blockchain network uses the same elliptic curve to generate a key pair, where the transaction initiator generates a private key d1 and a public key P1, and the transaction receiver generates a private key d2 and a public key P2. The specific process of generating the key pair is as follows:

[0030] 1. The two parties to the transaction select the same first elliptic curve and second elliptic curve to generate private keys d1 and d2. The private key is a random number in the range [1, n-1], where n is the order of the subgroup on the first elliptic curve;

[0031] 2. The two parties determine the base points G and H. G is the base point of the subgroup on the first elliptic curve, and H is the base point of the subgroup on the second elliptic curve.

[0032] 3. Both parties generate public keys P1 and P2, P1=d1 G,P2=d2 G, is the multiplication operation.

[0033] It is understandable that it is very easy to calculate the public key P1 when the private key d1 and the base point G are known, but it is very difficult to solve the private key d1 knowing only the public key P1 and the base point G.

[0034] The public keys P1 and P2 of both parties to the transaction are public. The transaction initiator can obtain the public key P2 of the transaction recipient, and the transaction recipient can obtain the public key P1 of the transaction initiator.

[0035] In step S110, the transaction initiator obtains the input amount v1, output amount v2 and change amount v3 of this transaction. The input amount v1 is the unspent transaction output of the transaction initiator, which is the balance of all accounts of the transaction initiator. The output amount v2 is the amount that the transaction initiator needs to transfer to the transaction recipient. The change amount v3 = v1-v2.

[0036] It should be noted that elliptic curves have the following properties:

[0037] Points on an elliptic curve can be added, subtracted, or multiplied by an integer. Given an integer k and using scalar multiplication to calculate k G,k G is also a point on the elliptic curve. Given another integer j, we can get (k+j) G=k G+j G, that is, the addition and scalar multiplication operations on the elliptic curve are still subject to the commutative and associative laws of addition and multiplication. Based on this property of the elliptic curve, this embodiment uses C = r G + v The formula H enables the hiding of transaction amount.

[0038] In step S120, the input hidden amount C1 is calculated based on the input amount v1, C1 = r1 G + v1 H.

[0039] Calculate the output hidden amount C2 based on the output amount v2, C2= r2 G+ v2 H.

[0040] Calculate the hidden change amount C3 based on the change amount v3, C3= r3 G+ v3 H.

[0041] Calculate the remainder C4, C4 = r4 G.

[0042] Among them, r1, r2 and r3 are blinding factors obtained according to random numbers, and r4=r1-r2-r3.

[0043] When constructing a transaction, C1 is used to replace v1 as the input amount of the UTXO transaction. r1 is a randomly generated random number. In one embodiment, the private key d1 of the transaction initiator can be used as the blinding factor r1, that is, r1 is equal to d1. Of course, a random number can also be generated separately as the blinding factor r1 for each transaction.

[0044] It can be understood that after a plaintext value v1 is multiplied by the base point H, the result is a ciphertext v1 that is simply encrypted by the elliptic curve. H, v1 H can also be regarded as a public key on the elliptic curve, and its corresponding private key v1 is a plaintext value. H and base point H cannot derive the private key v1, so it is impossible for a third party to calculate the value of v1 through C1 to achieve the purpose of hiding the amount.

[0045] When constructing a transaction, use C2 instead of v2 as the output amount of the UTXO transaction. In the process of calculating C2, the transaction initiator needs to first generate a blinding factor r2.

[0046] Optionally, this embodiment proposes a zero-interaction method for generating the blinding factor r2, where zero interaction means that the transaction initiator does not need to send the blinding factor r2 to the transaction recipient.

[0047] The public key P1 of the transaction initiator and the public key P2 of the transaction recipient are public, P1 = d1 G, P2 = d2 G, we can conclude that:

[0048] d1 d2 G =d1 P2 = d2 P1.

[0049] In this embodiment, the transaction initiator calculates the blinding factor r2 of this transaction based on the public key P2 of the transaction recipient, r2= Hash(d1 P2), Hash(.) is a hash operation. Correspondingly, the transaction receiver can calculate the blinding factor r2 of this transaction based on the public key P1 of the transaction initiator, r2= Hash(d2 P1), since d1 and d2 are not public, only the two parties involved in the transaction can calculate the value of r2. The transaction initiator does not need to send the blinding factor r2 to the transaction recipient alone. At the same time, it ensures that the third party cannot calculate the value of r2. The purpose of the transaction recipient obtaining r2 is to verify whether the output amount in the transaction is correct.

[0050] Optionally, the transaction initiator can also randomly generate a consistent blinding factor r2, and use an encryption and decryption algorithm to encrypt r2 to obtain r2 ciphertext, and package the r2 ciphertext into the transaction. The transaction recipient extracts the r2 ciphertext in the transaction, and uses the same encryption and decryption algorithm to decrypt the r2 ciphertext to obtain r2. The step of sending the blinding factor r2 is also omitted.

[0051] When constructing a transaction, C3 is used instead of v3 as the change amount of the UTXO transaction, v3 = v1 – v2; r3 is a randomly generated random number. In one embodiment, the private key d1 of the transaction initiator can be used as the blinding factor r3, that is, r3 can be equal to d1. Of course, a random number can also be generated separately as the blinding factor r3 for each transaction.

[0052] When constructing a transaction, you also need to calculate the remainder of the transaction. Remainder C4 = r4 G, r4=r1-r2-r3.

[0053] According to the calculation formulas of C1, C2, C3 and C4, if the input amount v1 = output amount v2 + change amount v3, then:

[0054]

[0055] That is, the transaction satisfies: if the input amount v1 = output amount v2 + change amount v3, then the equation C1 = C2 + C3 + C4 holds. Therefore, the blockchain node only needs to verify whether the equation C1 = C2 + C3 + C4 holds to confirm whether the input amount in the transaction is equal to the sum of the output amount and the change amount. This achieves the purpose of hiding the transaction amount without affecting the normal verification of the legality of the transaction on the blockchain network.

[0056] In step S130, the input hidden amount, output hidden amount, change hidden amount and remainder are packaged into the transaction, and the input address, output address, change address and other contents are also packaged into the transaction. Finally, the packaged transaction is sent to the blockchain network.

[0057] It should be noted that in addition to verifying whether the equation C1=C2+C3+C4 holds, the blockchain node also needs to verify that the transaction amount is non-negative. For example, if someone constructs a malicious transaction with an input amount of 10, an output amount of 20, and a change amount of -10, it also satisfies the equation C1=C2+C3+C4. However, this will create some money out of thin air, and the transaction is still illegal. Therefore, it is not enough to just verify whether the input amount in the transaction is equal to the sum of the output amount and the change amount.

[0058] Considering that the amount in the transaction has been replaced by C1, C2, and C3, the blockchain node cannot directly use the amount disclosed in plain text to verify whether the amount is greater than or equal to zero. Therefore, this embodiment solves this problem through a zero-knowledge proof algorithm. Zero-knowledge proof, as the name suggests, means that the transaction initiator can make the verifier believe that the output amount v2 is greater than or equal to zero and the change amount v3 is greater than or equal to zero without disclosing the output amount v2 and the change amount v3, thereby verifying the legitimacy of the transaction.

[0059] When constructing a transaction, the transaction initiator uses a zero-knowledge proof algorithm to generate a first range proof of the output hidden amount C2 and a second range proof of the change hidden amount C3, and packages the first range proof and the second range proof into the transaction. The blockchain node can verify whether the output amount v2 is greater than or equal to zero based on the first range proof, and can verify whether the change amount v3 is greater than or equal to zero based on the second range proof.

[0060] Optionally, when constructing a transaction, the output address can also be encrypted using a specific encryption formula to hide the output address and further protect the privacy of both parties to the transaction.

[0061] Figure 4Another structural diagram of the UTXO transaction provided by this embodiment is shown. Specifically, when constructing a transaction, the transaction initiator calculates the one-time public key Pubkey of this transaction based on the public key P2 of the transaction recipient, and uses the one-time public key Pubkey as the output address of this transaction to replace the original account address of the transaction recipient, thereby achieving the purpose of hiding the address. The calculation formula of Pubkey is as follows:

[0062] Pubkey=P2+Hash(Hash(tx),Hash(d2 d1 G)) G

[0063] Since d2 d1 G=d2 P1=d1 P2, so the above formula can be transformed into the following two forms:

[0064] Pubkey=P2+Hash(Hash(tx),Hash(d1 P2)) G

[0065] Pubkey=P2+Hash(Hash(tx),Hash(d2 P1)) G

[0066] Among them, tx is the current transaction. Since the output address has not been obtained at this time, tx can be the current transaction with a vacant output address.

[0067] The transaction initiator calculates the one-time public key Pubkey of this transaction based on its own private key d1 and the public key P2 of the transaction receiver to obtain the output address. Correspondingly, the transaction receiver can also calculate the corresponding one-time public key based on its own private key d2 and the public key P1 of the transaction initiator.

[0068] Optionally, when constructing a transaction, the transaction initiator can also hide the change address in the same way. Figure 5 Another structural schematic diagram of the UTXO transaction provided by this embodiment is shown. Specifically, the transaction initiator calculates the one-time public key Pubkey_1 according to the following formula (1), and calculates the one-time public key Pubkey_2 according to the following formula (2). Pubkey_1 is used as the output address of this transaction, and Pubkey_2 is used as the change address of this transaction. Among them, tx can be this transaction with both the output address and the change address blank.

[0069] Pubkey_1=P2+Hash(Hash(tx),Hash(d1 P2)) G (1)

[0070] Pubkey_2=P1+Hash(Hash(tx),Hash(d1)) G (2)

[0071] The transaction initiator packages the encrypted and hidden output address and the encrypted and hidden change address into the transaction, and sends the packaged transaction to the blockchain network.

[0072] Each blockchain node and transaction recipient needs to verify the legitimacy of transactions in the blockchain network. Figure 6 The flowchart of transaction legitimacy verification in the privacy transaction method provided in this embodiment is shown. Please refer to Figure 6 As shown in the flowchart, the transaction legitimacy verification process includes:

[0073] Step S210: Monitor transactions in the blockchain network.

[0074] Step S220: extract the input hidden amount C1, the output hidden amount C2, the change hidden amount C3 and the remainder C4 in the transaction, and verify whether the equation C1=C2+C3+C4 holds.

[0075] Step S230: extract the first range proof and the second range proof in the transaction, and verify whether the output amount and the change amount of the transaction are both greater than or equal to zero based on the first range proof and the second range proof.

[0076] Step S240: When the equation C1=C2+C3+C4 holds true and the output amount and the change amount of the transaction are both greater than or equal to zero, confirm that the transaction is legal.

[0077] If most nodes in the blockchain network confirm that the transaction is legal, the recipient of the transaction can use the output of the transaction to initiate a new transaction.

[0078] Figure 7 Another flowchart of the privacy transaction method provided by this embodiment is shown. In this flowchart, the transaction recipient uses its own private key d2 to find its own transaction by monitoring UTXO transactions. The specific process includes:

[0079] Step S310: Obtain the public key of the transaction initiator.

[0080] The public key P1 of the transaction initiator is public, and the transaction recipient can obtain the public key P1.

[0081] Step S320: Calculate the one-time public key Pubkey' to be verified for each legal transaction in the blockchain network based on its own private key and the public key of the transaction initiator.

[0082] Where, Pubkey' = P2 + Hash(Hash(tx),Hash(d2 P1)) G, d2 is the private key of the transaction recipient, P1 is the public key of the transaction initiator, tx is the transaction, the content of tx is consistent with the content of tx used when constructing the transaction, and tx can be the content of the transaction without the output address.

[0083] Step S330: Determine the target transaction according to the one-time public key Pubkey' to be verified of each transaction and the one-time public key Pubkey used as the output address in the transaction.

[0084] The target transaction refers to the transaction whose recipient is the current node itself. The transaction recipient compares the one-time public key Pubkey' to be verified of the legal transaction with the one-time public key Pubkey used as the output address in the transaction. If Pubkey' is inconsistent with Pubkey, it is confirmed that the recipient of the transaction is not itself; if Pubkey' is consistent with Pubkey, it is confirmed that the recipient of the transaction is itself, thereby determining the target transaction.

[0085] It is understandable that since the transaction initiator hides the output address, only the real transaction recipient can use his or her private key d2 to determine that the actual recipient of the transaction is himself or herself, and other third parties cannot confirm the specific recipient of a UTXO transaction.

[0086] Please refer to Figure 8 After step S330, after the transaction recipient determines the target transaction, the privacy transaction method further includes:

[0087] Step S410: Calculate the blinding factor r2 of the target transaction based on the public key of the transaction initiator.

[0088] The transaction receiver uses the formula r2= Hash(d2 P1) calculates the blinding factor r2, d2 is the private key of the transaction recipient, and P1 is the public key of the transaction initiator.

[0089] Step S420: Calculate the hidden amount C2' to be output for verification according to the transaction amount corresponding to the target transaction and the blinding factor r2.

[0090] The transaction receiver calculates the hidden amount C2' of the output to be verified based on the transaction amount v2 and the blinding factor r2 corresponding to the target transaction using the following formula:

[0091] C2'=r2 G+v2 H;

[0092] Wherein, H is the base point of the subgroup on the second elliptic curve.

[0093] Step S430: When the output hidden amount C2' to be verified is the same as the output hidden amount C2 in the target transaction, confirm that the output amount of the target transaction is correct.

[0094] The transaction recipient determines whether the hidden amount of the output to be verified C2' is the same as the hidden amount of the output in the target transaction C2. If C2'=C2, the output amount in this transaction is consistent with the actual transaction amount of this transaction, and the transaction recipient confirms that the output amount of the target transaction is correct. Otherwise, the transaction recipient confirms that the output amount of the target transaction is incorrect.

[0095] Through the above steps S410-430, even if the actual output amount in the transaction is hidden, the transaction recipient can still verify the correctness of the output amount output to himself.

[0096] Furthermore, after confirming that the output amount of the target transaction is correct, the transaction recipient can calculate the corresponding private key d3. As mentioned above, the output address of the target transaction is the corresponding one-time public key Pubkey:

[0097]

[0098] From the above formula, we can know that the private key d3 corresponding to the one-time public key Pubkey of the target transaction is:

[0099] d3=d2+Hash(Hash(tx),Hash(d2 P1))

[0100] Obviously, only the transaction recipient can calculate the private key d3 corresponding to the Pubkey through his own private key d2. The private key d3 is used to control the balance on the output address of the target transaction. Others cannot calculate the private key d3 and cannot use the balance on the output address, which improves the security of the transaction.

[0101] In summary, the privacy transaction method provided by this application uses the formula C = r G + v H achieves the hiding of transaction amount. When constructing a transaction, the input hidden amount C1 is used to replace the input amount v1, the output hidden amount C2 is used to replace the output amount v2, and the change hidden amount C3 is used to replace the change amount v3. In this way, a third party cannot directly obtain the plain text of the amount from the transaction, thus protecting the transaction privacy of the user. At the same time, this embodiment also calculates the remainder C4 of the transaction, so that the transaction satisfies: if the input amount v1 = the output amount v2 + the change amount v3, then the equation C1 = C2 + C3 + C4 holds. Therefore, this embodiment can hide the transaction amount without affecting the normal verification of the legality of the transaction.

[0102] Furthermore, this embodiment constructs a calculation formula for the blinding factor r2, that is, r2= Hash(d1 d2 G), so that the transaction initiator does not need to send the blinding factor r2 to the transaction recipient, and only the transaction parties can calculate the blinding factor r2 based on their own private keys, and a third party cannot obtain r2.

[0103] Furthermore, this embodiment constructs a calculation formula for the one-time public key Pubkey, namely Pubkey = P2 + Hash(Hash(tx), Hash(d1 d2 G)) G, cleverly uses Pubkey to replace the real account address of the transaction recipient. According to the formula, only the transaction recipient can use his own private key to find his own transaction and calculate the private key corresponding to Pubkey, thereby achieving the purpose of hiding the transaction address and improving the security of the transaction.

[0104] Based on the same inventive concept, the present application embodiment provides a privacy transaction device, please refer to Fig. 9 , the device comprises:

[0105] Amount acquisition module 510, used to acquire the input amount v1, output amount v2 and change amount v3 of this transaction;

[0106] Amount hiding module 520, used to calculate input hidden amount C1, output hidden amount C2, change hidden amount C3 and remainder C4, where C1= r1 G + v1 H, C2 = r2 G+ v2 H, C3 = r3 G+ v3 H, C4 = r4 G; r1, r2 and r3 are blinding factors obtained according to random numbers, r4=r1-r2-r3, G and H are base points of subgroups on the first elliptic curve and the second elliptic curve respectively;

[0107] The transaction generation module 530 is used to package the input hidden amount, the output hidden amount, the change hidden amount and the remainder into a transaction, and send the packaged transaction to the blockchain network.

[0108] Optionally, the device further includes: a blinding factor generation module, which is used to calculate the blinding factor r2 of this transaction according to the public key P2 of the transaction recipient, r2= Hash(d1 P2), Hash(.) is the hash operation, and d1 is the private key of the transaction initiator.

[0109] Optionally, the device further includes: an address hiding module, used to calculate the one-time public key Pubkey of this transaction according to the public key P2 of the transaction recipient, Pubkey=P2+ Hash(Hash(tx),Hash(d1 P2)) G, tx is the transaction with a vacant output address; the one-time public key Pubkey is packaged into the transaction as the output address.

[0110] Optionally, the device also includes: a range proof module, used to generate a first range proof of the output hidden amount and a second range proof of the change hidden amount using a zero-knowledge proof algorithm; and package the first range proof and the second range proof into a transaction.

[0111] Optionally, r1 and / or r3 are the private keys of the transaction initiator.

[0112] Based on the same inventive concept, the present application embodiment also provides a privacy transaction device, please refer to Fig.10 , the device comprises:

[0113] A transaction determination module 610, configured to determine a target transaction from a blockchain network;

[0114] The blinding factor calculation module 620 is used to calculate the blinding factor r2 of the target transaction according to the public key P1 of the transaction initiator, where r2= Hash(d2 P1), d2 is the private key of the transaction recipient, and Hash(.) is the hash operation;

[0115] The amount calculation module 630 is used to calculate the hidden amount C2' to be verified output according to the transaction amount v2 corresponding to the target transaction and the blinding factor r2, where C2'= r2 G+ v2 H, G and H are the base points of the subgroups on the first elliptic curve and the second elliptic curve respectively;

[0116] The amount verification module 640 is used to confirm that the output amount of the target transaction is correct when the output hidden amount C2' to be verified is the same as the output hidden amount C2 in the target transaction.

[0117] Optionally, the transaction determination module 610 is specifically used to: monitor transactions in the blockchain network; calculate the one-time public key Pubkey' to be verified for each legal transaction according to the private key d2 of the transaction recipient, Pubkey'=P2 + Hash(Hash(tx),Hash(d2 P1)) G, P2 is the public key of the transaction recipient, tx is the content of the transaction excluding the output address; the target transaction is determined according to the one-time public key Pubkey' to be verified for each transaction and the one-time public key Pubkey used as the output address in the transaction.

[0118] Optionally, the device further includes: a private key calculation module, used to calculate the private key d3 corresponding to the one-time public key Pubkey of the target transaction, where d3= (d2 + Hash(Hash(tx),Hash(d2 P1)), the private key d3 is used to control the balance on the output address of the target transaction.

[0119] Optionally, the device also includes: a legitimacy verification module, used to extract the input hidden amount C1, the output hidden amount C2, the change hidden amount C3 and the remainder C4 of the transaction, and verify whether the equation C1=C2+C3+C4 holds; extract the first range proof and the second range proof of the transaction, and verify whether the output amount and the change amount of the transaction are both greater than or equal to zero based on the first range proof and the second range proof; when the equation C1=C2+C3+C4 holds and the output amount and the change amount of the transaction are both greater than or equal to zero, confirm that the transaction is legal.

[0120] It can be understood that the implementation principle and technical effects of the privacy transaction device in this embodiment have been introduced in the aforementioned method embodiment. For the sake of brief description, the parts not mentioned in the privacy transaction device can refer to the corresponding description in the privacy transaction method.

[0121] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt 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 codes.

[0122] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 generate 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.

[0123] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0125] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0126] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A privacy transaction method, characterized in that: include: Get the input amount v1, output amount v2 and change amount v3 of this transaction; Calculate the blinding factor r2 of this transaction based on the public key P2 of the transaction recipient, P2 = d2 G, r2 = Hash(d1 P2), Hash(.) is a hash operation, d1 is the private key of the transaction initiator, d2 is the private key of the transaction recipient, and G is the base point of the subgroup on the first elliptic curve; Calculate the input hidden amount C1, output hidden amount C2, change hidden amount C3 and remainder C4, where C1 = r1 G+v1 H, C2 = r2 G+v2 H, C3 = r3 G+v3 H, C4 = r4 G; r1 and r3 are blinding factors obtained from random numbers or the private key of the transaction initiator, r4 = r1-r2-r3, H is the base point of the subgroup on the second elliptic curve, and the first elliptic curve and the second elliptic curve are the same; The input hidden amount, the output hidden amount, the change hidden amount and the remainder are packaged into a transaction, and the packaged transaction is sent to the blockchain network. When the equation C1=C2+C3+C4 holds and the output amount and the change amount of the transaction are both greater than or equal to zero, the transaction is confirmed to be legal.

2. The method according to claim 1, characterized in that Before sending the packaged transaction to the blockchain network, the method further includes: The one-time public key Pubkey of this transaction is calculated based on the public key P2 of the transaction recipient. Pubkey=P2+Hash(Hash(tx) ,Hash(d1 P2)) G, tx is the transaction with a vacant output address; The one-time public key Pubkey is packaged into the transaction as the output address.

3. The method according to claim 1, characterized in that Before sending the packaged transaction to the blockchain network, the method further includes: Generate a first range proof of the output hidden amount and a second range proof of the change hidden amount using a zero-knowledge proof algorithm, wherein the first range proof is used to verify whether the output amount is greater than or equal to zero, and the second range proof is used to verify whether the change amount is greater than or equal to zero; The first range proof and the second range proof are packaged into a transaction.

4. A privacy transaction method, characterized in that: include: Determine the target transaction from the blockchain network; wherein, determining the target transaction from the blockchain network includes: extracting the input hidden amount C1, the output hidden amount C2, the change hidden amount C3 and the remainder C4 of the transaction, and verifying whether the equation C1=C2+C3+C4 holds; wherein, C1=r1 G+v1 H, C2 = r2 G+v2 H, C3 = r3 G+v3 H, C4 = r4 G, r1, r3 are blinding factors obtained according to random numbers or the private key of the transaction initiator, r4 = r1-r2-r3, H is the base point of the subgroup on the second elliptic curve, and the first elliptic curve and the second elliptic curve are the same; extract the first range proof and the second range proof of the transaction, and verify whether the output amount and the change amount of the transaction are both greater than or equal to zero according to the first range proof and the second range proof; when the equation C1 = C2+C3+C4 holds and the output amount and the change amount of the transaction are both greater than or equal to zero, confirm that the transaction is legal; The blinding factor r2 of the target transaction is calculated based on the public key P1 of the transaction initiator, where r2 = Hash(d2 P1), P1=d1 G, d2 is the private key of the transaction recipient, Hash(.) is the hash operation, d1 is the private key of the transaction initiator, and G is the base point of the subgroup on the first elliptic curve; Calculate the hidden amount C2' of the output to be verified according to the transaction amount v2 corresponding to the target transaction and the blinding factor r2, where C2'=r2 G+v2 H, H is the base point of the subgroup on the second elliptic curve, and the first elliptic curve and the second elliptic curve are the same; When the output hidden amount C2' to be verified is the same as the output hidden amount C2 in the target transaction, it is confirmed that the output amount of the target transaction is correct.

5. The method according to claim 4, characterized in that Determining the target transaction from the blockchain network includes: Monitor transactions in the blockchain network; The one-time public key Pubkey' to be verified for each legal transaction is calculated based on the private key d2 of the transaction recipient. Pubkey'=P2+Hash(Hash(tx) ,Hash(d2 P1)) G, P2 is the public key of the transaction recipient, and tx is the content of the transaction minus the output address; The target transaction is determined according to the one-time public key Pubkey' to be verified of each transaction and the one-time public key Pubkey used as the output address in the transaction.

6. The method according to claim 4, characterized in that After confirming that the output amount of the target transaction is correct, the method further includes: Calculate the private key d3 corresponding to the one-time public key Pubkey of the target transaction, where d3 = (d2 + Hash (Hash (tx) , Hash (d2 P1)), the private key d3 is used to control the balance on the output address of the target transaction.

7. A private transaction device, characterized in that: include: The amount acquisition module is used to obtain the input amount v1, output amount v2 and change amount v3 of this transaction; The blinding factor generation module is used to calculate the blinding factor r2 of this transaction based on the public key P2 of the transaction recipient, P2 = d2 G, r2 = Hash(d1 P2), Hash(.) is a hash operation, d1 is the private key of the transaction initiator, d2 is the private key of the transaction recipient, and G is the base point of the subgroup on the first elliptic curve; Amount hiding module, used to calculate input hidden amount C1, output hidden amount C2, change hidden amount C3 and remainder C4, where C1 = r1 G+v1 H, C2 = r2 G+v2 H, C3 = r3 G+v3 H, C4 = r4 G; r1 and r3 are blinding factors obtained from random numbers or the private key of the transaction initiator, r4 = r1-r2-r3, H is the base point of the subgroup on the second elliptic curve, and the first elliptic curve and the second elliptic curve are the same; The transaction generation module is used to package the input hidden amount, the output hidden amount, the change hidden amount and the remainder into a transaction, and send the packaged transaction to the blockchain network. When the equation C1=C2+C3+C4 holds and the output amount and the change amount of the transaction are both greater than or equal to zero, the transaction is confirmed to be legal.

8. A private transaction device, characterized in that: include: The transaction determination module is used to determine the target transaction from the blockchain network; specifically, it is used to extract the input hidden amount C1, output hidden amount C2, change hidden amount C3 and remainder C4 of the transaction, and verify whether the equation C1=C2+C3+C4 holds; where C1=r1 G+v1 H, C2 = r2 G+v2 H, C3 = r3 G+v3 H, C4 = r4 G, r1, r3 are blinding factors obtained according to random numbers or the private key of the transaction initiator, r4 = r1-r2-r3, H is the base point of the subgroup on the second elliptic curve, and the first elliptic curve and the second elliptic curve are the same; extract the first range proof and the second range proof of the transaction, and verify whether the output amount and the change amount of the transaction are both greater than or equal to zero according to the first range proof and the second range proof; when the equation C1 = C2+C3+C4 holds and the output amount and the change amount of the transaction are both greater than or equal to zero, confirm that the transaction is legal; The blinding factor calculation module is used to calculate the blinding factor r2 of the target transaction according to the public key P1 of the transaction initiator, where r2 = Hash (d2 P1), P1=d1 G, d2 is the private key of the transaction recipient, Hash(.) is the hash operation, d1 is the private key of the transaction initiator, and G is the base point of the subgroup on the first elliptic curve; The amount calculation module is used to calculate the hidden amount C2' of the output to be verified according to the transaction amount v2 corresponding to the target transaction and the blinding factor r2, where C2'=r2 G+v2 H, H is the base point of the subgroup on the second elliptic curve, and the first elliptic curve and the second elliptic curve are the same; The amount verification module is used to confirm that the output amount of the target transaction is correct when the output hidden amount C2' to be verified is the same as the output hidden amount C2 in the target transaction.

9. A private transaction system, characterized in that: include: The transaction initiator and the transaction receiver; Wherein, the transaction initiator is used to execute the privacy transaction method as described in any one of claims 1 to 3; The transaction recipient is used to execute the privacy transaction method as described in any one of claims 4-7.