Red envelope processing method, computer device and storage medium based on zero-knowledge proof

By configuring a zero-knowledge proof circuit on the blockchain, the client generates and verifies the red envelope receiving transaction, which solves the problem that the red envelope receiving voucher is easily stolen, realizes the safe transfer of the red envelope, and prevents malicious nodes from stealing it.

CN113592469BActive Publication Date: 2024-09-24南京呗茵特互联网科技有限公司
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202110883014.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-02
Publication Date
2024-09-24
Estimated Expiration
2041-08-02

AI Technical Summary

Technical Problem

In the existing blockchain red envelope solution, the red envelope collection voucher is easily intercepted and stolen by malicious nodes, resulting in the red envelope being stolen.

Method used

Configure the zero-knowledge proof circuit in the red envelope contract on the blockchain, and generate and verify the red envelope receiving transaction through the user end, ensuring that only users holding the private key can successfully receive the red envelope and prevent malicious nodes from stealing it.

Benefits of technology

It effectively prevents criminals from stealing red envelopes by parsing them and ensuring the safety and reliability of red envelope transfers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113592469B
    Figure CN113592469B
Patent Text Reader

Abstract

The present invention provides a red envelope processing method based on zero-knowledge proof, a computer device and a storage medium, the method comprising: in response to receiving a first red envelope, receiving first data, a first public key and a first signature information; using the first data, the first public key and the second address of the current user as the public input of the proof algorithm of the zero-knowledge proof circuit, using the first signature information and the second private key corresponding to the second address as the private input of the proof algorithm, generating the first proof information; generating a first red envelope receiving transaction including the first data, the first public key, the second address and the first proof information and sending it to the blockchain network, so that the blockchain node can execute it through the red envelope contract. The present invention makes it impossible for criminals to steal red envelopes by parsing the red envelope receiving transaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a red envelope processing method, computer equipment and storage medium based on zero-knowledge proof. Background Art

[0002] In the existing blockchain red envelope solution, one implementation method is to record the verification information of the red envelope receipt voucher into the red envelope contract on the blockchain. When the user receives the red envelope, the user terminal packages the corresponding red envelope receipt voucher to generate a red envelope receipt transaction and sends it; when executing the red envelope receipt transaction, the red envelope contract verifies the red envelope receipt voucher based on the above verification information to determine whether the receipt is successful.

[0003] For example, in the scheme disclosed in application No. CN201910077876.9 previously applied for by the applicant, a random number is used as a red envelope receipt voucher, and a hash value of the random number is used as verification information of the red envelope receipt voucher.

[0004] The problem with the above solution is that when the red envelope collection transaction is intercepted by a malicious node at the beginning of sending, the red envelope collection certificate may be stolen, resulting in the red envelope being stolen.

[0005] For example, user A's client obtains the random number r1 as a red envelope receipt voucher, packages and generates a red envelope receipt transaction tx1 including r1 and sends it to blockchain node A. Under normal circumstances, node A will broadcast tx1 to other nodes in the blockchain network, and eventually tx1 will be packaged and executed on the chain. However, when node A is a malicious node controlled by lawbreakers, node A can parse the random number r1 from tx1, discard tx1, and then generate a red envelope receipt transaction tx2 including r1 to steal the red envelope. Even if user A's client also sends tx1 to other blockchain nodes at the same time, there is still a possibility that tx2 will be packaged and executed on the chain before tx1. Summary of the invention

[0006] In view of the above-mentioned defects or deficiencies in the prior art, it is desired to provide a red envelope processing method, computer device and storage medium based on zero-knowledge proof, which prevents criminals from stealing red envelopes by parsing red envelope redemption transactions.

[0007] In a first aspect, the present invention provides a red envelope processing method based on zero-knowledge proof applicable to a user terminal, wherein a red envelope contract is configured on a blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method comprises:

[0008] In response to receiving the first red envelope, receiving first data, a first public key and a first signature information; wherein the first signature information is generated by the red envelope sending user signing the first data with a first private key corresponding to the first public key, and the red envelope contract is further configured to record the first data and the first public key into the red envelope contract when executing the corresponding red envelope sending transaction;

[0009] Using the first data, the first public key, and the second address of the current user as public inputs of a proof algorithm of a zero-knowledge proof circuit, and using the first signature information and the second private key corresponding to the second address as private inputs of the proof algorithm, to generate first proof information;

[0010] A first red envelope receiving transaction including first data, a first public key, a second address and first proof information is generated and sent to the blockchain network for execution by the blockchain node through the red envelope contract, and the first data, the first public key, the second address and the first proof information are input into the verification algorithm of the zero-knowledge proof circuit to verify:

[0011] Whether the user receiving the red envelope holds the red envelope receipt signed by the first private key held by the user sending the red envelope;

[0012] Whether the second address is the address corresponding to the second private key held by the user who received the red envelope;

[0013] If any of the above verifications fail, the red envelope will fail to be received;

[0014] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the second address.

[0015] In a second aspect, the present invention provides a red envelope processing method based on zero-knowledge proof applicable to a blockchain node, wherein a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method comprises:

[0016] The first red envelope receiving transaction is executed through the red envelope contract, and the first data, the first public key, the second address and the first proof information are input into the verification algorithm of the zero-knowledge proof circuit to verify:

[0017] Whether the user receiving the red envelope holds the red envelope receipt signed by the first private key held by the user sending the red envelope;

[0018] Whether the second address is the address corresponding to the second private key held by the user who received the red envelope;

[0019] If any of the above verifications fail, the red envelope will fail to be received;

[0020] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the second address.

[0021] The first red envelope receiving transaction includes the first data, the first public key, the second address and the first certification information, which are packaged and generated by the first user terminal;

[0022] The first proof information is generated by the first user end after receiving the first red packet and the first data, the first public key and the first signature information, using the first data, the first public key and the second address as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the first signature information and the second private key corresponding to the second address as the private input of the proof algorithm;

[0023] The red envelope contract is also configured to record the first data and the first public key into the red envelope contract when executing the corresponding red envelope transaction.

[0024] In a third aspect, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a user terminal, wherein a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method comprises:

[0025] In response to receiving the second red envelope, receiving a third public key and a third private key; wherein the red envelope contract is further configured to record the third public key into the red envelope contract when executing the corresponding red envelope transaction;

[0026] Using the third public key and the fourth address of the current user as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the third private key and the fourth private key corresponding to the fourth address as private inputs of the proof algorithm, to generate second proof information;

[0027] Generate a second red envelope receiving transaction including the third public key, the fourth address and the second proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the third public key, the fourth address and the second proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0028] Whether the user receiving the red envelope holds the third private key corresponding to the third public key;

[0029] Whether the fourth address is the address corresponding to the fourth private key held by the user who received the red envelope;

[0030] If any of the above verifications fail, the red envelope will fail to be received;

[0031] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fourth address.

[0032] In a fourth aspect, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a blockchain node, wherein a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method comprises:

[0033] The second red envelope claiming transaction is executed through the red envelope contract, and the third public key, the fourth address and the second proof information are input into the verification algorithm of the zero-knowledge proof circuit to verify:

[0034] Whether the user receiving the red envelope holds the third private key corresponding to the third public key;

[0035] Whether the fourth address is the address corresponding to the fourth private key held by the user who received the red envelope;

[0036] If any of the above verifications fail, the red envelope will fail to be received;

[0037] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fourth address.

[0038] The second red envelope receiving transaction includes the third public key, the fourth address and the second certification information, which are packaged and generated by the second user terminal;

[0039] The second proof information is generated by the second user end after receiving the second red envelope and the third public key and the third private key, using the third public key and the fourth address as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the third private key and the fourth private key corresponding to the fourth address as the private input of the proof algorithm;

[0040] The red envelope contract is also configured to record the third public key into the red envelope contract when executing the corresponding red envelope transaction.

[0041] In a fifth aspect, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a user terminal, wherein a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method comprises:

