Blockchain transactions
By using the time lock puzzle to lock UTXO on the blockchain, it solves the problem of output transactions that cannot be time locked in the existing technology, and realizes the temporal locking and immutable storage of UTXO.
Patent Information
- Application Number
- CN202380021911.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-02-15
- Filing Date
- 2023-01-16
- Publication Date
- 2024-09-24
AI Technical Summary
It is difficult with existing technology to implement output transactions on the blockchain that can only be spent after a specific time, and existing methods such as nLocktime cannot effectively lock UTXO, resulting in transaction storage that is not immutable.
Use time lock puzzles to lock the UTXO of blockchain transactions. By generating a lock script that contains the time lock puzzle hash value and puzzle parameters, ensure that the UTXO can only be unlocked after a specific time. Use time locks such as modulus square puzzles. Puzzles ensure that parallel solving is not accelerated.
The timeliness of locking UTXO on the blockchain is realized, ensuring that UTXO can only be spent after a predetermined time, improving the immutability and security of transactions.
Smart Images

Figure CN118696523A
Abstract
Description
Technical Field
[0001] The present disclosure relates to a method for generating a blockchain transaction, wherein an output of the transaction is time-locked, and to a method for generating a blockchain transaction for unlocking a time-locked output. Background Art
[0002] Blockchain refers to a distributed data structure in which a copy of the blockchain is maintained at each of a plurality of nodes in a distributed peer-to-peer (P2P) network (hereinafter referred to as a "blockchain network") and is widely disclosed. The blockchain includes a series of data blocks, each of which includes one or more transactions. Except for the so-called "coinbase transaction", each transaction points to a previous transaction in a sequence, which can span one or more blocks back to one or more coinbase transactions. The coinbase transaction will be discussed further below. Transactions submitted to the blockchain network are included in new blocks. The process of creating a new block is generally referred to as "mining", which involves each of a plurality of nodes competing to perform "proof of work", i.e., solving a cryptographic puzzle based on a representation of a defined set of ordered and verified valid pending transactions waiting to be included in a new block of the blockchain. It should be noted that the blockchain can be pruned at some nodes, and the publication of blocks can be achieved by publishing only the block header.
[0003] Transactions in a blockchain can be used for one or more of the following purposes: transferring digital assets (i.e., a certain number of digital tokens); sorting a set of entries in a virtualized ledger or registry; receiving and processing time-stamped entries; and / or sorting index pointers by time. Blockchains can also be used to implement hierarchical additional functions on blockchains. For example, a blockchain protocol may allow additional user data or data indexes to be stored in a transaction. There is no pre-specified limit on the maximum data capacity that can be stored in a single transaction, so increasingly complex data can be incorporated. For example, this can be used to store electronic documents, audio, or video data in a blockchain.
[0004] The nodes of the blockchain network (commonly referred to as "miners") perform a distributed transaction registration and verification process, which will be described in more detail later. In summary, in this process, nodes verify transactions and insert them into block templates, which attempt to identify a valid proof-of-work solution for the block template. Once a valid solution is found, the new block is propagated to other nodes of the network, so that each node can record the new block on the blockchain. In order to record a transaction in the blockchain, a user (e.g., a blockchain client application) sends the transaction to one of the nodes in the network for propagation. The nodes receiving the transaction can compete to find a proof-of-work solution that incorporates the verified valid transaction into the new block. Each node is configured to execute the same node protocol, which will include one or more conditions for confirming that the transaction is valid. Invalid transactions will not be propagated or incorporated into the block. Assuming that the transaction has been verified to be valid and thus accepted on the blockchain, the transaction (including any user data) will therefore be registered and indexed as an immutable public record on each node in the blockchain network.
[0005] The node that successfully solves the proof-of-work puzzle to create the latest block is usually rewarded with a new transaction called a "coinbase transaction" that distributes the amount of digital assets, i.e. the number of tokens. The detection and rejection of invalid transactions is performed by the actions of competing nodes, which act as agents of the network and are incentivized to report and prevent improper behavior. The widespread publication of information allows users to continuously audit the performance of nodes. Publishing only block headers allows participants to ensure the continued integrity of the blockchain.
[0006] In the "output-based" model (sometimes referred to as the UTXO-based model), the data structure of a given transaction includes one or more inputs and one or more outputs. Any spendable output includes an element that specifies the amount of a digital asset, which can be derived from the ongoing sequence of transactions. Spendable outputs are sometimes called UTXOs ("unspent transaction outputs"). Outputs may also include a locking script that specifies future redemption conditions for the output. A locking script is a predicate that defines the conditions necessary to verify and transfer a digital token or asset. Each input of a transaction (except for a coinbase transaction) includes a pointer (i.e., a reference) to such an output in a previous transaction, and may also include an unlocking script for unlocking the locking script pointing to the output. Thus, consider a pair of transactions, referred to as a first transaction and a second transaction (or "target" transaction). The first transaction includes at least one output that specifies the amount of a digital asset, and includes a locking script that defines one or more conditions for unlocking the output. The second (target) transaction includes at least one input and an unlocking script, the at least one input including a pointer to the output of the first transaction; the unlocking script is used to unlock the output of the first transaction.
[0007] In such a model, when the second (target) transaction is sent to the blockchain network to be propagated and recorded in the blockchain, one of the validity conditions applied at each node will be that the unlocking script satisfies all of the one or more conditions defined in the locking script of the first transaction. Another condition will be that the output of the first transaction has not been redeemed by another earlier valid transaction. Any node that finds the target transaction invalid according to any of these conditions will not propagate the transaction (as a valid transaction, but may register an invalid transaction) nor include the transaction in a new block to be recorded in the blockchain.
[0008] Another transaction model is the account-based model. In this case, each transaction is defined not by reference to the UTXO of the previous transaction in the past transaction sequence, but by reference to the absolute account balance. The current state of all accounts is stored individually by the node in the blockchain and is constantly updated. Summary of the invention
[0009] In some scenarios, it is necessary to create transactions with outputs that can only be spent after a certain amount of time. This can be achieved to some extent with nLocktime, where the entire transaction is only submitted to the blockchain after nLocktime has expired, making the UTXOs only spendable after nLocktime. However, this approach does not lock only some of the UTXOs of a transaction, and means that transactions are stored locally, rather than on the blockchain in an immutable manner.
[0010] This article provides a blockchain transaction in which a timelock puzzle is used to lock the UTXO of the transaction stored on the chain, and these UTXO can only be spent after a specific amount of time.
[0011] According to one aspect disclosed herein, a computer-implemented method is provided for generating a puzzle blockchain transaction, the method comprising: providing a first locking script of the puzzle blockchain transaction, the first locking script corresponding to a first unspent transaction output and comprising a hash value derived from a target solution to a timelock puzzle, and a set of puzzle parameters for the timelock puzzle, wherein the target solution is calculated using a secret puzzle parameter set, and wherein the timelock puzzle is solvable using the puzzle parameter set in a time equal to or greater than a shortest solution time, wherein the puzzle parameter set does not include the secret puzzle parameter, wherein the locking script is configured to: when executed using a first unlocking script of a solution blockchain transaction, verify, based on the hash value, a candidate solution provided in the first unlocking script of the solution blockchain transaction and calculated using the puzzle parameter set; and providing the puzzle blockchain transaction to one or more nodes of a blockchain network.
[0012] Time-locked puzzles require the user to perform an exact number of sequential computations, so parallelizing the solving process will not speed up finding the solution. Therefore, if the user's hardware is known, the solution time of the puzzle can be estimated in advance. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] To facilitate an understanding of the embodiments of the present disclosure and to show how such embodiments may be implemented, reference will now be made, by way of example only, to the accompanying drawings, in which:
[0014] Figure 1 is a schematic block diagram of a system for implementing a blockchain;
[0015] Figure 2 Some examples of transactions that may be recorded in a blockchain are schematically shown;
[0016] Figure 3 A schematic block diagram of some node software for processing transactions is shown;
[0017] Figure 4 Schematically illustrating an exemplary method for unlocking a UTXO using a solution to a timelock puzzle;
[0018] Figure 5 Schematically illustrating an exemplary method for unlocking a UTXO using a time-locked private key that is not associated with a specific user;
[0019] Figure 6 Schematically illustrating an exemplary method for unlocking a UTXO using a time-locked private key associated with a particular user;
[0020] Figure 7 Schematically illustrating an exemplary method for unlocking a UTXO chain using a time-locked private key that is not associated with a specific user;
[0021] Figure 8 Schematically illustrating an exemplary method for unlocking a UTXO chain using a time-locked private key associated with a particular user;
[0022] Fig. 9 schematically illustrating a chained transaction including multiple outputs forming a time-locked chain;
[0023] Fig.10 An exemplary method for preventing a UTXO from being spent after a minimum resolution time is shown; and
[0024] Fig.11 An exemplary method for unlocking a UTXO chain is schematically illustrated, where a spend transaction contains the next puzzle to be solved. DETAILED DESCRIPTION
[0025] 1. Exemplary System Overview
[0026] Figure 1 An exemplary system 100 for implementing a blockchain 150 is shown. The system 100 may include a packet-switched network 101, typically a wide area internet such as the Internet. The packet-switched network 101 includes a plurality of blockchain nodes 104, which may be arranged to form a peer-to-peer (P2P) network 106 within the packet-switched network 101. Although not shown, the blockchain nodes 104 may be arranged as a nearly complete graph. Thus, each blockchain node 104 is highly connected to other blockchain nodes 104.
[0027] Each blockchain node 104 includes a computer device of a peer, and different nodes 104 belong to different peers. Each blockchain node 104 includes a processing device, which includes one or more processors, such as one or more central processing units (CPUs), accelerator processors, special processors and / or field programmable gate arrays (FPGAs), and other devices, such as application-specific integrated circuits (ASICs). Each node also includes a memory, that is, a computer-readable memory in the form of a non-transitory computer-readable medium. The memory may include one or more memory units, which use one or more memory media, such as magnetic media such as hard disks, electronic media such as solid-state drives (SSDs), flash memory, or electrically erasable programmable read-only memories (EEPROMs), and / or optical media such as optical disk drives.
[0028] The blockchain 150 includes a series of data blocks 151, wherein a respective copy of the blockchain 150 is maintained at each of the plurality of blockchain nodes 104 in the distributed or blockchain network 106. As described above, maintaining a copy of the blockchain 150 does not necessarily mean storing the blockchain 150 in its entirety. Instead, the blockchain 150 can be pruned as long as each blockchain node 150 stores a block header (discussed below) for each block 151. Each block 151 in the blockchain includes one or more transactions 152, wherein a transaction in this context refers to a data structure. The nature of the data structure will depend on the type of transaction protocol used as part of the transaction model or plan. A given blockchain uses a particular transaction protocol throughout. In a common transaction protocol, the data structure of each transaction 152 includes at least one input and at least one output. Each output specifies an amount of a digital asset represented as a property, an example of which is an output that is cryptographically locked to a user 103 (requiring the user's signature or other solution to unlock, thereby redeeming or spending). Each input points to the output of a previous transaction 152, thereby linking these transactions.
[0029] Each block 151 also includes a block pointer 155, which points to a previously created block 151 in the blockchain to define the order of blocks 151. Each transaction 152 (except for the coinbase transaction) includes a pointer to a previous transaction to define the order of the transaction sequence (Note: the sequence of transactions 152 can branch). The blockchain of blocks 151 is traced back to the genesis block (Gb) 153, which is the first block in the blockchain. One or more original transactions 152 earlier in the blockchain 150 point to the genesis block 153, not to the previous transaction.
[0030] Each blockchain node 104 is configured to forward transactions 152 to other blockchain nodes 104, so that transactions 152 are propagated throughout the network 106. Each blockchain node 104 is configured to create blocks 151 and store corresponding copies of the same blockchain 150 in its corresponding memory. Each blockchain node 104 also maintains an ordered set (or "pool") 154 of transactions 152 waiting to be incorporated into block 151. Ordered pools 154 are often referred to as "memory pools". In this article, the term is not intended to be limited to any particular blockchain, protocol, or model. The term refers to a set of ordered transactions that a node 104 has accepted as valid, and for which the node 104 is forced to not accept any other transaction that attempts to spend the same output.
[0031] In a given current transaction 152j, an input (or each input) includes a pointer that references an output of a previous transaction 152i in the transaction sequence, specifying that the output is to be redeemed or "spent" in the current transaction 152j. Spending or redeeming does not necessarily mean transferring a financial asset, although this is certainly a common application. More generally, spending can be described as consuming an output, or allocating it to one or more outputs in another subsequent transaction. In general, a previous transaction can be any transaction in an ordered set 154 or any block 151. Although a previous transaction 152i will need to exist and be verified to be valid in order to ensure that the current transaction is valid, it is not necessary for a previous transaction 152i to exist when the current transaction 152j is created or even sent to the network 106. Therefore, in this article, "previous" refers to the predecessor in a logical sequence linked by a pointer, and not necessarily the creation time or sending time in a time sequence, and therefore, does not necessarily exclude the situation where transactions 152i, 152j are created or sent out of order (see the discussion of isolated transactions below). A previous transaction 152i can also be called a predecessor transaction or a predecessor transaction.
[0032] The inputs of the current transaction 152j also include input authorizations, such as the signature of the user 103a to whom the outputs of the previous transaction 152i are locked. In turn, the outputs of the current transaction 152j may be cryptographically locked to the new user or entity 103b. Thus, the current transaction 152j may transfer the amounts defined in the inputs of the previous transaction 152i to the new user or entity 103b defined in the outputs of the current transaction 152j. In some cases, a transaction 152 may have multiple outputs to split the input amounts among multiple users or entities (one of which may be the original user or entity 103a for changes). In some cases, a transaction may also have multiple inputs to aggregate the amounts from multiple outputs of one or more previous transactions and reallocate them to one or more outputs of the current transaction.
[0033] According to an output-based transaction protocol, such as Bitcoin, when a party 103, such as an individual user or an organization, wishes to issue a new transaction 152j (either by an automated program employed by the party or manually), the issuing party sends the new transaction from its computer terminal 102 to a recipient. The issuing party or recipient will ultimately send the transaction to one or more blockchain nodes 104 of the network 106 (now typically a server or data center, but in principle it can also be other user terminals). It is also not excluded that the party 103 issuing the new transaction 152j can send the transaction directly to one or more blockchain nodes 104, and in some examples, the transaction may not be sent to the recipient. The blockchain node 104 receiving the transaction checks whether the transaction is valid according to the blockchain node protocol applied at each blockchain node 104. The blockchain node protocol typically requires the blockchain node 104 to check whether the cryptographic signature in the new transaction 152j matches the expected signature, which depends on the previous transaction 152i in the ordered sequence of transactions 152. In such an output-based transaction protocol, this may include checking whether the cryptographic signature or other authorization of the party 103 included in the input of the new transaction 152j matches the condition defined in the output of the previous transaction 152i that the new transaction spends (or "allocates"), where the condition typically includes at least checking whether the cryptographic signature or other authorization in the input of the new transaction 152j unlocks the output of the previous transaction 152i to which the input of the new transaction is linked. The condition may be defined at least in part by a script included in the output of the previous transaction 152i. Alternatively, this may be determined solely by the blockchain node protocol, or may be determined by a combination thereof. In either case, if the new transaction 152j is valid, the blockchain node 104 forwards it to one or more other blockchain nodes 104 in the blockchain network 106. These other blockchain nodes 104 apply the same test according to the same blockchain node protocol, and therefore forward the new transaction 152j to one or more other nodes 104, and so on. In this way, the new transaction is propagated throughout the network of blockchain nodes 104.
[0034] In the output-based model, the definition of whether a given output (e.g., UTXO) is allocated (or "spent") is whether it is validly redeemed by the input of another subsequent transaction 152j according to the blockchain node protocol. Another condition for a transaction to be valid is that the output of the previous transaction 152i that it attempts to redeem has not been redeemed by another transaction. Similarly, if invalid, transaction 152j will not be propagated (unless marked as invalid and propagated for reminder) or recorded in the blockchain 150. This prevents double spending, that is, the transaction processor allocates the output of the same transaction more than once. On the other hand, the account-based model prevents double spending by maintaining account balances. Because there is also a defined transaction order, the account balance has a single defined state at all times.
[0035] In addition to verifying that transactions are valid, blockchain nodes 104 compete to be the first node to create a block of transactions in a process generally referred to as mining, which is supported by "proof of work". At a blockchain node 104, a new transaction is added to an ordered pool 154 of valid transactions that have not yet appeared in a block 151 recorded on the blockchain 150. The blockchain nodes then compete to assemble a new valid transaction block 151 of transactions 152 in the ordered transaction set 154 by attempting to solve a cryptographic puzzle. Typically, this involves searching for a "nonce" value such that when the nonce is juxtaposed with a representation of the ordered pool 154 of pending transactions and hashed, the output of the hash value satisfies a predetermined condition. For example, the predetermined condition may be that the output of the hash value has a certain predefined number of leading zeros. Note that this is only one specific type of proof of work puzzle, and other types are not excluded. A property of a hash function is that it has an unpredictable output relative to its input. Therefore, this search can only be performed by brute force, consuming a large amount of processing resources at each blockchain node 104 that attempts to solve the puzzle.
[0036] The first blockchain node 104 that solves the puzzle announces the puzzle solution on the network 106, providing the solution as proof, which can then be easily checked by other blockchain nodes 104 in the network (once a solution to the hash value is given, it is directly possible to check whether the solution satisfies the output of the hash value). The first blockchain node 104 propagates a block to other nodes that accept the block to reach a threshold consensus, thereby enforcing the protocol rules. The ordered set of transactions 154 is then recorded by each blockchain node 104 as a new block 151 in the blockchain 150. A block pointer 155 is also assigned to the new block 151n pointing to the previously created block 151n-1 in the blockchain. The large amount of work required to create a proof-of-work solution (e.g., in the form of a hash) signals the intention of the first node 104 to follow the blockchain protocol. These rules include not accepting a transaction as valid if it spends or allocates the same output as a previously verified valid transaction, otherwise it is called a double spend. Once created, the block 151 cannot be modified because it is identified and maintained at each blockchain node 104 in the blockchain network 106. The block pointers 155 also impose an order on the blocks 151. Because transactions 152 are recorded in ordered blocks at each blockchain node 104 in the network 106, an immutable public ledger of transactions is provided.
[0037] It should be noted that the different blockchain nodes 104 competing to solve a puzzle at any given time may do so based on different snapshots of the pool 154 of transactions that have not yet been published at any given time, depending on when they began searching for a solution or the order in which they received the transactions. The person solving the corresponding puzzle first defines the transactions 152 included in the new block 151n and their order, and updates the current pool of unpublished transactions 154. The blockchain nodes 104 then continue to compete to create blocks from the newly defined ordered pool of unpublished transactions 154, and so on. In addition, there is a protocol to resolve any "forks" that may occur, where two blockchain nodes 104 solve puzzles within a short time of each other, thereby propagating conflicting views of the blockchain between the nodes 104. In short, the fork direction that is the longest becomes the final blockchain 150. It should be noted that this does not affect users or agents of the network, as the same transaction will appear in both forks.
[0038] According to the Bitcoin blockchain (and most other blockchains), a node that successfully constructs a new block 104 is granted the ability to newly allocate an additional, accepted amount of digital assets in a new special type of transaction that allocates an additional limited amount of digital assets (as opposed to an inter-agent or inter-user transaction, which transfers a certain amount of digital assets from one agent or user to another). This special type of transaction is often called a "coinbase transaction", but may also be called a "starting transaction" or "generating transaction". It usually forms the first transaction of a new block 151n. The proof of work signals the intention of the node that constructs the new block to follow the protocol rules, thereby allowing the particular transaction to be redeemed later. The blockchain protocol rules may require a maturation period, such as 100 blocks, before the special transaction can be redeemed. Typically, a regular (non-generating) transaction 152 will also specify an additional transaction fee in one of its outputs to further reward the blockchain node 104 that created the block 151n in which the transaction was published. This fee is often called a "transaction fee" and is discussed below.
[0039] Due to the resources involved in transaction verification and publication, typically at least each blockchain node 104 takes the form of a server comprising one or more physical server units, or even an entire data center. However, in principle, any given blockchain node 104 may take the form of a user terminal or a group of user terminals networked together.
[0040] The memory of each blockchain node 104 stores software configured to run on the processing device of the blockchain node 104 to perform its corresponding role according to the blockchain node protocol and process transactions 152. It should be understood that any action attributed to the blockchain node 104 herein can be performed by software running on the processing device of the corresponding computer device. The node software can be implemented in one or more applications at the application layer or a lower layer such as an operating system layer or a protocol layer, or any combination of these layers.
[0041] Computer devices 102 of each of the parties 103 acting as consuming users are also connected to the network 101. These users can interact with the blockchain network 106 but do not participate in verifying transactions or constructing blocks. Some of these users or agents 103 can act as senders and receivers in transactions. Other users can interact with the blockchain 150 without acting as senders or receivers. For example, some parties can act as storage entities that store a copy of the blockchain 150 (e.g., having obtained a copy of the blockchain from the blockchain node 104).
[0042] Some or all of the parties 103 may be connected as part of a different network, such as a network overlaid on the blockchain network 106. Users of the blockchain network (often referred to as "clients") may be referred to as being part of a system that includes the blockchain network 106; however, these users are not blockchain nodes 104 because they do not perform the roles required of blockchain nodes. Instead, each party 103 may interact with the blockchain network 106, thereby utilizing the blockchain 150 by connecting to (i.e., communicating with) the blockchain node 106. For illustrative purposes, two parties 103 and their corresponding devices 102 are shown: a first party 103a and its corresponding computer device 102a, and a second party 103b and its corresponding computer device 102b. It should be understood that more such parties 103 and their corresponding computer devices 102 may exist and participate in the system 100, but for convenience, they are not illustrated. Each party 103 may be an individual or an organization. For illustrative purposes only, in this document, the first party 103a is referred to as Alice and the second party 103b is referred to as Bob, but it should be understood that this is not limited to Alice or Bob, and any reference to Alice or Bob in this document can be replaced with "first party" and "second party" respectively.
[0043] The computer device 102 of each party 103 includes a corresponding processing device, which includes one or more processors, such as one or more CPUs, graphics processing units (GPUs), other accelerator processors, specific application processors and / or FPGAs. The computer device 102 of each party 103 also includes a memory, that is, a computer-readable memory in the form of a non-temporary computer-readable medium. The memory may include one or more memory units, which use one or more memory media, such as magnetic media such as hard disks, electronic media such as SSDs, flash memory or EEPROMs, and / or optical media such as optical disk drives. The memory on the computer device 102 of each party 103 stores software, which includes a corresponding instance of at least one client application 105 that is set to run on the processing device. It should be understood that any action attributed to a given party 103 in this article can be executed by software running on the processing device of the corresponding computer device 102. The computer device 102 of each party 103 includes at least one user terminal, such as a desktop or laptop computer, a tablet computer, a smart phone, or a wearable device such as a smart watch. The computer device 102 of a given party 103 may also include one or more other network resources, such as cloud computing resources accessed through a user terminal.
[0044] The client application 105 may initially be provided to the computer device 102 of any given party 103 via a suitable computer-readable storage medium downloaded from a server, for example, or via a removable storage device such as a removable SSD, flash memory key, removable EEPROM, removable disk drive, floppy disk or tape, an optical disk such as a CD or DVD ROM, or a removable optical drive, etc.
[0045] The client application 105 includes at least a "wallet" function. This has two main functions. One of the functions is to enable the corresponding party 103 to create, authorize (e.g., sign) and send transactions 152 to one or more Bitcoin nodes 104, which are then propagated in the network of blockchain nodes 104 and included in the blockchain 150. Another function is to report to the corresponding party the amount of digital assets it currently owns. In an output-based system, this second function includes collating the amounts defined in the outputs of various transactions 152 belonging to the relevant parties scattered in the blockchain 150.
[0046] Note: While various client functions may be described as being integrated into a given client application 105, this is not necessarily limiting, and rather, any client function described herein may be implemented in a suite consisting of two or more different applications, such as interfacing via an API or one application as a plug-in to another application. More generally, the client functions may be implemented at the application layer or at a lower layer such as an operating system, or any combination of these layers. The following description will be based on the client application 105, but it should be understood that this is not limiting.
[0047] An instance of a client application or software 105 on each computer device 102 is operably coupled to at least one of the blockchain nodes 104 of the network 106. This can enable a wallet function of the client 105 to send transactions 152 to the network 106. The client 105 can also contact the blockchain node 104 to query the blockchain 150 for any transactions to which the corresponding party 103 is a recipient (or indeed to check other parties' transactions in the blockchain 150, because in an embodiment, the blockchain 150 is a public facility that provides transaction trust to some extent through its public visibility). The wallet function on each computer device 102 is configured to formulate and send transactions 152 according to a transaction protocol. As described above, each blockchain node 104 runs software that is configured to verify transactions 152 according to the blockchain node protocol and forward transactions 152 for propagation in the blockchain network 106. The transaction protocol and the node protocol correspond to each other, and a given transaction protocol and a given node protocol together implement a given transaction model. The same transaction protocol is used for all transactions 152 in the blockchain 150. All nodes 104 in the network 106 use the same node protocol.
[0048] When a given party 103 (say Alice) wishes to send a new transaction 152j to be included in the blockchain 150, she will formulate the new transaction according to the relevant transaction protocol (using the wallet function in her client application 105). She will then send the transaction 152 from the client application 105 to one or more blockchain nodes 104 to which she is connected. For example, this may be the blockchain node 104 that Alice's computer 102 is best connected to. When any given blockchain node 104 receives the new transaction 152j, it will process it according to the blockchain node protocol and its corresponding role. This includes first checking whether the newly received transaction 152j meets certain conditions for becoming "valid", specific examples of which will be discussed in detail later. In some transaction protocols, the validity conditions may be configurable on a per-transaction basis through a script included in the transaction 152. Alternatively, the conditions may simply be a built-in function of the node protocol, or defined by a combination of script and node protocol.
[0049] If the newly received transaction 152j passes the validity test (i.e., under the “valid” condition), any blockchain node 104 that receives the transaction 152j will add the new verified valid transaction 152 to the ordered transaction set 154 maintained at the blockchain node 104. Further, any blockchain node 104 that receives the transaction 152j will then propagate the verified valid transaction 152 to one or more other blockchain nodes 104 in the network 106. Since each blockchain node 104 applies the same protocol, it is assumed that the transaction 152j is valid, which means that the transaction will soon be propagated throughout the network 106.
[0050] Once in the ordered pool 154 of pending transactions maintained at a given blockchain node 104, that blockchain node 104 will begin racing to solve the proof-of-work puzzle on the latest version of its respective pool 154 containing the new transaction 152 (keep in mind that other blockchain nodes 104 can attempt to solve the puzzle based on different transaction pools 154. However, whoever solves the puzzle first will define the set of transactions included in the latest block 151. Ultimately, the blockchain node 104 will solve the puzzle for a portion of the ordered pool 154, which includes Alice's transaction 152j). Once the pool 154 including the new transaction 152j completes the proof-of-work, it will immutably become part of one of the blocks 151 in the blockchain 150. Each transaction 152 includes a pointer to an earlier transaction, so the order of transactions is also immutably recorded.
[0051] Different blockchain nodes 104 may initially receive different instances of a given transaction and therefore have conflicting views about which instance is “valid” before one instance is published in a new block 151, at which point all blockchain nodes 104 agree that the published instance is the only valid instance. If a blockchain node 104 accepts one instance as valid and then discovers that a second instance has been recorded in the blockchain 150, the blockchain node 104 must accept this and will discard (i.e., treat as invalid) the instance it originally accepted (i.e., the instance that has not yet been published in block 151).
[0052] Another type of transaction protocol operated by some blockchain networks as part of the account-based transaction model can be called an "account-based" protocol. In the account-based case, each transaction is defined not by reference to the UTXO of a previous transaction in the past sequence of transactions, but by reference to an absolute account balance. The current state of all accounts is stored individually in the blockchain by the nodes of the network and is continuously updated. In such systems, transactions are ordered using an account's running transaction record (also called a "position"). This value is signed by the sender as part of their cryptographic signature and hashed as part of the transaction reference calculation. In addition, optional data fields can also be signed in the transaction. For example, a data field can point to a previous transaction if it contains the ID of the previous transaction.
[0053] 2. UTXO-based model
[0054] Figure 2 An exemplary transaction protocol is shown. This is an example of a UTXO-based protocol. A transaction 152 ("Tx" for short) is the basic data structure of the blockchain 150 (each block 151 includes one or more transactions 152). The following will be described with reference to an output-based or "UTXO"-based protocol. However, this is not limited to all possible embodiments. It should be noted that although the exemplary UTXO-based protocol is described with reference to Bitcoin, it can also be implemented on other exemplary blockchain networks.
[0055] In the UTXO-based model, each transaction ("Tx") 152 includes a data structure that includes one or more inputs 202 and one or more outputs 203. Each output 203 may include an unspent transaction output (UTXO), which can be used as a source of input 202 for another new transaction (if the UTXO has not been redeemed). The UTXO includes a value that specifies the amount of a digital asset. This represents a set of tokens on a distributed ledger. The UTXO may also include a transaction ID of its source transaction and other information. The transaction data structure may also include a header 201, which may include an indicator of the size of the input field 202 and the output field 203. The header 201 may also include an ID for the transaction. In an embodiment, the transaction ID is a hash value of the transaction data (excluding the transaction ID itself) and is stored in the header 201 of the original transaction 152 submitted to the node 104.
[0056] Let's say Alice 103a wishes to create a transaction 152j that transfers the relevant amount of digital assets to Bob 103b. Figure 2 In , Alice's new transaction 152j is labeled "Tx1". This new transaction takes the amount of digital assets locked to Alice in output 203 of the previous transaction 152i in the sequence and transfers at least a portion of such amount to Bob. Figure 2, the previous transaction 152i is labeled "Tx0". Tx0 and Tx1 are just arbitrary labels that do not necessarily mean that Tx0 refers to the first transaction in blockchain 151 and Tx1 refers to a subsequent transaction in pool 154. Tx1 can point to any previous (i.e., preceding) transaction that still has unspent output 203 locked to Alice.
[0057] When Alice creates her new transaction Tx1, or at least when she sends it to the network 106, the previous transaction Tx0 may already be valid and included in block 151 of the blockchain 150. The transaction may have been included in one of the blocks 151 at this time, or it may still be waiting in the ordered set 154, in which case it will be included in the new block 151 soon. Alternatively, Tx0 and Tx1 may be created and sent to the network 106 together; or, if the node protocol allows buffering of "orphan" transactions, Tx0 may even be sent after Tx1. The terms "previous" and "successor" as used herein in the context of transaction sequences refer to the order of transactions in the sequence defined by the transaction pointers specified in the transactions (which transaction points to which other transaction, etc.). They may equally be replaced by "predecessors" and "successors", "predecessors" and "descendants", or "parents" and "children", etc. This does not necessarily refer to the order in which they are created, sent to the network 106, or arrive at any given blockchain node 104. However, subsequent transactions (descendant transactions or "child transactions") pointing to a previous transaction (predecessor transaction or "parent transaction") will not be valid unless the parent transaction is valid. A child transaction that arrives at the blockchain node 104 before the parent transaction is considered an orphan transaction. Depending on the node protocol and / or node behavior, it may be discarded or buffered for a period of time to wait for the parent transaction.
[0058] One of the one or more outputs 203 of the previous transaction Tx0 includes a specific UTXO, labeled UTXO0. Each UTXO includes a value specifying the amount of digital assets represented by the UTXO and a locking script that defines the conditions that the unlocking script in the input 202 of the subsequent transaction must satisfy in order for the subsequent transaction to be valid and thus successfully redeem the UTXO. Typically, the locking script locks the amount to a specific party (the beneficiary of the transaction for that amount). That is, the locking script defines the unlocking condition, which typically includes the following conditions: the unlocking script in the input of the subsequent transaction includes the cryptographic signature of the party to which the previous transaction was locked.
[0059] The locking script (also known as scriptPubKey) is a piece of code written in a domain-specific language recognized by the node protocol. A specific example of such a language is called a "Script" (with a capital S), which can be used by the blockchain network. The locking script specifies the information required to spend the transaction output 203, such as the requirement for Alice's signature. The unlocking script appears in the output of the transaction. The unlocking script (also known as scriptSig) is a piece of code written in a domain-specific language that provides the information required to meet the locking script criteria. For example, it can contain Bob's signature. The unlocking script appears in the input 202 of the transaction.
[0060] Thus in the example shown, UTXO0 in output 203 of Tx0 includes a locking script [Checksig P A ], the locking script requires Alice’s signature Sig P A , in order to redeem UTXO0 (strictly speaking, to make subsequent transactions that attempt to redeem UTXO0 valid). A ] contains Alice's public key P from her public-private key pair A The input 202 of Tx1 includes a pointer to Tx1 (e.g., by its transaction ID (TxID0), which in the embodiment is the hash value of the entire transaction Tx0). The input 202 of Tx1 includes an index identifying UTXO0 in Tx0 to identify it among any other possible outputs of Tx0. The input 202 of Tx1 further includes an unlocking script <Sig P A >, the unlocking script includes Alice's cryptographic signature, which is created by Alice by applying the private key of her key pair to a predetermined portion of data (sometimes called a "message" in cryptography). The data (or "message") that Alice needs to sign to provide a valid signature can be defined by the locking script, the node protocol, or a combination thereof.
[0061] When a new transaction Tx1 arrives at a blockchain node 104, the node applies the node protocol. This includes running the locking script and the unlocking script together to check whether the unlocking script satisfies the conditions defined in the locking script (where the conditions may include one or more criteria). In an embodiment, this involves juxtaposing two scripts:
[0062] <Sig PA> <pa>||[Checksig PA]
[0063] Where "||" means concatenation, "<…>" means putting data on the stack, and "[…]" means a function consisting of locked scripts (in this case, a stack-based language). Similarly, scripts can be run one after another using a common stack instead of concatenating the scripts. In either case, when run together, the scripts use Alice's public key P A (included in the locking script of the output of Tx0) to verify that the unlocking script in the input of Tx1 contains Alice's signature when signing the expected portion of the data. The expected partial data itself (the "message") also needs to be included in order to perform this verification. In an embodiment, the signed data includes the entire Tx1 (so there is no need to include a separate element to plaintext specify the signed partial data, as it is already present).
[0064] Those skilled in the art will be familiar with the details of verification by public-private cryptography. Basically, if Alice has signed a message using her private key encryption, then given Alice's public key and the message in plain text, other entities such as node 104 can verify that the message must have been signed by Alice. Signing typically includes hashing the message, signing the hash value, and marking this to the message as a signature, so that any holder of the public key can verify the signature. Therefore, it should be noted that in embodiments, any reference to signing a particular data fragment or transaction portion, etc. herein can mean signing the hash value of the data fragment or transaction portion.
[0065] If the unlocking script in Tx1 satisfies one or more conditions specified in the locking script of Tx0 (so, in the example shown, if Alice's signature is provided and verified in Tx1), then the blockchain node 104 considers Tx1 to be valid. This means that the blockchain node 104 will add Tx1 to the pending transaction ordered pool 154. The blockchain node 104 will also forward the transaction Tx1 to one or more other blockchain nodes 104 in the network 106 so that it will propagate throughout the network 106. Once Tx1 is valid and included in the blockchain 150, this will define UTXO0 from Tx0 as spent. It should be noted that Tx1 is only valid if it spends unspent transaction output 203. If it attempts to spend an output that has already been spent by another transaction 152, then Tx1 will be invalid even if all other conditions are met. Therefore, the blockchain node 104 also needs to check whether the UTXO referenced in the previous transaction Tx0 has been spent (that is, whether it has formed a valid input for another valid transaction). This is one of the reasons why it is important for the blockchain 150 to impose a defined order on transactions 152. In practice, a given blockchain node 104 may maintain a separate database marking the UTXO 203 of a transaction 152 as having been spent, but ultimately defining whether a UTXO has been spent depends on whether it has formed a valid input to another valid transaction in the blockchain 150.
[0066] If the total amount specified in all outputs 203 of a given transaction 152 is greater than the total amount pointed to by all its inputs 202, this is another basis for failure in most transaction models. Therefore, such a transaction will not be propagated or included in block 151.
[0067] Note that in the UTXO-based transaction model, a given UTXO needs to be spent as a whole. You cannot "leave behind" a portion of the amount defined in a UTXO as spent while spending another portion. However, the amount of a UTXO can be split between multiple outputs of subsequent transactions. For example, the amount defined in UTXO0 of Tx0 can be split between multiple UTXOs in Tx1. Therefore, if Alice does not want to give all of the amount defined in UTXO0 to Bob, she can use the remaining portion to make change for herself in the second output of Tx1, or to pay another party.
[0068] In practice, Alice will also typically need to include a fee for the Bitcoin node 104 that successfully includes Alice's transaction 104 in block 151. If Alice does not include such a fee, Tx0 may be rejected by the blockchain node 104, and therefore, although technically valid, may not be propagated and included in the blockchain 150 (if the blockchain node 104 does not want to accept transaction 152, the node protocol does not force the blockchain node 104 to accept it). In some protocols, the transaction fee does not require its own separate output 203 (i.e., no separate UTXO is required). Instead, any difference between the total amount pointed to by input 202 and the total amount specified by output 203 of a given transaction 152 will be automatically provided to the blockchain node 104 that issued the transaction. For example, assume that a pointer to UTXO0 is the only input to Tx1, and Tx1 has only one output UTXO1. If the amount of digital assets specified in UTXO0 is greater than the amount specified in UTXO1, the difference may be allocated (or spent) by the node 104 that wins the proof-of-work race to create the block containing UTXO1. Alternatively or additionally, this does not necessarily preclude the possibility of explicitly specifying a transaction fee in one of the UTXOs 203 in its own transaction 152.
[0069] Alice and Bob's digital assets consist of the UTXO locked to them in any transaction 152 anywhere in the blockchain 150. Therefore, in general, the assets of a given party 103 are scattered among the UTXOs of various transactions 152 throughout the blockchain 150. No single number defining the total balance of a given party 103 is stored anywhere in the blockchain 150. The role of the wallet function of the client application 105 is to collate the various UTXO values locked to the respective parties and not yet spent in other subsequent transactions. To achieve this, it can query a copy of the blockchain 150 stored at any one Bitcoin node 104.
[0070] It should be noted that script code is often represented schematically (i.e., using an imprecise language). For example, an opcode (opcode) may be used to represent a particular function. "OP_..." refers to a particular opcode of the scripting language. For example, OP_RETURN is a scripting language opcode that, when preceded by OP_FALSE at the beginning of a locking script, creates an unspendable output of a transaction that can store data within the transaction, thereby immutably recording the data in the blockchain 150. For example, the data may include a file to be stored in the blockchain.
[0071] Typically, the inputs to a transaction contain a digital signature corresponding to the public key PA. In an embodiment, this is based on ECDSA using the elliptic curve secp256k1. The digital signature signs a specific piece of data. In an embodiment, for a given transaction, the signature will sign part of the transaction input and part or all of the transaction output. Signing a specific part of the output depends on the SIGHASH flag. The SIGHASH flag is typically a 4-byte code included at the end of the signature that selects the output to be signed (and is therefore fixed at the time of signing).
[0072] The locking script is sometimes referred to as "scriptPubKey", which means that it usually includes the public key of the party to which the corresponding transaction is locked. The unlocking script is sometimes referred to as "scriptSig", which means that it usually provides the corresponding signature. However, more generally speaking, in all applications of blockchain 150, the conditions for UTXO redemption do not necessarily include verification of the signature. More generally speaking, the scripting language can be used to define any one or more conditions. Therefore, the more general terms "locking script" and "unlocking script" may be preferred.
[0073] 3. Side Channels
[0074] like Figure 1 As shown, the client application on each of Alice and Bob's computer devices 102a, 120b can include additional communication functions. This additional function enables Alice 103a to establish a separate side channel 107 with Bob 103b (at the instigation of any party or third party). Side channel 107 enables data to be exchanged away from the blockchain network. Such communication is sometimes referred to as "off-chain" communication. For example, this can be used to exchange transactions 152 between Alice and Bob without registering the transaction (yet) on the blockchain network 106 or publishing it on the chain 150 until one of the parties chooses to broadcast it to the network 106. Sharing transactions in this way is sometimes referred to as sharing "transaction templates". The transaction template may lack one or more inputs and / or outputs required to form a complete transaction. Alternatively or additionally, side channel 107 can be used to exchange any other transaction-related data, such as keys, negotiation amounts or terms, data content, etc.
[0075] The side channel 107 may be established via the same packet switching network 101 as the blockchain network 106. Alternatively or additionally, the side channel 301 may be established via a different network such as a mobile cellular network or a local area network such as a wireless local area network, or even via a direct wired or wireless link between Alice's and Bob's devices 102a, 102b. In general, a side channel 107 referred to anywhere in this document may include any one or more links via one or more networking technologies or communication media that are used to exchange data "off-chain", i.e., off-chain. The link bundle or collection as a whole may be referred to as a side channel 107 in the case of multiple links. Therefore, it should be noted that if Alice and Bob are said to exchange certain information or data, etc., via a side channel 107, this does not necessarily mean that all of this data must be sent over exactly the same link or even the same type of network.
[0076] 4. Node software
[0077] Figure 3 An example of node software 450 running on each blockchain node 104 of the network 106 in an example of a UTXO-based or output-based model is shown. It should be noted that another entity may run the node software 450 without being classified as a node 104 on the network 106, i.e., not performing the actions required of the node 104. The node software 450 may include, but is not limited to, a protocol engine 451, a scripting engine 452, a stack 453, an application-level decision engine 454, and a collection of one or more blockchain-related functional modules 455. Each node 104 may run node software that includes, but is not limited to, all three of the following: a consensus module 455C (e.g., proof of work), a propagation module 455P, and a storage module 455S (e.g., a database). The protocol engine 401 is typically configured to identify different fields of a transaction 152 and process such fields according to the node protocol. When a transaction 152i (Tx m-1 )’s output (e.g., UTXO) is an input transaction 152j (Tx j ), the protocol engine 451 identifies Tx j The unlocking script in and passes it to the script engine 452. The protocol engine 451 also j Pointer in the input to identify and retrieve Tx i .Tx i may be published on blockchain 150, in which case the protocol engine may retrieve Tx from the copy of block 151 of blockchain 150 stored at node 104 i . Or, Tx i It can also be published on blockchain 150. In this case, protocol engine 451 can retrieve Tx from unpublished ordered transaction set 154 maintained by node 104. i Regardless of the method used, the script engine 451 will identify Tx i The locked script in the reference output is passed to the script engine 452.
[0078] Therefore, the script engine 452 has Tx i The locking script and the j The unlocking script for the corresponding input. For example, Figure 2 Transaction labels Tx0 and Tx1 are shown in FIG, but the same transaction can also be applied to any transaction pair. As previously described, the script engine 452 runs two scripts together, which will include placing data on and retrieving data from the stack 453 according to the stack-based scripting language used (e.g., script).
[0079] By running the scripts simultaneously, the script engine 452 determines whether the unlocking script satisfies one or more criteria defined in the locking script, i.e., whether the unlocking script unlocks the output including the locking script? The script engine 452 returns the result of the determination to the protocol engine 451. If the script engine 452 determines that the unlocking script does meet one or more criteria specified in the corresponding locking script, the result "TRUE" is returned. Otherwise, the result "FALSE" is returned.
[0080] In the output-based model, the result "TRUE" from the script engine 452 is one of the conditions for the validity of the transaction. Typically, one or more further protocol-level conditions evaluated by the protocol engine 451 must also be satisfied; for example, Tx j The total amount of digital assets specified in the inputs of tx does not exceed the total amount pointed to in its outputs, and tx i The pointed output of has not been spent by another valid transaction. The protocol engine 451 evaluates the result from the script engine 452 and one or more protocol-level conditions, and only if they are all TRUE, the protocol engine verifies the transaction Tx j The protocol engine 451 outputs an indication of whether the transaction is valid to the application-level decision engine 454. j Only when the conditions are really valid, the decision engine 454 can choose to control the consensus module 455C and the propagation module 455P at the same time to execute its Tx j . This includes the consensus module 455C, adding Tx to the corresponding ordered transaction set 154 of the node j , for incorporation into block 151; and propagation module 455P, Tx j Forwarded to another blockchain node 104 in the network 106. Optionally, in an embodiment, the application-level decision engine 454 may apply one or more additional conditions before triggering one or both of these functions. For example, the decision engine may choose to publish a transaction only if the transaction is valid and sufficient transaction fees are reserved.
[0081] In addition, it should be noted that in this article, the terms "TRUE" and "FALSE" are not necessarily limited to returning results that are expressed only in the form of a single binary number (bit), although this is indeed a possible implementation. More generally, "TRUE" can refer to any state indicating a successful or positive result, while "FALSE" can refer to any state indicating an unsuccessful or non-positive result. For example, in an account-based model, the combination of implicit protocol-level verification of signatures and additional positive outputs of smart contracts can be used to indicate that the result is "TRUE" (if both individual results are TRUE, the overall result is considered to be TRUE).
[0082] 5. Time-locked UTXO
[0083] The timelock puzzle can be used as described below to lock the UTXO of a transaction stored on-chain, which can only be spent (i.e., unlocked) after a certain amount of time.
[0084] Time-locked puzzles require the user to perform an exact number of sequential computations, so parallelizing the solving process will not speed up the solution. Therefore, if the user's hardware used to derive the solution is known, the solution time of the puzzle can be estimated in advance.
[0085] Timelock puzzles can be used to build time-locked UTXO chains, where solving one puzzle allows the user to solve the puzzle for the next UTXO. By chaining locked UTXOs, it ensures that a UTXO in the chain cannot be spent unless all puzzles for previous UTXOs in the chain are solved.
[0086] Here, the party that generates the puzzle is called the "challenger", and the party that solves the puzzle to unlock the transaction is called the "solution provider" or "puzzle solver".
[0087] 5.1 Time Lock Puzzle
[0088] Time-lock puzzles require the user to spend a specific amount of time to solve them. These time-lock puzzles are sequential in nature, so parallel computing does not help find a solution faster. Since different computers have different processing power, the solution time for time-lock puzzles can only be roughly controlled. It is advantageous if the time spent verifying the solution to the puzzle is much less than the time spent solving the puzzle.
[0089] Some useful properties of time lock puzzles include:
[0090] ● Non-parallelizability: It is not possible to obtain a solution faster than the predetermined time by distributing the puzzle to multiple machines or CPU cores.
[0091] ● Efficient verification: Verifying the solution of the puzzle should be much faster than solving the puzzle.
[0092] ● Fine-grained difficulty: The difficulty of the puzzle can be finely adjusted to different levels.
[0093] 5.1.1 Modulus Square Puzzle
[0094] An exemplary type of time-lock puzzle that is particularly useful in this implementation is the modular squaring puzzle.
[0095] The modular squaring puzzle is a time-lock puzzle that requires the user to repeatedly compute squaring operations in the multiplicative group of integers modulo n = pq, where p and q are large prime numbers. This puzzle forms the basis of many time-locked puzzles. p and q are large prime numbers because they cannot be found from n. Their length is typically 2048 bits, but it should be understood that other bit lengths can be used. A bit length of at least 2048 provides strong security for the puzzle.
[0096] The algorithm that defines the modular squaring puzzle is as follows:
[0097] ● SETUP(1 k ) → (params, secret): Given the security parameter k, generate the composite modulus n = pq using two randomly chosen large secret prime numbers p and q. Output params = (n) and secret = (p, q). The secret parameter k represents the bit length of the modulus n. For example, it can be equal to 2048.
[0098] ● GENPUZ(t, params) → puz: Select a random a, where 1 < a < n. Output puz = (a, t), where t > 0 and t is the time parameter.
[0099] ● F IND S OLN (puz, params) → sol: Compute and output sol.
[0100] ● V ER S OLN (sol, puz, params, secret) → {0, 1}: Use secret = (p, q) to compute In the case, output 1 (solution is valid), otherwise output 0 (solution is invalid).
[0101] Given the puzzle parameters a, t, and n, we can perform log2(2 t ) = t modular multiplication operations to compute the solution to the modular square puzzle. Since each step in the solution process depends on the previous step, the solution cannot be computed in parallel.
[0102] Know The verifier can efficiently verify the solution. Using the Euler function The provided trap door can verify the solution through O(log(n)) modular multiplication operations.
[0103] For users who do not know p and q, calculating the square operation is easier than calculating is much faster, while the latter can be shown to be just as difficult as factoring n. This guarantees that the successful solver has performed all the repeated squaring operations.
[0104] The number of square operations t required to solve the puzzle can be precisely controlled. This enables the challenger to create puzzles of various desired difficulty levels. The control is linear in t, and the solution time can be predetermined given knowledge of the user's modular square speed. Assuming the challenger wants to create a time-locked puzzle that cannot be solved before T seconds, t should be set such that t ≥ TS, where S is the number of modular square operations n that the user can perform per second. If the user's speed is unknown, a lower limit can be set based on the latest hardware capabilities, referred to in this article as the shortest solution time.
[0105] The modulus square puzzle is not publicly verifiable because efficient verification of the solution requires knowledge of secret information
[0106] Other examples of time lock puzzles include square root based puzzles. While such puzzles can be used to time lock transactions as described herein, modulus square puzzles are preferred because they provide a wider range of possible time lock durations and therefore provide more tunable solutions.
[0107] 5.2 Time-locked UTXO with Modulus Square Puzzle
[0108] A time lock puzzle such as the above modulus square puzzle can be used to lock a UTXO for a predetermined amount of time. The predetermined amount of time is the minimum solution time t.
[0109] In the example provided in this article, the challenger locks the transaction Tx for a predetermined amount of time. a Output.
[0110] 5.2.1 Standard Construction
[0111] The challenger performs the following steps:
[0112] 1. Call SETUP(1) for a given security parameter k k ) to generate (params, secret) and keep the value secret private.
[0113] 2. Choose the time parameter t of the modular square puzzle and generate puz by calling GENPUZ(t).
[0114] 3. Use the secret generated in step 1 to calculate
[0115] 4. Use puz, params and To precompute the solution to the puzzle
[0116]
[0117] 5. Calculate the hash of the solution h(sol).
[0118] The challenger then generates a transaction with a first locking script that includes the hash of the solution h(sol) and the puzzle parameters a, t, and n. The puzzle parameters are included in the OP_RETURN, enabling the puzzle solver to compute the solution.
[0119] The first locking script is associated with the first UTXO locked by the timelock puzzle, and can only be spent if the puzzle solver provides the solution to the puzzle in the first unlocking script of the solution transaction.
[0120] The challenger constructs the locking script as follows:
[0121] Locking script:
[0122] OP_HASH<h(sol)> OP_EQUALVERIFY OP_CHECKSIG OP_RETURN<puz=(a,t)><params=(n)>
[0123] Include the puzzle puz = (a, t) and the parameters params = (i) in the script using OP_RETURN. Including t allows the user to estimate the time they will need to solve the puzzle and thus understand whether it is worth the effort.
[0124] To spend a time-locked UTXO, the user must compute the solution to the puzzle by calling FINDSOLN(puz,params). In the case of FINDSOLN(puz,params) To calculate the solution.
[0125] The unlocking script can then be constructed as follows:
[0126] Unlock script:
[0127] <sig> <sol>
[0128] That is, the puzzle solver provides the signature sig generated using his private key, the corresponding public key P, and the solution sol to the puzzle in the unlocking script.
[0129] Here, we assume that the challenger is honest. In fact, a malicious challenger could potentially This makes the user spend a lot of resources without being rewarded. Even if the user correctly calculates the solution, this will make the user unable to spend the UTXO.
[0130] Using this method, anyone who computes the solution to the puzzle can redeem the funds. However, this construction is vulnerable to a "man-in-the-middle" (MITM) attack. An attacker can intercept a transaction containing the solution to the puzzle, replace the receiving address with their own address, and sign the transaction with their own private key. They can then ensure that this modified transaction is published before the intercepted transaction, thereby stealing the funds redeemed by the legitimate puzzle solver.
[0131] To prevent MITM attacks, transactions can also be verified by checking whether the public key given in the unlocking script hashes to the specific value h(P a ) to a specific address. However, this is a drawback of transactions only being able to spend to a specific address.
[0132] Figure 4 It shows how to time-lock UTXO using the above construction.
[0133] The challenger provides a puzzle blockchain transaction Tx1 502A, which has a first locking script 520A, which includes puzzle parameters 510 and a portion derived from the solution 508, which is here the hash of the solution h(sol). The solution provided by the challenger is called the target solution, denoted as sol T The target solution is computed by the challenger using large prime numbers p and q.
[0134] The puzzle parameters 510 may be provided in an OP_RETURN output to provide the puzzle parameters 510 to other users when the puzzle transaction Tx1 502A is submitted to the blockchain. The OP_RETURN output is unspendable. The puzzle parameters 510 may also be provided in a spendable output, for example using OP_PUSH and OP_DROP.
[0135] The solution provider uses the puzzle parameters 510 provided in the puzzle transaction Tx1 502A to calculate the solution in step A. The solution calculated by the solution provider is called a candidate solution, denoted as sol C Solution provider use Compute candidate solutions within at least the minimum solution time T.
[0136] The solution provider generates a solution transaction Tx2 504A and provides a candidate solution 506 in a first unlocking script 522A.
[0137] When the first locking script 520A and the first unlocking script 522A are run together, the first locking script is configured to calculate the hash of the candidate solution 506 (step B) and verify whether the hash of the candidate solution is equal to the hash of the target solution (step C), thereby verifying that the solution provider has correctly calculated the solution within at least the shortest calculation time T.
[0138] If these hashes match, the solution provider is able to spend the UTXO associated with the first locking script 520A.
[0139] 5.2.2 P2PKH with time-locked private keys
[0140] The following construction allows a puzzle solver to spend a UTXO locked using the modulus square puzzle while ensuring that the spend transaction cannot be modified before it is published on the blockchain.
[0141] A P2PKH script can be provided to prevent MITM attacks. This method can be used to allow anyone to spend UTXO locked using the modulus square puzzle, or to send funds to a specific recipient by time.
[0142] Therefore, the construction provided below ensures that the UTXO cannot be spent until at least the minimum solution time has elapsed.
[0143] 5.2.2.1 Anyone can spend
[0144] The private key that can spend the UTXO is bound to the solution to the modulus square puzzle, so that only the user who computes the solution to the puzzle can spend the UTXO, while still allowing any user who computes the solution first to spend the UTXO. By signing the spending transaction with the key bound to the solution to the puzzle, the spending transaction cannot be modified by users who have not yet computed the solution, and the spending transaction remains valid.
[0145] In this construction, the locking script is a P2PKH transaction spending to sk G, where G is the elliptic curve generator point, sk is a randomly generated ECDSA private key, and sk G is the corresponding public key. The modulus square puzzle can be used to encrypt the private key sk so that it can only be decrypted after a predetermined amount of time, as follows:
[0146] C sk =sk+sol mod n
[0147] in
[0148] In some embodiments, can be used as a private key. However, this does not guarantee that the result is uniformly distributed within the range of ECDSA private keys, unlike the private key sk.
[0149] Encrypted key C sk Included in the OP_RETURN data along with the puzzle puz=(a,t) and parameters params=(n), allowing the private key sk to be derived.
[0150] To spend UTXO, the user needs to compute the solution to the puzzle To derive the private key sk = C sk -solmodn and unlock the P2PKH script.
[0151] The challenger generates a blockchain transaction using the first locking script corresponding to the first UTXO, which includes the hash of the public key h(sk G), the puzzle parameters a, t and n, and the encrypted key C sk The puzzle parameters and the encrypted key are included in the OP_RETURN, allowing the puzzle solver to compute the solution.
[0152] The locking script could look like this:
[0153] Locking script:
[0154]
[0155] The puzzle solver derives a private key sk and uses it to generate a public key sk·G, which is provided in the first unlocking script of the solution transaction.
[0156] sk·G is considered to be derived from the solution because the puzzle solver uses sk=C sk -sol mod n to find sk. The puzzle solver also provides a signature sig generated using the derived private key sk. This ensures that users who have not yet calculated the private key sk cannot modify the transaction.
[0157] The unlock script could look like this:
[0158] Unlock script:
[0159] <sig><sk·G>
[0160] The locking script is configured to generate a hash of the provided public key sk·G and verify that this hash is equal to the hash h(sk·G) provided in the unlocking script.
[0161] The locking script is also configured to check that the signature provided in the unlocking script is correct and was calculated using the private key sk.
[0162] Therefore, this construction allows anyone to spend a time-locked UTXO. In addition, the signature guarantees that a malicious actor who has not yet calculated the solution to the puzzle cannot modify a spending transaction that has not yet been published on the blockchain.
[0163] Using this approach, the solver of the puzzle cannot be identified from the unlocking script, since the public key used to unlock the UTXO is the same for all users. In some embodiments, the public key addition in the script is used to define that in addition to providing the solution to the puzzle, the user needs to include their public key in the unlocking script.
[0164] Figure 5 Shown how to time-lock a UTXO using the above P2PKH construction that anyone can spend.
[0165] The challenger provides a puzzle transaction Tx1 502B, which has a first locking script 520B, which includes puzzle parameters 510, encrypted key C sk 512 and the part derived from the solution 508, which is here the hash h(sk·G) of the public key derived from the solution. The private key provided by the challenger is called the target private key, denoted as sk T The target private key is calculated by the challenger using large prime numbers p and q.
[0166] The puzzle parameters 510 and the encrypted key 512 are provided in an OP_RETURN output to provide the puzzle parameters 510 to other users when the puzzle transaction Tx1 502B is submitted to the blockchain.
[0167] The solution provider uses the puzzle parameters 510 provided in transaction Tx1 502B to compute the solution in step A. The solution computed by the solution provider is called a candidate solution, denoted as sol C Solution provider use Compute candidate solutions within at least the minimum solution time T.
[0168] The solution provider then uses the candidate solution sol C and the encrypted key C sk 512 to calculate the candidate private key sk C (Step B). The candidate private key is sk C =C sk -sol C Then, the solution provider uses the candidate private key to generate the candidate public key skC·G514 (step C).
[0169] The solution provider generates a solution transaction Tx2 504C and provides the candidate public key sk in the first unlocking script 522B C ·G514.
[0170] When the first locking script 520B and the first unlocking script 522B are run together, the first locking script 520B is configured to calculate the hash of the candidate public key 514 (step D) and verify whether the hash of the candidate public key is equal to the hash of the target public key (step E), thereby verifying that the solution provider has correctly calculated the solution within at least the shortest calculation time T.
[0171] The locking script 520B is also configured to check the signature 518 provided in the unlocking script 522B against the public key sk C G is correct (step F). That is, the locking script checks sk C Has it been used to generate signature sig 518?
[0172] If these hashes match, that is, if sk C Equal to sk T And the signature 518 is signed using the private key sk C Calculated, the solution provider is able to spend the UTXO associated with the first locking script 520B.
[0173] 5.2.2.2 A single user can spend
[0174] The previous construction can be adjusted to use the public key P according to the time A Send funds to a specific recipient. To do this, the challenger sets the transaction to spend to (sk A +sol)·G, where and sk A It is the private key of the user who is allowed to spend UTXO.
[0175] Challengers can be without knowing sk A In the case of using the distribution property of elliptic curve scalar multiplication to calculate (sk A +sol)·G:
[0176] (sk A +sol)·G=sk A ·G+sol·g=P A +sol·G
[0177] Therefore, as long as the challenger knows the user's public key P A , they can lock the UTXO to the private key sk A The corresponding user.
[0178] The challenger generates a blockchain transaction using a first locking script corresponding to the first UTXO, where the first locking script includes the hash of the public key h((sk A + sol)·G) and the puzzle parameters a, t, and n. The puzzle parameters are included in the OP_RETURN, allowing the puzzle solver to calculate the solution. It should be noted that since the puzzle solver knows their private key sk A , so no encrypted keys are provided in this build.
[0179] The locking script could look like this:
[0180] Locking script:
[0181] OP_DUP OP_HASH <h((sk A +sol)·G)>OP_EQUALVERIFY OP_CHECKSIG OP_RETURN<puz=(a,t)><params=(n)>
[0182] The puzzle solver derives the solution sol and uses it to generate the public key (sk A + sol)·G, which is provided in the first unlocking script of the decryption transaction. A + sol)·G is considered to be derived from the solution, because the puzzle solver must solve the problem to generate the public key. The puzzle solver also provides the private key (sk A +sol) to prove that the puzzle solver is sk A and has derived the solution sol.
[0183] The unlock script could look like this:
[0184] Unlock script:
[0185] <sig><(sk A +sol)·G>
[0186] The locking script is configured to generate the provided public key (sk A +sol)·G and verify that the hash is equal to the hash h((sk A +sol)·G).
[0187] The locking script is also configured to check that the signature provided in the unlocking script is correct and was signed using the private key (sk A +sol) calculated.
[0188] Only knowing the secret key sk A Only users can spend UTXO by calculating the solution to the puzzle sol and using the private key sk A +sol spends the UTXO.
[0189] Figure 6 It is shown how a UTXO can be time-locked using the above P2PKH construction that a single user can spend.
[0190] The challenger provides a puzzle blockchain transaction Tx1 502C having a first locking script 520C comprising puzzle parameters 510 and a portion derived from the solution 508, which here is a hash of the public key derived from the solution h((sk A +solT)·G). The solution used to derive the private key provided by the challenger is called the target solution, denoted as sol T The target solution is computed by the challenger using large prime numbers p and q.
[0191] The puzzle parameters 510 are provided in an OP_RETURN to provide the puzzle parameters 510 to other users when the puzzle transaction Tx1 502C is submitted to the blockchain.
[0192] The solution provider uses the puzzle parameters 510 provided in the puzzle transaction Tx1 502C to calculate the solution in step A. The solution calculated by the solution provider is called a candidate solution, denoted as sol C Solution provider use Compute candidate solutions within at least the minimum solution time T.
[0193] The solution provider then uses the candidate solution sol C and their own private key sk A To calculate the candidate public key (step B). The candidate public key is calculated using (sk A +sol C )·G derived.
[0194] The solution provider generates a solution transaction Tx2 504C and provides a candidate public key (sk A +sol C )·G516.
[0195] When the first locking script 520C and the first unlocking script 522C are run together, the first locking script 520C is configured to calculate the hash of the candidate public key 516 (step C) and verify whether the hash of the candidate public key is equal to the hash of the target public key (step D), thereby verifying that the solution provider has correctly calculated the solution within at least the shortest calculation time T.
[0196] The locking script 520C is also configured to check the signature 518 provided in the unlocking script 522C against the public key (sk A +sol c )·G is correct (step E). That is, the locking script checks sk A +sol c Has it been used to generate the signature sig518?
[0197] If these hashes match, that is, if col C Equal to sol T And the signature 518 is signed using the private key sk A +sol c Calculated, the solution provider is able to spend the UTXO associated with the first locking script 520C.
[0198] 5.3 Time-locked puzzle chains
[0199] Time-locked puzzles such as the modulus square puzzle can be used to create puzzle chains, and thus transaction chains or locked UTXOs. A time-locked transaction chain consists of transactions that can only be made within an increasing time [t1,…,t N ] are N transactions [Tx1,…,Tx N ]composition.
[0200] 5.3.1 Anyone can spend
[0201] A chain of transactions is provided using linked sequential modular square puzzles. The puzzles are linked by setting the solution of one puzzle as the parameter that needs to be squared repeatedly in the next puzzle. Therefore, only the first transaction in the chain needs to specify the value a. By i To solve the puzzle, users can use the next transaction Tx i+1 Solve this puzzle in .
[0202] To create a puzzle chain, the challenger does the following:
[0203] 1. Call S for a given security parameter k ETUP (1 k ) to generate (params, secret) and keep the value secret private.
[0204] 2. Select N time parameters t1,…,t N , to determine the solution time for each puzzle (optionally, choose t to be the same for all puzzles).
[0205] 3. Call GENPUZ(t1) to generate the first puzzle puz=(a,t1).
[0206] 4. Use the secret generated in step 1 to calculate
[0207] 5. Using puz, params and To precompute the solution
[0208] 6. Use sol i-1 、params、t i and To precompute all (for 2≤i≤n).
[0209] 7. Randomly generate N private keys sk1…sk N And each secret key sk i Encrypted as
[0210] 8. Create a P2PKH locking script, which is used to use the private key sk1…sk N to lock each of the N transactions.
[0211] Before all N transactions are published to the blockchain, the challenger will i The OP_RETURN data includes the time parameter t of the puzzle i (additionally, the value a in the first transaction Tx1), the parameter params=(n) and the encrypted key
[0212] It also includes the address h(sk i+1 G) so that the user knows the next transaction in the chain. Therefore, a complete chain of transaction IDs can be derived from the first transaction in the chain.
[0213] Using the time parameter t included in each transaction i , users can estimate the time required to solve each puzzle as well as complete puzzle chains.
[0214] The locking script and unlocking script of the first transaction Tx1 are as follows:
[0215] Locking script:
[0216]
[0217] Unlock script:
[0218] <sig><sk1·G>
[0219] The i-th transaction Tx i The locking script and unlocking script are as follows:
[0220] Locking script:
[0221]
[0222] Unlock script:
[0223] <sig><sk i ·G>
[0224] It should be noted that, in the case where i > 1, the locking script for each transaction does not include the puzzle parameter a. Instead, the provided set of puzzle parameters only includes t1 and n1, because when calculating the solution sol i of the previous puzzle, it is the solution sol i-1 of the previous puzzle rather than the puzzle parameter a that is squared.
[0225] Therefore, in order to derive the private keys sk1…sk N required for the UTXOs in the spending chain, the user must calculate the following values in sequence:
[0226]
[0227] ……
[0228]
[0229] ……
[0230]
[0231] From the recursive structure of the puzzle chain, calculating sol i requires calculating all sol j (for j < i). Therefore, only a user who has already calculated the solutions of all the puzzles in the chain can spend the last transaction Tx N .
[0232] The puzzle chain structure allows a single difficult puzzle with a time parameter t hard_puzzle to be decomposed into N sub-puzzles with time parameters t1,…,t N , where t hard_puzzle = ∑ i t i . Solving all the sub-puzzles can only be done in sequence, so the time required is equivalent to solving the difficult puzzle. Instead of getting a single reward for solving one difficult puzzle, users get small rewards when solving the sub-puzzles to incentivize them to perform smaller calculations.
[0233] Figure 7 Illustrates how to use a P2PKH that anyone can spend to time-lock a UTXO as shown in combination Figure 5 to time-lock the transaction chain. It should be understood that it is the UTXO of the transaction that is time-locked, rather than the transaction itself.
[0234] The challenger provides a first transaction Tx1 with a locking script that provides a first set of parameters a, t1, and n1, which correspond to the solution sol1 of the first timelock puzzle and the first encryption key C in OP_RETURN. sk1 The locking script also includes a hash derived from the solution of the first timelock puzzle (here h(sk1·G)) and a hash derived from the solution of the second timelock puzzle (here h(sk2·G)).
[0235] The challenger also generates subsequent transactions for each Tx i (where 2 ≤ i ≤ N), where N is the total number of transactions in the chain. Each of these transactions includes a locking script that provides a second set of puzzle parameters t i and n i , which correspond to the solution sol i of the i-th timelock puzzle and the i-th encryption key C in OP_RETURN ski . The locking script also includes a hash derived from the solution of the i-th timelock puzzle (here h(sk i ·G)). For each Tx i (where 2 ≤ i < N), OP_RETURN also includes a hash derived from the solution of the (i + 1)-th timelock puzzle (here h(ski +1 ·G)).
[0236] The transaction Tx i is submitted to the blockchain. It should be noted that in this embodiment, any puzzle solver can unlock the UTXO as long as the correct solution is calculated.
[0237] The puzzle solver uses the first set of parameters provided in the first transaction Tx1 to calculate the first solution sol1. Then, the puzzle solver uses the first solution sol1 and the first encryption key C sk1 provided in the first transaction Tx1 to derive the first private key sk1.
[0238] The puzzle solver generates a hash h(sk1·G) of the public key derived from the first private key. The puzzle solver generates a first spending transaction Tx S1 , which includes an unlocking script that includes the public key sk1·G.
[0239] Check the public key provided in the unlocking script of Tx S1 against the hash provided in the locking script of Tx1 to verify whether the puzzle solver has correctly calculated the solution, and check the signature provided in the unlocking script of Tx S1 to verify whether the signature is generated from the private key sk1.
[0240] Once the puzzle solver has computed the first solution sol1, they can use sol1 and a set of second puzzle parameters provided in the second transaction Tx2 to compute the solution sol2 to the second time-lock puzzle. sk2 Together they are used to derive the second private key sk2.
[0241] The puzzle solver uses the second private key sk2 to generate the second spending transaction Tx S2 The unlock script.
[0242] For each transaction Tx i Repeat these steps until the puzzle solver calculates the solution N And according to this sk N In the Nth spending transaction Tx SN The unlock script is provided in .
[0243] Each transaction Tx i Defines the amount of digital assets to be transferred to the puzzle solver for providing the solution corresponding to this transaction.
[0244] It should be understood that although Figure 7 Each transaction Tx i The hash h(sk) derived from the solution of the next time lock puzzle is provided in the locking script of i+1 G), but the hash can be sent off-chain. The purpose of providing this hash to the puzzle solver, whether in the transaction locking script or off-chain, is to enable the puzzle solver to identify the next transaction in the chain.
[0245] It should be understood that the amount locked by the locking script in each transaction may also include an amount sufficient to cover the transaction fee of the transaction. Alternatively, the puzzle solver may need to pay the transaction fee when providing the transaction.
[0246] 5.3.2 A single user can spend
[0247] In the puzzle chain construction described previously, anyone can spend UTXO in the chain. This can be modified using the ideas described in Section 5.2.2.2 so that anyone with public key P A =sk A A single user of G can spend the UTXO in the chain.
[0248] To do this, the challenger sends transaction Tx i Set to spend to (sk A +sol i )·G, where and sk A is the private key of the user who is allowed to spend UTXO. The first transaction Tx1 spends (sk A +sol1)·G, where
[0249] The locking script and unlocking script of the first transaction Tx1 are as follows:
[0250] Locking script:
[0251] OP_DUP OP_HASH <h((sk A +sol1)·G)>OP_EQUALVERIFY OP_CHECKSIG OP_RETURN <puz=(a,t1)><params=(n)><h((sk A +sol2)·G)>
[0252] Unlock script:
[0253] <sig><(sk A +sol1)·G>
[0254] The i-th transaction Tx i The locking script and unlocking script are as follows:
[0255] Locking script:
[0256] OP_DUP OP_HASH <h((sk A +sol i )·G)>OP_EQUALVERIFY OP_CHECKSIG OP_RETURN <t i > <params=(n)><h((sk A +sol i+1 )·G)>
[0257] Unlock script:
[0258] <sig><(sk A +sol i )·G>
[0259] Only users who know the secret key sk A can spend the UTXO in the chain by calculating the solution sol i of the puzzle and using the private key sk A +sol i to sign the spending transaction.
[0260] Figure 8 Figure shows how to use P2PKH that can be spent by a single user to construct a time lock for UTXO, as shown in reference Figure 6 and can be used in the transaction chain. It should be understood that the time lock is applied to the UTXO of the transaction, rather than the transaction itself.
[0261] The challenger provides a first transaction Tx1 with a locking script that provides a first set of parameters a, t1, and n1, which correspond to the solution sol1 of the first time lock puzzle in the OP_RETURN output. The locking script also includes a hash derived from the solution of the first time lock puzzle (here h((sk A +sol1)·G), where sk A is the private key of the predefined puzzle solver) and a hash derived from the solution of the second time lock puzzle (here h((sk A +sol2)·G)).
[0262] The challenger also generates subsequent transactions for each Tx i (where 2 ≤ i ≤ N). Each of these transactions includes a locking script that provides a second set of parameters t i and n i , which correspond to the solution sol i of the ith time lock puzzle in the OP_RETURN output. The locking script also includes a hash derived from the solution of the ith time lock puzzle (here h((sk A +sol i )·G)). For each Tx i (where 2 ≤ i < N), the OP_RETURN also includes a hash derived from the solution of the (i + 1)th time lock puzzle (here h((sk A +sol i+1 )·G)).
[0263] The transaction Tx i is submitted to the blockchain.
[0264] The puzzle solver (who is sk A The owner of ) uses the first set of parameters provided in the first transaction Tx1 to calculate the first solution sol1.
[0265] The puzzle solver generates a A and the public key derived from the first solution sol1 (sk A +sol1)·G. The puzzle solver generates a first spending transaction Txs1, which includes an unlocking script, which includes (sk A +sol1)·G.
[0266] The public key provided in the unlocking script of Txs1 is checked against the hash provided in the locking script of Tx1 to verify that the puzzle solver has correctly computed the solution, and the signature provided in the unlocking script is checked to verify that the signature was made using the private key (sk A +sol).
[0267] Once the puzzle solver has computed the first solution sol1, they are able to compute the solution to the second timelock puzzle sol2 using sol1 and the second set of puzzle parameters provided in the locking script of the second transaction Tx2.
[0268] The puzzle solver uses the second solution sol2 to generate the second spending transaction Tx S2 The unlock script.
[0269] For each transaction Tx i Repeat these steps until the puzzle solver computes solN to spend transaction Tx at the Nth time. SN The unlock script is provided in .
[0270] As described above, the hash h(sk) derived from the solution to the next time-lock puzzle i+1 G) can be sent off-chain to an off-chain puzzle solver instead of being provided in the transaction’s locking script.
[0271] As reference Figure 7 As mentioned above, each transaction Tx i Defines the amount of digital assets to be transferred to the puzzle solver to solve the transaction Tx i It should be noted that the puzzle solver is sk A The owner of.
[0272] For example, a chain of time-locked puzzles that a single user can spend can be used to implement fixed-income securities such as fixed-rate bonds. A fixed-rate bond is a bond that pays the same level of interest throughout its term. The issuer of the bond can create a chain of transactions to repay the holder. Time-locking transactions in the chain allows the holder to receive coupons in a regular sequence. When the bond matures, the holder will receive the initial principal back from the last UTXO in the chain. This scheme requires constant computation of the solution to the puzzle, which sometimes takes a long time because the term of the bond can be decades. The computation can be outsourced to an external server that will perform the computation on behalf of the holder. Even if the external server knows the solution to the puzzle, this construction guarantees that the external server cannot spend time-locked transactions because it would require knowing the holder's secret key.
[0273] 5.3.3 Linked UTXO
[0274] The method provided above for chaining transactions can be modified to chain the outputs of a single transaction so that each output of that transaction can only be spent after the solution to the previous output in the chain has been calculated.
[0275] Fig. 9 An exemplary transaction including a linked UTXO is shown. In this example, the UTXO can be spent by any solution provider who effectively computes a solution to the time puzzle. However, it should be understood that the UTXO can be locked in accordance with the method described in Section 5.3.2 so that only a single user can spend it.
[0276] The challenger provides a chained puzzle transaction Tx that includes a set of outputs C Each output uses a locking script to lock an amount of digital assets x i The locking script defines a set of puzzle parameters and an encryption key. The set of puzzle parameters and encryption key can be included in the OP_RETURN output. The unlocking script includes the public key sk derived from the solution i ·G.
[0277] For i=1, the set of puzzle parameters includes a, n1 and t1; for i>1, the set of puzzle parameters includes n i and t i , because the solution sol previously output in the chain i-1 To calculate the solution sol i .
[0278] The puzzle solver uses the information provided in the OP_RETURN output to derive the solution i and private key sk i , used to generate a set of solution transactions Tx Si The private key of each unlocking script of the transaction in . Each spending transaction corresponds to the chain transaction Tx C One of the time-locked outputs in the time-locked outputs.
[0279] For each output i > 1, the puzzle solver uses the solution sol corresponding to the previous output in the chain i-1 and the puzzle parameters provided in the OP_RETURN output to calculate the solution sol i , thereby calculating the unlocking script for the i-th solution transaction.
[0280] Therefore, the puzzle solver must calculate the solution transactions in order such that each UTXO of the chained transaction can only be spent after a different and sequentially greater minimum solving time. When the puzzle solver provides the solution transaction Tx corresponding to the α-th output of the chain α , for i > α, all outputs remain locked; while for i ≤ α, those outputs can be or have been spent.
[0281] Compared with the methods provided in Sections 5.3.1 and 5.3.2 (i.e., the method of providing each linked UTXO in a different transaction), providing the linked outputs in a single chained transaction can reduce the storage requirements generated by the puzzle chain.
[0282] 5.3.4 Template Puzzle Transactions
[0283] As referenced above Figure 7 and Figure 8 the chained transactions described can be provided in the link set of the chained transaction. Fig.11 An example of such a link set using a method that can be spent by anyone is shown. It should be understood that this method can be modified to allow the use of a method that can be spent by a single user.
[0284] The challenger provides the first transaction Tx1 with a locking script that provides the first set of parameters a, t1, and n1, which correspond to the solution sol1 of the first time-lock puzzle and the first encryption key C in the OP_RETURN sk1 . The locking script also includes a hash derived from the solution of the first time-lock puzzle (here h(sk1·G)).
[0285] The challenger also generates template transactions for each Tx i (where 2 ≤ i < N), where N is the total number of transactions in the chain. Each of these transactions includes a locking script that provides a second set of puzzle parameters t i and n i that correspond to the solution sol of the i-th time-lock puzzle i and the i-th encryption key C in the OP_RETURN ski The locking script also includes the hash derived from the solution of the ith timelock puzzle (here h(sk i ·G)).
[0286] The first transaction Tx1 is submitted to the blockchain, and the template transaction is provided to one or more puzzle solvers. It should be noted that in this embodiment, any puzzle solver can unlock the UTXO as long as the correct solution is calculated.
[0287] The puzzle solver uses the first set of parameters provided in the first transaction Tx1 to calculate the first solution sol1. Then, the puzzle solver uses the first solution sol1 and the first encryption key C provided in the first transaction Tx1. sk1 To derive the first private key sk1.
[0288] The puzzle solver uses the first private key to generate a public key sk1·G. The puzzle solver uses the template second transaction to generate a second transaction Tx2, which includes the locking script provided by the challenger in the template transaction and the unlocking script including the public key sk1·G.
[0289] The public key provided in Tx2’s unlocking script is checked against the hash provided in Tx1’s locking script to verify that the puzzle solver has computed the solution correctly, and the signature provided in the unlocking script is checked to verify that it was generated using private key sk1.
[0290] Once the puzzle solver has calculated the first solution sol1, they can use sol1 and a set of second puzzle parameters provided in the locking script of the second transaction Tx2 to calculate the solution sol2 of the second time lock puzzle. The second solution sol2 is used together with the second encryption key Csk2 to derive the second private key sk2.
[0291] The puzzle solver uses the second private key sk2 to generate an unlocking script for the third transaction Tx3, which includes the locking script defined by the challenger in the template of the third transaction.
[0292] For each transaction Tx i These steps are repeated until the puzzle solver computes solN -1 And according to this sk N-1 In the Nth transaction Tx N The unlock script is provided in .
[0293] In order for the puzzle solver to know the order of transactions, the hash derived from the next solution in the chain can be provided in the locking script of the template transaction, as described above in conjunction with Figure 7 and Figure 8 Alternatively, the order may be communicated by associating each template transaction with an index corresponding to its order in the chain.
[0294] The first transaction Tx1 defines the total amount of digital assets to be transferred to the puzzle solver across the entire puzzle chain. For each template transaction (where 1 < i < N), the locking script provided by the challenger is associated with the amount of digital assets to be locked in the transaction and thus with the amount to be transferred to the puzzle solver.
[0295] For example, Tx1 defines the total amount of digital assets x1. The template for Tx2 defines the amount x2 = x1 - y1 locked by the locking script of Tx2, where y1 is the amount of digital assets allocated to the puzzle solver for calculating sol1. Similarly, the template for Tx3 defines the amount x3 = x1 - y1 - y2, and so on.
[0296] When generating each transaction from a template transaction that pays the puzzle solver an amount y i the puzzle solver also provides an additional output.
[0297] The amount of digital assets locked in the second-to-last transaction Tx N-1 is equal to the final amount to be transferred to the puzzle solver.
[0298] It should be understood that the amount locked by the locking script in each transaction may also include an amount sufficient to cover the transaction fees. Alternatively, the puzzle solver may be required to pay the transaction fees when providing the transaction.
[0299] However, there is no guarantee that the user will not modify the template and break the transaction chain. This can be overcome by using the pseudocode PUSHTX, which can be used to enforce that the transaction Tx i can only be spent by the next transaction Tx i+1 in the chain, while enabling the challenger to publish the complete chain on the blockchain.
[0300] 5.4 General Methods
[0301] Fig.10 An exemplary method for implementing the time-lock UTXO as described above is shown.
[0302] In step 1, the challenger 602 establishes a puzzle by randomly selecting p and q and calculating n based on these values. The challenger 602 also randomly selects the parameter a and determines a suitable time parameter t. Using p, q, a, and t, the challenger 602 uses to calculate the solution to the time-lock puzzle.
[0303] In step 2, the challenger 602 generates a hash derived from the solution to the time lock puzzle. Various variations of this hash have been introduced above, and the value to be hashed depends at least in part on who is eligible to spend the UTXO, i.e., whether anyone can pay or only one party can pay. In some embodiments, the challenger 602 defines a private key sk in step 2 and encrypts the private key using the solution to generate an encryption key C sk .
[0304] In step 3, the challenger 602 generates a puzzle transaction Tx1 502, where the challenger 602 provides puzzle parameters n, a, and t and a hash derived from the solution of the time-lock puzzle in the locking script.
[0305] In step 4 , the challenger 602 provides the transaction Tx1 to one or more nodes of the blockchain 606 for submission to the blockchain 606 .
[0306] In step 5, the puzzle solver 604 retrieves the puzzle parameters n, a, and t from the blockchain 606, as well as any other information provided in the OP_RETURN output, such as the encryption key C sk (if provided).
[0307] In step 6, using the puzzle parameters n, a and t, the puzzle solver 604 uses The puzzle solver uses this solution to generate a hash preimage derived from the puzzle solution, such as sk·G or (sk i +sol)·G.
[0308] In step 7, the puzzle solver 604 uses the hash preimage derived from the solution to generate an unlocking script for transaction Tx2 504.
[0309] In step 8, the solution transaction Tx2 504 is sent to one or more nodes of the blockchain 606 to be submitted to the blockchain 606.
[0310] In some embodiments, multiple puzzle solvers 604 may attempt to solve the puzzle and subsequently provide solution transactions 504. Only the first solution transaction provided (including the hash preimage corresponding to the solution) is submitted to the blockchain.
[0311] 6. Further comments
[0312] Other variations or uses of the disclosed technology may become apparent to those skilled in the art once given the disclosure herein.The scope of the present disclosure is not limited by the described embodiments but only by the appended claims.
[0313] For example, some of the embodiments above have been described in terms of the Bitcoin network 106, the Bitcoin blockchain 150, and the Bitcoin node 104. However, it should be understood that the Bitcoin blockchain is a specific example of a blockchain 150, and the above description can generally be applied to any blockchain. That is, the present invention is in no way limited to the Bitcoin blockchain. More generally, any references to the Bitcoin network 106, the Bitcoin blockchain 150, and the Bitcoin node 104 above can be replaced with reference to the blockchain network 106, the blockchain 150, and the blockchain node 104, respectively. Blockchains, blockchain networks, and / or blockchain nodes can share some or all of the characteristics of the Bitcoin blockchain 150, the Bitcoin network 106, and the Bitcoin node 104 described above.
[0314] In a preferred embodiment of the present invention, the blockchain network 106 is a Bitcoin network, and the Bitcoin node 104 performs at least all of the functions described in creating, publishing, propagating and storing blocks 151 of the blockchain 150. It is not excluded that there may be other network entities (or network elements) that perform only one or some of these functions but not all of them. That is, a network entity may perform the functions of propagating and / or storing blocks without creating and publishing blocks (remember that these entities are not considered to be nodes of the preferred Bitcoin network 106).
[0315] In other embodiments of the present invention, the blockchain network 106 may not be a Bitcoin network. In these embodiments, it is not excluded that the node can perform at least one or part of the functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150, but not all of the functions. For example, on these other blockchain networks, "node" may be used to refer to a network entity that is configured to create and publish blocks 151 but does not store and / or propagate these blocks 151 to other nodes.
[0316] Even more generally, any reference above to the term "Bitcoin node" 104 may be replaced with the term "network entity" or "network element," where such entity / element is configured to perform some or all of the roles in creating, publishing, propagating, and storing blocks. The functionality of such a network entity / element may be implemented in hardware in the same manner as described above with reference to blockchain node 104.
[0317] It should be understood that the above embodiments are described by way of example only. In more general terms, a method, apparatus or program may be provided according to any one or more of the following statements.
[0318] Statement 1. A computer-implemented method for generating a puzzle blockchain transaction, the method comprising:
[0319] providing a first locking script of the puzzle blockchain transaction, the first locking script corresponding to the first unspent transaction output and comprising a hash value derived from a target solution to a timelock puzzle, and a set of puzzle parameters for the timelock puzzle, wherein the target solution is computed using a set of secret puzzle parameters, and wherein the timelock puzzle is solvable using the set of puzzle parameters in a time equal to or greater than a minimum solution time, wherein the set of puzzle parameters does not include the secret puzzle parameters, wherein the locking script is configured to:
[0320] When executed using a first unlocking script of a solution blockchain transaction, verifying based on the hash value a candidate solution computed using the set of puzzle parameters provided in the first unlocking script of the solution blockchain transaction; and
[0321] The puzzle blockchain transaction is provided to one or more nodes of a blockchain network.
[0322] Statement 2. The method of statement 1, wherein the hash value is a hash of a public key derived using the target solution of the time-lock puzzle.
[0323] Statement 3. The method of statement 2, wherein the public key is derived from a private key, wherein the private key is derived from a private key of a predefined recipient and the target.
[0324] Statement 4. The method of statement 3, wherein the private key is the sum of the private key of the predefined recipient and the target solution.
[0325] Statement 5. The method of statement 2, wherein the public key is derived from a private key, wherein the private key is a randomly generated private key, and wherein the method further comprises: randomly generating the private key.
[0326] Statement 6. The method of statement 5, wherein the method further comprises: encrypting the private key based on the target solution.
[0327] Statement 7. The method of statement 6, wherein the first locking script also includes the encrypted private key for ensuring availability when the puzzle blockchain transaction is submitted to the blockchain.
[0328] Statement 8. A method according to statement 1 or any dependent statement thereof, wherein the first locking script also includes a second hash value, wherein the second hash value is derived from a second target solution to a second time lock puzzle and a set of second puzzle parameters of the second time lock puzzle and corresponds to a second unspent transaction output, wherein the second unspent transaction output corresponds to a second locking script including the second hash value.
[0329] Statement 9. The method of statement 8, wherein the second unspent transaction output and the second locking script are provided in a second puzzle blockchain transaction.
[0330] Statement 10. The method of statement 8, wherein the second unspent transaction output and the second locking script are provided in the puzzle blockchain transaction.
[0331] Statement 11. The method of statement 8 or any dependent statement thereof as dependent on statement 2, wherein the second hash value is a hash of a second public key derived using the target solution of the second time-lock puzzle.
[0332] Statement 12. A computer-implemented method for generating a solution blockchain transaction for unlocking a time-locked unspent transaction output of a puzzle blockchain transaction, the puzzle blockchain transaction comprising a first locking script of the puzzle blockchain transaction, the first locking script corresponding to a first unspent transaction output and comprising a hash value derived from a target solution to a timelock puzzle and a set of puzzle parameters for the timelock puzzle, wherein the target solution is computed using a set of secret puzzle parameters, and wherein the timelock puzzle is solvable using the set of puzzle parameters in a time equal to or greater than a minimum solution time, wherein the set of puzzle parameters does not include the secret puzzle parameters, the method comprising:
[0333] generating a candidate solution to the time lock puzzle based on the set of puzzle parameters;
[0334] providing a portion derived from the candidate solution in a first unlocking script of the solution blockchain transaction; and,
[0335] The deblockchain transaction is provided to one or more nodes of a blockchain network.
[0336] Statement 13. The method of statement 12, wherein the portion derived from the candidate solution is a public key derived using the candidate solution.
[0337] Statement 14. The method of statement 13, wherein the method further comprises:
[0338] generating a private key, wherein the private key is generated using the candidate solution and a private key of a user who generates the candidate solution;
[0339] Using the generated private key to derive the public key;
[0340] generating a signature using the private key; and,
[0341] The signature is provided in the unlocking script.
[0342] Statement 15. The method according to statement 13, wherein the first locking script of the puzzle blockchain transaction further comprises an encrypted private key, wherein the encrypted private key is a randomly generated private key, the randomly generated private key is encrypted based on the target solution, and wherein the method further comprises:
[0343] Determining the private key based on the candidate solution and the encrypted private key;
[0344] Deriving the public key using the determined private key;
[0345] Generating a signature using the private key; and,
[0346] Providing the signature in the unlocking script.
[0347] Statement 16. The method according to any one of statements 12 to 15, wherein the first locking script of the puzzle blockchain transaction further comprises a second hash value, wherein the second hash value is derived from a second target solution of a second time lock puzzle and a set of second puzzle parameters of the second time lock puzzle and corresponds to a second unspent transaction output, wherein the second unspent transaction output corresponds to a second locking script comprising the second hash value, and wherein the method further comprises:
[0348] Generating a second candidate solution of the second time lock puzzle based on the set of second puzzle parameters and the candidate solution of the time lock puzzle;
[0349] Providing a second part derived from the second candidate solution in a second unlocking script of a second solution blockchain transaction; and,
[0350] Providing the second solution blockchain transaction to one or more nodes of a blockchain network.
[0351] Statement 17. The method according to statement 16, which is subordinate to statement 14 or 15, wherein the private key of the second part is derived from the second candidate solution.
[0352] Statement 18. The method according to any one of the foregoing statements, wherein the time lock puzzle is a modular square puzzle.
[0353] Statement 19. The method according to statement 18, wherein the candidate solution is calculated using the following formula:
[0354]
[0355] where a, t, and n are puzzle parameters, where 1 < a < n and t > 0.
[0356] Statement 20. The method according to statement 19, wherein the puzzle parameter n is defined by the following formula:
[0357] modulusn=pq
[0358] where p and q are large prime numbers.
[0359] Statement 21. The method of statement 20, wherein the target solution is calculated using the following formula:
[0360]
[0361] in The set of secret puzzle parameters includes p and q.
[0362] Statement 22. The method of statement 19 or any statement dependent thereon, wherein the encrypted transaction encryption key is defined by the following formula:
[0363] C k =K+sol mod n.
[0364] Statement 23. A method according to a method dependent on statement 8, or dependent on statement 16, or dependent on statement 19 or any of its subordinate statements, wherein the set of second puzzle parameters includes the puzzle parameters t and n, and wherein the puzzle parameter a is not included in the second locking script, and wherein when generating the candidate solutions to the second time lock puzzle, the candidate solutions to the time lock puzzle are used as the puzzle parameter a.
[0365] Statement 24. A computer device, the computer device comprising:
[0366] a memory, the memory comprising one or more memory cells; and,
[0367] A processing device comprising one or more processing units, wherein the memory stores code configured to be executed on the processing device, the code being configured to execute a method according to any one of statements 1 to 23 when executed on the processing device.
[0368] Statement 25. A computer program embodied on a computer readable memory and configured to, when executed on one or more processors, perform the method of any one of statements 1 to 23.< / sig> < / sig> < / sig> < / sig> < / sig> < / sig> < / sol> < / sig> < / pa>
Claims
1. A computer-implemented method for generating a puzzle blockchain transaction, the method comprising: providing a first locking script of the puzzle blockchain transaction, the first locking script corresponding to the first unspent transaction output and comprising a hash value derived from a target solution to a timelock puzzle, and a set of puzzle parameters for the timelock puzzle, wherein the target solution is computed using a set of secret puzzle parameters, and wherein the timelock puzzle is solvable using the set of puzzle parameters in a time equal to or greater than a minimum solution time, wherein the set of puzzle parameters does not include the secret puzzle parameters, wherein the locking script is configured to: When executed using a first unlocking script of a decrypted blockchain transaction, verifying based on the hash value a candidate solution provided in the first unlocking script of the decrypted blockchain transaction and computed using the set of puzzle parameters; as well as The puzzle blockchain transaction is provided to one or more nodes of a blockchain network.
2. The method of claim 1, wherein the hash value is a hash of a public key derived using the target solution of the time-lock puzzle.
3. The method of claim 2, wherein the public key is derived from a private key, wherein the private key is derivable from a private key of a predefined recipient and the target. The method of claim 3 , wherein the private key is a sum of the private key of the predefined recipient and the target solution.
5. The method of claim 2, wherein the public key is derived from a private key, wherein the private key is a randomly generated private key, wherein the method further comprises: The private key is randomly generated.
6. The method according to claim 5, wherein the method further comprises: The private key is encrypted based on the target solution.
7. The method of claim 6, wherein the first locking script further comprises the encrypted private key for ensuring availability when the puzzle blockchain transaction is submitted to the blockchain.
8. The method of claim 1 or any claim dependent thereon, wherein the first locking script further comprises a second hash value, wherein the second hash value is derived from a second target solution to a second time-lock puzzle and a set of second puzzle parameters of the second time-lock puzzle and corresponds to a second unspent transaction output, wherein the second unspent transaction output corresponds to a second locking script comprising the second hash value.
9. The method of claim 8, wherein the second unspent transaction output and the second locking script are provided in a second puzzle blockchain transaction.
10. The method of claim 8, wherein the second unspent transaction output and the second locking script are provided in the puzzle blockchain transaction.
11. The method of claim 8 when dependent on claim 2 or any claim dependent thereon, wherein the second hash value is a hash of a second public key derived using the target solution of the second time-lock puzzle.
12. A computer-implemented method for generating a solution blockchain transaction for unlocking a time-locked unspent transaction output of a puzzle blockchain transaction, the puzzle blockchain transaction comprising a first locking script of the puzzle blockchain transaction, the first locking script corresponding to a first unspent transaction output and comprising a hash value derived from a target solution to a timelock puzzle and a set of puzzle parameters for the timelock puzzle, wherein the target solution is computed using a set of secret puzzle parameters, and wherein the timelock puzzle is solvable using the set of puzzle parameters in a time equal to or greater than a minimum solution time, wherein the set of puzzle parameters does not include the secret puzzle parameters, the method comprising: generating a candidate solution to the time lock puzzle based on the set of puzzle parameters; In the first unlocking script of the solution blockchain transaction, providing a portion derived from the candidate solution; as well as The deblockchain transaction is provided to one or more nodes of a blockchain network.
13. The method of claim 12, wherein the portion derived from the candidate solution is a public key derived using the candidate solution.
14. The method according to claim 13, wherein the method further comprises: generating a private key, wherein the private key is generated using the candidate solution and a private key of a user who generates the candidate solution; Using the generated private key to derive the public key; generating a signature using the private key; as well as The signature is provided in the unlocking script.
15. The method of claim 13, wherein the first locking script of the puzzle blockchain transaction further comprises an encrypted private key, wherein the encrypted private key is a randomly generated private key, the randomly generated private key is encrypted based on the target solution, wherein the method further comprises: determining the private key based on the candidate solution and the encrypted private key; deriving the public key using the determined private key; generating a signature using the private key; as well as The signature is provided in the unlocking script.
16. The method of any one of claims 12 to 15, wherein the first locking script of the puzzle blockchain transaction further comprises a second hash value, wherein the second hash value is derived from a second target solution to a second timelock puzzle and a set of second puzzle parameters of the second timelock puzzle and corresponds to a second unspent transaction output, wherein the second unspent transaction output corresponds to a second locking script comprising the second hash value, wherein the method further comprises: generating a second candidate solution to the second time lock puzzle based on the set of second puzzle parameters and the candidate solution to the time lock puzzle; providing a second portion derived from the second candidate solution in a second unlocking script of a second solution blockchain transaction; as well as The second blockchain transaction is provided to one or more nodes of the blockchain network.
17. The method according to claim 16, dependent on claim 14 or 15, wherein the private key of the second part is derived from the second candidate solution.
18. The method according to any one of the preceding claims, wherein the time - lock puzzle is a modular - square puzzle.
19. The method according to claim 18, wherein the candidate solution is calculated using the following formula: sol = a 2t mod n where a, t, and n are puzzle parameters, where 1 < a < n and t > 0.
20. The method according to claim 19, wherein the puzzle parameter n is defined by the following formula: modulus n = pq where p and q are large prime numbers.
21. The method according to claim 20, wherein the target solution is calculated using the following formula: where where the set of secret puzzle parameters includes p and q.
22. The method according to claim 19 or any of its dependent claims, wherein the encrypted transaction encryption key is defined by the following formula: C k = K + sol mod n.
23. The method according to claim 19 or any of its dependent claims, dependent on claim 8, or claim 16 or any of its dependent claims, wherein the set of second puzzle parameters includes the puzzle parameters t and n, and wherein the puzzle parameter a is not included in the second locking script, and wherein when generating the candidate solution of the second time - lock puzzle, the candidate solution of the time - lock puzzle is used as the puzzle parameter a.
24. A computer device, the computer device comprising: a memory, the memory comprising one or more memory units; as well as A processing device comprising one or more processing units, wherein the memory stores a code arranged to be executed on the processing device, the code being configured to execute the method according to any one of claims 1 to 23 when executed on the processing device.
25. A computer program, the computer program being embodied on a computer - readable memory and configured to, when run on one or more processors, execute the method according to any one of claims 1 to 23.
