Disclosure of Invention
In view of the above-mentioned deficiencies or inadequacies in the prior art, it would be desirable to provide an NFT ownership transfer method, computer device, and storage medium that allows a transferor to generate proof of transfer when the transferee is not determined, while safeguarding that the NFT is not stolen by a hacker.
In a first aspect, the present invention provides an NFT ownership transfer method applicable to a blockchain node, where a blockchain is deployed with an NFT ownership transfer contract, the NFT ownership transfer contract is configured with a zero-knowledge proof circuit for verifying an transferor and a transferee, and a first operation mode satisfying homomorphic encryption is determined for a third random number according to two random numbers, and the method includes:
and executing the first ownership transfer transaction, and inputting the elliptic curve encrypted value of the first random number, the second random number and the first certification information, and the elliptic curve encrypted value of the third random number and the second certification information into a verification algorithm of the zero-knowledge certification circuit for verification:
and if the verification is successful, transferring the ownership of the first NFT to a first transferee designated by the first ownership transfer transaction.
Wherein the first attestation information is generated according to a first attestation algorithm of a zero-knowledge attestation circuit; the public input of the first attestation algorithm comprises an elliptic curve encrypted value of a first random number and a second random number, and the private input of the first attestation algorithm comprises the first random number, an address of a first transferor of the first NFT and a private key;
the second proof information is generated according to a second proof algorithm of the zero-knowledge proof circuit; the public input of the second attestation algorithm comprises an elliptic curve cryptographic value of a third random number, and the private input of the second attestation algorithm comprises the third random number and the address of the first transferee;
the third random number is determined according to the first random number, the second random number and the first operation mode.
In a second aspect, the present invention provides an NFT ownership transfer method applicable to a client of a transferee, where a blockchain deploys an NFT ownership transfer contract, the NFT ownership transfer contract is configured with a zero-knowledge proof circuit for verifying the transferee and the transferee, and a first operation mode satisfying homomorphic encryption is determined for a third random number according to two random numbers, and the method includes:
acquiring an elliptic curve encrypted value of a first random number, a second random number and first certification information; wherein the first attestation information is generated according to a first attestation algorithm of a zero-knowledge attestation circuit; the public input of the first attestation algorithm comprises an elliptic curve encrypted value of a first random number and a second random number, and the private input of the first attestation algorithm comprises the first random number, an address of a first transferor of the first NFT and a private key;
acquiring a third random number; the third random number is determined according to the first random number, the second random number and the first operation mode;
generating second attestation information according to a second attestation algorithm of the zero-knowledge attestation circuit; wherein the public input of the second attestation algorithm comprises an elliptic curve cryptographic value of a third random number, and the private input of the second attestation algorithm comprises the third random number and the address of the current user;
generating a first ownership transfer transaction comprising the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information in a packaging manner, sending the first ownership transfer transaction to a block chain network for a block chain node to execute through an NFT ownership transfer contract, and inputting the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information into a verification algorithm of a zero-knowledge certification circuit for verification:
and if the verification is successful, transferring the ownership of the first NFT to the current user.
In a third aspect, the present invention further provides an NFT ownership transfer method applicable to a client of a transferor, where a blockchain deploys an NFT ownership transfer contract, the NFT ownership transfer contract is configured with a zero-knowledge proof circuit for verifying the transferor and the transferee, and a first operation mode satisfying homomorphic encryption is determined for a third random number according to two random numbers, and the method includes:
responding to the current user to transfer the ownership of the held first NFT to the first transferee, and acquiring the address of the first transferee;
generating first attestation information according to a first attestation algorithm of a zero-knowledge attestation circuit; the public input of the first certification algorithm comprises an elliptic curve encrypted value of a first random number and a second random number, and the private input of the first certification algorithm comprises the first random number, the address of the current user and a private key;
determining a third random number according to the first random number, the second random number and the first operation mode;
generating second attestation information according to a second attestation algorithm of the zero-knowledge attestation circuit; wherein the public input of the second attestation algorithm comprises an elliptic curve cryptographic value of a third random number, and the private input of the second attestation algorithm comprises the third random number and the address of the first transferee;
generating a first ownership transfer transaction comprising the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information in a packaging manner, sending the first ownership transfer transaction to a block chain network for a block chain node to execute through an NFT ownership transfer contract, and inputting the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information into a verification algorithm of a zero-knowledge certification circuit for verification:
and if the verification is successful, transferring the ownership of the first NFT to the first transferee.
In a fourth 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 to cause the one or more processors to perform the NFT ownership transfer method provided according to embodiments of the present invention.
In a fifth aspect, the present invention also provides a storage medium storing a computer program that causes a computer to execute the NFT ownership transfer method provided according to the embodiments of the present invention.
The NFT ownership transfer method, the computer device, and the storage medium provided in the embodiments of the present invention configure a zero-knowledge proof circuit for verifying the transferor and the transferee in the smart contract, determine the first operation mode of the third random number according to the two random numbers, which satisfies homomorphic encryption, and utilize the property of irreversible pushing of elliptic curve encryption, thereby ensuring that a hacker cannot break the third random number even if hijacking the transaction, and therefore cannot generate the second proof information that can pass the verification to steal the NFT, and finally realizing that the transferor can generate the transfer proof when the transferee is not determined, and at the same time ensuring that the NFT cannot be stolen by the hacker.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of an NFT ownership transfer method according to an embodiment of the present invention.
As shown in fig. 1, in this embodiment, the present invention provides an NFT ownership transfer method applicable to a blockchain node, where a blockchain is deployed with an NFT ownership transfer contract, the NFT ownership transfer contract is configured with a zero knowledge proof circuit for verifying an transferor and a transferee, and a first operation mode satisfying homomorphic encryption is determined for a third random number according to two random numbers, and the method includes:
s11: and executing a first ownership transfer transaction, and inputting the first random number of the elliptic curve encrypted value, the second random number and the first certification information, and inputting the third random number of the elliptic curve encrypted value and the second certification information into a verification algorithm of a zero-knowledge certification circuit for verification:
if the verification is successful, step S13 is executed: ownership of the first NFT is transferred to a first transferee designated by the first ownership transfer transaction.
Wherein the first attestation information is generated according to a first attestation algorithm of a zero-knowledge attestation circuit; the public input of the first attestation algorithm comprises an elliptic curve encrypted value of a first random number and a second random number, and the private input of the first attestation algorithm comprises the first random number, an address of a first transferor of the first NFT and a private key;
the second proof information is generated according to a second proof algorithm of the zero-knowledge proof circuit; the public input of the second attestation algorithm comprises an elliptic curve cryptographic value of a third random number, and the private input of the second attestation algorithm comprises the third random number and the address of the first transferee;
the third random number is determined according to the first random number, the second random number and the first operation mode.
In the present application, the zero knowledge proof circuit is verified based on the following principle:
1. verifying whether the private key and the address of the first transferor correspond to each other, and verifying whether the address of the first transferor is the address of the owner of the first NFT;
that is, verifying whether the first attestation information was generated by an owner of the first NFT;
2、R1=r1*G;
r3=f(r1,r2);
R3=r3*G=f(r1,r2)*G=f(r1*G,r2*G)=f(R1,R2);
that is, it is verified whether the generator of the second certification information knows R3, and only the first transferee designated by the person who knows R3 can pass the verification (those skilled in the art will understand that R3 cannot be calculated from R3);
wherein G is an elliptic curve base point, R1 is a first random number, R1 is an elliptic curve cryptographic value of the first random number, R2 is a second random number, R2 is an elliptic curve cryptographic value of the second random number, R3 is a third random number, R3 is an elliptic curve cryptographic value of the third random number, and f () is a first operation mode.
Those skilled in the art will understand how to generate a zero knowledge proof circuit according to the above verification principle in a zero knowledge proof architecture, the generated zero knowledge proof circuit including the first proof algorithm pro 1(), the second proof algorithm pro 2(), and the verification algorithm Verify (), and may further include the generation algorithm Setup (). The detailed process is not described herein.
The following will be referred to as Jia HePersistent NFT3Awarding transfer certificates before a certain decrypted game as a winner of the game, and finally earning NFT after B wins the decrypted game3The above method is exemplarily illustrated for the sake of example.
Prior to the race, the user end of the first responds to the generation of the NFT3Generating a first random number r1 and a second random number r 2;
then generating an elliptic curve cryptographic value R1 ═ R1 × G of the first random number, and a third random number R3 ═ f (R1, R2); wherein, f () is a first operation mode configured by the NFT ownership transfer contract;
the elliptic curve encryption value R1 of the first random number and the second random number R2 are used as public inputs of a first proving algorithm pro 1() of a zero-knowledge proving circuit, and the first random number R1 and the address addr of the first1And a private key p1As a private input of the first proof algorithm pro 1(), first proof information pro is generated1:
Prove1(R1、r2,r1、addr1、p1)→prove1;
Finally, the elliptic curve of the first random number is encrypted with a value R1, a second random number R2 and first proof information pro1As NFT3The transfer certificate disclosure of (a) may reside on the official website server of the decrypted competition, or, on the blockchain; while the third random number r3 is used as a winning voucher (not publicly available) for the winner.
After winning the decryption match, the user B receives the third random number R3 of the prize-receiving voucher of the winner, and simultaneously the user side of the user B obtains the elliptic curve encryption value R1, the second random number R2 and the first proof information pro from the positions of the official network server or the blockchain and the like1;
The user end of the second user end uses the elliptic curve encryption value R3 of the third random number as the public input of the second proof algorithm Prove2() of the zero-knowledge proof circuit, uses the third random number R3 and the address addr of the second user end2As a private input of the second proof algorithm pro 2(), second proof information pro is generated2:
Prove2(R3,r3、addr2)→prove2;
Repackaging generates an elliptic curve cryptographic value R1 including a first random number, a second random number R2, and first proof information pro1And, an elliptic curve cryptographic value R3 of a third random number and second proof information pro2To tx1 and sends tx1 to the blockchain network.
In step S11, the block link point executes tx1 by NFT ownership transfer contract, and transfers R1, R2, pro1R3 and pro2Inputting a verification algorithm Verify () of the zero knowledge proof circuit for verification:
Verify(R1、r2,prove1,R3,prove2)→Yes/No;
when the output result of the verification algorithm Verify () is No, the verification fails, and the tx1 fails to execute;
when the output result of the verification algorithm Verify () is Yes, the verification is successful, and step S13 is executed to put NFT on3Ownership of (b) is transferred to (b).
As can be understood by those skilled in the art, when a hacker hijacks tx1, only R1, R2 and pro of tx1 can be resolved1R3 and pro2However, R1 and R3 cannot be known, that is, a hacker cannot reversely deduce R3 from R3, or cannot calculate R3 from R1 and R2, so that on the premise that R3 cannot be obtained, a pro that can pass verification by the verification algorithm Verify () cannot be generated2', leading to the impossibility of stealing NFT3。
Those skilled in the art will also understand that the first operation manner f () can be configured as any operation manner commonly used in the art to satisfy homomorphic encryption, and can achieve the same technical effect.
The above embodiment exemplifies the method shown in fig. 1 by taking the elliptic curve cryptographic value of which the public input of the first certification algorithm comprises the first random number and the second random number, and the elliptic curve cryptographic value of which the public input of the second certification algorithm comprises the third random number; in further embodiments, different public inputs may be configured for the first and second attestation algorithms according to actual requirements, for example, a hash value of the first NFT may be further included, and so on.
The above embodiment takes the example of the client of the transferee packaging and generating ownership transfer transaction as an example, and exemplarily illustrates the method shown in fig. 1;
in another embodiment, the user side of the transferor may further obtain the address of the first transferee after determining the transferee, and package the address to generate the ownership transfer transaction, and the user side of the transferee only needs to provide the address without performing other operations, thereby achieving the same technical effect.
The embodiment is characterized in that a zero-knowledge proof circuit for verifying the transferor and the transferee, a first operation mode which determines a third random number according to the two random numbers and meets homomorphic encryption, and a characteristic that elliptic curve encryption is irreversible is utilized, so that a hacker cannot break the third random number even if hijacking the transaction, and therefore cannot generate second proof information which can pass verification to steal NFT, and finally the transferor can generate a transfer proof when the transferee is not determined, and simultaneously the NFT cannot be stolen by the hacker.
Fig. 2 is a flowchart of another NFT ownership transfer method according to an embodiment of the present invention. The method shown in fig. 2 may be performed in conjunction with the method shown in fig. 1 (packaging of the first ownership transfer transaction by the transferee).
As shown in fig. 2, in this embodiment, the present invention further provides an NFT ownership transfer method applied to a client of a transferee, where a blockchain deploys an NFT ownership transfer contract, the NFT ownership transfer contract is configured with a zero-knowledge proof circuit for verifying the transferor and the transferee, and a first operation manner satisfying homomorphic encryption is determined for a third random number according to two random numbers, and the method includes:
s21: acquiring an elliptic curve encrypted value of a first random number, a second random number and first certification information; wherein the first attestation information is generated according to a first attestation algorithm of a zero-knowledge attestation circuit; the public input of the first attestation algorithm comprises an elliptic curve encrypted value of a first random number and a second random number, and the private input of the first attestation algorithm comprises the first random number, an address of a first transferor of the first NFT and a private key;
s23: acquiring a third random number; the third random number is determined according to the first random number, the second random number and the first operation mode;
s25: generating second attestation information according to a second attestation algorithm of the zero-knowledge attestation circuit; wherein the public input of the second attestation algorithm comprises an elliptic curve cryptographic value of a third random number, and the private input of the second attestation algorithm comprises the third random number and the address of the current user;
s27: generating a first ownership transfer transaction comprising the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information in a packaging manner, sending the first ownership transfer transaction to a block chain network for a block chain node to execute through an NFT ownership transfer contract, and inputting the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information into a verification algorithm of a zero-knowledge certification circuit for verification:
and if the verification is successful, transferring the ownership of the first NFT to the current user.
The NFT ownership transfer of the method shown in fig. 2 can refer to an example of the ownership transfer transaction packaged by the transferee in the method shown in fig. 1, and is not described herein again.
Fig. 3 is a flowchart of a further NFT ownership transfer method according to an embodiment of the present invention. The method shown in fig. 3 may be performed in conjunction with the method shown in fig. 1 (packaging of the first ownership transfer transaction by the transferor).
As shown in fig. 3, in another embodiment, the present invention further provides an NFT ownership transfer method applied to a user end of a transferor, where a blockchain deploys an NFT ownership transfer contract, the NFT ownership transfer contract is configured with a zero-knowledge proof circuit for verifying the transferor and the transferee, and a first operation mode satisfying homomorphic encryption is determined for a third random number according to two random numbers, the method includes:
s31: responding to the current user to transfer the ownership of the held first NFT to the first transferee, and acquiring the address of the first transferee;
s33, generating first certification information according to a first certification algorithm of the zero-knowledge certification circuit; the public input of the first proving algorithm comprises an elliptic curve encrypted value of a first random number and a second random number, and the private input of the first proving algorithm comprises the first random number, the address of a current user and a private key;
s35: determining a third random number according to the first random number, the second random number and the first operation mode;
s37: generating second attestation information according to a second attestation algorithm of the zero-knowledge attestation circuit; wherein the public input of the second attestation algorithm comprises an elliptic curve cryptographic value of a third random number, and the private input of the second attestation algorithm comprises the third random number and the address of the first transferee;
s39: generating a first ownership transfer transaction comprising the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information in a packaging manner, sending the first ownership transfer transaction to a block chain network for a block chain node to execute through an NFT ownership transfer contract, and inputting the elliptic curve encrypted value of the first random number, the second random number, the first certification information, the elliptic curve encrypted value of the third random number and the second certification information into a verification algorithm of a zero-knowledge certification circuit for verification:
and if the verification is successful, transferring the ownership of the first NFT to the first transferee.
The NFT ownership transfer in the method shown in fig. 3 can refer to an example of the transfer party packaging ownership transfer transaction in the method shown in fig. 1, and is not described here again.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 4, as another aspect, the present application also provides a computer apparatus 400 including one or more Central Processing Units (CPUs) 401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the device 400 are also stored. The CPU401, ROM402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each unit may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.