[0042] In response to receiving the third red envelope, receiving the first random number; wherein the red envelope contract is further configured to record the hash value of the first random number into the red envelope contract when executing the corresponding red envelope transaction;

[0043] Using the hash value of the first random number and the fifth address of the current user as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the first random number and the fifth private key corresponding to the fifth address as private inputs of the proof algorithm, to generate third proof information;

[0044] Generate a third red envelope receiving transaction including the hash value of the first random number, the fifth address and the third proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the hash value of the first random number, the fifth address and the third proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0045] Whether the user receiving the red envelope holds the first random number;

[0046] Whether the fifth address is the address corresponding to the fifth private key held by the user who received the red envelope;

[0047] If any of the above verifications fail, the red envelope will fail to be received;

[0048] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fifth address.

[0049] In a sixth aspect, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a blockchain node, wherein a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method comprises:

[0050] The third red envelope claiming transaction is executed through the red envelope contract, and the hash value of the first random number, the fifth address and the third proof information are input into the verification algorithm of the zero-knowledge proof circuit to verify:

[0051] Whether the user receiving the red envelope holds the first random number;

[0052] Whether the fifth address is the address corresponding to the fifth private key held by the user who received the red envelope;

[0053] If any of the above verifications fail, the red envelope will fail to be received;

[0054] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fifth address.

[0055] The third red envelope receiving transaction includes the hash value of the first random number, the fifth address and the third certification information, which are packaged and generated by the third user terminal;

[0056] The third proof information is generated by the third user end after receiving the third red packet and the first random number, using the hash value of the first random number and the fifth address as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the first random number and the fifth private key corresponding to the fifth address as the private input of the proof algorithm;

[0057] The red envelope contract is also configured to record the hash value of the first random number into the red envelope contract when executing the corresponding red envelope transaction.

[0058] In the seventh aspect, the present invention also provides a computer device comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors so that the one or more processors execute the red envelope processing method based on zero-knowledge proof provided according to various embodiments of the present invention.

[0059] In an eighth aspect, the present invention also provides a storage medium storing a computer program, which enables a computer to execute a red envelope processing method based on zero-knowledge proof provided according to various embodiments of the present invention.

[0060] The red envelope processing method, computer device and storage medium based on zero-knowledge proof provided by many embodiments of the present invention configure a zero-knowledge proof circuit for verifying the red envelope receipt and the red envelope payment address in the red envelope contract, and the user end that obtains the red envelope receipt generates proof information based on the red envelope receipt and the payment account private key, and then packages it to generate a red envelope receipt transaction, so that even if the criminals parse the proof information from the red envelope receipt transaction, they cannot steal the red envelope, thereby preventing the criminals from stealing the red envelope by parsing the red envelope receipt transaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0062] Figure 1 A flowchart of a red envelope processing method based on zero-knowledge proof applicable to a user terminal is provided in accordance with an embodiment of the present invention.

[0063] Figure 2 A flowchart of a red envelope processing method based on zero-knowledge proof applicable to a blockchain node provided in one embodiment of the present invention.

[0064] Figure 3 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to a user terminal provided in one embodiment of the present invention.

[0065] Figure 4 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to blockchain nodes provided in one embodiment of the present invention.

[0066] Figure 5 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to a user terminal is provided as an embodiment of the present invention.

[0067] Figure 6 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to a blockchain node provided in one embodiment of the present invention.

[0068] Figure 7 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0069] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.

[0070] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0071] Figure 1 A flowchart of a red envelope processing method based on zero-knowledge proof applicable to a user terminal is provided in accordance with an embodiment of the present invention.

[0072] like Figure 1 As shown, in this embodiment, the present invention provides a red envelope processing method based on zero-knowledge proof applicable to a user terminal, a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method includes:

[0073] S11: In response to receiving the first red envelope, receiving first data, a first public key and a first signature information; wherein the first signature information is generated by the red envelope sending user signing the first data with a first private key corresponding to the first public key, and the red envelope contract is further configured to record the first data and the first public key into the red envelope contract when executing the corresponding red envelope sending transaction;

