[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN113592651B - Delay transaction method, computer device and storage medium - Google Patents

Delay transaction method, computer device and storage medium Download PDF

Info

Publication number
CN113592651B
CN113592651B CN202110881833.3A CN202110881833A CN113592651B CN 113592651 B CN113592651 B CN 113592651B CN 202110881833 A CN202110881833 A CN 202110881833A CN 113592651 B CN113592651 B CN 113592651B
Authority
CN
China
Prior art keywords
transaction
delay
complete
delayed
bitcoin
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110881833.3A
Other languages
Chinese (zh)
Other versions
CN113592651A (en
Inventor
姜鹏
王志文
吴思进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202110881833.3A priority Critical patent/CN113592651B/en
Publication of CN113592651A publication Critical patent/CN113592651A/en
Application granted granted Critical
Publication of CN113592651B publication Critical patent/CN113592651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • G06Q20/102Bill distribution or payments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/407Cancellation of a transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/42Confirmation, e.g. check or permission by the legal debtor of payment
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Storage Device Security (AREA)

Abstract

The invention provides a delay transaction method, computer equipment and storage medium, wherein the method comprises the steps of generating a first locking script according to a first delay transaction rule at the end time of a first delay, and generating a first delay transaction address according to the first locking script; generating an unsigned first delayed transaction and calculating a first transaction hash of the unsigned first delayed transaction; generating a first temporary bitcoin transaction; calling a bitcoin blockchain interface to generate a first unlocking script according to the first locking script, the first temporary bitcoin transaction and a private key held by a current user; generating a first delay transaction sender public key according to the first locking script, and constructing first signature information of unsigned first delay transaction; and generating a complete first delayed transaction according to the unsigned first delayed transaction and the first signature information and sending the complete first delayed transaction to the blockchain network. The method and the device enable the realization of the delay transaction service to be more universal.

Description

Delay transaction method, computer device and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a delay transaction method, a computer device, and a storage medium.
Background
In the other two patent applications of the same date application of the applicant, the delay transaction service of the blockchain can be realized as well; however, in the other two patent applications, the solutions are similar but not common, because the implementation of the delay verification is coupled with the specific transaction verification rule, and the delay verification rules are mutually bound, and different delay verification rules need to be implemented correspondingly, which results in that different delay transaction services need to be implemented repeatedly.
Disclosure of Invention
In view of the foregoing drawbacks or deficiencies of the prior art, it is desirable to provide a general time delay transaction method, computer device and storage medium.
In a first aspect, the present invention provides a delayed transaction method applicable to a client, wherein a blockchain is a non-bitcoin blockchain, and a locktime field is added in signature information of a bitcoin script verification type transaction, the method comprising:
responding to a first delay transaction rule comprising a first delay ending moment determined by a current user and a second user, generating a first locking script according to the first delay transaction rule, and generating a first delay transaction address according to the first locking script;
generating an unsigned first delayed transaction and calculating a first transaction hash of the unsigned first delayed transaction; wherein the first transaction initiator address of the unsigned first delayed transaction is the first delayed transaction address;
generating a first temporary bitcoin transaction; the first temporary bit coin transaction only comprises one input UTXO, a first index hash of the input UTXO of the first temporary bit coin transaction is a first transaction hash, and the locktime of the first temporary bit coin transaction is configured as a first delay ending time;
calling a bitcoin blockchain interface to generate a first unlocking script according to the first locking script, the first temporary bitcoin transaction and a private key held by a current user;
generating a first delay transaction sender public key according to the first locking script, and constructing first signature information of unsigned first delay transaction; the first signature information comprises a first identifier which is identified as a bitcoin script verification type, a first delay transaction sender public key, a first locking script and a first unlocking script, and the locktime of the first signature information is configured to be a first delay ending moment;
generating a complete first delayed transaction according to the unsigned first delayed transaction and the first signature information and sending the complete first delayed transaction to a blockchain network for the blockchain node to:
storing the complete first delay transaction when the complete first delay transaction is judged to be the first type of transaction needing delay; the method comprises the steps of,
the following operations are performed on the first block packed with the complete first delayed transaction:
judging whether the complete first delay transaction is a transaction of a bitcoin script verification type according to a first identifier in the complete first delay transaction, judging whether a first transaction sender public key in the complete first delay transaction is matched with a first transaction initiator address in the complete first delay transaction, judging whether a first locking script in the complete first delay transaction is matched with a first transaction sender public key in the complete first delay transaction, and judging whether the current block moment reaches a first delay ending moment;
if the judgment is yes, generating a second temporary bitcoin transaction; the second temporary bit coin transaction only comprises one input UTXO, a second index hash of the input UTXO of the second temporary bit coin transaction is used as a first transaction hash, and the locktime of the second temporary bit coin transaction is configured as a first delay ending time;
invoking a bitcoin blockchain interface to judge whether the current block moment reaches the first delay ending moment according to a first locking script in the complete first delay transaction, a first unlocking script in the complete first delay transaction and a second temporary bitcoin transaction: if yes, then executing the complete first delay transaction to execute the first block.
In a second aspect, the present invention provides a delayed transaction method applicable to a blockchain node, where the blockchain is a non-bitcoin blockchain, and a locktime field is added to transaction signature information of a bitcoin script verification type, and the method includes:
receiving a complete first delayed transaction; the method comprises the steps that a complete first delay transaction is generated according to unsigned first delay transaction and first signature information of unsigned first delay transaction, a first transaction initiator address of unsigned first delay transaction is a first delay transaction address, the first delay transaction address is generated according to a first locking script, the first locking script is generated according to a first delay transaction rule comprising first delay ending time determined by a first user and a second user, the first signature information comprises a first identifier which is marked as a bit script verification type, a first delay transaction sender public key, a first locking script and a first unlocking script, locktime of the first signature information is configured to be a first delay ending time, the first delay transaction sender public key is generated according to the first locking script, a first client of the first user calls a bit block chain interface according to the first locking script, first temporary bit coin transaction and a first temporary bit coin which is generated by the first user only comprises an input UTXO, the first temporary bit transaction is configured to be a first delay transaction bit time of a first hash, and the first delay transaction of the first temporary bit hash is configured to be a first delay transaction;
storing the complete first delay transaction when the complete first delay transaction is judged to be the first type of transaction needing delay; the method comprises the steps of,
the following operations are performed on the first block packed with the complete first delayed transaction:
judging whether the complete first delay transaction is a transaction of a bitcoin script verification type according to a first identifier in the complete first delay transaction, judging whether a first transaction sender public key in the complete first delay transaction is matched with a first transaction initiator address in the complete first delay transaction, judging whether a first locking script in the complete first delay transaction is matched with a first transaction sender public key in the complete first delay transaction, and judging whether the current block moment reaches a first delay ending moment;
if the judgment is yes, generating a second temporary bitcoin transaction; the second temporary bit coin transaction only comprises one input UTXO, a second index hash of the input UTXO of the second temporary bit coin transaction is used as a first transaction hash, and the locktime of the second temporary bit coin transaction is configured as a first delay ending time;
invoking a bitcoin blockchain interface to judge whether the current block moment reaches the first delay ending moment according to a first locking script in the complete first delay transaction, a first unlocking script in the complete first delay transaction and a second temporary bitcoin transaction: if yes, then executing the complete first delay transaction to execute the first block.
In a third aspect, the present invention also provides an apparatus 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 delayed transaction method provided in accordance with the embodiments of the present invention.
In a fourth aspect, the present invention also provides a storage medium storing a computer program, the computer program causing a computer to execute the time-lapse transaction method provided according to the embodiments of the present invention.
According to the delay transaction method, the computer equipment and the storage medium provided by the embodiments of the invention, a first delay transaction rule comprising a first delay ending moment is determined by responding to a current user and a second user, a first locking script is generated according to the first delay transaction rule, and a first delay transaction address is generated according to the first locking script; generating an unsigned first delayed transaction and calculating a first transaction hash of the unsigned first delayed transaction; generating a first temporary bitcoin transaction; calling a bitcoin blockchain interface to generate a first unlocking script according to the first locking script, the first temporary bitcoin transaction and a private key held by a current user; generating a first delay transaction sender public key according to the first locking script, and constructing first signature information of unsigned first delay transaction; and generating a complete first delayed transaction according to the unsigned first delayed transaction and the first signature information and sending the complete first delayed transaction to the blockchain network, so that the delayed transaction service is more universal to realize.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings, in which:
fig. 1 is a flowchart of a method for delaying transaction according to an embodiment of the present invention.
Fig. 2 is a flowchart of another method for time-delay transaction according to an embodiment of the present invention.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The present application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the invention are shown in the drawings.
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a flowchart of a method for delaying transaction according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a delay transaction method applicable to a client, where a blockchain is a non-bitcoin blockchain, and a locktime field is added to signature information of a bitcoin script verification type transaction, where the method includes:
s11: responding to a first delay transaction rule comprising a first delay ending moment determined by a current user and a second user, generating a first locking script according to the first delay transaction rule, and generating a first delay transaction address according to the first locking script;
s12: generating an unsigned first delayed transaction and calculating a first transaction hash of the unsigned first delayed transaction; wherein the first transaction initiator address of the unsigned first delayed transaction is the first delayed transaction address;
s13: generating a first temporary bitcoin transaction; the first temporary bit coin transaction only comprises one input UTXO, a first index hash of the input UTXO of the first temporary bit coin transaction is a first transaction hash, and the locktime of the first temporary bit coin transaction is configured as a first delay ending time;
s14: calling a bitcoin blockchain interface to generate a first unlocking script according to the first locking script, the first temporary bitcoin transaction and a private key held by a current user;
s15: generating a first delay transaction sender public key according to the first locking script, and constructing first signature information of unsigned first delay transaction; the first signature information comprises a first identifier which is identified as a bitcoin script verification type, a first delay transaction sender public key, a first locking script and a first unlocking script, and the locktime of the first signature information is configured to be a first delay ending moment;
s16: generating a complete first delayed transaction according to the unsigned first delayed transaction and the first signature information and sending the complete first delayed transaction to a blockchain network for the blockchain node to:
storing the complete first delay transaction when the complete first delay transaction is judged to be the first type of transaction needing delay; the method comprises the steps of,
the following operations are performed on the first block packed with the complete first delayed transaction:
judging whether the complete first delay transaction is a transaction of a bitcoin script verification type according to a first identifier in the complete first delay transaction, judging whether a first transaction sender public key in the complete first delay transaction is matched with a first transaction initiator address in the complete first delay transaction, judging whether a first locking script in the complete first delay transaction is matched with a first transaction sender public key in the complete first delay transaction, and judging whether the current block moment reaches a first delay ending moment;
if the judgment is yes, generating a second temporary bitcoin transaction; the second temporary bit coin transaction only comprises one input UTXO, a second index hash of the input UTXO of the second temporary bit coin transaction is used as a first transaction hash, and the locktime of the second temporary bit coin transaction is configured as a first delay ending time;
invoking a bitcoin blockchain interface to judge whether the current block moment reaches the first delay ending moment according to a first locking script in the complete first delay transaction, a first unlocking script in the complete first delay transaction and a second temporary bitcoin transaction: if yes, then executing the complete first delay transaction to execute the first block.
Specifically, the step of generating the first delayed transaction address according to the first locking script includes "performing hash operation on the first locking script twice to generate the first delayed transaction address", the step of generating the first delayed transaction sender public key according to the first locking script includes "performing hash operation on the first locking script once to generate the first delayed transaction sender public key", the step of judging whether the first transaction sender public key in the complete first delayed transaction is matched with the first transaction initiator address in the complete first delayed transaction, and the step of judging whether the first locking script in the complete first delayed transaction is matched with the first transaction sender public key in the complete first delayed transaction includes "performing hash operation on the first transaction sender public key in the complete first delayed transaction once, and the step of judging whether the value after hash operation is identical with the first transaction initiator address in the complete first delayed transaction; performing one-time hash operation on a first locking script in the complete first delayed transaction, and judging whether the value after the hash operation is the same as a first transaction sender public key in the complete first delayed transaction; the standard script of the bitcoin is exemplified by P2 PKH;
assuming that the user a and the user b determine that the user a transfers 0.1btc to the user b after the first delay time T;
in response to determining the rule, the client of the user a executes step S11 to generate a lock script S1 (< T > op_ CHECKLOCKTIMEVERIFY OP _dr op_op_dup_hash 160< a' S public address > op_equal RIFY op_cheksig) according to the rule, and generates a delay transaction address addr (X) according to S1, addr (X) =hash (HASH (S1);
the client of user a generates a transfer transaction tx0 for transferring to addr (X) and sends the transfer transaction tx0 to the blockchain network, and when tx0 is successfully executed, the blockchain node forwards 0.1btc in addr (a) to addr (X) (assuming that the universal certificate specified by tx0 is 0.1 btc); it should be understood by those skilled in the art that the user a may delegate the generation of the transfer transaction tx0 described above to other clients, so long as the user a notifies addr (X) to the delegated client, the same technical effect may be achieved;
the client of user a performs step S12 to generate an unsigned delayed transaction tx1 and calculates a transaction hash (tx 1) of the unsigned tx1; the transaction initiator address of unsigned tx1 is addr (X);
the client of the user a executes the step S13 to generate a temporary bitcoin transaction tx2; tx2 comprises only one input UTXO, the index hash of the input UTXO for tx2 is hash (tx 1), and the locktime for tx2 is configured as T; those skilled in the art will understand that, the locking script and the unlocking script are based on the transaction of the bitcoin blockchain, but the transaction of the bitcoin blockchain is not existed in the bitcoin blockchain, when the locking script and the unlocking script are constructed, the temporary bitcoin transaction tx2 and the subsequent temporary bitcoin transaction tx3 are constructed to restrict the unsigned tx1, tx2 and tx3 to be the transactions conforming to the rule of the bitcoin blockchain, therefore, both tx2 and tx3 need to be unique input UTXOs, and the index hash of the UTXO is hash (tx 1), so that one of tx2 and tx3 comprises the unsigned tx1 (the corresponding relation between tx2 and tx3 and the unsigned tx1 is also ensured), the unsigned tx1 is not tampered, and whether the public key of the first transaction sender in the complete first delay transaction is matched with the address of the first transaction initiator in the complete first delay transaction is ensured, and whether the public key of the first transaction in the complete first delay transaction is matched with the complete first transaction can be judged; assuming that the index hash of the unique input UTXO for tx2 or tx3 is not hash (tx 1), then it indicates that unsigned tx1 was tampered, resulting in a complete tx1 execution failure;
the client of the user a executes step S14 to call the bitcoin blockchain interface to generate an unlocking script S2 (< a 'S signature > < a' S public key >) according to S1, tx2 and the private (a);
the client of the user a executes step S15 to generate a delayed transaction sender public key P1, p1=hash (S1) according to S1, and constructs signature information of tx1 which is not signed; the signature information comprises identification btccript, P1, S1 and S2 which are identified as bitcoin script verification types, and locktime of the signature information is configured as T;
the client of user a performs step S16: generating complete tx1 according to the unsigned tx1 and the signature information, and sending the complete tx1 to a blockchain network;
when the blockchain node judges that the complete tx1 is a first type transaction needing to be delayed according to the name of an actuator of the complete tx1, the complete tx1 is stored; it should be understood by those skilled in the art that it may also be determined whether tx1 is a first type of transaction according to other methods, for example, determining according to a delay identifier in signature information, or in other manners, so as to achieve the same technical effect; the method comprises the steps of,
assuming complete tx1 is packed into block (100), the blockchain node performs the following on block (100):
judging whether the complete tx1 is a transaction of a bitcoin script verification type according to the btccript in the complete tx1;
carrying out hash operation on P1 in the complete tx1, and judging whether the hash (P1) is the same as the addr (X);
carrying out hash operation on S1 in the complete tx1, and judging whether the hash (S1) is identical to P1;
judging whether the current block moment reaches T or not;
since btccript, addr (X) =hash (hash (S1)), p1=hash (S1) is included in the complete tx1, and assuming that the current block time has reached T, a temporary bitcoin transaction tx3 is generated; tx3 comprises only one input UTXO, the index hash of the input UTXO for tx3 is hash (tx 1), and the locktime for tx3 is configured as T; those skilled in the art will understand that executing the complete tx1 fails if bttcscript is not included in tx1, and/or addr (X) =hash (hash (S1)), and/or p1=hash (S1), and/or the current block time does not reach T;
the blockchain node calls a bitcoin blockchain interface to judge whether the current block moment reaches T according to S1 in the complete tx1 and S2 and tx3 in the complete tx1, namely, the blockchain node executes < a ' S signature > < a ' S public key > < T > OP_ CHECKLOCK TIMEVERIFY OP _DROP_DUP OP_HASH160< a ' S public addr ess > OP_EQUAVERIFY OP_CHECKSIG;
upon determining that T has been reached, then complete tx1 is performed to execute block (100). It will be appreciated by those skilled in the art that if performing the complete tx1 is successful, then 0.1btc is scratched from addr (X) to addr (b); if there is less than 0.1btc in addr (X) or there are other reasons that would cause a complete tx1 execution failure, then the complete tx1 execution fails.
In more embodiments, the generating of the first delayed transaction address according to the first locking script may also be configured according to actual requirements, for example, configured to "hash the first locking script three times to generate the first delayed transaction address"; accordingly, generating the first delayed transaction sender public key from the first locking script should be configured as "hash twice the first locking script to generate the first delayed transaction sender public key"; correspondingly, judging whether the public key of the first transaction sender in the complete first delayed transaction is matched with the address of the first transaction initiator in the complete first delayed transaction, judging whether the first locking script in the complete first delayed transaction is matched with the public key of the first transaction sender in the complete first delayed transaction or not, and if so, carrying out hash operation on the public key of the first transaction sender in the complete first delayed transaction twice, and judging whether the value after hash operation is the same as the address of the first transaction initiator in the complete first delayed transaction or not; performing hash operation twice on a first locking script in the complete first delayed transaction, and judging whether the value after the hash operation is the same as a first transaction sender public key in the complete first delayed transaction; the same technical effects can be achieved.
In more embodiments, the client of user a may also configure the conditions for generating the unsigned first delayed transaction according to actual requirements; for example, user a's client generates an unsigned first delayed transaction only if at least 0.1btc in addr (X) is monitored; the same technical effects can be achieved.
In further embodiments, generating a complete first delayed transaction from the unsigned first delayed transaction and the first signature information and sending the complete first delayed transaction to the blockchain network further includes "delete first temporary bitcoin transaction after a first duration"; after executing the complete first delayed transaction, the method further comprises the step of deleting the second temporary bitcoin transaction after the second time period so as to clear the temporary bitcoin transaction at regular time.
In more embodiments, the bitcoin standard script used may be configured as other standard scripts, for example, configured as P2PK, where S1 is < T > op_ CHECKL OCKTIMEVERIFY OP _drop < a 'S public address > op_checksig, and the blockchain node executes < a' S signature > < a 'S public key > < T > op_ CHE CKLOCKTIMEVERIFY OP _drop < a' S public address > op_checksig to determine whether the current block time has reached T, so that the same technical effect can be achieved.
In more embodiments, the lo cktime field may be added to the signature information of all transactions, so that the same technical effect may be achieved.
In the other two patent applications of the same date application of the applicant, the delay transaction service of the blockchain can be realized as well; however, in the other two patent applications (hereinafter referred to as application one and application two and described in some sections for brevity), the solutions are similar but not common to each other;
in the first application, the client of the user a generates a delay structure S { pub (a), T } according to the public key pub (a) of the user a and the first time length T to be prolonged, and determines whether the addr (X) 'is the same as the addr (X) according to the need of generating a delay transfer address addr (X)' according to the S to generate a delay transfer address addr (X) … … and determining whether the signature sig_a is matched with the pu b (a) in S;
in the second application, assuming that the main account address of the user a is addr (a), the standby account address is addr (a)', and the time delay time is T; the client side of the user a with the addr (a) generates wallet retrieving structures S { addr (a), addr (a) ', T } according to the addr (a), addr (a) ', T, generates a wallet retrieving address addr (X) … … according to the S, generates a wallet retrieving transfer address addr (X) ', judges whether the addr (X) ' is the same as the addr (X), and judges whether the signature is matched with the addr (a) ';
it can be seen that the implementation of the delay verification is coupled with the specific transaction verification rule, and the delay verification rules are mutually bound, and different delay verification rules need to be implemented correspondingly, so that different delay transaction services need to be implemented repeatedly.
In this application, "< T > op_ CHECKLOCKTIMEVERIFY OP _drop" in S1 is the script content for delay constraint, and "< T > op_ CHECKLOCKTIMEVERIFY OP _drop" is unchanged regardless of the bitcoin standard script used, for example, when the bitcoin standard script used is P2PK, the lock script S1 is < T > op_ CHECKL OCKTIMEVERIFY OP _drop < a' S public address > op_checksi G; the functions realized by the time delay constraint script are independent, and the time delay constraint function can be realized by adding "< T > OP_ CHECKLOCKTIMEVERIFY OP _DROP" into the script; the method and the device enable the realization of the delay transaction service to be more universal.
Fig. 2 is a flowchart of another method for time-delay transaction according to an embodiment of the present invention. The method shown in fig. 2 may be used in conjunction with the method shown in fig. 1. As shown in fig. 2, in this embodiment, the present invention provides a delay transaction method applicable to a blockchain node, where the blockchain is a non-bitcoin blockchain, and a locktime field is added to transaction signature information of bitcoin script verification type, and the method includes:
s21: receiving a complete first delayed transaction; the method comprises the steps that a complete first delay transaction is generated according to unsigned first delay transaction and first signature information of unsigned first delay transaction, a first transaction initiator address of unsigned first delay transaction is a first delay transaction address, the first delay transaction address is generated according to a first locking script, the first locking script is generated according to a first delay transaction rule comprising first delay ending time determined by a first user and a second user, the first signature information comprises a first identifier which is marked as a bit script verification type, a first delay transaction sender public key, a first locking script and a first unlocking script, locktime of the first signature information is configured to be a first delay ending time, the first delay transaction sender public key is generated according to the first locking script, a first client of the first user calls a bit block chain interface according to the first locking script, first temporary bit coin transaction and a first temporary bit coin which is generated by the first user only comprises an input UTXO, the first temporary bit transaction is configured to be a first delay transaction bit time of a first hash, and the first delay transaction of the first temporary bit hash is configured to be a first delay transaction;
s22: storing the complete first delay transaction when the complete first delay transaction is judged to be the first type of transaction needing delay; the method comprises the steps of,
the following operations are performed on the first block packed with the complete first delayed transaction:
s23: judging whether the complete first delay transaction is a transaction of a bitcoin script verification type according to a first identifier in the complete first delay transaction, judging whether a first transaction sender public key in the complete first delay transaction is matched with a first transaction initiator address in the complete first delay transaction, judging whether a first locking script in the complete first delay transaction is matched with a first transaction sender public key in the complete first delay transaction, and judging whether the current block moment reaches a first delay ending moment;
s24: if the judgment is yes, generating a second temporary bitcoin transaction; the second temporary bit coin transaction only comprises one input UTXO, a second index hash of the input UTXO of the second temporary bit coin transaction is used as a first transaction hash, and the locktime of the second temporary bit coin transaction is configured as a first delay ending time;
s25: invoking a bitcoin blockchain interface to judge whether the current block moment reaches the first delay ending moment according to a first locking script in the complete first delay transaction, a first unlocking script in the complete first delay transaction and a second temporary bitcoin transaction: if yes, then executing the complete first delay transaction to execute the first block.
The principle of the delayed transaction in the above embodiment may refer to the method shown in fig. 1, and will not be described herein.
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 3, as another aspect, the present application also provides a computer device including one or more Central Processing Units (CPUs) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the computer device are also stored. The CPU501, ROM502, and RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments 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 present 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 via the communication portion 509, and/or installed from the removable media 511.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be a computer-readable storage medium contained in the apparatus of the above-described embodiment; or may be a computer-readable storage medium, alone, that is not assembled into a computer device. The computer readable storage medium stores one or more programs for use by one or more processors to perform the methods described herein.
The flowcharts 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 may be implemented by hardware. The described units or modules may also be provided in a processor, for example, each of the units may be a software program provided in a computer or a mobile smart device, or may be separately configured hardware devices. Wherein the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
The foregoing description is only of the preferred embodiments of the present application and is presented as a description of the principles of the technology being utilized. It will be appreciated by persons skilled in the art that the scope of the invention referred to in this application is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or their equivalents without departing from the spirit of the application. Such as the above-described features and technical features having similar functions (but not limited to) disclosed in the present application are replaced with each other.

Claims (7)

1. A time delay transaction method is characterized in that a blockchain is a non-bitcoin blockchain, a locktime field is additionally arranged in signature information of a bitcoin script verification type transaction, the method is suitable for a client, and the method comprises the following steps:
responding to a first delay transaction rule comprising a first delay ending moment determined by a current user and a second user, generating a first locking script according to the first delay transaction rule, and generating a first delay transaction address according to the first locking script;
generating an unsigned first delayed transaction and calculating a first transaction hash of the unsigned first delayed transaction; wherein a first transaction initiator address of the unsigned first delayed transaction is the first delayed transaction address;
generating a first temporary bitcoin transaction; the first temporary bitcoin transaction only comprises one input UTXO, a first index hash of the input UTXO of the first temporary bitcoin transaction is the first transaction hash, and the locktime of the first temporary bitcoin transaction is configured as the first delay ending time;
calling a bitcoin block link port to generate a first unlocking script according to the first locking script, the first temporary bitcoin transaction and a private key held by a current user;
generating a first delay transaction sender public key according to the first locking script, and constructing first signature information of the unsigned first delay transaction; the first signature information comprises a first identifier which is identified as a bitcoin script verification type, the first delay transaction sender public key, the first locking script and the first unlocking script, and locktime of the first signature information is configured as the first delay ending moment;
generating a complete first delay transaction according to the unsigned first delay transaction and the first signature information and sending the complete first delay transaction to a blockchain network for a blockchain node to:
storing the complete first delayed transaction when the complete first delayed transaction is judged to be a first type of transaction needing delay; the method comprises the steps of,
performing the following operations on the first block packed with the complete first delayed transaction:
judging whether the complete first delayed transaction is a transaction of a bitcoin script verification type according to a first identifier in the complete first delayed transaction, judging whether a first transaction sender public key in the complete first delayed transaction is matched with a first transaction initiator address in the complete first delayed transaction, judging whether a first locking script in the complete first delayed transaction is matched with a first transaction sender public key in the complete first delayed transaction, and judging whether the current block moment reaches the first delay ending moment;
if the judgment is yes, generating a second temporary bitcoin transaction; the second temporary bitcoin transaction only comprises one input UTXO, a second index hash of the input UTXO of the second temporary bitcoin transaction is the first transaction hash, and locktime of the second temporary bitcoin transaction is configured as the first delay ending time;
invoking a bitcoin block link port to judge whether the current block moment reaches the first delay ending moment according to the first locking script in the complete first delay transaction, the first unlocking script in the complete first delay transaction and the second temporary bitcoin transaction: if yes, the complete first delay transaction is executed to execute the first block.
2. The method of claim 1, wherein the generating a first delayed transaction address from the first locking script comprises:
performing hash operation on the first locking script twice to generate a first delay transaction address;
the generating a first delayed transaction sender public key according to the first locking script comprises:
performing hash operation on the first locking script to generate a first delay transaction sender public key;
the determining whether the first transaction sender public key in the complete first delayed transaction is matched with the first transaction initiator address in the complete first delayed transaction, and the determining whether the first locking script in the complete first delayed transaction is matched with the first transaction sender public key in the complete first delayed transaction includes:
performing a hash operation on the first transaction sender public key in the complete first delay transaction, and judging whether the value after the hash operation is the same as a first transaction initiator address in the complete first delay transaction;
and carrying out one-time hash operation on the first locking script in the complete first delay transaction, and judging whether the value after the hash operation is the same as the public key of the first transaction sender in the complete first delay transaction.
3. The method of claim 1, wherein prior to generating the unsigned first delayed transaction, further comprising:
and generating a first transfer transaction transferring the first delayed transaction address, and sending the first transfer transaction to a blockchain network, so that when the blockchain node successfully executes the first transfer transaction, the pass appointed by the first transfer transaction is transferred from a first user address of a current user to the first delayed transaction address.
4. A time delay transaction method is characterized in that a blockchain is a non-bitcoin blockchain, a locktime field is additionally arranged in transaction signature information of bitcoin script verification type, the method is suitable for blockchain nodes, and the method comprises the following steps:
receiving a complete first delayed transaction; the method comprises the steps that a first time delay transaction is completed, a first time delay transaction initiator address of the first time delay transaction is generated according to a first time delay transaction rule comprising first time delay ending time determined by a first user and a second user, the first signature information comprises a first identifier which is marked as a bit coin script verification type, a first time delay transaction sender public key, the first locking script and a first unlocking script, the lock time of the first signature information is configured to be the first time delay ending time, the first time delay transaction sender public key is generated according to the first locking script, the first unlocking script is generated by a first client of the first user, a bit coin block link is generated according to the first locking script, a first temporary bit transaction, a first hash time of the first user is configured to be the first time delay transaction, and the first time delay transaction is input, and the first time delay transaction is configured to be the first bit time delay XO;
storing the complete first delayed transaction when the complete first delayed transaction is judged to be a first type of transaction needing delay; the method comprises the steps of,
performing the following operations on the first block packed with the complete first delayed transaction:
judging whether the complete first delayed transaction is a transaction of a bitcoin script verification type according to a first identifier in the complete first delayed transaction, judging whether a first transaction sender public key in the complete first delayed transaction is matched with a first transaction initiator address in the complete first delayed transaction, judging whether a first locking script in the complete first delayed transaction is matched with a first transaction sender public key in the complete first delayed transaction, and judging whether the current block moment reaches the first delay ending moment;
if the judgment is yes, generating a second temporary bitcoin transaction; the second temporary bitcoin transaction only comprises one input UTXO, a second index hash of the input UTXO of the second temporary bitcoin transaction is the first transaction hash, and locktime of the second temporary bitcoin transaction is configured as the first delay ending time;
invoking a bitcoin block link port to judge whether the current block moment reaches the first delay ending moment according to the first locking script in the complete first delay transaction, the first unlocking script in the complete first delay transaction and the second temporary bitcoin transaction: if yes, the complete first delay transaction is executed to execute the first block.
5. The method of claim 4, wherein the first delayed transaction address is obtained by performing a hash operation on the first locking script twice; the first transaction sender public key is obtained by performing one-time hash operation on the first locking script;
the determining whether the first transaction sender public key in the complete first transaction matches the first transaction initiator address in the complete first transaction, and the determining whether the first locking script in the complete first transaction matches the first transaction sender public key in the complete first transaction comprises:
performing a hash operation on the first transaction sender public key in the complete first transaction, and judging whether the value after the hash operation is the same as a first transaction initiator address in the complete first transaction;
and carrying out one-time hash operation on the first locking script in the complete first transaction, and judging whether the value after the hash operation is the same as the public key of the first transaction sender in the complete first transaction.
6. A computer device, the device comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-5.
7. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-5.
CN202110881833.3A 2021-08-02 2021-08-02 Delay transaction method, computer device and storage medium Active CN113592651B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110881833.3A CN113592651B (en) 2021-08-02 2021-08-02 Delay transaction method, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110881833.3A CN113592651B (en) 2021-08-02 2021-08-02 Delay transaction method, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN113592651A CN113592651A (en) 2021-11-02
CN113592651B true CN113592651B (en) 2023-05-30

Family

ID=78253852

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110881833.3A Active CN113592651B (en) 2021-08-02 2021-08-02 Delay transaction method, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN113592651B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112600664A (en) * 2020-12-09 2021-04-02 杭州复杂美科技有限公司 Delayed transaction generation method, delayed transaction execution device and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201806112D0 (en) * 2018-04-13 2018-05-30 Nchain Holdings Ltd Computer-implemented system and method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112600664A (en) * 2020-12-09 2021-04-02 杭州复杂美科技有限公司 Delayed transaction generation method, delayed transaction execution device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于聚合签名与加密交易的全匿名区块链;王子钰;刘建伟;张宗洋;喻辉;;计算机研究与发展(第10期);全文 *

Also Published As

Publication number Publication date
CN113592651A (en) 2021-11-02

Similar Documents

Publication Publication Date Title
CN112994892B (en) Cross-chain interaction method, device, system and electronic equipment
US7350212B2 (en) Method and apparatus for data transfer across a network
CN110009494B (en) Method and device for monitoring transaction content in block chain
CN114255031A (en) System for executing cross block chain of transaction, cross chain transaction method and equipment
CN112150141A (en) Block chain consensus method, device and system
KR20180102269A (en) System and method for supporting external interface based on block chain
Garcia Bringas et al. BlockChain platforms in financial services: current perspective
CN112039913A (en) Server API calling method, device and storage medium
Kaur et al. A novel blockchain model for securing IoT based data transmission
CN112202564B (en) Transaction transfer method and device, electronic equipment and readable storage medium
Eizinger et al. Open problems in cross-chain protocols
CN113592651B (en) Delay transaction method, computer device and storage medium
US20100306835A1 (en) Communicating security credentials between cics regions
CN113095825B (en) Asset management method and device based on block chain and electronic equipment
CN113706303B (en) Universal time delay transaction method, computer equipment and storage medium
GB2530471A (en) Financial switching engine and messaging
CN114372879A (en) Transaction method, computer device and storage medium
CN113191756B (en) Cross-chain asset security management method, computer device and storage medium
CN112950183B (en) Cross-chain data interchange method, system, device and electronic equipment
CN113592643B (en) Asset periodic thawing method, computer device and storage medium
CN116263925A (en) Accounting method and device based on blockchain
CN111510306A (en) Offline signature method and device based on block chain
CN113703880B (en) Application program starting method and device, electronic equipment and readable storage medium
CN114780633B (en) Data interaction method, equipment and storage medium for financial terminal and blockchain
CN113205336B (en) Multiple signature transaction method, computer device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant