Universal wallet retrieval method, computer device and storage medium
By adding UTXOSEQUENCE fields to the Bitcoin blockchain and the method of generating delayed transactions, the problem of incompleteness of the wallets in the existing technologies to retrieve the rules is not flexibly adjusted, and a more flexible and efficient wallet recovery process is achieved.
Patent Information
- Application Number
- CN202111167257.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-04
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2041-10-04
AI Technical Summary
When the existing technology adjusts the relevant rules for wallet recovery, the blockchain node code needs to be recompiled and issued, and the node needs to update new blockchain programs, resulting in inflexibility.
By adding UTXOSEQUENCE fields to the signature data of the Bitcoin script verification type transaction, a general wallet is provided, including generating wallets to retrieve the lock script, the public key and address, and respond to the loss of the private key to generate the transaction. Delayed transactions are performed through the blockchain network.
The flexibility of the wallet recovery function is realized, and the needs of the blockchain node code to re -compile and improve the system's flexibility and response speed.
Smart Images

Figure CN113888329B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a universal wallet retrieval method, computer equipment and storage medium. Background Art
[0002] In the prior art, the main method of wallet recovery is to pre-associate a backup address. The private key of this address can initiate an asset recovery transaction and transfer the assets of the associated address to the backup address. The asset recovery transaction needs to meet certain delay requirements.
[0003] In the above mechanism, when the wallet retrieval rules are adjusted (for example, there are multiple backup addresses, etc.), the blockchain node code needs to be recompiled and issued, and the node needs to update the new blockchain program, which is very inflexible. Summary of the invention
[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a flexible universal wallet retrieval method, computer device and storage medium.
[0005] In a first aspect, the present invention provides a general wallet retrieval method applicable to a client, wherein the blockchain is a non-Bitcoin blockchain, and a UtxoSequence field is added to the signature data of a Bitcoin script verification type transaction, and the method comprises:
[0006] Generate a first wallet retrieval locking script based on the first public key of the current user's primary account, the second public key of the current user's backup account, and the first wallet retrieval duration; generate a first wallet retrieval public key based on the first wallet retrieval locking script; and generate a first wallet retrieval address based on the first wallet retrieval public key;
[0007] In response to the loss of the first private key of the primary account, an unsigned first wallet retrieval transaction is generated; wherein the first transaction initiator address of the first wallet retrieval transaction is the first wallet retrieval address;
[0008] Generate a first temporary bitcoin transaction according to the unsigned first wallet retrieval transaction; wherein the first temporary bitcoin transaction includes only one input UTXO, the first index hash of the input UTXO of the first temporary bitcoin transaction is the first transaction hash of the unsigned first wallet retrieval transaction, and the Sequence of the first temporary bitcoin transaction is configured as the first wallet retrieval duration;
[0009] According to the first temporary Bitcoin transaction, the first wallet retrieves the locking script and the second private key of the backup account to generate the first signature data, and generates the first wallet retrieves the unlocking script according to the first signature data;
[0010] Generate the unsigned second signature data of the first wallet retrieval transaction according to the first wallet retrieval lock script, the first wallet retrieval unlock script, the Bitcoin signature verification mark, and the first wallet retrieval public key; wherein the UtxoSequence of the second signature data is configured as the first wallet retrieval duration;
[0011] Generate a complete first wallet retrieval transaction based on the unsigned first wallet retrieval transaction and the second signature data;
[0012] Generate a first wallet retrieval evidence transaction according to the complete first wallet retrieval transaction; wherein the payload of the first wallet retrieval evidence transaction includes the complete first wallet retrieval transaction;
[0013] Send the First Wallet retrieval evidence transaction to the blockchain network for blockchain nodes to:
[0014] When executing the first block in which the first wallet retrieves the evidence transaction is packaged, and determining that the first wallet retrieves the evidence transaction is a first-type transaction that requires delayed execution, deduct the handling fee of the first wallet retrieves the evidence transaction, record the first wallet retrieves the evidence transaction on the blockchain, and store the complete first wallet retrieves the evidence transaction locally;
[0015] When executing packaging of the second block with the complete first wallet retrieval transaction, the start packaging time of the complete first wallet retrieval transaction is calculated according to the block packaging time of the first block and the first wallet retrieval duration;
[0016] According to the Bitcoin signature verification mark in the complete first wallet retrieval transaction, determine whether the complete first wallet retrieval transaction is a Bitcoin script verification type transaction, determine whether the first wallet retrieval public key in the complete first wallet retrieval transaction matches the first transaction initiator address in the complete first wallet retrieval transaction, determine whether the first wallet retrieval locking script in the complete first wallet retrieval transaction matches the first wallet retrieval public key in the complete first wallet retrieval transaction, and determine whether the current block time has reached the start packaging time;
[0017] When the above judgments are all yes, a second temporary Bitcoin transaction is generated; wherein the second temporary Bitcoin transaction includes only one input UTXO, the second index hash of the input UTXO of the second temporary Bitcoin transaction is the first transaction hash, and the Sequence of the second temporary Bitcoin transaction is configured as the first wallet retrieval time;
[0018] Call the Bitcoin blockchain interface to determine whether the current block time has reached the starting packaging time according to the first wallet retrieval locking script in the complete first wallet retrieval transaction, the first wallet retrieval unlocking script in the complete first wallet retrieval transaction, and the second temporary Bitcoin transaction: if yes, execute the complete first wallet retrieval transaction to execute the second block.
[0019] In a second aspect, the present invention also provides a 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 general wallet retrieval method provided according to various embodiments of the present invention.
[0020] In a third aspect, the present invention further provides a storage medium storing a computer program, which enables a computer to execute the universal wallet retrieval method provided according to various embodiments of the present invention.
[0021] The universal wallet retrieval method, computer device and storage medium provided by many embodiments of the present invention generate a first wallet retrieval locking script according to the first public key of the current user's main account, the second public key of the current user's backup account and the first wallet retrieval time, generate a first wallet retrieval public key according to the first wallet retrieval locking script, and generate a first wallet retrieval address according to the first wallet retrieval public key; in response to the loss of the first private key of the main account, generate an unsigned first wallet retrieval transaction; generate a first temporary Bitcoin transaction according to the unsigned first wallet retrieval transaction; generate a first signature data according to the first temporary Bitcoin transaction, the first wallet retrieval locking script and the second private key of the backup account, and generate a first wallet retrieval unlocking script according to the first signature data; generate the second signature data of the unsigned first wallet retrieval transaction according to the first wallet retrieval locking script, the first wallet retrieval unlocking script, the Bitcoin signature verification mark and the first wallet retrieval public key; generate a complete first wallet retrieval transaction according to the unsigned first wallet retrieval transaction and the second signature data; generate a first wallet retrieval evidence transaction according to the complete first wallet retrieval transaction; and send the first wallet retrieval evidence transaction to the blockchain network, so that the wallet retrieval function is more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] 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:
[0023] Figure 1 The present invention provides a flowchart of a universal wallet recovery method according to an embodiment of the present invention.
[0024] Figure 2 A schematic diagram of the structure of a device provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0025] 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.
[0026] 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.
[0027] Figure 1 A flowchart of a universal wallet recovery method provided by an embodiment of the present invention. Figure 1 As shown, in this embodiment, the present invention provides a universal wallet retrieval method applicable to a client, the blockchain is a non-Bitcoin blockchain, and a UtxoSequence field is added to the signature data of a Bitcoin script verification type transaction, and the above method includes:
[0028] S10: Generate a first wallet retrieval locking script according to the first public key of the current user's primary account, the second public key of the current user's backup account, and the first wallet retrieval duration; generate a first wallet retrieval public key according to the first wallet retrieval locking script; and generate a first wallet retrieval address according to the first wallet retrieval public key;
[0029] S12: In response to the loss of the first private key of the primary account, generating an unsigned first wallet retrieval transaction; wherein the first transaction initiator address of the first wallet retrieval transaction is the first wallet retrieval address;
[0030] S13: Generate a first temporary bitcoin transaction according to the unsigned first wallet retrieval transaction; wherein the first temporary bitcoin transaction includes only one input UTXO, the first index hash of the input UTXO of the first temporary bitcoin transaction is the first transaction hash of the unsigned first wallet retrieval transaction, and the Sequence of the first temporary bitcoin transaction is configured as the first wallet retrieval duration;
[0031] S14: Generate first signature data based on the first temporary bitcoin transaction, the first wallet retrieval lock script and the second private key of the backup account, and generate the first wallet retrieval unlock script based on the first signature data;
[0032] S15: Generate the unsigned second signature data of the first wallet retrieval transaction according to the first wallet retrieval lock script, the first wallet retrieval unlock script, the Bitcoin signature verification mark, and the first wallet retrieval public key; wherein the UtxoSequence of the second signature data is configured as the first wallet retrieval duration;
[0033] S16: Generate a complete first wallet retrieval transaction according to the unsigned first wallet retrieval transaction and the second signature data;
[0034] S17: Generate a first wallet retrieval evidence transaction according to the complete first wallet retrieval transaction; wherein the payload of the first wallet retrieval evidence transaction includes the complete first wallet retrieval transaction;
[0035] S18: Send the first wallet's evidence retrieval transaction to the blockchain network for the blockchain node to:
[0036] When executing the first block in which the first wallet retrieves the evidence transaction is packaged, and determining that the first wallet retrieves the evidence transaction is a first-type transaction that requires delayed execution, deduct the handling fee of the first wallet retrieves the evidence transaction, record the first wallet retrieves the evidence transaction on the blockchain, and store the complete first wallet retrieves the evidence transaction locally;
[0037] When executing packaging of the second block with the complete first wallet retrieval transaction, the start packaging time of the complete first wallet retrieval transaction is calculated according to the block packaging time of the first block and the first wallet retrieval duration;
[0038] According to the Bitcoin signature verification mark in the complete first wallet retrieval transaction, determine whether the complete first wallet retrieval transaction is a Bitcoin script verification type transaction, determine whether the first wallet retrieval public key in the complete first wallet retrieval transaction matches the first transaction initiator address in the complete first wallet retrieval transaction, determine whether the first wallet retrieval locking script in the complete first wallet retrieval transaction matches the first wallet retrieval public key in the complete first wallet retrieval transaction, and determine whether the current block time has reached the start packaging time;
[0039] When the above judgments are all yes, a second temporary Bitcoin transaction is generated; wherein the second temporary Bitcoin transaction includes only one input UTXO, the second index hash of the input UTXO of the second temporary Bitcoin transaction is the first transaction hash, and the Sequence of the second temporary Bitcoin transaction is configured as the first wallet retrieval time;
[0040] Call the Bitcoin blockchain interface to determine whether the current block time has reached the starting packaging time according to the first wallet retrieval locking script in the complete first wallet retrieval transaction, the first wallet retrieval unlocking script in the complete first wallet retrieval transaction, and the second temporary Bitcoin transaction: if yes, execute the complete first wallet retrieval transaction to execute the second block.
[0041] Specifically, generating a first wallet retrieval public key according to the first wallet retrieval locking script, generating a first wallet retrieval address according to the first wallet retrieval public key includes "performing a hash operation on the first wallet retrieval locking script to generate a first wallet retrieval public key; performing a hash operation on the first wallet retrieval public key to generate a first wallet retrieval address"; determining whether the first wallet retrieval public key in the complete first wallet retrieval transaction matches the first transaction initiator address in the complete first wallet retrieval transaction, and determining whether the first wallet retrieval locking script in the complete first wallet retrieval transaction matches the first wallet retrieval public key in the complete first wallet retrieval transaction includes "performing a hash operation on the first wallet retrieval locking script to generate a first wallet retrieval public key; performing a hash operation on the first wallet retrieval public key to generate a first wallet retrieval address". The first wallet retrieval public key in the complete first wallet retrieval transaction is hashed to determine whether the hashed value is the same as the first transaction initiator address in the complete first wallet retrieval transaction; the first wallet retrieval locking script in the complete first wallet retrieval transaction is hashed to determine whether the hashed value is the same as the first wallet retrieval public key in the complete first wallet retrieval transaction. " is taken as an example; and the first wallet retrieval locking script is generated according to the first public key of the current user's primary account, the second public key of the current user's backup account, and the first wallet retrieval time, including "generating the first wallet retrieval locking script S1, S1 = OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; where pub(A) is the first public key and pub(B) is the second public key"; based on the first temporary Bitcoin transaction, the first wallet retrieval lock script and the second private key of the backup account, the first signature data is generated, and based on the first signature data, the first wallet retrieval unlock script is generated, including "generating the first signature data based on tx3, S1 and pri(B)<Signature B> ; Among them, tx3 is the first temporary Bitcoin transaction, pri(B) is the second private key; according to<Signature B> Generate the first wallet retrieval unlocking script S2, S2=<Signature B> <false>"; Call the Bitcoin blockchain interface to determine whether the current block time has reached the starting packaging time according to the first wallet retrieval locking script in the complete first wallet retrieval transaction, the first wallet retrieval unlocking script in the complete first wallet retrieval transaction, and the second temporary Bitcoin transaction, including "calling the Bitcoin blockchain interface, tx4 execution:<Signature B> <false>OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; where tx4 is the second temporary Bitcoin transaction "as an example;
[0042] Assume that the current user is User A, the public key of User A's primary account is pub(a), and the public key of User A's backup account is pub(b); the wallet retrieval time is T;
[0043] User A's client executes step S10 and generates wallet retrieval lock script S1 according to pub(a), pub(b), and T, where S1 = OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; Perform hash operation on S1 to generate wallet retrieval public key P, P = hash(S1); Perform hash operation on P to generate wallet retrieval address X, X = hash(P);
[0044] User A's client generates a transfer transaction tx0; the transaction recipient address of tx0 is X;
[0045] User A's client sends tx0 to the blockchain network. When the blockchain node successfully executes tx0, it transfers the token specified by tx0 to X. Those skilled in the art should understand that the above tx0 can also be generated by other clients or centralized servers, but user A's client needs to provide X.
[0046] In response to the loss of pri(a), the client of user A executes step S12 to generate an unsigned wallet retrieval transaction tx1; the transaction initiator address of tx1 is X;
[0047] User A's client executes step S13 to generate a temporary Bitcoin transaction tx3 based on the unsigned tx1; tx3 includes only one input UTXO, the index hash of the input UTXO is hash(tx1), and the Sequence configuration of tx3 is T;
[0048] User A's client executes step S14 to generate signature data based on tx3, S1 and pri(B)<Signature B> , and according to<Signature B> Generate wallet retrieval unlock script S2, S2=<Signature B> <false>;
[0049] The client of user A executes step S15, and generates the signature data of the unsigned tx1 according to S1, S2, the Bitcoin signature verification identifier btcscript, and P; wherein the UtxoSequence of the signature data of the unsigned tx1 is configured as T;
[0050] The client of user A executes step S16 to generate a complete tx1 based on the unsigned tx1 and the signature data of the unsigned tx1;
[0051] User A's client executes step S17, generating a wallet retrieval evidence transaction tx2 based on the complete tx1; wherein the payload of tx2 includes the complete tx1;
[0052] User A's client executes step S18 and sends tx2 to the blockchain network;
[0053] Assume that the block containing tx2 is block(100), and the block containing the complete tx1 is block(150);
[0054] When the blockchain node is at block (100) and determines that tx2 is the first type of transaction that needs to be executed with delay, it deducts the handling fee of tx2, records tx2 on the blockchain, and stores the complete tx1 locally;
[0055] When executing block(150), the blockchain node calculates the starting packaging time T1 of the complete tx1 based on the block packaging time of block(100) (assuming it is T0) and T, where T1=T0+T.
[0056] The blockchain node performs the following judgment:
[0057] Determine whether the complete tx1 is a Bitcoin script verification type transaction based on the btcscript in the complete tx1;
[0058] Perform a hash operation on P in the complete tx1 to obtain X', and determine whether X' is the same as the transaction initiator address X in the complete tx1;
[0059] Perform a hash operation on S1 in the complete tx1 to obtain S1', and determine whether S1' is the same as P in the complete tx1;
[0060] Determine whether the current block time has reached T1;
[0061] When the above judgments are all yes, a temporary Bitcoin transaction tx4 is generated; wherein tx4 includes only one input UTXO, the index hash of the input UTXO of tx4 is hash(tx1), and the Sequence configuration of tx4 is T;
[0062] The blockchain node calls the Bitcoin blockchain interface and tx4 executes:<Signature B> <false>OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF, when the execution result is true, it means that the current block time has reached T1, and the complete tx1 is executed to execute block(150).
[0063] In more embodiments, the method of generating the first wallet retrieval public key according to the first wallet retrieval locking script and generating the first wallet retrieval address according to the first wallet retrieval public key can also be configured according to actual needs, for example, configured as "performing two hash operations on the first wallet retrieval locking script to generate the first wallet retrieval public key, and performing hash operations on the first wallet retrieval public key to generate the first wallet retrieval address"; accordingly, judging whether the first wallet retrieval public key in the complete first wallet retrieval transaction matches the first transaction initiator address in the complete first wallet retrieval transaction, and judging whether the first wallet retrieval locking script in the complete first wallet retrieval transaction matches the first wallet retrieval public key in the complete first wallet retrieval transaction should be configured as: performing a hash operation on the first wallet retrieval public key in the complete first wallet retrieval transaction, and judging whether the hashed value is the same as the first transaction initiator address in the complete first wallet retrieval transaction; performing two hash operations on the first wallet retrieval locking script in the complete first wallet retrieval transaction, and judging whether the hashed value is the same as the first wallet retrieval public key in the complete first wallet retrieval transaction; the same technical effect can be achieved.
[0064] In more embodiments, the client of user A may also configure the conditions for generating an unsigned first wallet retrieval transaction according to actual needs; for example, the client of user A generates an unsigned first wallet retrieval transaction only when it detects that the number of tokens in X is greater than 0; the same technical effect may be achieved.
[0065] In more embodiments, the Bitcoin standard script used can also be configured as other standard scripts according to actual needs to achieve the same technical effect.
[0066] The above embodiment makes the wallet retrieval more flexible. For example, if user A also has a backup account, the public key of the backup account is pub(C), and the delay required to retrieve the assets to the wallet corresponding to pub(C) is set to T3, then the first wallet retrieval locking script can be generated according to the first public key of the current user's primary account, the second public keys of several backup accounts of the current user, and the first wallet retrieval time corresponding to each backup account, that is, S1 = OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE OP_IF <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ELSE <t3>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(C)> OP_CHECKSIGVERIFY OP_ENDIF OP_ENDIF; Then, when the user retrieves the assets back to the wallet corresponding to pub(B), S2=<Signature B> <false> <true>; When the assets are retrieved back to the wallet corresponding to pub(C), S2=<Signature C> <false> <false>; Other processes are similar to the above embodiments and will not be repeated here.
[0067] Preferably, when the first private key is not lost, the method further comprises:
[0068] Generate an unsigned first transfer transaction;
[0069] Generate a third temporary Bitcoin transaction according to the unsigned first transfer transaction; wherein the third temporary Bitcoin transaction includes only one input UTXO, and the third index hash of the input UTXO of the third temporary Bitcoin transaction is the third transaction hash of the unsigned first transfer transaction;
[0070] According to the third temporary Bitcoin transaction, the first wallet retrieves the locking script and the first private key to generate the third signature data, and generates the third wallet retrieval unlocking script according to the third signature data;
[0071] Generate the fourth signature data of the unsigned first transfer transaction according to the first wallet retrieval locking script, the third wallet retrieval unlocking script, the Bitcoin signature verification mark, and the first wallet retrieval public key;
[0072] Generate a complete first transfer transaction based on the unsigned first transfer transaction and the fourth signature data;
[0073] Send the complete first transfer transaction to the blockchain network for blockchain nodes to:
[0074] Determine whether the complete first transfer transaction is a Bitcoin script verification type transaction according to the Bitcoin signature verification identifier in the complete first transfer transaction, determine whether the first wallet retrieval public key in the complete first transfer transaction matches the first transaction initiator address in the complete first transfer transaction, and determine whether the first wallet retrieval locking script in the complete first transfer transaction matches the first wallet retrieval public key in the complete first transfer transaction;
[0075] When the above judgments are all yes, a fourth temporary bitcoin transaction is generated; wherein the fourth temporary bitcoin transaction includes only one input UTXO, and the fourth index hash of the input UTXO of the fourth temporary bitcoin transaction is the third transaction hash;
[0076] Call the Bitcoin blockchain interface and the fourth temporary Bitcoin transaction to execute the first wallet in the complete first transfer transaction to retrieve the locking script and the third wallet in the complete first transfer transaction to retrieve the unlocking script. When the execution is successful, the complete first transfer transaction is executed.
[0077] Specifically, generating the third signature data according to the third temporary Bitcoin transaction, the first wallet retrieval locking script and the first private key, and generating the third wallet retrieval unlocking script according to the third signature data includes "generating the third signature data according to tx5, S1 and pri(A)<Signature A> ; Among them, tx5 is the third temporary Bitcoin transaction, pri(A) is the first private key; according to<Signature A> Generate the third wallet to retrieve the unlocking script S3, S3=<Signature A> <true>"; calling the Bitcoin blockchain interface, the fourth temporary Bitcoin transaction executes the first wallet in the complete first transfer transaction to retrieve the lock script and the third wallet in the complete first transfer transaction to retrieve the unlock script, including "calling the Bitcoin blockchain interface, tx6 execution:<Signature A> <true>OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; where tx6 is the fourth temporary Bitcoin transaction "as an example;
[0078] User A's client generates an unsigned transfer transaction tx10;
[0079] User A's client generates a temporary Bitcoin transaction tx5 based on the unsigned tx10; tx5 only includes one input UTXO, and the index hash of the input UTXO of tx5 is hash(tx10);
[0080] User A's client generates the third signature data based on tx5, S1 and pri(A)<Signature A> , and according to<Signature A> Generate wallet retrieval unlock script S3, S3=<Signature A> <true>;
[0081] User A's client generates the signature data of unsigned tx10 based on S1, S3, btcscript, and P;
[0082] User A's client generates a complete tx10 based on the unsigned tx10 and the signature data of the unsigned tx10;
[0083] User A's client sends the complete tx10 to the blockchain network;
[0084] The blockchain node determines whether the complete first transfer transaction is a Bitcoin script verification type transaction according to the Bitcoin signature verification identifier in the complete first transfer transaction, determines whether the first wallet retrieval public key in the complete first transfer transaction matches the first transaction initiator address in the complete first transfer transaction, and determines whether the first wallet retrieval locking script in the complete first transfer transaction matches the first wallet retrieval public key in the complete first transfer transaction; the above judgment and Figure 1 The principles of several steps in the illustrated embodiment are the same and will not be repeated here;
[0085] When the above judgments are all yes, the blockchain node generates a temporary Bitcoin transaction tx6; wherein tx6 includes only one input UTXO, and the index hash of the input UTXO of tx6 is hash(tx10);
[0086] The blockchain node calls the Bitcoin blockchain interface and tx6 executes:<Signature A> <true>OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t>OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; when the execution result is true, it means the execution is successful, and the blockchain node executes the complete tx10.
[0087] In more embodiments, the Bitcoin standard script used can also be configured as other standard scripts according to actual needs to achieve the same technical effect.
[0088] Figure 2 A schematic diagram of the structure of a device provided in one embodiment of the present invention.
[0089] like Figure 2 As shown, as another aspect, the present application also provides a device, including one or more central processing units (CPU) 201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 202 or the program loaded from the storage part 208 to the random access memory (RAM) 203. In the RAM 203, various programs and data required for the operation of the device 200 are also stored. The CPU 201, the ROM 202, and the RAM 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0090] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed, so that a computer program read therefrom is installed into the storage section 208 as needed.
[0091] 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 209, and / or installed from the removable medium 211.
[0092] 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.
[0093] 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.
[0094] 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 arranged in a processor. For example, each of the units may be a software program arranged 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.
[0095] 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.< / t> < / true> < / true> < / t> < / true> < / true> < / false> < / false> < / true> < / false> < / t> < / t> < / false> < / false> < / t> < / t> < / false> < / false> < / t>
Claims
1. A universal wallet recovery method, characterized in that: The blockchain is a non-bitcoin blockchain, and a UtxoSequence field is added to the signature data of a transaction of a bitcoin script verification type. The method is applicable to a client, and the method includes: Generate a first wallet retrieval locking script according to the first public key of the current user's primary account, the second public key of the current user's backup account, and the first wallet retrieval duration; generate a first wallet retrieval public key according to the first wallet retrieval locking script; and generate a first wallet retrieval address according to the first wallet retrieval public key; In response to the loss of the first private key of the primary account, generating an unsigned first wallet retrieval transaction; wherein the first transaction initiator address of the first wallet retrieval transaction is the first wallet retrieval address; Generate a first temporary Bitcoin transaction according to the unsigned first wallet retrieval transaction; wherein the first temporary Bitcoin transaction includes only one input UTXO, the first index hash of the input UTXO of the first temporary Bitcoin transaction is the first transaction hash of the unsigned first wallet retrieval transaction, and the Sequence of the first temporary Bitcoin transaction is configured as the first wallet retrieval duration; According to the first temporary Bitcoin transaction, the first wallet retrieves the locking script and the second private key of the backup account to generate first signature data, and generates a first wallet retrieves the unlocking script according to the first signature data; Generate the second signature data of the unsigned first wallet retrieval transaction according to the first wallet retrieval lock script, the first wallet retrieval unlock script, the Bitcoin signature verification identifier, and the first wallet retrieval public key; wherein the UtxoSequence of the second signature data is configured as the first wallet retrieval duration; Generate a complete first wallet retrieval transaction according to the unsigned first wallet retrieval transaction and the second signature data; Generate a first wallet retrieval evidence transaction according to the complete first wallet retrieval transaction; wherein the payload of the first wallet retrieval evidence transaction includes the complete first wallet retrieval transaction; The first wallet retrieves the evidence transaction and sends it to the blockchain network for the blockchain node to: When executing the first block packaged with the first wallet's evidence retrieval transaction and determining that the first wallet's evidence retrieval transaction is a first-type transaction that requires delayed execution, deducting the handling fee of the first wallet's evidence retrieval transaction, recording the first wallet's evidence retrieval transaction on the blockchain, and storing the complete first wallet's evidence retrieval transaction locally; When executing the second block packaged with the complete first wallet retrieval transaction, calculating the start packaging time of the complete first wallet retrieval transaction according to the block packaging time of the first block and the first wallet retrieval duration; According to the Bitcoin signature verification identifier in the complete first wallet retrieval transaction, determine whether the complete first wallet retrieval transaction is a Bitcoin script verification type transaction, determine whether the first wallet retrieval public key in the complete first wallet retrieval transaction matches the first transaction initiator address in the complete first wallet retrieval transaction, determine whether the first wallet retrieval locking script in the complete first wallet retrieval transaction matches the first wallet retrieval public key in the complete first wallet retrieval transaction, and determine whether the current block time has reached the starting packaging time; When the above judgments are all yes, a second temporary Bitcoin transaction is generated; wherein the second temporary Bitcoin transaction includes only one input UTXO, the second index hash of the input UTXO of the second temporary Bitcoin transaction is the first transaction hash, and the Sequence of the second temporary Bitcoin transaction is configured as the first wallet retrieval time length; Call the Bitcoin blockchain interface to determine whether the current block time has reached the starting packaging time according to the first wallet retrieval locking script in the complete first wallet retrieval transaction, the first wallet retrieval unlocking script in the complete first wallet retrieval transaction, and the second temporary Bitcoin transaction: if yes, execute the complete first wallet retrieval transaction to execute the second block.
2. The method according to claim 1, characterized in that When the first private key is not lost, the method further includes: Generate an unsigned first transfer transaction; Generate a third temporary Bitcoin transaction according to the unsigned first transfer transaction; wherein the third temporary Bitcoin transaction includes only one input UTXO, and a third index hash of the input UTXO of the third temporary Bitcoin transaction is a third transaction hash of the unsigned first transfer transaction; According to the third temporary Bitcoin transaction, the first wallet retrieves the locking script and the first private key to generate third signature data, and generates a third wallet retrieve unlocking script according to the third signature data; Generate fourth signature data of the unsigned first transfer transaction according to the first wallet retrieval locking script, the third wallet retrieval unlocking script, the Bitcoin signature verification identifier, and the first wallet retrieval public key; Generate a complete first transfer transaction according to the unsigned first transfer transaction and the fourth signature data; The complete first transfer transaction is sent to the blockchain network for the blockchain node to: According to the Bitcoin signature verification identifier in the complete first transfer transaction, determine whether the complete first transfer transaction is a Bitcoin script verification type transaction, determine whether the first wallet retrieval public key in the complete first transfer transaction matches the first transaction initiator address in the complete first transfer transaction, and determine whether the first wallet retrieval locking script in the complete first transfer transaction matches the first wallet retrieval public key in the complete first transfer transaction; When the above judgments are all yes, a fourth temporary bitcoin transaction is generated; wherein the fourth temporary bitcoin transaction includes only one input UTXO, and the fourth index hash of the input UTXO of the fourth temporary bitcoin transaction is the third transaction hash; Calling the Bitcoin blockchain interface and the fourth temporary Bitcoin transaction to execute the first wallet retrieval locking script in the complete first transfer transaction and the third wallet retrieval unlocking script in the complete first transfer transaction, and when the execution is successful, executing the complete first transfer transaction.
3. The method according to claim 2, characterized in that The generating of the first wallet retrieval locking script according to the first public key of the primary account of the current user, the second public key of the backup account of the current user, and the first wallet retrieval time comprises: Generate the first wallet retrieval lock script S1, S1 = OP_IF<pub(A)> OP_CH ECKSIGVERIFY OP_ELSE <t> OP_CHECKSEQUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; where pub(A) is the first public key and pub(B) is the second public key;< / t> The first wallet retrieving the locking script and the second private key of the standby account generating the first signature data according to the first temporary Bitcoin transaction, and generating the first wallet retrieving the unlocking script according to the first signature data includes: According to tx3, S1 and pri(B) generate the first signature data<Signature B> ; Wherein, tx3 is the first temporary Bitcoin transaction, and pri(B) is the second private key; according to<Signature B> Generate the first wallet to retrieve the unlocking script S2, S2 =<Signat ure B> <false> ;< / false> The calling of the Bitcoin blockchain interface to determine whether the current block time has reached the starting packaging time according to the first wallet retrieval locking script in the complete first wallet retrieval transaction, the first wallet retrieval unlocking script in the complete first wallet retrieval transaction, and the second temporary Bitcoin transaction comprises: Call the Bitcoin blockchain interface and execute tx4:<Signature B> <false>OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t> OP_CHECKSE QUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; where tx4 is the second temporary Bitcoin transaction.< / t> < / false> 4. The method according to claim 3, characterized in that The first wallet retrieving the locking script and the first private key generating the third signature data according to the third temporary Bitcoin transaction, and generating the third wallet retrieving the unlocking script according to the third signature data includes: According to tx5, S1 and pri(A) generate the third signature data<Signature A> ; Wherein, tx5 is the third temporary Bitcoin transaction, and pri(A) is the first private key; according to<Signature A> Generate the third wallet to retrieve the unlocking script S3, S3=<Signature A> <true> ;< / true> The calling of the Bitcoin blockchain interface and the execution of the first wallet retrieving the locking script in the complete first transfer transaction and the third wallet retrieving the unlocking script in the complete first transfer transaction by the fourth temporary Bitcoin transaction include: Call the Bitcoin blockchain interface and execute tx6:<Signature A> <true>OP_IF<pub(A)> OP_CHECKSIGVERIFY OP_ELSE <t> OP_CHECKSE QUENCEVERIFY OP_DROP<pub(B)> OP_CHECKSIGVERIFY OP_ENDIF; wherein tx6 is the fourth temporary bitcoin transaction.< / t> < / true> 5. The method according to any one of claims 1 to 4, characterized in that: In response to the loss of the first private key of the primary account, before generating an unsigned first wallet retrieval transaction, the method further includes: Generate a second transfer transaction; wherein the transaction recipient address of the second transfer transaction is the first wallet retrieval transaction address; The second transfer transaction is sent to the blockchain network so that the blockchain node can: when the second transfer transaction is successfully executed, transfer the token specified in the second transfer transaction to the first wallet to retrieve the transaction address.
6. The method according to any one of claims 1 to 4, characterized in that: The generating a first wallet retrieval public key according to the first wallet retrieval locking script, and generating a first wallet retrieval address according to the first wallet retrieval public key comprises: Performing a hash operation on the first wallet retrieval locking script to generate a first wallet retrieval public key; Performing a hash operation on the first wallet retrieval public key to generate a first wallet retrieval address; The determining whether the first wallet retrieval public key in the complete first wallet retrieval transaction matches the first transaction initiator address in the complete first wallet retrieval transaction, and determining whether the first wallet retrieval locking script in the complete first wallet retrieval transaction matches the first wallet retrieval public key in the complete first wallet retrieval transaction includes: Performing a hash operation on the first wallet retrieval public key in the complete first wallet retrieval transaction, and determining whether the hashed value is the same as the first transaction initiator address in the complete first wallet retrieval transaction; A hash operation is performed on the first wallet retrieval locking script in the complete first wallet retrieval transaction, and it is determined whether a value after the hash operation is the same as the first wallet retrieval public key in the complete first wallet retrieval transaction.
7. 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 6.
8. A computer-readable 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 6 is implemented.
Citation Information
Patent Citations
Computer-implemented system and method providing a decentralised protocol for the recovery of cryptographic assets
CN110741600A
Wallet retrieving method and device and storage medium
CN112583811A