[0074] S13: using the first data, the first public key, and the second address of the current user as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the first signature information and the second private key corresponding to the second address as private inputs of the proof algorithm to generate first proof information;

[0075] S15: Generate a first red envelope receiving transaction including the first data, the first public key, the second address and the first proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the first data, the first public key, the second address and the first proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0076] Whether the user receiving the red envelope holds the red envelope receipt signed by the first private key held by the user sending the red envelope;

[0077] Whether the second address is the address corresponding to the second private key held by the user who received the red envelope;

[0078] If any of the above verifications fail, the red envelope will fail to be received;

[0079] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the second address.

[0080] In this embodiment, the red envelope receipt voucher is the first signature information, and the verification algorithm of the red envelope receipt voucher is the signature verification algorithm, that is, verifying whether the first signature information is generated by signing the first data with the first private key according to the first public key; the verification algorithm of the red envelope payment address is to generate an address according to the private key and then verify whether the two addresses are the same, that is, verifying whether the second address is an address generated according to the second private key. Those skilled in the art can understand the principles of various signature verification algorithms in this field, as well as the principle of one-to-one correspondence between private keys, public keys and addresses.

[0081] The zero-knowledge proof circuit configured in the red envelope contract is generated according to the above algorithms. Specifically, those skilled in the art can understand how to generate a zero-knowledge proof circuit according to an algorithm in a zero-knowledge proof system. The zero-knowledge proof circuit includes at least a proof algorithm Prove() and a verification algorithm Verify(), and may also include a generation algorithm Setup(). The specific process will not be repeated here.

[0082] The following example takes user B sending a red packet to three people and user C grabbing one of the red packets. Figure 1 The method shown is explained by way of example.

[0083] When sending the red envelope to the three persons, the user terminal of user B randomly selects or generates three data items data1, data2, and data3, packages them to generate a red envelope transaction tx3 including data1, data2, data3 and the public key P1 of user B, and then sends it to the blockchain network by directly sending it, or by packaging it into a transaction group with the red envelope payment transaction and then sending it.

[0084] When tx3 is executed successfully, the blockchain node records data1, data2, data3 and P1 into the red envelope contract.

[0085] When user C grabs one of the red envelopes, the user terminal of user C executes step S11 to receive the data data1 and signature information sign(data1) corresponding to the red envelope, as well as the public key P1 sent by the centralized red envelope server.

[0086] In step S13, the user terminal of user C uses data data1, public key P1, and address addr2 of user C as the public input of the proof algorithm Prove() of the zero-knowledge proof circuit, and uses signature information sign(data1) and private key p2 corresponding to address addr2 as the private input of the proof algorithm Prove() to generate the first proof information prove1:

[0087] Prove(data1, P1, addr2, sign(data1), p2) → prove1.

[0088] In step S15, the user terminal of user C packages and generates a red envelope receiving transaction tx4 including data data1, public key P1, address addr2 and proof information prove1, and sends tx4 to the blockchain network.

[0089] The blockchain node receives, broadcasts, packages, and executes tx4 through the red envelope contract, inputting the data data1, public key P1, address addr2, and proof information prove1 into the verification algorithm Verify() of the zero-knowledge proof circuit for verification:

[0090] Verify(data1, P1, addr2, prove1)→Yes / No.

[0091] Specifically, the verification algorithm Verify() ensures that the following two verifications are performed simultaneously within the zero-knowledge proof circuit:

[0092] Verify whether the signature information sign(data1) is generated by signing data1 with the private key p1 held by the user who sent the red envelope according to the public key P1 and data data1;

[0093] Verify whether the address addr2 corresponds to the private key p2;

[0094] When any of the above verifications fails, the output result of the verification algorithm Verify() is No, tx4 execution fails, and the red envelope collection fails;

[0095] When all the above verifications are successful, the output result of the verification algorithm Verify() is Yes, tx4 is executed successfully, and the red envelope amount corresponding to data1 / sign(data1) is transferred to address addr2.

[0096] Specifically, in the above embodiment, if there is a malicious node that parses and discards tx4, the malicious node can only parse out data data1, public key P1, address addr2 and proof information prove1 from tx4, but cannot parse out sign(data1):

[0097] If a malicious node repackages a red envelope redemption transaction with data data1, public key P1, address addr2 and proof information prove1, the execution result of the transaction is still to transfer the red envelope amount to address addr2;

[0098] If a malicious node uses the criminal's address addr x Replace addr2 with data data1, public key P1, address addr xand proof information prove1 to repackage another red envelope receiving transaction. When executing the transaction, the red envelope contract will use the verification algorithm Verify() to determine the address addr x It is not the address corresponding to the private key p2, so the transaction cannot be verified and criminals cannot steal the red envelope.

[0099] The above embodiment configures a zero-knowledge proof circuit for verifying the red envelope receipt and the red envelope payment address in the red envelope contract, and the user end that obtains the red envelope receipt generates proof information based on the red envelope receipt and the private key of the payment account, and then packages and generates a red envelope receipt transaction, so that even if the criminals parse the proof information from the red envelope receipt transaction, they cannot steal the red envelope, thereby preventing the criminals from stealing the red envelope by parsing the red envelope receipt transaction.

[0100] Figure 2 A flowchart of a red envelope processing method based on zero-knowledge proof applicable to a blockchain node provided in one embodiment of the present invention. Figure 2 The method shown can be used with Figure 1 The method shown is executed.

[0101] like Figure 2 As shown, the present invention also provides a red envelope processing method based on zero-knowledge proof applicable to a blockchain node, a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method includes:

[0102] S21: Execute the first red envelope receiving transaction through the red envelope contract, input the first data, the first public key, the second address and the first proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0103] Whether the user receiving the red envelope holds the red envelope receipt signed by the first private key held by the user sending the red envelope;

[0104] Whether the second address is the address corresponding to the second private key held by the user who received the red envelope;

[0105] If any of the above verifications fail, the red envelope will fail to be received;

[0106] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the second address.

[0107] The first red envelope receiving transaction includes the first data, the first public key, the second address and the first certification information, which are packaged and generated by the first user terminal;

[0108] The first proof information is generated by the first user end after receiving the first red packet and the first data, the first public key and the first signature information, using the first data, the first public key and the second address as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the first signature information and the second private key corresponding to the second address as the private input of the proof algorithm;

[0109] The red envelope contract is also configured to record the first data and the first public key into the red envelope contract when executing the corresponding red envelope transaction.

[0110] Figure 2 The red envelope processing principle of the method shown can be referred to Figure 1 The method shown will not be repeated here.

[0111] Figure 3 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to a user terminal provided in one embodiment of the present invention.

[0112] like Figure 3 As shown, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a user terminal, a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method includes:

[0113] S31: In response to receiving the second red envelope, receiving a third public key and a third private key; wherein the red envelope contract is further configured to record the third public key into the red envelope contract when executing the corresponding red envelope transaction;

[0114] S33: using the third public key and the fourth address of the current user as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the third private key and the fourth private key corresponding to the fourth address as private inputs of the proof algorithm to generate second proof information;

[0115] S35: Generate a second red envelope receiving transaction including the third public key, the fourth address and the second proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the third public key, the fourth address and the second proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0116] Whether the user receiving the red envelope holds the third private key corresponding to the third public key;

[0117] Whether the fourth address is the address corresponding to the fourth private key held by the user who received the red envelope;

[0118] If any of the above verifications fail, the red envelope will fail to be received;

[0119] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fourth address.

[0120] Specifically, Figure 3 The method shown is Figure 1 The differences between the methods shown are:

[0121] exist Figure 3 In the method shown, the red envelope receipt voucher is a (one-time) third private key, and the verification algorithm of the red envelope receipt voucher is a public-private key verification algorithm, that is, the third private key is verified based on the third public key.

[0122] Take the example of user B sending a red packet to three people. Figure 3 In the method shown, User B's client needs to randomly generate three one-time public and private key pairs, and record the three one-time public keys into the red envelope contract through the red envelope transaction;

[0123] In step S31, the user terminal of user C receives the one-time public key P3 and private key p3 in the same way;

[0124] In step S33, the client of user C generates proof information prove2 in the same way:

[0125] Prove(P3, addr4, p3, p4)→prove2.

[0126] In step S35, the user terminal of user C packages and generates a red envelope receiving transaction tx5 including the public key P3, address addr4 and proof information prove2, and sends tx5 to the blockchain network.

[0127] The blockchain node executes tx5 through the red envelope contract, and inputs the public key P3, address addr4 and proof information prove2 into the verification algorithm Verify() for verification:

[0128] Verify(P3, addr4, prove2)→Yes / No.

[0129] Similarly, when the malicious node parses and discards tx5, it can only parse out the public key P3, address addr4, and proof information prove2 from tx5, but cannot parse out the private key p3;

[0130] Regardless of whether the malicious node uses the criminal's address addr x Replacing addr4 will not be able to steal the red envelope.

[0131] Figure 4 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to blockchain nodes provided in one embodiment of the present invention. Figure 4 The method shown can be used with Figure 3 The method shown is executed.

[0132] like Figure 4As shown, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a blockchain node, a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method includes:

[0133] The second red envelope claiming transaction is executed through the red envelope contract, and the third public key, the fourth address and the second proof information are input into the verification algorithm of the zero-knowledge proof circuit to verify:

[0134] Whether the user receiving the red envelope holds the third private key corresponding to the third public key;

[0135] Whether the fourth address is the address corresponding to the fourth private key held by the user who received the red envelope;

[0136] If any of the above verifications fail, the red envelope will fail to be received;

[0137] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fourth address.

[0138] The second red envelope receiving transaction includes the third public key, the fourth address and the second certification information, which are packaged and generated by the second user terminal;

[0139] The second proof information is generated by the second user end after receiving the second red envelope and the third public key and the third private key, using the third public key and the fourth address as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the third private key and the fourth private key corresponding to the fourth address as the private input of the proof algorithm;

[0140] The red envelope contract is also configured to record the third public key into the red envelope contract when executing the corresponding red envelope transaction.

[0141] Figure 4 The red envelope processing principle of the method shown can be referred to Figure 3 The method shown will not be repeated here.

[0142] Figure 5 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to a user terminal is provided as an embodiment of the present invention.

[0143] like Figure 5 As shown, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a user end, a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method includes:

[0144] S51: In response to receiving the third red envelope, receiving the first random number; wherein the red envelope contract is further configured to record the hash value of the first random number into the red envelope contract when executing the corresponding red envelope transaction;

[0145] S53: using the hash value of the first random number and the fifth address of the current user as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the first random number and the fifth private key corresponding to the fifth address as the private input of the proof algorithm to generate third proof information;

[0146] S55: Generate a third red envelope receiving transaction including the hash value of the first random number, the fifth address and the third proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the hash value of the first random number, the fifth address and the third proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0147] Whether the user receiving the red envelope holds the first random number;

[0148] Whether the fifth address is the address corresponding to the fifth private key held by the user who received the red envelope;

[0149] If any of the above verifications fail, the red envelope will fail to be received;

[0150] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fifth address.

[0151] Specifically, Figure 5 The method shown is Figure 1 The difference between the method shown in / 3 is:

[0152] exist Figure 5 In the method shown, the red envelope receipt voucher is a first random number, and the verification algorithm of the red envelope receipt voucher is a hash algorithm, that is, verifying whether the hash value of the first random number is the same as the hash value recorded in the contract.

[0153] Take the example of user B sending a red packet to three people. Figure 5 In the method shown, user B's client needs to randomly generate three random numbers r1, r2, and r3, and record the hash values ​​of the three random numbers hash(r1), hash(r2), and hash(r3) into the red envelope contract through a red envelope transaction;

[0154] In step S51, the user terminal of user C receives the random number r1 in the same way;

[0155] In step S53, the client of user C generates proof information prove3 in the same way:

[0156] Prove(hash(r1),addr5,r1,p5)→prove3.

[0157] In step S55, the user terminal of user C packages and generates a red envelope receiving transaction tx6 including hash(r1), addr5, and prove3, and sends tx6 to the blockchain network.

[0158] The blockchain node executes tx6 through the red envelope contract, and inputs hash(r1), addr5, and prove3 into the verification algorithm Verify() for verification:

[0159] Verify(hash(r1),addr5,prove3)→Yes / No.

[0160] Similarly, when the malicious node parses and discards tx6, it can only parse out hash(r1), addr5, and prove3 from tx6, but cannot parse out r1;

[0161] Regardless of whether the malicious node uses the criminal's address addr x No matter who replaces addr5, the red envelope cannot be stolen.

[0162] Figure 6 A flowchart of another red envelope processing method based on zero-knowledge proof applicable to a blockchain node provided in one embodiment of the present invention. Figure 6 The method shown can be used with Figure 5 The method shown is executed.

[0163] like Figure 6 As shown, the present invention also provides another red envelope processing method based on zero-knowledge proof applicable to a blockchain node, a red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract, and the method includes:

[0164] S61: Execute the third red envelope receiving transaction through the red envelope contract, input the hash value of the first random number, the fifth address and the third proof information into the verification algorithm of the zero-knowledge proof circuit to verify:

[0165] Whether the user receiving the red envelope holds the first random number;

[0166] Whether the fifth address is the address corresponding to the fifth private key held by the user who received the red envelope;

[0167] If any of the above verifications fail, the red envelope will fail to be received;

[0168] If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fifth address.

[0169] The third red envelope receiving transaction includes the hash value of the first random number, the fifth address and the third certification information, which are packaged and generated by the third user terminal;

[0170] The third proof information is generated by the third user end after receiving the third red packet and the first random number, using the hash value of the first random number and the fifth address as the public input of the proof algorithm of the zero-knowledge proof circuit, and using the first random number and the fifth private key corresponding to the fifth address as the private input of the proof algorithm;

[0171] The red envelope contract is also configured to record the hash value of the first random number into the red envelope contract when executing the corresponding red envelope transaction.

[0172] Figure 6 The red envelope processing principle of the method shown can be referred to Figure 5 The method shown will not be repeated here.

[0173] Figure 7 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention.

[0174] like Figure 7 As shown, as another aspect, the present application also provides a computer device 700, including one or more central processing units (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0175] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0176] In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes a program code for executing any of the above methods. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 709, and / or installed from the removable medium 711.

[0177] As another aspect, the present application also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the apparatus of the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into the device. The computer-readable storage medium stores one or more programs, which are used by one or more processors to execute the method described in the present application.

[0178] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a dedicated hardware-based system that performs a specified function or operation, or can be realized by a combination of dedicated hardware and computer instructions.

[0179] The units or modules involved in the embodiments described in the present application may be implemented by software or by hardware. The units or modules described may also be provided in a processor. For example, each unit may be a software program provided in a computer or a mobile smart device, or may be a separately configured hardware device. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves.

[0180] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the concept of the present application. For example, the above features are replaced with the technical features with similar functions disclosed in the present application (but not limited to) to form a technical solution.

Claims

1. A red envelope processing method based on zero-knowledge proof, characterized in that: A red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract. The method is applicable to a user end, and the method comprises: in response to receiving a first red envelope, receiving first data, a first public key and first signature information; wherein the first signature information is generated by the red envelope sending user signing the first data with a first private key corresponding to the first public key, and the red envelope contract is further configured to record the first data and the first public key into the red envelope contract when executing a corresponding red envelope sending transaction; Using the first data, the first public key, and the second address of the current user as public inputs of a proof algorithm of the zero-knowledge proof circuit, and using the first signature information and a second private key corresponding to the second address as private inputs of the proof algorithm, to generate first proof information; Generate a first red envelope receiving transaction including the first data, the first public key, the second address and the first proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the first data, the first public key, the second address and the first proof information into the verification algorithm of the zero-knowledge proof circuit to verify: whether the user receiving the red envelope holds the red envelope receiving voucher signed by the first private key held by the user sending the red envelope; Whether the second address is the address corresponding to the second private key held by the user who received the red envelope; If any of the above verifications fail, the red envelope will fail to be received; If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the second address.

2. A red envelope processing method based on zero-knowledge proof, characterized in that: A red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract. The method is applicable to a blockchain node, and the method includes: executing a first red envelope receipt transaction through the red envelope contract, inputting first data, a first public key, a second address and first proof information into a verification algorithm of the zero-knowledge proof circuit to verify: whether the red envelope receiving user holds a red envelope receipt signed by a first private key held by the red envelope issuing user; Whether the second address is the address corresponding to the second private key held by the user who received the red envelope; If any of the above verifications fail, the red envelope will fail to be received; If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the second address; The first red envelope receiving transaction includes the first data, the first public key, the second address and the first certification information, which are packaged and generated by the first user terminal; The first proof information is generated by the first user end after receiving the first red envelope and the first data, the first public key and the first signature information, using the first data, the first public key and the second address as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the first signature information and the second private key corresponding to the second address as private inputs of the proof algorithm; The red envelope contract is also configured to record the first data and the first public key into the red envelope contract when executing the corresponding red envelope transaction.

3. A red envelope processing method based on zero-knowledge proof, characterized in that: A red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt and a red envelope payment address is configured in the red envelope contract. The method is applicable to a user end, and the method includes: in response to receiving a second red envelope, receiving a third public key and a third private key; wherein the red envelope contract is further configured to record the third public key into the red envelope contract when executing a corresponding red envelope transaction; Using the third public key and the fourth address of the current user as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the third private key and the fourth private key corresponding to the fourth address as private inputs of the proof algorithm, to generate second proof information; Generate a second red envelope receiving transaction including the third public key, the fourth address and the second proof information and send it to the blockchain network for execution by the blockchain node through the red envelope contract, and input the third public key, the fourth address and the second proof information into the verification algorithm of the zero-knowledge proof circuit to verify: whether the red envelope receiving user holds the third private key corresponding to the third public key; Whether the fourth address is the address corresponding to the fourth private key held by the user who received the red envelope; If any of the above verifications fail, the red envelope will fail to be received; If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fourth address.

4. A red envelope processing method based on zero-knowledge proof, characterized in that: A red envelope contract is configured on the blockchain, and a zero-knowledge proof circuit for verifying a red envelope receipt voucher and a red envelope payment address is configured in the red envelope contract. The method is applicable to a blockchain node, and the method includes: executing a second red envelope receipt transaction through the red envelope contract, inputting a third public key, a fourth address, and a second proof information into a verification algorithm of the zero-knowledge proof circuit to verify: whether the red envelope receiving user holds a third private key corresponding to the third public key; Whether the fourth address is the address corresponding to the fourth private key held by the user who received the red envelope; If any of the above verifications fail, the red envelope will fail to be received; If both of the above verifications are successful, the corresponding red envelope amount will be transferred to the fourth address; The second red envelope receiving transaction includes the third public key, the fourth address and the second certification information, which are packaged and generated by the second user terminal; The second proof information is generated by the second user end after receiving the second red envelope and the third public key and the third private key, using the third public key and the fourth address as public inputs of the proof algorithm of the zero-knowledge proof circuit, and using the third private key and the fourth private key corresponding to the fourth address as private inputs of the proof algorithm; The red envelope contract is also configured to record the third public key into the red envelope contract when executing the corresponding red envelope transaction.

5. A computer device, characterized in that: The device comprises: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method according to any one of claims 1 to 4.

6. A storage medium storing a computer program, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Anonymous transfer method and system based on block chain, and storage medium

    CN108764874A

  • Payment method and system, device and storage medium

    CN108985760A

  • Red packet processing method and device and storage medium

    CN109727009A

  • Block chain red envelope processing, creating and getting method and device, medium and computer program

    CN110363512A

  • Electronic certificate generation and verification and key control method, device, system and medium

    CN110535648A