Proof of Knowledge
The r-puzzle method using ECDSA signatures addresses miner attacks in blockchain transactions by ensuring only authorized parties can redeem transactions, maintaining integrity and flexibility in authorization without disclosing ephemeral keys.
Patent Information
- Application Number
- JP2021569310
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-05-24
- Filing Date
- 2020-04-22
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-04-22
AI Technical Summary
Traditional hash puzzles in blockchain transactions are vulnerable to miner attacks, allowing unscrupulous miners to redirect payments by observing and mimicking the unlock script, which compromises the integrity of transactions.
Implement an 'r-puzzle' based on the reference value of the ECDSA signature, where the second transaction must provide a valid signature containing the r-part to redeem the first transaction, without disclosing the ephemeral key k, ensuring that only those with knowledge of k can unlock the transaction.
The r-puzzle method prevents malicious miners from redirecting payments by ensuring that only authorized parties can redeem the transaction, maintaining transaction integrity and allowing flexible authorization without disclosing sensitive information.
Smart Images

Figure 0007551658000060 
Figure 0007551658000069 
Figure 0007551658000070
Abstract
Description
[Technical field]
[0001] The present disclosure relates to a form of proof of knowledge that can be implemented by a set of transactions for recording on a blockchain. [Background technology]
[0002] Blockchain refers to a form of distributed data structure in which a duplicate copy of the blockchain is maintained at each of multiple nodes in a peer-to-peer (P2P) network. A blockchain contains a chain of blocks of data, with each block containing one or more transactions. Each transaction may point to the previous transaction in the sequence. Transactions can be submitted to the network for inclusion in a new block. New blocks are generated by a process known as "mining." "Mining" involves each of multiple mining nodes competing to perform a "proof-of-work," i.e., solving a cryptographic puzzle based on a pool of pending transactions waiting to be included in a block.
[0003] Traditionally, transactions in a blockchain are used to transfer digital assets, i.e. data that acts as a store of value. However, blockchains can also be used to stack additional functionality on top of the blockchain. For example, blockchain protocols may allow additional user data to be stored in the output of a transaction. Modern blockchains increase the maximum amount of data that can be stored in a single transaction, allowing more complex data to be incorporated. For example, this can be used to store electronic documents, or audio or video data, in the blockchain.
[0004] Each node in the network can have any one, two, or all three roles: forwarding, mining, and storage. Forwarding nodes propagate transactions through the nodes of the network. Mining nodes mine transactions into blocks. Storage nodes each store their own copies of the mined blocks of the blockchain. To have a transaction recorded in the blockchain, a party sends the transaction to one of the nodes of the network to be propagated. Mining nodes that receive a transaction may compete to mine the transaction into a new block. Each node is configured for the same node protocol, which includes one or more conditions for a transaction to be valid. Invalid transactions are not propagated or mined into blocks. Assuming the transaction is verified and thereby accepted into the blockchain, the transaction (including any user data) thus remains stored in each node of the P2P network as an immutable public record.
[0005] Miners who successfully solve the proof-of-work puzzle to generate an updated block are typically rewarded with a new transaction, called a "generation transaction," that generates a new amount of the digital asset. Proof-of-work incentivizes miners not to cheat the system by including double-spending transactions in their blocks, because it requires a huge amount of computational resources to mine a block, and because blocks containing double-spending attempts may not be accepted by other nodes.
[0006] In an “output-based” model (sometimes called a 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, sometimes called a UTXO (for “unspent transaction output”), that specifies an amount of digital assets. The output may further include a locking script that specifies a condition for redeeming the output. Each input includes a pointer to such an output in a prior transaction and may further include an unlocking script for unlocking the pointed-to output’s locking script. Thus, when considering a pair of transactions, we refer to them as a first transaction and a second transaction. The first transaction includes at least one output that includes a locking script that specifies an amount of digital assets and defines one or more conditions for unlocking the output. The second transaction includes at least one input that includes a pointer to an output of the first transaction and an unlocking script for unlocking the output of the first transaction.
[0007] In such a model, when the second transaction is sent to the P2P network to be propagated and recorded in the blockchain, one of the conditions for validity applied at each node is that the unlock script meets all of one or more conditions defined in the lock script of the first transaction, and another is that the output of the first transaction has not yet been redeemed by another previous valid transaction. Any node that finds the second transaction invalid according to any of these conditions will not propagate it or mine it into a block for recording in the blockchain.
[0008] An alternative type of transaction model is the account-based model, where each transaction transfers by referencing absolute account balances, rather than defining the amount transferred by referencing back to the UTXO of the preceding transaction in the past sequence of transactions. The current state of every account is stored and constantly updated by miners separate from the blockchain. Account-based model transactions can also involve smart contracts that execute on each node at the same time as they validate the transaction.
[0009] Transactions in either model can include a proof of knowledge. "Knowledge proof" or "proof of knowledge" is a conventional term for testing that a party knows some piece of data, say d. As an example, in the case of an output-based transaction model, the lock script in the output of one transaction, Tx1, can include a hash puzzle. If an input of a second transaction, Tx2, points to this output of Tx1, then the unlock script in that input of Tx2 must solve the hash puzzle to successfully redeem the output of Tx1. The hash puzzle includes a hash value h, which is the hash of d, i.e., h=H puz (d). The puzzle may also include a script piece that, when executed at a node together with Tx2’s unlock script, takes a data value d’ purported to be d from Tx2’s unlock script and multiplies it by a hash function H puz and compare it with the hash value h included in the lock script of Tx1. That is, the piece of the script is puz(d') and unlocks the output of Tx1 only if the comparison is yes (or "true" in traditional terms). Thus, the recipient of Tx2 can unlock the output of Tx1 only if d is included in the unlock script of Tx2, which proves knowledge of d.
[0010] The problem with using traditional hash puzzles alone is that an unscrupulous miner or other node could observe d in Tx2's unlock script and therefore generate and mine (or issue) his own version, Tx2*, and pay himself in the output of Tx2* instead of the intended recipient in Tx2 (e.g., Bob). The existing way to get around this is to include an additional pay-to-public key hash (P2PKH) requirement in Tx1's lock script. In addition to a proof of knowledge for d, this requires a cryptographic signature of the intended recipient to be included in Tx2's lock script.
[0011] Hash puzzles and P2PKH can also be implemented using smart contracts in account-based models, in addition to lock and unlock scripts in output-based models.
[0012] As will be familiar to those skilled in the art, a cryptographic signature is generated based on a private key V and can be verified based on the corresponding public key P of a private-public key pair. Given a signature generated by applying private key V to a message m, it is possible for another party, without knowing V, to verify using P that the signature was generated using V (so verifying the signature itself is, in its own right, another form of proof of knowledge).
[0013] One form of algorithm for this is the elliptic curve digital signature algorithm (ECDSA), which works on top of elliptic curve cryptography (ECC).
[0014] In this case, P and V are related by: P=V G where P is a two-element vector (P x ,P y ), V is a scalar, and G is a two-element vector (G x ,G y ). The operation "·" is scalar elliptic curve multiplication, a known form of operation that transforms one point on an elliptic curve to another.
[0015] An ECDSA signature is a tuple (r,s) consisting of two elements, commonly known in the art as the r-part (r) and the s-part (s), respectively. The signature (r,s) is generated by applying a private key V to a message m. In the case of a transaction for recording in the blockchain, m is part of the transaction, and the signature is tagged to the transaction in addition to the part in plaintext, allowing the transaction to be verified. For example, in an output-based model, a signature is included in the lock script of Tx2 to sign the part of Tx2 and unlock the outputs of Tx1. The signed parts typically contain the outputs of the transaction, and therefore they cannot be changed without invalidating the signature and therefore the transaction.
[0016] Whatever transaction model is used, the signature (r,s) is calculated as follows:
number
[0017] Given knowledge of the signature (r,s), the message m, and the public key P, it is possible for any party who does not know the private key V to verify that the signature was generated for message m using the private key. This is done by computing:
number
[0018] The problem with using a hash puzzle as a proof of knowledge in combination with a P2PKH to avoid possible miner attacks is that while P2PKH first guarantees that payments can only be made to parties that know d, it also means that the output of Tx1 is tied to a specific, predetermined recipient or set of recipients (it is possible to specify alternative conditions that may include alternative recipients).
[0019] It is recognized that it may be desirable to allow such transactions to be redeemable by any unspecified party who can prove knowledge of a particular secret value in a way that avoids disclosing that value. For example, suppose Alice wants to set up a first transaction that can be unlocked by anyone to whom she gives a secret key, but she does not want to specify in advance who those parties are. For example, the first transaction may pay someone to accept delivery of some item, such as a letter or parcel, on Alice's behalf, and / or pay a shipping company to deliver the item. The first transaction can be redeemed by a second transaction that proves knowledge of the secret. At the time of ordering the delivery, Alice may set up the first transaction and provide it to the shipping company or publish it on the blockchain (or, for example, simply provide the necessary details to enable the shipping company to generate the first transaction). Thus, the shipping company has trust that payment will be made once the delivery is completed. However, Alice does not want to determine at this stage who will accept the delivery on her behalf. Instead, she only provides the secret value later to one or more trusted parties (e.g., her housemates Charlie and / or Bob, who have been confirmed to be at home on the day of delivery). This allows any of them to sign on her behalf by providing a second transaction that demonstrates a proof of Alice's secret value.
[0020] It is understood that this is just one illustrative example. As another example, a transaction may be used to indicate agreement to the terms of a contract. Alice may wish to agree only after deciding to grant signing authority or proxy power to sign on her behalf to a subset of one or more relying parties. For example, at the time of agreement, Alice intends to sign herself, but later finds out that she has lost mental capacity or is unable to sign for some reason, and therefore needs to assign proxy power to someone else (e.g., in this case Bob and Charlie could be her family or business associates).
[0021] More generally, it may be desirable to provide an alternative to traditional hash puzzles, where the alternative form of puzzle allows proof of knowledge of a secret value without disclosing it to a node or publishing it on the blockchain, and which is not tied to a particular identity.
[0022] According to this disclosure, a new type of proof of knowledge is provided, referred to herein as an “r-puzzle” or, equivalently, an “r-challenge”. It is based on a reference value corresponding to the r portion of an ECDSA signature as the basis of the challenge (i.e., puzzle). The reference value is included in a first transaction (e.g., in the lock script of Tx1) as a challenge that requires that a second transaction include a signature containing the specified r portion in order to redeem the first transaction (e.g., in the unlock script of Tx2). By providing the solution to the r-puzzle in the second transaction, this proves that the prover must know the corresponding ephemeral key k, but without the need to disclose k in the second transaction. Thus, k can be used as an ephemeral private key, and r behaves similarly to the corresponding ephemeral public key.
[0023] According to one aspect disclosed herein, there is provided a computer-implemented method for performing a proof of knowledge based on an elliptic curve digital signature algorithm (ECDSA) verification function, the method comprising: obtaining a first transaction including executable code, the code including an element specifying a reference instance of the r portion of the first ECDSA signature; receiving a second transaction including information including at least the s portion of the first ECDSA signature; The method includes obtaining a first public key, where a first ECDSA signature is for signing a message based on a first private key that corresponds to the first public key, the message being part of a second transaction. The method then includes executing code from the first transaction, where the code is configured to return a result of true provided that, regardless of whose public key was used as the first private key (and thus whose public key is used in the second transaction), an ECDSA verification function, when applied to the first ECDSA signature, verifies that, given the received message and the obtained first public key in the second transaction, the s portion received in the second transaction corresponds to the reference instance of the r portion specified by the first transaction.
[0024] The element included in the code of the first transaction may be the reference instance of the r part itself, or a transformation thereof, e.g. a hash of the components that comprise the r part (where the hashed component may be equal to the r part itself, or may be concatenated with another data value d, for example). Note that "specified" in the context therefore does not necessarily mean including its explicit value (which is of course one possible implementation). More generally, it may represent any element equal to or derived from the reference instance of the r part (e.g. a hash of it), that allows checking whether the submitted instance of the s part corresponds validly to the reference instance according to the ECDSA verification algorithm.
[0025] Whatever the way it is specified, the code thus sets up an "r-puzzle" that proves that a challengee (e.g., Bob) must know the ephemeral key k (it is infeasible for a solution to be provided without knowing k). The puzzle advantageously uses the r-part as the basis of this proof of knowledge and does not require the challengee to submit the ephemeral key k to the node or to disclose it in a second transaction (e.g., Tx2). This means, for example, that k can be used by a first party (e.g., Alice) as some kind of ephemeral key or secret that she can use to assign signing authority to one or more second parties, such as Bob and / or Charlie. Because the r-puzzle proves knowledge of k without disclosing k, a malicious miner or other node cannot generate his / her own signature to form a valid second transaction Tx2* that could pay him / herself instead of the intended beneficiary. Furthermore, since the r-part of the signature is not itself linked to any identity in the system, this means that anyone who knows k can satisfy the proof. The conditions on the validity of the second transaction need not be tied to a particular identity by the first transaction. Thus, for example, Alice does not need to pre-determine who will lock the first transaction. For example, she may provide the details to set up the first transaction to a shipping company, and later decide who to give signing authority to receive packages on her behalf. [Brief description of the drawings]
[0026] To aid in the understanding of embodiments of the present disclosure and to show how such embodiments may be put into effect, reference is made, by way of example only, to the accompanying drawings in which: [Figure 1] FIG. 1 is a schematic block diagram of a system for implementing a blockchain. [Diagram 2] 1 illustrates diagrammatically some examples of transactions that may be recorded on a blockchain. [Diagram 3]FIG. 1 is a schematic block diagram of another system for implementing a blockchain. [Figure 4] FIG. 1 is a schematic block diagram of a piece of node software that processes transactions according to the output-based model node protocol. [Diagram 5] FIG. 2 is a schematic diagram of an exemplary set of transactions. [Figure 6A] This outlines some of the principles behind the Elliptic Curve Digital Signature Algorithm (ECDSA). [Figure 6B] This outlines some of the principles behind the Elliptic Curve Digital Signature Algorithm (ECDSA). [Figure 6C] This outlines some of the principles behind the Elliptic Curve Digital Signature Algorithm (ECDSA). [Figure 6D] This outlines some of the principles behind the Elliptic Curve Digital Signature Algorithm (ECDSA). [Figure 7] FIG. 1 is a schematic diagram of one possible implementation of a type of knowledge proof referred to herein as an r-puzzle (or equivalently an r-challenge). [Figure 8] FIG. 1 is a schematic diagram of another possible implementation of the r-puzzle. [Figure 9] FIG. 1 is a schematic diagram of another possible implementation of the r-puzzle. [Figure 10] FIG. 13 is a schematic diagram of yet another possible implementation of the r-puzzle. [Figure 11] FIG. 1 is a schematic block diagram of a piece of node software that processes transactions according to the account-based model node protocol. [Figure 12] 1 illustrates an exemplary format of an ECDSA signature. [Figure 13] 1 is a step-by-step script analysis of an exemplary implementation of a lock and unlock script for one form of r-puzzle. [Figure 14A] 1 illustrates a schematic of a series of r-puzzle transfer transactions. [Figure 14B] 1 illustrates a schematic of a series of r-puzzle transfer transactions. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0027] In some cryptographic schemes, a verifier may need to convince a person (called the prover or challengee) that he or she has some piece of information, called a knowledge proof. Simply, this can be done by directly providing the verifier with the piece of information. Alternatively, the prover may be required to perform a computation that depends on the piece of information. Preferably, the computation involved is such that the verifier himself does not need to know the piece of information to set a challenge, or that the piece of information does not need to be disclosed to the verifier to verify that the prover knows it. For the computation method, the verification computation must be performed on the input data. A straightforward way to prove knowledge of a secret value is through the use of cryptographic hash functions, due to the preimage and collision resistance properties of cryptographic hash functions. This hashing method can be easily integrated into many blockchain applications, since hash functions form a fundamental part of the private-public key cryptosystem in many blockchain applications. This kind of knowledge proof is quite common in blockchain applications, where it is typically called a hash puzzle.
[0028] In a UTXO-based blockchain, the solution to the hash puzzle (the preimage of the hash value) can be set as a condition of use. Thus, validation is performed by miners as part of transaction validation. However, in this approach, transactions must also require signing with a specific private key, since otherwise the miner would receive the hash puzzle solution before including the transaction in a block. This could give a malicious miner the opportunity to generate payment transactions with outputs destined for an address belonging to the miner.
[0029] In this disclosure, a proof of knowledge is provided that avoids this problem while still allowing verification to be performed by the miner (or forwarding node). To do this, the proof of knowledge is connected to an ephemeral key that corresponds to an elliptic curve digital signature algorithm (ECDSA) signature. The cryptographic primitives used in this algorithm are native to many blockchains, so it can be readily integrated into current infrastructures.
[0030] <Exemplary System Overview> FIG. 1 illustrates an exemplary system 100 for implementing a blockchain 150. The system 100 includes a packet-switched network 101, which is typically a wide area internetwork such as the Internet. The packet-switched network 101 includes a number of nodes 104 arranged to form a peer-to-peer (P2P) overlay network 106 within the packet-switched network 101. Each node 104 includes a peer computing device with different nodes 104 belonging to different peers. Each node 104 includes a processing device including one or more processors, e.g., one or more central processing units (CPUs), accelerator processors, application specific processors, and / or field programmable gate arrays (FPGAs). Each node also includes a memory, i.e., a computer-readable storage device in the form of one or more non-transitory computer-readable media. The memory may include one or more memory units using one or more memory media, e.g., magnetic media such as hard disks, electronic media such as solid-state drives (SSDs), flash memory or EEPROMs, and / or optical media such as optical disk drives.
[0031] Blockchain 150 refers to a chain of blocks 151 of data, with a respective copy of the blockchain 150 maintained at each of multiple nodes in a peer-to-peer (P2P) network 160. Each block 151 in the chain includes one or more transactions 152, where transaction in this context refers to a type of data structure. The nature of the data structure depends on the type of transaction protocol used as part of the transaction model or scheme. A given blockchain typically uses one particular transaction protocol throughout. In one common type of transaction protocol, the data structure of each transaction 152 includes at least one input and at least one output. Each output specifies an amount that represents the quantity of a digital asset belonging to a user for which that output is cryptographically locked (requiring that user's 103 signature to be unlocked and thereby redeemed or used). Each input points back to the output of a preceding transaction 152, thereby linking the transactions.
[0032] At least some of the nodes 104 assume the role of forwarding nodes 104F, which forward and thereby propagate transactions 152. At least some of the nodes 104 assume the role of miners 104M, which mine blocks 151. At least some of the nodes 104 assume the role of storage nodes 104S (also called "full-copy" nodes), with each node storing a respective copy of the same blockchain 150 in its respective memory. Each miner node 104M also maintains a pool 154 of transactions 152 waiting to be mined into blocks 151. A given node 104 may be a forwarding node 104, a miner 104M, a storage node 104S, or any combination of two or all of these.
[0033] For a given current transaction 152j, the input (or each of them) includes a pointer that references the output of a previous transaction 152i in the sequence of transactions, specifying that this output is redeemed or "spent" in the current transaction 152j. In general, the previous transaction can be any transaction in the pool 154 or any block 151. The previous transaction 152i does not necessarily have to exist when the current transaction 152j is created or sent to the network 106, but the previous transaction 152i must exist and be verified for the current transaction to be valid. Thus, "preceding" in this specification refers to something that precedes in a logical sequence linked by a pointer, and not necessarily to a time of creation or transmission in the chronological order. Thus, it does not necessarily exclude transactions 152i, 152j from being created or transmitted out of order (see the discussion of orphan transactions below). A preceding transaction 152i may equally be referred to as an antecedent or predecessor transaction.
[0034] The input of the current transaction 152j also includes the signature of the user 103a to whom the output of the previous transaction 152i is locked. The output of the current transaction 152j can also be cryptographically locked to the new user 103b. Thus, the current transaction 152j can transfer an amount defined in the input of the previous transaction 152i to the new user 103b defined in the output of the current transaction 152j. In some cases, a transaction 152 may have multiple outputs and split the input amount among multiple users (one of which is the original user to make the change). In some cases, a transaction may have multiple inputs and combine amounts from multiple outputs of one or more previous transactions and redistribute them into one or more outputs of the current transaction.
[0035] This is sometimes called an "output-based" transaction protocol, and sometimes also called an "unspent transaction output (UTXO) type protocol" (where the outputs are called UTXOs). A user's total balance is not defined by one number stored in the blockchain, instead, the user needs a special "wallet" application 105 to collate the values of all of the user's UTXOs, which are distributed across many different transactions 152 in the blockchain 151.
[0036] As part of the account-based transaction model, another type of transaction protocol is sometimes called an "account-based" protocol. In the account-based case, each transaction transfers by referencing an absolute account balance, rather than defining the amount to be transferred by referencing back to the UTXO of a preceding transaction in the past sequence of transactions. The current state of every account is stored and constantly updated by miners separate from the blockchain. In such a system, transactions are ordered using the successive transaction records (so-called "positions") of the accounts. This value is signed by senders as part of their cryptographic signatures and hashed as part of the transaction reference calculation. In addition, an optional data field can also sign the transaction. This data field may point back to a previous transaction, for example if a previous transaction ID is included in the data field.
[0037] In both types of transaction protocols, when a user 103 wants to execute a new transaction 152j, he sends the new transaction from his computer terminal 102 to one of the nodes 104 of the P2P network 106 (currently usually a server or a data center, but in principle it could be another user terminal). This node 104 checks whether the transaction is valid according to a node protocol applied to each node 104. The details of the node protocol correspond to the type of transaction protocol used in the blockchain 150 in question and together form an overall transaction model. The node protocol typically requires the nodes 104 to check that the cryptographic signature in the new transaction 152j matches an expected signature, which depends on the previous transaction 152i in the ordered sequence of transactions 152. In the output-based case, this may include checking that the cryptographic signature of the user included in the input of the new transaction 152j matches a condition defined in the output of the previous transaction 152j that the new transaction consumes, which typically includes at least checking that the cryptographic signature in the input of the new transaction 152j unlocks the output of the previous transaction 152i to which the input of the new transaction points. In some transaction protocols, the condition may be defined, at least in part, by custom script included in the input and / or output. Alternatively, it may be fixed solely in the node protocol, or by a combination of these. In any case, if the new transaction 152j is valid, the current node forwards the new transaction to one or more other nodes 104 in the P2P network 106. At least some of these nodes 104 also act as forwarding nodes 104F, applying the same tests according to the same node protocol and forwarding the new transaction 152j to one or more further nodes 104, etc.In this manner, the new transaction is propagated throughout the network of nodes 104.
[0038] In an output-based model, the definition of whether a given output (e.g., UTXO) is spent is whether it has already been validly redeemed by an input of another onward transaction 152j according to the node protocol. Another condition for a transaction to be valid is that the output of the preceding transaction 152i that it attempts to spend or redeem has not yet been consumed / redeemed by another valid transaction. Again, if not valid, the transaction 152j is not propagated or recorded in the blockchain. This prevents double-spending, where a payer attempts to spend the same transaction output multiple times. On the other hand, an account-based model prevents double-spending by maintaining an account balance. Again, because of the defined order of transactions, the account balance has a single defined state at a time.
[0039] In addition to validating, at least some of the nodes 104M compete to be the first to create a block of transactions in a process called mining, which is backed by a "proof of work." At the mining nodes 104M, new transactions are added to a pool of valid transactions that have not yet appeared in a block. Miners then compete to assemble a new valid block 151 of transactions 152 from the pool of transactions 154 by attempting to solve a cryptographic puzzle. This typically involves searching for a "nonce" value such that when the nonce is concatenated with the pool of transactions 154 and hashed, the output of the hash satisfies a predefined condition. For example, the predefined condition may be that the output of the hash has a predefined number of leading zeros. A property of a hash function is that it has an output that is unpredictable with respect to the input. This search can therefore only be performed by brute force and therefore consumes a significant amount of processing resources at each node 104M trying to solve the puzzle.
[0040] The first miner node 104M to solve the puzzle announces this to the network 106 and provides its solution as a proof. This solution can be easily checked by other nodes 104 in the network (it is easy to verify that the hash output satisfies the condition given the solution for the hash). The pool 154 of transactions for which the winner solved the puzzle is recorded as a new block 151 in the blockchain 150 by at least some of the nodes 104 acting as storage nodes 104S, based on checking the winner's published solution at each node. The new block 151n is also assigned a block pointer 155, which points to the previously created block 151n-1 in the chain. The proof-of-work helps to reduce the risk of double spending, since it takes a lot of effort to create a new block 151, and blocks containing double spending are likely to be rejected by other nodes 104, thus providing an incentive for mining nodes 104M not to include double spending in their blocks. Once created, blocks 151 cannot be altered because they are known and maintained at each storage node 104Si in the P2P network 106 according to the same protocol, and block pointers 155 impose an order on blocks 151. This provides an immutable public ledger of transactions, as transactions 152 are recorded in ordered blocks at each storage node 104S in the P2P network 106.
[0041] Note that different miners 104M, who are constantly competing to solve the puzzle, may be solving the puzzle based on different snapshots of the unmined transaction pool 154 at any given time, depending on when they started looking for a solution. Whoever solves the puzzle first defines the transactions 152 to be included in the next new block 151n, and the current unmined transaction pool 154 is updated. Miners 104M then continue to compete to produce blocks from the newly defined unsolved pool 154. There is also a protocol to resolve possible "forks", which are cases when two miners 104M solve the puzzle within a very short time of each other and inconsistent views of the blockchain propagate. In essence, whenever a branch of a fork grows, the longest one becomes the final blockchain 150.
[0042] In most blockchains, the winning miner 104M is automatically rewarded with a special type of new transaction that creates a new amount of digital assets out of nothing (a normal transaction transfers an amount of digital assets from one user to another). Thus, the winning node is said to have "mined" an amount of digital assets. This special type of transaction is sometimes called a "generation" transaction. It automatically forms part of a new block 151n. This reward motivates miners 104M to participate in the proof-of-work competition. Often, normal (non-generation) transactions specify an additional transaction fee in one of their outputs to further reward the winning miner 104M who generated the block 151n that contains the transaction.
[0043] Due to the computational resources involved in mining, typically at least each of the miner nodes 104M takes the form of a server including one or more physical server units, or an entire data center. Each transfer node 104M and / or storage node 104S may also take the form of a server or a data center. However, in principle, any given node 104 may include a user terminal or a group of user terminals networked together.
[0044] The memory of each node 104 stores software 400 configured to run on the processing unit of the node 104 to perform one or more respective roles and process transactions 152 according to the node protocol. It will be appreciated that any operation pertaining to a node 104 may be performed by the software 400 executing on the processing unit of the respective computing device. The node software 400 may be implemented in one or more applications at the application layer, or a lower layer such as the operating system layer or protocol layer, or any combination thereof. Additionally, the term "blockchain" as used herein is a general term referring to a general type of technology and is not limited to any particular proprietary blockchain, protocol, or service.
[0045] Also connected to the network 101 are computing devices 102 of each of a number of parties 103 acting as consumer users. These act as payers and payees in transactions, but do not necessarily participate in mining or propagating transactions on behalf of other parties. They do not necessarily execute the mining protocol. Two parties 103 and their respective devices 102 are shown for illustration purposes: a first party 103a and its respective computing device 102a, and several second parties 103b and their respective computing devices 102b. It will be understood that many more such parties 103 and their respective computing devices 102 may exist and participate in the system, but for convenience they are not shown. Each party 103 may be an individual or an organization. Purely by way of example, the first party 103a will be referred to herein as Alice and the second party 103b will be referred to as Bob, although it will be understood that this is not limiting and that references herein to Alice or Bob may be interchangeable with "first party" and "second party", respectively.
[0046] The computing equipment 102 of each party 103 comprises a respective processing device comprising one or more processors, for example one or more CPUs, GPUs, other accelerator processors, application specific processors, and / or FPGAs. The computing equipment 102 of each party 103 further comprises a memory, i.e. a computer readable storage device in the form of a non-transitory computer readable medium or media. This memory may include one or more memory units using, for example, a magnetic medium such as a hard disk, an electronic medium such as a SSD, a flash memory or an EEPROM, and / or an optical medium such as an optical disk drive. The memory on the computing equipment 102 of each party 103 stores software including a respective instance of at least one client application 105 arranged to operate on the processing device. It will be understood that any operation belonging to a given node 104 may be performed by using software executed on the processing device of the respective computing equipment 102. The computing equipment 102 of each party 103 comprises at least one user terminal, for example a desktop or laptop computer, a tablet, a smartphone, or a wearable device such as a smart watch. The computing device 102 of a given party 103 may also include one or more other networked resources, such as cloud computing resources, accessed via a user terminal.
[0047] The client application 105 may be initially provided to the computing equipment 102 of any given party 103 on one or more suitable computer readable storage media, for example downloaded from a server, or on a removable storage device such as a removable SSD, a flash memory key, a removable EEPROM, a removable magnetic disk drive, a magnetic floppy disk or tape, an optical disk, for example a CD or DVD ROM, or a removable optical drive.
[0048] The client application 105 has at least a "wallet" functionality, which has two main functions. One of these is to allow each user party 103 to create, sign and send transactions 152 that are propagated throughout the network of nodes 104 and thereby included in the blockchain 150. The other is to report to each party the amount of digital assets that it currently owns. In an output-based system, this second function involves reconciling the amount defined in the outputs of the various transactions 152 scattered throughout the blockchain 150 that belong to that party.
[0049] NOTE: Although various client functions are sometimes described as being integrated into a given client application 105, this is not necessarily limiting; instead, any client functionality described herein may be implemented in two or more different suites of applications, interfacing, for example, via an API, or one plugging into the other. More generally, client functions may be implemented at the application layer, or at a lower layer such as an operating system, or any combination of these. The following is described in terms of a client application 105, but it will be understood that this is not limiting.
[0050] An instance of a client application or software 105 on each computing device 102 is operatively coupled to at least one of the forwarding nodes 104F of the P2P network 106. This allows the wallet function of the client 105 to transmit the transaction 152 to the network 106. The client 105 can also contact one, some, or all of the storage nodes 104 to query the blockchain 150 for any transactions in which the respective party 103 is a recipient (or, in an embodiment, actually inspect the transactions of other parties in the blockchain 150, since the blockchain 150 is a public facility that provides trust of transactions in part through its public visibility). The wallet function on each computing device 102 is configured to form and transmit the transaction 152 according to a transaction protocol. Each node 104 executes software 400 configured to validate the transaction 152 according to the node protocol and, in the case of a forwarding node 104F, forward the transaction 152 for propagation throughout the network 106. The transaction protocol and the node protocol correspond to each other, and a given transaction protocol implements a given transaction model together with a given node protocol. The same transaction protocol is used for all transactions 152 in the blockchain 150 (although a transaction protocol may allow different subtypes of transactions). The same node protocol is used by all nodes 104 in the network 106 (although many nodes process different transaction subtypes differently according to rules defined for that subtype, and different nodes may take on different roles and thus implement different corresponding aspects of the protocol).
[0051] As mentioned above, the blockchain 150 includes a chain of blocks 151, each of which includes a set of one or more transactions 152 created by the proof-of-work process, as described above. Each block 151 also includes a block pointer 155 that points back to a previously created block 151 in the chain, so as to define a sequential order to the blocks 151. The blockchain 150 also includes a pool of valid transactions 154 waiting to be included in a new block by the proof-of-work process. Each transaction 152 includes a pointer to a previous transaction, so as to define an order to the sequence of transactions (note: the sequence of transactions 152 is allowed to diverge). The chain of blocks 151 goes back to a genesis block (Gb) 153, which was the first block in the chain. Early in the chain 150, one or more original transactions 152 pointed to the genesis block 153, but not to a preceding transaction.
[0052] When a given party 103, for example Alice, wants to send a new transaction 152j to be included in the blockchain 150, she formulates the new transaction (using the wallet functionality of her client application 105) according to the relevant transaction protocol. Then, from the client application 105, she sends the transaction 152 to one of one or more forwarding nodes 104F to which she is connected. For example, this may be the forwarding node 104F that is closest or best connected to Alice's computer 102. When any given node 104 receives the new transaction 152j, it processes it according to the node protocol and its respective role. This includes first checking whether the newly received transaction 152j meets certain conditions to be "valid", examples of which will be detailed shortly. In some transaction protocols, the conditions for validation may be configurable per transaction by a script included in the transaction 152. Alternatively, the conditions may simply be a built-in feature of the node protocol, or may be defined by a combination of the script and the node protocol.
[0053] Provided that the newly received transaction 152j passes the tests to be considered valid (i.e., is "valid"), any storage node 104S that receives the transaction 152j adds the newly validated transaction 152 to a pool 154 in the copy of the blockchain 150 maintained at that node 104S. Additionally, any forwarding node 104F that receives the transaction 152j propagates the validated transaction 152 to one or more other nodes 104 in the P2P network 106. Because each forwarding node 104F applies the same protocol, assuming the transaction 152j is valid, this means that it will soon be propagated throughout the P2P network 106.
[0054] Once it enters the pool 154 within a copy of the blockchain 150 maintained by one or more storage nodes 104, the miner node 104M starts competing to solve the proof-of-work puzzle for the latest version of the pool 154 that includes the new transaction 152 (other miners 104M are still trying to solve the puzzle based on an older view of the pool 154, but whoever gets there first defines where the next new block 151 ends and a new pool 154 starts, and ultimately someone solves a part of the puzzle for the pool 154 that includes Alice's transaction 152j). Once the proof-of-work is done for the pool 154 that includes the new transaction 152j, it becomes part of one of the blocks 151 within the blockchain 150. Since each transaction 152 includes a pointer to the previous transaction, the order of the transactions is also immutably recorded.
[0055] Different nodes 104 may first receive different instances of a given transaction, and thus may have conflicting views as to which instance is "valid" before one instance is mined into the block 150, at which point all nodes 104 agree that only the mined instance is the valid instance. If a node 104 accepts one instance as valid and then discovers that a second instance is recorded in the blockchain 150, the node 104 must accept this and discard the previously accepted yet unmined instance (i.e., treat it as invalid).
[0056] <UTXO-based model> Figure 2 shows an example of a transaction protocol. This is an example of a UTXO-based protocol. A transaction 152 (abbreviated as "Tx") is the fundamental data structure of a blockchain 150 (each block 151 contains one or more transactions 152). The following is described with reference to an output-based or "UTXO"-based protocol. However, this is not limited to all possible implementations.
[0057] In a 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 yet been redeemed). The UTXO specifies an amount of a digital asset (a store of value). It includes, among other information, the transaction ID of the transaction from which it originated. The transaction data structure may also include a header 201, which may include an indicator of the size of the input fields 202 and the output fields 203. The header 201 may also include an ID for the transaction. In an embodiment, the transaction ID is a hash of the transaction data (minus the transaction ID itself) and is stored in the header 201 of the outstanding transaction 152 submitted to the miner 104M.
[0058] For example, Alice 103a wants to create a transaction 152j that transfers the amount of the digital asset in question to Bob 103b. In FIG. 2, Alice's new transaction 152j is labeled "Tx1". It takes the amount of the digital asset locked to Alice into the output 203 of the preceding transaction 152i in the sequence and transfers at least a portion of it to Bob. The preceding transaction 152i is labeled "Tx0" in FIG. 2. Tx0 and Tx1 are just arbitrary labels. They do not necessarily mean that Tx0 is the first transaction in the blockchain 151 or that Tx1 is the immediate next transaction in the pool 154. Tx1 could point to any preceding (i.e., ancestor) transaction that still has unspent outputs 203 locked to Alice.
[0059] The preceding transaction Tx0 may already be validated and included in the blockchain 150 by the time Alice creates her new transaction Tx1, or at least by the time she sends it to the network 106. It may already be included in one of the blocks 151 at that point, or it may still be waiting in the pool 154, in which case it will be included in the new block 151 immediately. Alternatively, Tx0 and Tx1 may be generated and sent to the network 102, or Tx0 may be sent after Tx1 if the node protocol allows for buffering of "orphan" transactions. The terms "preceding" and "following" as used herein in the context of a sequence of transactions refer to the order of transactions in a sequence defined by transaction pointers specified in the transaction (such as which transaction points to which other transaction). They may equally be replaced by "preceding" and "inheriting" or "ancestor" and "descendant", "parent" and "child", etc. This does not necessarily mean the order in which they are created, sent to the network 106, or arrive at any given node 104. Nevertheless, a subsequent transaction (descendant transaction or "child") that points to a preceding transaction (ancestor transaction or "parent") will not be validated unless the parent transaction is validated. A child that arrives at node 104 before its parent is considered an orphan. It may be discarded or buffered for a certain amount of time to wait for its parent, depending on the node protocol and / or miner behavior.
[0060] One of the one or more outputs 203 of the preceding transaction Tx0 includes a particular UTXO, labeled herein as UTXO0. Each UTXO includes a value that specifies the amount of the digital asset represented by the UTXO, and a locking script that defines the conditions that must be met by an unlocking script in the input 202 of the following transaction for the following transaction to be validated, and thus for the UTXO to be successfully redeemed. Typically, the locking script locks the amount to a particular party (the beneficiary of the transaction in which it is included). That is, the locking script typically defines the unlocking conditions as follows: the unlocking script in the input of the following transaction includes a cryptographic signature of the party to whom the preceding transaction was locked.
[0061] A lock script (aka 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 "script" (Script, capital S). A lock script specifies the information needed to consume a transaction output 203, e.g., the requirements of Alice's signature. An unlock script appears in the transaction's output. An unlock script (aka scriptSig) is a piece of code written in a domain-specific language that provides the information needed to satisfy the criteria of the lock script. For example, it may include Bob's signature. An unlock script appears in the transaction's inputs 202.
[0062] Therefore, in the illustrated example, UTXO0 of output 203 of Tx0 is A ], which means that Alice's signature SigP must be present in order for UTXO0 to be redeemed (or, more precisely, for a subsequent transaction that attempts to redeem UTXO0 to be valid). A [ChecksigP A ] is the public key P from Alice's public-private key pair.A Input 202 of Tx1 includes a pointer to Tx1 (e.g., its transaction ID, TxID0, which in an embodiment is a hash of the entire transaction Tx0). Input 202 of Tx1 includes an index that identifies UTXO0 in Tx0 to identify it among any other possible outputs of Tx0. Input 202 of Tx1 further includes an unlock script that includes Alice's cryptographic signature, created by Alice applying her private key from her key pair to a predetermined portion of data (sometimes called a "message" in cryptography). <SigP A The data (or "message") that Alice needs to sign in order to provide a valid signature may be defined by the lock script, or by the node protocol, or by a combination of these.
[0063] When a new transaction Tx1 arrives at node 104, the node applies the node protocol, which involves running the lock script and the unlock script together to check if the unlock script satisfies the conditions defined in the lock script (which may include one or more criteria). In an embodiment, this involves concatenation of the two scripts.
number
[0064] where "||" denotes concatenation, "<...>" means to place data on a stack, and "[...]" is a function included in the unlock script (in this example, a stack-based language). Equivalently, the scripts may be executed one by one with a common stack rather than concatenating them. Either way, when executed together, the scripts use Alice's public key PA, included in the lock script in the output of Tx0, to authenticate that the lock script in the input of Tx1 contains Alice's signature signing the expected portion of the data. The expected portion of the data (the "message") must also be included in Tx0 to perform this authentication. In an embodiment, the signed data comprises the entirety of Tx0 (so a separate element must be included in the clear in specifying the signed portion of the data, since the signed portion of the data is already inherently present).
[0065] The details of authentication using public-private cryptography will be well known to those skilled in the art. Essentially, if Alice signs a message by encrypting it with her private key, then with Alice's public key and the message in the clear (unencrypted message), another entity, such as node 104, can authenticate that the encrypted version of the message must have been signed by Alice. Signatures typically allow the holder of the public key to authenticate the signature by hashing the message, signing the hash, and tagging this as the signature on a clear version of the message. Thus, in embodiments, references to signing a particular piece of data or portion of a transaction, etc., may mean signing a hash of the piece of data or portion of the transaction.
[0066] If the unlock script in Tx1 satisfies one or more conditions specified in the lock script of Tx0 (in the example shown, Alice's signature is provided and authenticated in Tx1), the node 104 considers Tx1 valid. If it is a storage node 104S, this means adding it to the pool 154 of transactions waiting for proof-of-work. If it is a forwarding node 104F, it forwards the transaction Tx1 to one or more other nodes 104 in the network 106, which will cause it to be propagated throughout the network. Once Tx1 is validated and included in the blockchain 150, it defines it as having spent UTXO0 from Tx0. Note that Tx1 is only valid if it uses unspent transaction outputs 203. If it tries to consume an output that has already been consumed by another transaction 152, Tx1 becomes invalid even if all other conditions are met. Therefore, node 104 also needs to check whether the UTXO referenced in the preceding transaction Tx0 has already been spent (already formed a valid input to another valid transaction). This is one of the reasons why it is important for blockchain 150 to impose a defined order on transactions 152. In practice, a given node 104 may maintain a separate database that marks UTXOs 203 that transactions 152 have spent, but ultimately, what defines whether a UTXO is spent is whether it already forms a valid input to another valid transaction in blockchain 150.
[0067] If the total amount specified in all of the outputs 203 of a given transaction 152 is greater than the total amount pointed to by all of its inputs 202, this is another basis for invalidity in most transaction models. Thus, such a transaction will not be propagated or mined into a block 151.
[0068] Note that in the UTXO-based transaction model, a given UTXO must be spent in its entirety; it is not possible to "leave" an amount defined in a UTXO while another amount is spent. However, an amount from a UTXO can be split into multiple outputs of a subsequent transaction. For example, the amount defined in UTXO0 of Tx0 can be split into multiple UTXOs of Tx1. Thus, if Alice does not want to give Bob the entire amount defined in UTXO0, she can use the remaining amount to give herself change or pay another party in the second output of Tx1.
[0069] In practice, Alice should usually also include a fee for the winning miner, because today, the reward of the generating transaction alone is usually not enough to motivate mining. If Alice does not include a fee for the miner, Tx0 will likely be rejected by the miner's node 104M, and thus, although technically valid, it will still not be propagated and included in the blockchain 150 (the miner's protocol does not force the miner 104M to accept the transaction 152 if the miner does not want to). In some protocols, the mining fee does not require its own separate output 203 (i.e., it does not require a separate UTXO). Instead, the difference between the total amount pointed to by the input 202 and the total amount specified in the output 203 of a given transaction 152 is automatically given to the winning miner 104. For example, suppose that a pointer to UTXO0 is the only input to Tx1, and Tx1 has only one output UTXO1. If the amount of the digital asset specified in UTXO0 is greater than the amount specified in UTXO1, the difference automatically goes to the winning miner 104M. However, nothing in this document precludes that a miner's fee may alternatively or additionally be explicitly specified in a unique one of the UTXOs 203 of transaction 152.
[0070] Alice and Bob's digital assets consist of the unspent UTXOs locked to them in any transaction 152 in the blockchain 150. Thus, typically, the assets of a given party 103 are distributed across the UTXOs of various transactions 152 throughout the blockchain 150. No single number is stored anywhere in the blockchain 150 that defines the total balance of a given party 103. It is the role of the wallet function in the client application 105 to aggregate the value of all the various UTXOs locked to each party that have not yet been spent in another onward transaction. This can be done by querying the copy of the blockchain 150 stored in any of the storage nodes 104S, for example, the storage node 104S that is closest or best connected to each party's computer device 02.
[0071] Note that script code is often expressed diagrammatically (i.e., not in a precise language). For example, A ] to [ChecksigP A ]=OP_DUPOP_HASH160 <H(P A)>OP_EQUALVERIFYOP_CHECKSIG. "OP_..." represents a specific opcode in a scripting language. OP_CHECKSIG (also called "Checksig") is a scripting opcode that takes two inputs (a signature and a public key) and verifies the validity of the signature using the Elliptic Curve Digital Signature Algorithm (ECDSA). At runtime, the occurrence of the signature ("sig") is removed from the script, but additional requirements such as a hash puzzle remain for transactions to be verified by the "sig" input. As another example, OP_RETURN is a scripting language opcode for generating an unspent output of a transaction that can store metadata within the transaction, thereby immutably recording the metadata to the blockchain 150. For example, the metadata can include a document that is desirable to store on the blockchain.
[0072] signature P A is a digital signature. In an embodiment, it is based on ECDSA using the elliptic curve secp256k1. A digital signature signs specific data. In an embodiment, for a given transaction, the signature signs some of the transaction inputs, and all or some of the transaction outputs. The specific parts of the outputs to sign depend on the SIGHASH flag, which is a 4-byte code included at the end of the signature that selects which outputs are signed (and is therefore fixed at the time of signing).
[0073] A lock script is sometimes referred to as a "scriptPubKey" to indicate that the respective transaction includes the public key of the party being locked. An unlock script is sometimes referred to as a "scriptSig" to indicate that it provides a corresponding signature. However, more generally, it is not required in all applications of blockchain 150 that the conditions under which a UTXO is redeemed include authenticating a signature. More generally, a scripting language may be used to define one or more conditions. Thus, the more general terms "lock script" and "unlock script" are preferred.
[0074] <Optional Side Channel> FIG. 3 illustrates a further system 100 for implementing a blockchain 150. The system 100 is substantially the same as described in connection with FIG. 1, except that an additional communication function is included. The client applications present on each of Alice's and Bob's computing devices 102a, 102b, respectively, include the additional communication function. That is, it allows Alice 103a to establish (at the solicitation of either party or a third party) a separate side channel 301 with Bob 103b. The side channel 301 allows for the exchange of data separately from the P2P network. Such communication is sometimes referred to as "off-chain". For example, it may be used to exchange transactions 152 between Alice and Bob without the transaction being (yet) published to the network P2P 106 or on the chain 150 until one of the parties chooses to broadcast the transaction to the network 106. Alternatively or additionally, the side channel 301 may be used to exchange data related to any other transaction, such as keys, amounts or terms to be negotiated, data content, etc.
[0075] The side channel 301 may be established over the same packet-switched network 101 as the P2P overlay network 106. Alternatively or additionally, the side channel 301 may be established over a different network, such as a local area network, such as a mobile cellular network, or a local wireless network, or a direct wired or wireless link between Alice and Bob's devices 102a, 102b. In general, the side channel 301 referred to anywhere in this specification may include any one or more links over one or more networking technologies or communication media for exchanging data "off-chain", i.e., separately from the P2P overlay network 106. When more than one link is used, the bundle or collection of off-chain links as a whole may be referred to as the side channel 301. Thus, it is noted that when Alice and Bob are said to exchange certain information or pieces of data, etc., over the side channel 301, this does not necessarily mean that all of these pieces of data need to be transmitted over exactly the same links or the same type of network.
[0076] <Node software> FIG. 4 illustrates an example of node software 400 that may be executed by each node 104 of the P2P network 106 in the example UTXO or output based model. The node software 400 includes a protocol engine 401, a script engine 402, a stack 403, an application level decision engine 404, and a set of one or more blockchain related functional modules 405. For any given node 104, these may include any one, two, or all three of the mining module 405M, the forwarding module 405F, and the storage module 405S (depending on the node's role or roles). The protocol engine 401 is configured to recognize different fields of a transaction 152 and process them according to the node protocol. Transaction 152m (Tx m ) is received, and another preceding transaction 152m-1 (Tx m-1), the protocol engine 401 executes Tx m The protocol engine 401 then identifies the unlock script in the Tx m Based on the pointer in the input of Tx m-1 It identifies and searches for Tx m-1 If Tx is not already on the blockchain 150, each node can choose to use it from its own pool of pending transactions 154, or m-1 If Tx is already on the blockchain 150, the node can obtain Tx from a copy of block 151 in the blockchain 150 stored in the node or another node 104. m-1 In either case, the script engine 401 may search for Tx m-1 The script engine 402 then identifies the lock script in the output pointed to by the script.
[0077] The script engine 402 therefore m-1 Lock script and Tx m 4, but the same is true for any pair of transactions such as Tx0 and Tx1, etc. The script engine 402 executes the two scripts together as described above, which includes putting data on the stack 403 and retrieving data according to the script language (e.g., Script) based on the stack being used.
[0078] By executing the scripts together, the script engine 402 determines whether the unlock script meets one or more criteria defined in the lock script, i.e., whether it "unlocks" the output in which the lock script is included. The script engine 402 returns the result of this determination to the protocol engine 401. If the script engine 402 determines that the unlock script meets one or more criteria specified in the corresponding lock script, it returns the result "true". Otherwise, it returns the result "false".
[0079] In the output-based model, the result "true" from the script engine 402 is one of the conditions for the validity of the transaction. Typically, there are one or more further protocol-level conditions evaluated by the protocol engine 401 that must also be satisfied, and Tx m the total amount of Digital Assets specified in the Outputs of does not exceed the total amount pointed to by its Inputs; m-1 The output pointed to by the transaction Tx has not yet been consumed by another valid transaction, etc. The protocol engine 401 evaluates the result from the script engine 402 together with one or more protocol-level conditions, and if all of them are true, the transaction Tx m The protocol engine 401 outputs an indication of whether the transaction is valid to the application level decision engine 404. m 4. Provided only that the mining module 405M and / or the transfer module 405F are in fact verified, the decision engine 404 may then cause the mining module 405M and / or the transfer module 405F to perform their respective blockchain-related functions as Tx m This means that the mining module 405M may choose to control the execution of Tx m 4 of each of the nodes, and / or the forwarding module 405F mto another node 104 in the P2P network 106. Note, however, that in embodiments, the decision engine 404 does not choose to forward or mine an invalid transaction, but conversely, this does not necessarily mean that it must trigger mining or forwarding of a valid transaction simply because it is valid. Optionally, in embodiments, the decision engine 404 may apply one or more additional conditions before triggering either or both of these functions. For example, if the node is a mining node 104M, the decision engine may choose to mine a transaction only if the transaction is valid and if there are sufficient mining fees remaining.
[0080] It is noted that the terms "true" and "false" herein are not necessarily limited to returning a result expressed in the form of only a single binary digit (bit), although that is certainly one possible implementation. More generally, "true" can represent any state that indicates a successful or positive outcome, and "false" can represent any state that indicates an unsuccessful or non-positive outcome. For example, in an account-based model (not shown in FIG. 4), a "true" outcome can be indicated by a combination of an implicit protocol-level validation of the signature by node 104 and an additional positive output of the smart contract (the overall outcome is considered to convey true if both individual outcomes are true).
[0081] <Example transaction set> FIG. 5 illustrates a set of transactions 152 for use in accordance with embodiments disclosed herein. The set includes a zeroth transaction Tx0, a first transaction Tx1, and a second transaction Tx2. Note that “zeroth”, “first”, and “second” are merely labels for convenience. They do not necessarily mean that these transactions are immediately placed in block 151 or blockchain 150 one after the other, or that the zeroth transaction is the first transaction in block 151 or blockchain 150. Also, these labels do not imply anything about the order in which the transactions are sent to the network 106. They simply represent a logical series in which the output of one transaction is pointed to by the input of the next transaction. Recall that in some systems, it is possible for a parent to be sent to the network 106 after its children (in which case the “orphaned” children are buffered in one or more nodes 104 for a period of time while waiting for their parents to arrive).
[0082] The zeroth transaction Tx0 may be referred to as a source transaction for the purposes of the present invention and serves as a source of the amount of the locked digital asset to Alice 103a. The first transaction Tx1 may be referred to as a challenge transaction or puzzle transaction for the purposes of the present invention. It serves as an intermediary to conditionally transfer the amount of the digital asset from the source transaction Tx0, depending on the second transaction Tx2 providing a solution to the r-puzzle. The second transaction Tx2 may be referred to as a proof transaction or payment transaction, and is the transaction that provides the solution to the r-puzzle set in the first transaction Tx1 and locks the resulting payment to the prover (or, in some cases, the beneficiary represented by the prover). The embodiment may be illustrated with an example in which the prover (second party) will be Bob, but it will be recognized based on the discussion below that in fact the r-puzzle allows any second party to be a prover, regardless of their identity, as long as they provide a valid signature that solves the r-puzzle.
[0083] As shown in FIG. 5, source transaction Tx0 includes at least one output 2030 (e.g., output 0 of Tx0) that specifies an amount of digital assets, and further includes a locking script that locks this output to Alice 103a. This means that the locking script of source transaction Tx0 requires that at least one condition be met. This condition is that an input of any transaction that seeks to unlock the output (thus redeeming the amount of digital assets) must include Alice's cryptographic signature (i.e., using Alice's public key) in its unlocking script. In this sense, the amount defined in the output of Tx0 is said to be owned by Alice. The output may be referred to as a UTXO. It is not particularly important for the purposes of the present invention which previous transaction's outputs point to the input of Tx0 (as long as they are sufficient to cover the total output of Tx0).
[0084] In the present case, the transaction that unlocks the output of source transaction Tx0 is the first transaction Tx1 (the challenge transaction). Thus, Tx1 has at least one input 2021 (e.g., input 0 of Tx1) that further includes an unlock script requiring at least a signature from Alice, which includes a pointer to the relevant output of Tx0 (output 0 of Tx0 in the illustrated example) and is configured to unlock the pointed output of Tx0 according to the conditions defined in the lock script of that output. The signature from Alice required by the lock script of Tx0 is required to sign a specific part of Tx1. In some protocols, the part of Tx1 that needs to be signed may be a setting defined in the unlock script of Tx1. For example, this may be set by the SIGHASH flag, which is a byte that is appended to the signature. Thus, in terms of data, the unlock script is as follows: <Sig P A > <sighashflag><P A Alternatively, the parts that need to be signed may simply be a fixed or default part of Tx1. Either way, the parts to be signed may typically exclude the unlock script itself, and exclude some or all of the inputs of Tx1. However, the signed part of Tx1 will at least include output 2031, which contains the r-puzzle (see below, output 0 of Tx1 in this example).
[0085] The first transaction Tx1 has at least one output 2031 (e.g., output 0 of Tx1, where the output may again be referred to as a UTXO). The output of the first transaction Tx1 is not locked to any one party. Like Tx0, it has at least one output (e.g., output 0 of Tx1) that specifies the amount of digital assets to be transferred. The output further includes a locking script that defines what is needed to unlock the output and thus redeem the amount. However, this locking script can be unlocked by any party that provides a solution to the r-puzzle.
[0086] The second transaction (payment transaction) Tx2 has at least one input 2022 (e.g., input 0 of Tx2), which includes a pointer to the aforementioned output of Tx1 (output 0 of Tx1 in the illustrated example), and further includes an unlock script configured to unlock the output of Tx1 based on satisfying one or more requirements of the unlock script defined in the lock script of Tx1. According to an embodiment disclosed herein, the unlock condition includes at least a requirement that the corresponding unlock script includes a solution to an r-puzzle. The r-puzzle includes a challenge defined in the lock script of Tx1 based on the r-part of an elliptical curve cryptography (ECC) signature. This can be satisfied by any party (which happens to be Bob in this case) that includes their signature (or at least its s-part) in the unlock script of Tx2. Unlike the lock script of Tx0, any party's signature can be used to unlock the lock condition of Tx1 as long as it is a valid signature that satisfies the r-challenge (i.e., the r-puzzle). Examples of this will be discussed in more detail shortly. Although Bob is chosen here simply as an example of a prover or second party, r-puzzles actually allow any second party to be a prover, e.g., Charlie, Dora, Ezekiel, etc. In some embodiments, the unlock condition in Tx1 may also be made subject to one or more further conditions, e.g., requiring that Alice's signature be also included in the unlock script of Tx2.
[0087] The second transaction, Tx2, has at least one output 2022 (e.g., output 0 of Tx2) that specifies the amount of the digital asset to be transferred to Bob and a lock script that locks it to Bob (i.e., this requires that further, future transactions include Bob's signature in the unlock script in order to use it). In this sense, the output of the target transaction, Tx2, is said to be owned by Bob. This output may again be referred to as a UTXO.
[0088] The signature of the verifier (e.g., Sig P in Bob's case) B ) includes at least this output 2032, the output that locks the payment to the prover (in this example, output 0 of Tx2).
[0089] In an embodiment, it is possible for the lock script in output 2031 in Tx1 to define multiple alternative conditions for unlocking the output, such as multiple alternative r-puzzles. In this case, the unlock script in input 2022 of Tx2 will unlock the output of Tx1 if it meets any one of the alternative unlock conditions.
[0090] The zeroth (i.e., source) transaction Tx0 may be generated by Alice, a prover (e.g., Bob), or a third party. It typically requires a signature from the preceding party from whom Alice obtained a defined amount in the input of Tx0. It may be sent to the network 106 by Alice, Bob, the preceding party, or another third party.
[0091] The first transaction (i.e., challenge transaction) Tx1 may be generated by Alice, a prover (e.g., Bob), or a third party. In an embodiment, it may be generated by Alice since it requires Alice's signature. Alternatively, it may be generated by Bob or a third party as a template and then sent to Alice for signing, e.g., sent via side channel 301. Alice can then send the signed transaction to network 106 herself, or send it to Bob or a third party to forward them to network 106, or simply send her signature to Bob or a third party to be assembled into signed Tx1 and forwarded to network 106. Any off-chain exchanges prior to sending Tx1 to network 106 may be performed via side channel 301.
[0092] The second transaction (i.e., the attestation or payment transaction) Tx2 may be generated by Alice, a prover (e.g., Bob), or a third party. Since the first version requires a prover's signature and / or data, it may be generated by Bob. Alternatively, it may be generated by Alice or a third party as a template and then sent to Bob to be signed, e.g., sent to Bob via side channel 301. Bob can then send the signed transaction to the network 106 himself, or send it to Alice or a third party and forward them to the network 106, or simply send his signature to Alice or a third party to be assembled into a signed Tx2 and forwarded to the network.
[0093] It will be appreciated that there are a variety of locations where different elements of a transaction may be generated and configured, and a variety of ways in which they may be transmitted, directly or indirectly, to their ultimate destination in the P2P network 106. The scope of implementation of the disclosed techniques is not limited in any of these respects.
[0094] Phrases such as "by Alice," "by Bob," and "by a third party" are sometimes used herein as shorthand for "by Alice's computing device 102a," "by Bob's computing device 102b," and "by a third party's computing device 102," respectively. It is also noted that the equipment of a given party may include one or more user devices used by that party, or several server resources, such as cloud resources, utilized by that party, or any combination thereof. It does not necessarily limit operations to being performed on a single user device.
[0095] <ELIPTICAL CURVE DIGITAL SIGNATURE ALGORITHM (ECDSA)> Public key cryptography is used as the basis for securing transactions in many different blockchain architectures. Uses of public key cryptography include public key encryption and digital signature schemes. Public key cryptography is based on the principle that certain functions are easy to compute but difficult to reverse without some specific knowledge. Such functions are called trapdoor functions, and the specific knowledge required to reverse them is called the trapdoor of the function. Easy to compute means that it is computationally feasible to compute the trapdoor function in a reasonable time frame for a given input (or set of inputs), and difficult to reverse means that it is computationally infeasible to infer the input (or inputs) from the result without knowledge of the trapdoor.
[0096] In the context of public key cryptography, a key pair means a public key (which is freely available to anyone) and a corresponding private key (which is assumed to be secret, in the sense that it is known only to a particular entity or group). The public key defines a trapdoor function, and the corresponding private key is the trapdoor needed to reverse the function.
[0097] In the context of public key cryptography, encryption is based on a trapdoor function (i.e., encryption is performed "forward"), while decryption is based on the inversion of the trapdoor function, which is only feasible if the trapdoor is known (i.e., decryption is performed "backwards").
[0098] In the context of digital signatures, signature verification is performed in the forward direction using the public key, while signature generation is performed in the reverse direction and can only be performed using the private key.
[0099] In the context of blockchain, digital signatures based on public key cryptography are used as the basis for cryptographically signing transactions and for verifying transaction signatures.
[0100] ECC is a form of public key cryptography that exploits the mathematical properties of elliptic curves and has various advantages over other cryptographic schemes such as DSA (Digital Secure Algorithm).
[0101] "Elliptic Curve Digital Signature Algorithm (ECDSA)" refers to a class of digital signature schemes that use ECC as the basis for digital signature generation and verification. The specific principles of ECDSA are outlined below.
[0102] In mathematical terms, ECC exploits the algebraic structure of elliptic curves over finite fields of prime order. A finite field means a finite set of elements and a set of associated operations of multiplication, addition, subtraction, and division that satisfy the usual rules of arithmetic (associative, commutative, etc.) when applied to elements in the set -- that is, operations that do not involve addition, multiplication, etc. in the "usual" sense, but which behave essentially the same way.
[0103] Elliptic Curve Arithmetic: In the context of ECC, the addition, subtraction, and multiplication operations are respectively elliptic curve point addition, denoted herein by "+", elliptic curve point subtraction, denoted herein by "-", and elliptic curve point multiplication, denoted herein by "·". The addition and subtraction operations are each applied to two points on an elliptic curve and return a third point on the elliptic curve. However, the multiplication operation is applied to a scalar and a single point on the elliptic curve and returns a second point on the elliptic curve. In contrast, division is defined on scalars.
[0104] For illustrative purposes, FIG. 6A is a collection of all real-valued two-dimensional coordinates.
number
number
number
[0105] Addition: The mathematical property of ε is that given any two points A, B on an elliptic curve ε, the line that intersects A and B intersects again at only one additional point, denoted ε and C; the elliptic curve addition of A and B, i.e., A+B, is defined as the "reflection" of C, and if one takes a horizontal line that intersects C, the reflection of C is the other point on the elliptic curve where the line intersects. This definition holds true when A=B, with the modification that the point where the tangent to ε at A intersects ε again is C. This definition holds true when the line that intersects the two points is perpendicular, by defining the point at infinity, denoted ∞, as the point on the elliptic curve where any vertical line intersects the elliptic curve (e.g., the points labeled D and E are vertically and horizontally aligned, so D+E=∞).
[0106] Subtraction / additive inverse: The above definition of reflection can be applied to any point, providing the definition of elliptic curve point subtraction. AB is the sum of A and the reflection of B. The reflection of B is more formally called the "additive inverse" of B, denoted as -B. Using this notation, elliptic curve subtraction can be defined in mathematical notation: AB=A+(-B)
[0107] Now, in Figure 6B, C = -(A+B) and (A+B) = -C. Note also that under this definition, D = -E, reflecting a general rule of algebraic construction: the elliptic point convolution of any point on an elliptic curve with its converse is a point at infinity. That is, A+(-A)=∞ ∀A∈E
[0108] The point at infinity, ∞, is more formally called the "identity" (noting both a parallelism and a deviation from normal arithmetic: in normal arithmetic, the sum of any number a and its additive opposite, -a, is 0, and 0 is the identity of normal arithmetic). Another property of the identity, ∞, that mirrors normal arithmetic, is that for any point A on ε, including ∞ itself, A+∞=A (similar to the statement a+0=0 for any real number a).
[0109] Multiplication: From the definition of elliptic curve point addition, the definition of elliptic curve scalar multiplication is as follows. Multiplication of an elliptic curve point A by an integer v is defined as:
number
[0110] That is, v elliptic curve point additions of A with itself.
[0111] Note: Elliptic curve scalar multiplication is also conventionally called elliptic curve point multiplication. These two terms have the same meaning in this disclosure.
[0112] Division / multiplicative Inverse: The inverse of division is defined in terms of scalars. Given a scalar v, the "multiplicative inverse" is the scalar v -1 which results in: vv -1 =1
[0113] Figure 6A provides an intuitive visualization of the above operations, where ε is a full real number:
number
[0114] FIG. 6B shows an elliptic curve ε defined by n This shows more precisely how the above operations are actually applied in the context of ECC:
number
[0115] where p is a prime number (prime modulus) and mod denotes modulo arithmetic. The set of points that satisfy the above equation is finite, and all but one of these points are shown in Figure 6B as open circles; the remaining points are the identity element ∞.
[0116] The prime number p forms part of the definition of an elliptic curve and can be chosen freely. For an elliptic curve to have good cryptographic properties, p must be sufficiently large. For example, a p of 265 bits is specified in certain blockchain models.
[0117] The subscript “n” here denotes the order of the group formed by the elliptic curve points under point addition defined above (simply put, this is the order of the elliptic curve ε n (This may be called the order of .) See below.
[0118] In other words, n is the order of the group and p is the order of the field. There are a total of n elliptic curve points. Each point on the elliptic curve is represented by two numbers / coordinates (x,y), where x and y are all in the range -(p-1),…0,…,(p-1).
[0119] ε in Figure 6B n is the ε in Figure 6A n This is a general property of elliptic curves over prime files, so ε n The definition of the negative of a point above still applies. Some points do not have a horizontally aligned mirror point (e.g., (0,0)). Such points are their own negative.
[0120] ε n A line that intersects with the two points A and B above A,B becomes a finite set of points, denoted by the small black circles, that satisfy similar geometric requirements, and the definition of elliptic curve scalar multiplication still applies. Similar to Figure 6A, Figure 6B shows the point A+B=-C, which is the additive inverse of the point C=-(A+B), where the line l A,B is ε n and intersect again.
[0121] ε n The elliptic curve addition of the above two points A+B=-C can be defined algebraically by the following formula:
number
number
[0122] That is, the multiplicative reciprocal of an integer v is the modular reciprocal of v mod p.
[0123] The case B=-A is special and can be solved by introducing the identity ∞, as shown above, in which case A+B=A+(-A)=∞. The case B=∞ is also special and can be solved by writing A+∞=A, as shown above.
[0124] The definition of elliptic curve scalar multiplication adopts this definition of elliptic curve addition and otherwise remains the same.
[0125] In other contexts, the multiplication of the related scalar v by its opposite v -1 The definition is:
number
[0126] It is clear from the context whether the multiplicative reciprocal is defined mod n or mod p.
[0127] In practice, to identify whether a number should be treated as mod n or mod p, the following checks may be applied: (1) Is it a number that represents the coordinates of an EC point? a) If yes, then mod p (2) Is it a number used to multiply the EC points? a) If yes, then mod n Note that it is possible that both checks give a positive result, in which case the number must be mod p and mod n.
[0128] <Elliptic Curve Cryptography (ECC)> Elliptic curve arithmetic offers the unique ability to obfuscate secret values and forms the basis of many modern cryptosystems. In particular, inverting scalar multiplication of elliptic curve points over finite fields is an extremely hard problem (computationally infeasible to perform).
[0129] The private key V takes the form of an integer, and the corresponding public key P is a function of the elliptic curve ε n The elliptic curve ε is derived from the generator point G on n is a point P on the
number
[0130] where "·" is the elliptic curve ε defined by a, b, and n (elliptic curve parameters). n Here we show the above elliptic curve scalar multiplication.
[0131] For a sufficiently large V, it is difficult, i.e., computationally infeasible, to actually perform V elliptic curve additions to derive P. However, if V is known, P can be computed much more efficiently by exploiting the algebraic properties of elliptic curve arithmetic. An example of an efficient algorithm that can be used to compute P is the "Double and Add" algorithm. Crucially, this can only be done if V is known.
[0132] Conversely, if V is unknown, then there is no computationally feasible way to derive V (i.e., reverse the scalar multiplication), even if both G and P are known (this is the so-called "discrete logarithm problem"). An attacker could try to "brute force" break P by starting with G and repeatedly performing elliptic curve point additions until he obtains P. At this point, the attacker knows V is the number of elliptic curve point additions he must perform, but knows that it is computationally infeasible. Thus, V satisfies the trapdoor requirement in the sense described above.
[0133] In ECC, a public key P, a generator key G, and an elliptic curve ε n is assumed to be publicly known, while the private key V is secret.
[0134] <Elliptic Curve Digital Signature Verification Algorithm (ECDSA)> In a blockchain system, a user or other entity typically holds a private key V that is used to prove their identity, and a corresponding public key P can be calculated by: P=V G A private key V can be used to sign a piece of data m (a “message”) using ECDSA.
[0135] Further details on ECDSA are provided in the following document, “RFC6979-Deterministic Usage of the Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)”, Tools.ietf.org, 2019, which is incorporated herein by reference in its entirety.
[0136] 6C shows a simplified functional block diagram of a signature generation function (signature generator 600) that generates an ECDSA signature (r, s) for a public-private key pair (V, P). The ECDSA signature is a pair of values, referred to herein as the r-part (r) and s-part (s), respectively.
[0137] The signature generation is performed on the same elliptic curve ε that was used to derive the public key P. n and the generator G. Thus, the elliptic curve parameters a, b, and n, as well as the generator G, are shown as inputs to signature generator 600.
[0138] A temporary key generator 602 of signature generator 600 generates a "temporary" key k∈[1,n-1], ie, in the range 1 to n-1 inclusive.
[0139] The r-part generator 604 computes the corresponding ephemeral key from k as follows:
[0140] R = k G Next, we take in the x-coordinate of the point to be calculated (see the process for taking in the x-coordinate of the elliptic curve point [] x by).
[0141] r=[R] x The above expression is the r part of the signature.
[0142] The s-part generator 606 generates the modular inverse k of k mod n. -1 Calculate the s part of the signature using (i.e., see above):
number
number
[0143] In this example, message m includes the date to be included in transaction 608 (in this example, one or more transaction outputs). This may be referred to as signing message m, and message m may be referred to as the signed portion of the transaction.
[0144] The message m and the signature (r, s) also form part of the transaction 608. In this example, the signature (r, s) is included in the input of the transaction 608 as part of the unlock script.
[0145] 6D shows a simplified functional block diagram of a signature verification function (signature verifier) 620 that verifies transaction 608. Note that the calculations performed by signature verifier 620 are performed over the same publicly available elliptic curve ε n and based on generator G.
[0146] Although a signature requires the private key V as input, i.e., its knowledge in order to generate a valid signature, to verify a signature (r,s) only the signature pair (r,s), the message m, and the public key P are needed. To verify a signature, the signature verifier 620 hashes the signed portion of the transaction m (applying the same hash function H that was used to generate the signature (r,s)). The verification process is then performed using the following calculation:
number
[0147] [R'] x The signature is valid (i.e., the signature verifier succeeds) if and only if =r. Otherwise, it is invalid (i.e., signature verification fails). In this example, r denotes the r portion of the signature included in transaction 608.
[0148] The public key P used in the signature verifier process is specified, for example, in the lock script of the preceding transaction. In this case, signature verification is performed using the public key specified in the lock script of the preceding transaction, the signed part m of the (later) transaction 608, and the signature (r, s), and will fail unless the signature (r, s) was generated based on the private key V corresponding to the public key P specified in the preceding transaction and the signed part m of the subsequent transaction 608. Therefore, if the private key V is retention Only a party that has signed the transaction can claim the output of the preceding transaction (typically by including their own public key in the output of the later transaction 608), and the signed portion m of the later transaction 608 cannot be altered without invalidating the signature (R,S).
[0149] R Puzzle The following describes a new form of proof of knowledge based on ECDSA. By way of illustration, the challenger is a first party, Alice, who sets up an r-puzzle in a first transaction, Tx1, by generating Tx1 herself and publishing it to the P2P blockchain network, or by providing a third party with the necessary details to configure and publish Tx1. The verifier (the party that actually performs the proof) is an operator of a node 104 in the network, e.g., a miner. Solution is provided by publishing Tx2 to the network 106. As the r-puzzle is not inherently tied to an identity, the prover can be any second party. However, by way of example, the following may be described in terms of a scenario where the prover happens to be Bob. The prover may generate and publish Tx2 himself, or may provide the necessary details to a third party to compose and publish Tx2.
[0150] Cryptographic hash functions provide a means to deterministically obfuscate an input, where small changes in the input result in unpredictable changes in the output. Classic hash functions include MD5, RIPEMD-160, SHA-1, and SHA-256[5]. These provide the following properties, respectively: collision resistance (the probability of finding two inputs that produce the same output is extremely small) and preimage resistance (given a hash value h=H(d), it is extremely difficult to find an input d).
[0151] A traditional hash puzzle can be set up as follows: The idea is to set up a first transaction, Tx1, that allows its output to be redeemed by a second transaction, Tx2, provided that the second transaction, Tx2, includes some specific piece of data in its inputs.
[0152] In a blockchain transaction, a first party (Alice) may simply create a non-standard transaction Tx1 using the hash value h in a lock script as follows: OP_HASH160 <h>OP_EQUALVERIFY Here, h=H puz (d) and H puz is the hash function used in the puzzle (in the example above, according to the lock script, this hash function must be HASH160, but other forms of hash functions may be used in other implementations). Redeeming a UTXO containing this lock script requires the hash puzzle solution to be in the unlock script of a later transaction. Thus, a payment transaction Tx2 for a second party with address Addr_Bob can be constructed whose unlock script only needs to contain d. [Table 1]
[0153] Where TxID i Tx i is the transaction ID of Tx1. The lock script states: take the data value d from the unlock script in the input of Tx2, hash it, and check if it is equal to the hash value h contained in the lock script in the output of Tx1. Thus, the output is unlocked by providing d in the unlock script of Tx2.
[0154] In this naive example, after learning of the user's transaction with the hash puzzle solution in Tx2, the miner who first received this transaction could maliciously reject the transaction and generate a new malleated version Tx2* with the same solution to the hash puzzle but changing the output to their own address Add_Miner. The malicious miner could then mine Tx2* by himself into block 151. If they succeed in mining Tx2* before Tx2 is mined, the malicious miner will receive the payment on Bob's behalf. [Table 2]
[0155] Digital signatures are commonly used in blockchain transactions to prove ownership and redeem unspent transaction outputs (UTXOs). This allows a transaction output, such as Tx1, to be locked to a specific party. The most common example is a pay-to-public-key-hash (P2PKH) transaction, where the transaction output is locked to a specific hash of a public key (which also serves as the address of that party). The locking script for public key P is: OP_DUP OP_HASH160 <h P > OP_EQUALVERIFY OP_CHECKSIG
[0156] Here, h P =H sig (P) and H sig is the hash function used in the signature (in the example above, according to the lock script, this hash function must be HASH160, but other implementations may use other forms of hash functions). In order to be able to use this UTXO as input to another transaction, we need to provide an unlock script with a valid ECDSA signature using P: <sig>
[0157] The whole string (unlock + lock script) is evaluated by the miner, who checks if the correct public key is provided and that the signature is valid and corresponds to P. The lock script basically states the following: it takes the public key P from the unlock script in the input of Tx2, hashes it, and returns the hash value h that is included in the lock script in the output of Tx1. P and further verifies the signature sig using the public key P from the unlock script in Tx2 based on the ECDSA verification function, given knowledge of the signed portion of Tx2. The ECDSA verification function is called with the OP_CHECKSIG opcode.
[0158] Therefore, the output can only be unlocked by providing a valid signature sig, signed under the private key V corresponding to P, in the unlock script of Tx2.
[0159] Combined with the hash puzzle, the vulnerability described above can be fixed by requiring a digital signature from the intended recipient along with the hash puzzle solution. A lock script can be constructed as follows: OP_HASH160 <h>OP_EQUALVERIFY OP_DUP OP_HASH160 <h P > OP_EQUALVERIFY P_CHECKSIG
[0160] The corresponding unlock script looks like this: <sig>< / sig> < / h> <d>
[0161] However, this limits who can redeem it to the owner of the public key P. Now, we realize that this may be undesirable in some applications, for example if we want to retain the ability to select the signing authority only after Alice has set up the puzzle.
[0162] Here, we can see that the hash puzzle function can be emulated by using the r part of the ECDSA signature, which can be a temporary random value. The ECDSA signature consists of two parts, r and s. As we can see above, r = [k G] x Instead of the traditional hash puzzle h=H(d), the inverse difficulty of elliptic curve addition can be used to form a similar puzzle, referred to herein as the r-puzzle. To solve the puzzle, one needs to obtain a solution value k, where k is an ephemeral key corresponding to r.
[0163] In a traditional hash puzzle, there is a risk of disclosing d on the blockchain when solving the puzzle. However, in an r-puzzle, k is never revealed. Instead, r is revealed, and knowledge of k can be proven from r along with the signature.
[0164] Since k must be a fixed size, but the preimage data for a hash puzzle can be of any length (and one feature of a hash function is that it outputs a fixed-length value regardless of the length of the input data), to emulate the hash puzzle function, the generator of an r-puzzle may first hash some other preimage data to obtain a value k. For example, if a 256-bit long secret / ephemeral key is used, then the preimage data for the r-puzzle must be hashed to obtain k. Alternatively, however, some suitable length value of k can simply be chosen and used as the secret value directly in its own right (i.e., without the need to derive it from some other preimage).
[0165] This method can be used with any blockchain system that uses ECDSA signatures for spending. For illustration, the following describes an example implementation in a UTXO-based model. In the scripting language, the OP_CHECKSIG opcode requests a signature and a public key on the stack (the public key on the top of the stack, and the signature just below it). For an r-puzzle, the script is configured to check if the r value in the provided signature is the same as the one used to raise the r-puzzle challenge. In other words, the script not only checks that the signature is valid based on the public key (through OP_CHECKSIG), but also verifies that the signature was generated using the r value of an r-puzzle that has been previously published on the blockchain.
[0166] Some example implementations of r-puzzles are discussed below with reference to Figures 7-10. In each case, a prover, say Bob, generates a signature (r,s) by signing a portion of Tx2. This form of signature is sometimes called a "sig". In the context of cryptographic signatures, the signed portion is also called a "message" (m). The signed portion (message) m includes at least the output of Tx2 that locks the resulting payment to Bob. If there is more than one output, m may include some or all of the outputs. m may also include other parts, such as a locktime, if used; however, it excludes the unlock script itself (and, of course, at least, the signature itself). The portion of Tx2 to be signed as message m is set by Sighash or is a default, and Mala can also be a fixed feature of the protocol.
[0167] Perhaps the simplest implementation of the r-puzzle is shown in FIG. 7. The lock script in Tx1 contains a reference instance or r portion, here labeled r'. In this way, the unlock script in Tx2 need only contain at least the s portion (s) of Bob's signature. It may also contain the public key P that corresponds to the private key V that Bob used to sign m. The lock script in Tx1, when executed by the script engine 402 on node 104, is configured to take s and P from the unlock script in Tx2 and perform the following operations:
number
[0168] where r' is taken from the lock script of Tx1, and s and m are taken from the unlock script of Tx2. Bob's public key P may also be taken from the unlock script of Tx2 or may be known by other means. H sig is the hash function used to hash m in generating the first ECDSA signature. It may be any type of hash function. Whatever its type, the type of hash function may be considered to be known to both parties. G is a fixed, publicly known vector value.
[0169] The lock script is configured to return a "true" result conditional on the above check being true, and a "false" result otherwise. In the case of UTXOs, a true (i.e., successful) result of executing the lock together with the unlock script is a requirement for the validity of the transaction. Thus, the validity of Tx2 can be used as a proxy for the outcome of the r-puzzle. Or, alternatively, the validity of Tx2 is conditional on providing a solution to the r-puzzle. That is, if Bob does not pass the r-puzzle, his transaction Tx2 will not be propagated across the network 106 and will not be recorded in the blockchain 150 (any payment defined in the output of Tx1 will not be redeemed).
[0170] While the example in Figure 7 is the simplest in a mathematical sense, this does not necessarily mean that it is the simplest to integrate with any given node protocol or scripting language.<r,s> and< / d> Instead, in the unlock script <s> and< / s> <s>If you provide only one, your script must accommodate this. Operations I)-II) are not standard Checksig type opcode operations. The OP_CHECKSIG opcode expects the signature to be in DER format, so <s>If only values were provided in the unlock script, then there would need to be some additional opcodes in the lock script (such as OP_CAT for concatenation) to generate a valid signature in DER format. Figure 8 briefly describes and shows an example of a simpler alternative that, mathematically speaking, involves additional steps, but in practice, integrates with a scripting language such as Script that already has dedicated opcodes to invoke ECDSA signature verification based on r and s, both taken from the inputs of Tx2.
[0171] We also note that it is not essential to include P in Tx2 in all possible embodiments. Indeed, from knowledge of the message m and (r,s) or (r',s) in this case, it is possible to compute two possible values of the public key P and -P (but not know which is which). The two verifications can then be used to identify which is the correct one. Or alternatively, a one-bit flag can be included in Tx2 to signal which of the two possible solutions should be used. This latter approach is currently used in some account-based protocols. However, it tends not to be used in current UTXO-based protocols, where the scripting language (e.g., Script) does not have opcodes for the operation to compute P and -P from (r,s) and m. However, it should not be excluded that the operation could be explicitly coded or introduced in the lock script. Another possibility is that Alice already knows or has access to P or receives it via a side channel 301. However, that requires another lookup to map P to Tx2.
[0172] Another example implementation is shown in FIG. 8, where the r-puzzle requires that the unlock script of Tx2 explicitly includes the submitted instance r of the r part. The lock script of Tx1 includes a test on the r part, where the reference instance r' of the r part is compared against the submitted instance r. In this way, the unlock script in Tx2 must include at least the r part (r) and the s part (s) of Bob's signature. It may also include the public key P that corresponds to the private key V that Bob used to sign m. The lock script of Tx1, when executed by the script engine 402 at the node 104, is configured to take r, s, and P from the unlock script of Tx2 and perform the following operations:
number
[0173] where r' is taken from the lock script of Tx1, and s, r, and m are taken from the unlock script of Tx2. Bob's public key P may also be taken from the unlock script of Tx2 or may be known by other means, e.g., derived from (r,s) and m, or may be (r,s) and m as above.
[0174] The lock script is configured to return a result of "true" on condition that both checks of steps I) and II) are true, and a result of "false" otherwise. Even when based on UTXO, this allows the validity of a transaction to be determined depending on the outcome of the r-puzzle proof of knowledge. Note that the numbers I-III do not necessarily imply an order: III) must be performed after II), while check I) can be performed before or after II)-III).
[0175] In the method of Figure 8, steps II) and III) are solely conventional operations performed by the ECDSA verification function. In most protocols, they are therefore invoked by dedicated opcodes such as the existing Checksig opcode (OP_CHECKSIG) in Script. Step I) can be coded separately in the lock script using a generic opcode (an example is given below). It is not excluded in principle that steps II) and III) could be explicitly coded using generic opcodes instead of using a dedicated opcode like Checksig.
[0176] In one exemplary transaction protocol, transaction ECDSA signatures use the Abstract Syntax Notation One (ASN.1) Distinguished Encoding Rules (DER) encoding format, as shown in Figure 12. The first byte field contains a flag 0x30 indicating the ASN.1 sequence number. The next byte field contains the length of the sequence in hexadecimal. The third byte field contains a flag 0x02 indicating an ASN.1 integer. After that, the r value of the ECDSA signature is contained in the next 32 or 33 bytes. The field should be 32 bytes, but if the first byte of r is greater than 0x7f (the first bit is 1), an additional byte of zero is prepended to the r value to make it 33 bytes long. This is done as a result of the DER format encoding interpreting the first bit of the integer as the signature. The additional byte of zero is prepended to the beginning of the value so that it is not interpreted as a negative value. The same is done for the s value of the ECDSA signature. Finally, a one-byte field, hash type (ht), is added to the DER encoding, which corresponds to the type of Bitcoin signature in the transaction (SIGHASH_ALL, SIGHASH_NONE, etc.).
[0177] Consider the case where Alice (A) wants to generate an r-puzzle transaction that can be used by anyone who obtains the solution to the puzzle. To achieve this, she generates a new transaction Tx1, as shown in the example below. The input part contains the unlock script of the previous transaction Tx0 that has been used. For simplicity, we assume that it is a standard P2PKH used with Alice's signature and public key. The output part contains the lock script (script public key), or in other words the r-puzzle challenge. As shown in Figure 12, the signature may use the DER encoded format in some protocols. Thus, the script extracts the value of r from the encoded signature and then <r>Then the script must check that the signature is valid based on the public key. A more detailed explanation of how the script works is shown in Figure 5. The opcode in bold is basically how to extract r from the signature. [Table 3]
[0178] The corresponding unlock script is shown below, where the signature sig r uses r, and the payer Bob (B) can compute the signature using any private / public key pair. sig r Note that is (r,s). <P B > <sig r >
[0179] Figure 13 shows the step-by-step analysis of the script.
[0180] The ephemeral key k may be generated by Alice and given to Bob (and optionally one or more other possible provers). Alternatively, k may be generated by Bob and given to Alice to set up an r-puzzle that only Bob (or someone Bob chooses to share k with) can solve. In either case, the prover Bob must trust that the sender Alice knows the solution (k) to the r-puzzle and will not use the transaction herself. To prevent this, the prover Bob may generate a puzzle and send the r-value to Alice for use when she creates the r-puzzle transaction. Bob can then redeem the output at a later date with any private / public key pair, as long as he holds the value k, which is the solution to the r-puzzle and can be seen as a form of key. On the other hand, in some cases, the fact that Alice knows k can be an advantageous feature. For example, it can be used to generate atomic swaps, which are generalized through it to generate private key puzzles.
[0181] 9 shows another example of r-puzzle, which, similar to pay to public key hash (P2PKH), is named herein as "pay to r-puzzle hash (P2RPH)". For added security and privacy, the r value can be hashed before being placed in Tx1 (which is propagated through nodes 104 of network 106 and placed on the blockchain 150). Similar to P2PKH, r-puzzle does the same thing, where only the hash of the public key is on the blockchain, and not the public key itself.
[0182] Again, the r-puzzle requires that Tx2's unlock script contains the submitted instance r of part r. Tx1's lock script again contains a test on part r, but this time in the form of a compressed instance of part r in the form of a hash of r', i.e., h=H(r'). This is compared against the submitted instance r. In this manner, the unlock script in Tx2 must again contain at least the r part (r) and the s part (s) of Bob's signature. It may also contain the public key P that corresponds to the private key V that Bob used to sign m. Tx1's lock script, when executed by the script engine 402 at node 104, is configured to take r, s, and P from Tx2's unlock script and perform the following operations:
number
[0183] Here, h is taken from the lock script of Tx1, and s, r, and m are taken from the unlock script of Tx2. The hash value h=H puz (r), where H puz is the hash function used in the hash-of-r puzzle. It can be any form of hash function. It is sig It may be the same or a different form of hash function as H. puz may be considered to be known to both parties in due course. Bob's public key P may also be taken from Tx2's unlock script or may be known by other means, e.g., derived from (r,s) and m, or may be (r,s) and m as above.
[0184] The lock script is configured to return a "true" result if both checks in steps I) and II) are true, and a "false" result otherwise. Check I) can be performed before or after II)-III), while III) must be performed after II).
[0185] Again, as in Figure 8, steps II) and III) are solely conventional operations performed by the ECDSA verification function. In most protocols, they are therefore invoked by dedicated opcodes such as the existing Checksig opcode (OP_CHECKSIG) in Script. Step I) can be coded separately in the lock script using a generic opcode.
[0186] An example of a lock script in a transaction challenge Tx1 is shown below. [Table 4]
[0187] Any type of hash function that is consistent between both the sending and receiving parties may be used, however, in keeping with the P2PKH standard, we use OP_HASH160, a double hash of SHA-256, and RIPEMD-160.
[0188] The corresponding unlock script is shown below (same as in the previous section), where the signature sig r uses r, and the payer Bob (B) can compute the signature using any private / public key pair. <P B > <sig r >
[0189] Thus, the example in Figure 9 is similar to that in Figure 8, except that instead of the untransformed instance of r, a hash of the r portion is used as the basis for the r-challenge.
[0190] Note that in any of these cases, Tx1's unlock script imposes additional criteria for a "true" result. Examples could be a lock time or a requirement for an additional signature.
[0191] An illustrative use case for any of the above techniques is a general knowledge challenge. Consider any challenge with some solution k, or any solution that hashes to k. Alice generates r puzzles that are combined into a puzzle. That is, she generates r = [k G] x can be defined.
[0192] As an example, Alice is a mathematics professor. She can compose an r-puzzle transaction Tx1, where the underlying k value is the solution to the mathematics problem that students are encouraged to solve. Whoever manages to come up with the solution can use it to generate a signature (r,s) and thus claim the reward, where r matches a value in the lock script. The signature not only provides authenticity but also acts as a proof of knowledge of the solution without disclosing the solution to anyone else. Thus, r-puzzles provide a secure mechanism to generically prove knowledge or information of any solution without risking exposing it. It elegantly reuses the signature required in the unlock script and allows any public key P to be used, allowing whoever finds the solution to claim the reward with privacy.
[0193] This scheme can also be used as a form of token or digital ticket. For example, an event organizer can issue different values of k to attendees as digital tickets. When attendees want to attend the event, they can prove knowledge of the secret token through the use of the r puzzle.
[0194] As another illustrative use case, r-puzzles can be used as a signing authorization scheme where one party can delegate the right to sign to another party. Consider an r-puzzle transaction Tx1 that can only be unlocked if a signature with a matching r value is provided to the locking script. This can be done by adding a signature with a matching r value k, where [k G]. x = r, meaning that only someone who knows k can generate such a signature. However, if a person passes knowledge of k to someone else, this effectively gives that other person the right to sign on his or her behalf.
[0195] For example, say Alice wants to receive a delivery. She is concerned that she may not be there to receive the delivery. She gives copies of k to both Bob and Charlie so that they can receive the delivery on her behalf. If Dave is delivering the package, she must get a signature with the expected r value in order to release the package to Bob.
[0196] In such a scenario, k can be thought of as an ephemeral private key and r as an ephemeral public key, behaving similarly to V and P, respectively, except that k and r are not linked to any particular identity.
[0197] <JOINT-VALUE r puzzle> As an extension to the hashed r-puzzle (P2PKH) in Figure 9, (h = H puz It is possible to include an additional value d that is concatenated with r before hashing (to get r||d). In that case, the prover (say, Bob) must not only solve the r puzzle, but also know d. An example of this is shown in Figure 10.
[0198] The lock script of Tx1, when executed by the script engine 402 at node 104, is configured to take r, s, P, and d from the unlock script of Tx2 and perform the following operations:
number
[0199] r||d denotes the concatenation of r and d, in either order (r first or d first). An example of a lock script in a challenge transaction Tx1 is shown below. [Table 5]
[0200] The corresponding unlock script is shown below (same as in the previous section except for the inclusion of d). Signature sig r P B uses r, and the prover Bob (B) can compute the signature using any private / public key pair. <sig’><P B > <d><sig r >
[0201] The additional signature sig' is an added feature for security (see the section on optional security features below), but this is not required in all possible implementations.
[0202] An example use case may be a CLTV Linked R-Puzzle. In this case, a data value d may be a time value t linked to a Check Lock Time Verify (CLTV) transaction output. The motivation behind this is to hide the time t, before which the output cannot be used in the P2RPH hash, linking it to the r-puzzle. In that case, the prover (e.g. Bob) must not only solve the r-puzzle, but also know t and must wait until a certain time to use it. An example of a lock script within a transaction is shown below: [Table 6]
[0203] The corresponding unlock script is shown below, where the signature sig r P B uses r, and the payer Bob (B) can compute the signature using any private / public key pair. <sig’><P B > <t><sig r >
[0204] The additional signature sig' is an added feature for security (see the section on optional security features below), but this is not required in all possible implementations.
[0205] The above has been described in terms of concatenation. However, it is possible to generalize this to a particular function f(r,d). For example, f could be the sum of r and d, e.g. <r> <d>It can be implemented as OP_ADD.
[0206] <Multiple r-value statements> Another possibility is to have multiple predefined values of r, for example r1, r2, and r3, that are associated with and unlock different statements. i Each r i , we assign the corresponding r i By using a 'signature', a specific statement can be acknowledged. For example, it may be used to sign to indicate acceptance of one or more alternative possible items of agreement.
[0207] It is possible to configure a lock script that checks which r value is used in the unlock script, and can assign an interpretation to the value of r. A lock script that implements the above ideas might look like this:
number
[0208] All<statement i> should be replaced by a different lock condition that can only be accessed after solving the corresponding r puzzle. The unlock script is shown below, where r i are the different r values required to access the set statement. <sig’>< / d> < / r> < / t> < / d> < / r> < / s> < / s> <s> <s><sig ri >
[0209] The additional signature sig' is also, here, an optionally added feature for security (see below). However, this is not required in all possible embodiments.
[0210] <r-puzzle forward chain> Consider a series of transactions where the sufficient condition for consuming transaction Tx(i + 1) is the same knowledge as required by the consumption condition of transaction Tx(i), and one additional piece of knowledge. For example, if the knowledge of P0, R0 (the secret key part) is required to consume the output of Tx0, then the knowledge of P0, R0, R1 (the secret key part) is sufficient to consume the output of Tx1. In a sense, the transactions are linked to each other in the forward chain. [R i x = r i Note that it is. An exemplary use case could be when the token r i is an access token to something. Here, the order is important, for example, each token enables access to a different respective part of a media stream, say.
[0211] Figure 14 shows an example of a series of transactions.
[0212] For example, assume Alice owns tokens r0, r1, r2,... and the token issuer has the knowledge of hashes H(r0), H(r1), H(r2),.... The token r i is agreed to be activated by disclosing it on the blockchain and providing a proof of knowledge of k i .
[0213] Alice may activate her token by generating a series of transactions as described above. When Alice broadcasts transaction Tx0, she promises to activate token r0 in the next transaction. When she broadcasts Tx1, she discloses r0 and provides a proof of knowledge of k0 that activates the token.
[0214] The advantage of this method is that no one else can activate Alice's token r0, since they cannot prove knowledge of k0. Also, there is a hierarchical authentication link between Alice's public key P0 and each token activation. Furthermore, the size of the transaction is kept to an absolute minimum while maintaining security. This is achieved by incorporating her token activation into her digital signature.
[0215] Token r i is generated in advance. i There need not be any particular relationship between the actual values of P. i+1 =P i +R i Note that the relationship between them is not required. Alternatively, this can be done with any or freely chosen public key. The relationship shown in Figure 14A is simply a convenient way to generate public keys.
[0216] <Optional Security Feature #1> If a signature based on k is published, then anyone who knows the value of k can derive the value of the secret key V used to generate the signature by solving for V in the signing formula:
number
[0217] Solving for V, we get:
number
[0218] Since in many cases the only recipients of a transaction know k, this does not pose a significant risk. In other cases, the payer must be careful to never reuse the private key V that was used to sign the solution to the r-puzzle. Good security practice dictates that users never reuse a public / private key pair (P,V), but rather always use a fresh new public / private key pair when receiving new money.
[0219] In principle, a public-private key pair (P,V) is "forever", i.e. it can be used many times. The use of a random ephemeral key k should guarantee this. However, problems arise when the random number generator is poorly implemented.
[0220] If two different messages are signed with the same ephemeral key k and the same private key, then it is possible to derive the private key V from the two signatures. That is, given (r,s) and k, it is possible to calculate V, where r=[k G] x where V is the private key for the public key P used in signing. If the random number generator fails during the signing process, it may generate the same random number at the end, thus leaking the private key to the public. To solve this problem, people started to avoid reusing public keys, instead fixing the random number generator.
[0221] In this example, Alice knows k, but she does not know V, the private key for Bob's public key. When Alice gives k to Bob. Bob can solve the r-puzzle by providing (r,s) using his private key. When Alice sees the signature, she knows k, so she can derive V. This may be undesirable for Bob. Therefore, Bob should preferably avoid reusing (P,V).
[0222] The problem with this, however, is that Bob's public key P cannot be used as a persistent means of identifying Bob.
[0223] To solve this, according to an embodiment disclosed herein, Bob may include his additional signature sig2 in Tx2 using a separate private key V2 with corresponding public key P2. He also includes P2 along with the additional signature. Thus, there are two types of public-private key pairs. The first type is generated on the fly for one-time use. The other type is generated according to some additional protocol, e.g. HD wallet. Bob can use the first type of key pair for r-puzzle signatures and the second type for the second signature.
[0224] Alice can use the second public key to look up Bob's identity, such as Bob's legal name, username, or network address, based on the mapping between the public key and the identity. The mapping may be made available, for example, in a public database that maps public keys to identities. Alternatively, the mapping may simply be pre-agreed upon between Alice and Bob (e.g., stored privately on Alice's computing device 102a).
[0225] Now consider again the use case of signing authority. For example, Alice wants to receive a delivery but may not be able to accept the delivery herself. She gives both Bob and Charlie a copy of k so they can receive the delivery on her behalf. Dave is delivering a package. He needs to get a signature that has the expected r value. Now consider that in his record or rule correspondence, Dave also needs to verify the identity of the recipient.
[0226] Suppose Bob is there to accept the delivery. If Bob has generated his public key and a signature based on k, then both Alice and Charlie can calculate Bob's private key V. This isn't a problem if the public key is designated for one-time use, but it is not ideal if Bob needs this public key to prove his identity in the future.
[0227] To solve this problem, embodiments may include in Tx2 one or more signatures from Bob that are independent of the r-puzzle and can be used to identify Bob. For example, the additional signature and corresponding public key P2 can be added to the OP_RETURN output (unspent output) in the same transaction that Dave accepts. An alternative is to include an additional OP_CHECKSIG in the lock script of the r-puzzle transaction. By viewing the transaction and the public key used for the additional signature, Alice can tell who signed on her behalf.
[0228] In some other cases, there may be a concern that the value k may be leaked before it is used. To solve this, Alice can add a P2PKH to the r-puzzle transaction to make it more secure. Suppose Alice wants to delegate her signing authority to Bob. She obtains a one-time public key P2 from Bob and generates an r-puzzle transaction that not only specifies the r value, but also specifies the additional public key P2.
[0229] Optionally, Alice can generate a 1-out-of-2 MultiSig to allow her to sign as well. An example lock script is given below. [Table 7]
[0230] Note that r-puzzles offer additional flexibility because Alice can choose when to hand over the solution to the r-puzzle, and therefore the signing power, to Bob: she can decide to do so or not, even after the transaction has been mined.
[0231] If k is leaked, people can discover the private key used to sign signatures with the leaked k. However, there is another private key V2, a private key linked to the public key that can be used to identify Bob. To damage the output, an attacker would have to obtain two independent secrets, which is much less likely than damaging only one of them.
[0232] In the above example, Tx2's lock script is locked to Bob's additional public key P2 using a conventional P2PKH (not the one used in r-puzzle, but unlocked by an additional signature). The r-puzzle technique allows additional options for users. In some applications, it may be desirable to use r-puzzles so that the prover can satisfy the challenge regardless of identity. On the other hand, in some other applications, a combination of hash puzzles and P2PKH may still be desirable, and r-puzzles may optionally be used in that context. This will be discussed in more detail shortly.
[0233] However, if an additional signature corresponding to P2 is required for identity lookup and / or security, but the locking script of Tx1 is not pre-bound to a particular certifier's identity as in a P2PKH, then the locking script described above can be employed accordingly: the additional signature can simply include a Checksig rather than an OP_EQUALVERIFY for the corresponding public key P2.
[0234] <Optional Security Feature #2> Another possible security vulnerability in the above method is signature forgeability, which can be exploited by miners trying to claim funds (similar to hash puzzles). A miner who receives a transaction (from a payer) can modify the transaction and send funds to themselves, using the same signature that the payer used in the original transaction. This is done as follows:
[0235] Let P = V · G be the public / private key pair used to sign the original transaction, denoted by m, to obtain the signature (r, s) as follows:
number
[0236] To use the transaction, the payer uses the following unlock script: < / s> < / s> <s> <s><r,s>
[0237] A miner who receives this transaction can modify the transaction to a new one, denoted by m', that sends funds to itself using the new unlock script below. <P’><r,s>
[0238] where P'=V'·G is the public / private key pair, as follows:
number
[0239] Note that the miner does not need to know V' (since he does not know V). The verification process is then performed using the following calculation:
number
[0240] The signature is (R') x It is valid if and only if =r, and is invalid in other cases.
[0241] With the new transaction m' and the new unlock script, the verification process is as follows:
number
[0242] (Note that primed notation has a different meaning than before, and in this context, being primed does not denote a reference instance.)
[0243] To address this potential vulnerability, in an embodiment, a miner can provide another message m that cannot be provided unless the miner knows the secret key V. sighash In that case, the unlock script may look like this: <sig’>< / s> < / s> <s> <s><sig r >
[0244] sig' is a different message m sighash It can be a signature on . Therefore, to modify the message, we just use a different sighash flag than the original one (e.g. SIGHASH_NONE instead of the default flag SIGHASH_ALL). sig' must also use a different value of r. As a result, it does not leak the private key (because the private key can be derived from two signatures that use the same ephemeral key). Finally, the transaction needs to include another OP_CHECKSIG at the end, as shown below. [Table 8]
[0245] This requires using the same public key P as the r-puzzle, so that only someone who knows the private key V for public key P can generate another signature, making the above attack impossible.
[0246] An attacker tries to replace the public key with another public key, whose private key the attacker does not have knowledge of. To prevent this attack, the challenge also asks for knowledge of the private key. In this case, one signature is not enough. Therefore, two signatures are required. Both signatures are considered as proof of knowledge of the same private key. This is secure, since the challenge requires that they have different ephemeral keys.
[0247] <P2PKH+P2PRPH> Just as the r-puzzle is used as a proof of knowledge, the P2PKH output is also a proof of knowledge of the private key that corresponds to the public key in the P2PKH output. This basically means that the puzzle k is used as a proof of knowledge of the public key P puzzle =V puzzle A private key V that maps to G puzzle In an r-puzzle embodiment, the proof of knowledge is accompanied by a public key that can be selected by the prover and used to link to an identity. In P2PKH, the regular payment signature and public key (which signs the knowledge of the secret puzzle) must be accompanied by another signature and public key to link to a specific identity. Trivially, the prover can add another signature and public key for P2PKH unlock corresponding to a different OP_CHECKSIG to the lock script, as shown below: [Table 9]
[0248] The corresponding unlock script is shown below.
number
[0249] <sigP ID > <P ID Note that there is no cryptographic link between the signatures and the puzzles or transactions. Miners and anyone can actually replace them with different signatures based on different public keys. This is a bit like how a miner can eavesdrop on a public hash puzzle. A miner or eavesdropper cannot change the message to send funds to themselves (as in the case of a public hash puzzle). However, they can <sigP ID > <P ID > with their own, as if it were linked to their own identity.
[0250] On the other hand, based on the techniques disclosed herein, it is possible to use both P2PKH and P2RPH together in the same script to enforce a cryptographic link on the second signature, so that it cannot be intercepted and replaced in the above mentioned cases. [Table 10]
[0251] In your lock script,
number
[0252] So they are essentially equivalent. They are not actually equivalent because the public key is either compressed or uncompressed, and a prefix is prepended either way. As shown below, when extracting the r value from the signature, you can explicitly add a prefix to the script, <H(P puzzle )>= <H(r puzzle )>. However, this does not achieve much benefit in practice. [Table 11]
[0253] (Note that H(...) is denoted by angle brackets <> in the schematic representation of the lock script, and that this actually represents the value of the hash, not the hash function. The angle brackets <> refer to the position of this value in the stack.) The corresponding unlock scripts for both transactions are shown below.
number
[0254] <Alternative implementation in the account-based model> The above has been described broadly in terms of an implementation in an output-based model (e.g., a UTXO-based model). However, it will be understood that this is not limiting. Figure 11 shows a possible alternative implementation using an account-based model.
[0255] In essence, in an account-based model, the r-puzzle function may be included in a smart contract function that is called by a user. One party may set the r-puzzle value (or a hashed r-puzzle value) in the smart contract. Other parties may then subsequently provide signatures to the smart contract.
[0256] In the UTXO blockchain architecture, the requirements embedded in the unlock script of the first transaction must be met by the lock script of the second transaction in order for the second transaction to be accepted as valid and recorded in the blockchain. This is advantageous because it leverages the work already done by miners as part of the transaction validation process. As a concrete example in this context, the fact that a transaction has been added to the blockchain means that it has been verified by nodes across the blockchain network and that its lock script meets certain useful requirements. Interested parties do not need to check for themselves whether those requirements are met; they can simply assume that those requirements are met by the fact that the transaction has been successfully recorded in the blockchain. This is due to the fact that for a transaction to be valid, the script must return a "true" result when completed (there may be other requirements for a transaction to be valid), and if the script returns a "false" result (which includes, according to the terminology used herein, if the script fails, for example because an OP_VERIFY opcode terminates the script), the transaction is invalid.
[0257] However, in other blockchain models (e.g., specific account-based architectures), the interdependence between transaction validity and the outcome of executing transaction code is not necessarily mirrored. For example, in a specific smart contract blockchain, transactions may be valid, and therefore accepted for recording on the blockchain, if they meet a set of "basic" validity requirements imposed by the blockchain protocol. Thus, a second transaction may still be accepted as valid and recorded on the blockchain even if it does not meet certain requirements embedded in the code of the first transaction. The code of the first transaction may, for example, be smart contract code.
[0258] If the second transaction is addressed to the smart contract account created by the first transaction, it then drops down to the smart contract code to decide how to respond to the transaction, for example ignoring it (or returning a false result) if any requirements are not violated, while rewarding the prover with an amount of digital assets deducted and credited from the balance of the smart contract account (or returning a true value) if the requirements are correct. In a sense, this abstracts the "agent level" processing by the smart contract (agent), i.e., explicitly coded in the smart contract code, from the "protocol level" processing performed "implicitly" by the node, i.e., processing performed on the transaction to determine whether it meets the validity requirements imposed by the blockchain protocol on which the blockchain network operates. Thus, in such a blockchain architecture, the "valid / invalid" decision by the node at the protocol level for each transaction may be decoupled from the "true / false" result returned for that transaction by the smart contract at the agent level. Here, a transaction may be determined to be valid at the protocol level, but may return a false result at the agent level.
[0259] This contrasts with the UTXO architecture, which requires that the "script is true" result be returned for a transaction to be valid; a transaction is invalid if the script terminates or completes leaving anything other than true on the stack.
[0260] One of the fundamental requirements for transaction validity may be that the transaction contains a valid signature. Thus, while in the above UTXI example the signature was verified by the code of the challenge transaction itself (e.g., using an OP_CHECKSIG opcode that verifies the signature and returns true / false for signature verification, or an OP_CHECKSIGVERIFY opcode that checks the signature in the same way and also verifies that the result is true, and if not, the script terminates), in alternative blockchain architectures the signature may be verified by the processing node implicitly in the above sense, which may avoid the need to code the signature check into the transaction code itself.
[0261] In the context of this application, as a concrete example, a transaction may be considered valid at the protocol level, e.g. because it contains a valid signature, but may still return a false result at the application level, e.g. because some other requirement is not met.
[0262] FIG. 11 illustrates an alternative node software 400 for processing transactions according to an account-based model. The node software is labeled here as 400acc. An instance of this node software 400acc may be implemented in each of the account-based version nodes 104 of the network 106. The account-based node software 400acc includes an account-based protocol engine 401acc, a contract engine 402acc (similar to the script engine 402), an application-level decision engine 404, and a set of one or more blockchain-related function modules 405. In any given node 104, these may include any one, two, or all three of the mining module 405M, the forwarding module 405F, and the storage module 405S (depending on the node's role or roles). The protocol engine 401acc is configured to recognize different fields of a transaction and process them according to the node protocol. The node software 400acc also maintains an account state 406 for each of a number of accounts in the memory of each node 104. These may include, for example, accounts of Alice, the prover (e.g., Bob), and / or another party that is debited or credited depending on the contract established between Alice and the prover. The contract engine 402acc is configured to modify account states depending on the outcome of smart contracts received within a transaction. Smart contracts are also referred to as "agents."
[0263] FIG. 11 illustrates a transaction Tx1 that may implement the same or similar r-puzzle functionality as described above with respect to FIGS. acc and Tx2 acc Also shown is a pair of 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1200, 1210, 1220, 1230, 1240, 1250, 1260, 1270, 1280, 1290, 1300, 1310, 1320, 1330, 1340, 1350, 1360, 1370, 1380, 1390, 1400, 1410, 1420, 1430, 1440, 1450, 1460, 1470, 1480, 1490, 1500, 1510, 1520, 1530, 1540, 1550, 1560, 1570, 1580, 1610, 1620, 1630, 1640, 1650, 1660, 1670, 1680, 1690, 1700, 1710, 1720, 1730, 1740, 1750, 1760, 1770, 1780, 1790, 1800, 1810, 1820, 1830, 1840, 1850, 1860, 1870, 1880, 1890, 1900, 1910, 1920, 1930, 1940, 1950, 1960, acc The second transaction Tx2 includes a source account address 1102a and a destination account address 1103a. acc The first transaction Tx1 includes a source account address 1102b and a destination account address 1103b. acc The second transaction Tx2 also includes a smart contract 1101. The smart contract 1101 may include a challenge (puzzle) by Alice, which may be generated by Alice or by a third party on her behalf using details provided by Alice. acc Transaction Tx1 may optionally include one or more fee data fields 1104 carrying user-specified payload data, which may include at least a portion of the solution to the puzzle provided by the prover, e.g., Bob. acc and Tx2 acc is further signed by Alice and the prover, respectively. Each transaction also includes the signatures 1105a, 1105b of the respective parties.
[0264] The transactions are broadcast across the network 106. Upon receiving each transaction, the protocol engine 401acc automatically verifies whether the signature 1105 is valid or not; this is an inherent feature of the protocol engine 401acc and does not need to be specified within the smart contract 1101. The protocol engine 401acc therefore validates each transaction for forwarding and / or mining, provided at least that the respective signature is valid. It may require one or more additional conditions for validity to be met. If valid, the application level decision engine 404 can choose to control the mining module 405M and / or the forwarding module 405F to mine and / or forward the transaction, respectively.
[0265] In such an account-based model, Alice, Bob, and the smart contract itself are assigned separate accounts with different account addresses. A transaction is said to be sent "from" the address in its source address field and "to" the address in its destination address field. To create an account for a smart contract, a transaction containing the bytecode of the smart contract is uploaded to the blockchain in a transaction. In such an account creation transaction, the destination address 1103 in the destination field must be an address not previously used in the blockchain. Once the transaction is accepted, that address becomes the address of the newly created smart contract account. Further transactions can then be sent to that address to "invoke" the smart contract, i.e., to cause the bytecode of the smart contract to execute, depending on the further transaction. The "destination" address 1103 acts as an intermediate address to enact the contract. Alice uses TX1 to create a smart contract that specifies one or more requirements. acc Bob sends TX2 to that address to invoke the smart contract. acc to that same address. Also, the smart contract will receive TX2 acc The “source” address 1102 specifies the account of a user who is a party to the contract. acc If it determines that the specified requirements are met, the smart contract will deduct the amount of the digital assets from its account balance and acc credit the balance of the account with source address 1102b in TX2 (i.e., Bob's account) by that amount (intuitively, acc By sending a ,Bob is effectively asking the smart contract (identified in the destination address field) to credit his account (identified in the source address field).
[0266] Protocol Engine 401acc is TX2 acc When it receives TX2, it will acc Search for an account that matches the destination address 1103b in Tx1 acc If the transaction is processed and valid, the account will be acc , and is associated with the smart contract code provided in TX1. In response, protocol engine 401acc acc 1101 and takes as operand data data from one or more fields of the smart contract, depending on what criteria are defined in the contract. The operand data may include, for example, data from one or more of the free data fields 1104 and / or a signature from the signature field 1105b. acc Operand data from Tx1 acc Conditional on satisfying one or more criteria defined in the smart contract 1101 of Tx2, the contract engine 402acc modifies the account state 406 of one or more parties (Alice, the prover, and / or one or more third parties) according to the changes defined in the smart contract 1101. In other cases, this change to the account state 406 is not made. However, in some account-based systems, the outcome of the smart contract is not a condition for the validity of the transaction. Thus, Tx2 acc Tx1 acc If the criteria set in the smart contract 1101 are not met, Tx2 acc is still propagated and mined into a block as a record of the failed transaction, which may still result in mining fees (so protocol engine 401 may still modify the account state 406 of one of the parties and the winning miner).
[0267] To implement the r-puzzle, at least part of the r-puzzle function must be acc The solution can be coded in the smart contract 1101 of Tx2 acc 7. For example, this may be used to implement the variant of FIG. 7. Optionally, part of the implicit signature verification functionality of protocol engine 401acc may be utilized to implement, for example, one of the variants of FIG. 8-10. In the case of FIG. 8-10, steps II) and III) are performed by Tx2 acc When verifying the signature of Tx1, it may be an implicit function of the protocol engine 401acc (recall that signature verification itself is an inherent function of the node protocol implemented by the protocol engine 401acc). acc In the smart contract 1101 of Tx2, it is only necessary to stack step I) on top of this. The smart contract determines whether the result of I) is true and whether the protocol engine 401acc acc indicates that r is valid. If both are Yes, it declares an overall result of "True" for the verification, i.e., Bob succeeds in satisfying the challenge set by the r-puzzle. Note that of the implementations of Figures 8-10, only the data value d in the cases of Figures 9 and 10 needs to be included in the free data field 1104. The signature information is included in the signature field 1105b.
[0268] A smart contract account is also indexed with "data registers" (not shown), which are (logical) data storage elements associated with the account. In the UTXO model outlined above, values are embedded in the lock script itself, and the same is true for specific pieces of smart contract code 1101. However, the smart contract bytecode of a smart contract may alternatively or additionally be executed on data stored in one or more of its account registers. Furthermore, it is usually possible to store values in a smart contract account register after a smart contract account has been created. Thus, for example, a smart contract account is created when a challenge transaction Tx 1,α acc A separate "intermediate" transaction Tx 1,β acc may then be sent to the (now existing) smart contract account, which has the effect of storing a particular value v in a register $R of the smart contract account. The smart contract may be configured to only accept such data from (for example) a specified source account address, e.g., the same party that created the smart contract in the first location (Alice). Tx2 acc When the contract is received, the operation to be performed by the contract engine 402acc (e.g., “access register $R and set the value to Tx2 acc The challenge transaction Tx 1,α acc However, the value stored in $R is defined by the smart contract bytecode provided in the intermediate transaction Tx 1,β acc According to the terminology used in this specification, Tx 1,α acc is still a challenge transaction that sets one or more requirements. Now, only those requirements are passed on to one or more intermediate transactions (e.g., Tx 1,β acc ) may be defined.
[0269] Thus, in some implementations, the challenge transaction Tx 1,α acc is the operation of r puzzles (e.g., proof transaction Tx2 acc $R, and check whether they match. acc The value in $R that is compared with the r part of the intermediate transaction Tx 1,β acc The information may be transmitted by
[0270] Note also that some account-based models do not require that the public key P be included along with the signature 1105. Instead, they simply include a one-bit flag flg. As discussed above, it is possible to derive two possible keys P and -P from (r,s) and the message. The flag flg indicates which of these two possible solutions is, in fact, the signature of Tx2 acc The protocol engine 401acc uses (r,s) and flg to signal whether the public key corresponds to the private key V used by the prover to sign the message in Tx2. acc derives the signer's public key P instead of explicitly receiving it in the signature. This technique is also possible in output-based models and is not exclusive to account-based models. However, in the scripting languages used in many current output-based models, there is no dedicated opcode to derive P from r and s. Thus, it would be complicated to explicitly code this functionality in the unlock script using existing generic opcodes in stack-based languages. Furthermore, note that certain account-based models derive the source address of a transaction from the public key used to sign the transaction. Thus, the source address is not necessarily encoded separately in the transaction; if the public key is derived from the signature, this means that the source address can also be derived indirectly from the signature.
[0271] <Conclusion> It will be understood that the above-described embodiments have been described by way of example only.
[0272] More generally, according to a first embodiment of the technology disclosed herein, there is provided a computer-implemented method for performing proof of knowledge based on an elliptic curve digital signature algorithm (ECDSA) verification function, the method comprising: obtaining a first transaction including executable code, the code including an element specifying a reference instance of the r portion of the first ECDSA signature; receiving a second transaction including information including at least the s portion of the first ECDSA signature; obtaining a first public key, a first ECDSA signature signing a message based on a first private key corresponding to the first public key, the message being part of a second transaction; and executing the code from the first transaction, the code being configured to return a result of true, regardless of whose public key was used as the first private key, provided that an ECDSA verification function, when applied to the first ECDSA signature, verifies that the s portion received in the second transaction corresponds to the reference instance of the r portion specified by the first transaction, given the message received in the second transaction and the first public key obtained.
[0273] In an output-based model (e.g., a UTXO-based model), the ECDSA validation function may be invoked by an opcode in the lock script of the first transaction's output (e.g., a UTXO). The opcode may invoke an instance of the ECDSA validation function pre-stored in the validating node. Alternatively, as in an account-based model, the ECDSA validation function may be an implicit function in the node. This is performed automatically as part of the node protocol, rather than having to be explicitly invoked by code in the first transaction (which may be a smart contract in the account-based case). Another alternative does not exclude that ECDSA validation may be explicitly coded into the code.
[0274] According to a second optional embodiment of the techniques disclosed herein, there is provided a method according to the first embodiment, wherein the element is a reference instance of the r portion of the first ECDSA signature.
[0275] According to a third optional embodiment of the present disclosure, in the method according to the second embodiment, the ECDSA verification function performs:
number
[0276] In this case, the code is configured to return a true result provided that the above check is true, and a false result otherwise.
[0277] According to a fourth optional embodiment, there may be provided a method according to the first or second embodiment, wherein the information received in the instance transaction further includes a submitted instance of the r portion of the first ECDSA signature, and the code is configured to check that the submitted instance of the r portion equals the reference instance.
[0278] According to a fifth optional embodiment, there may be provided a method according to the fourth embodiment, wherein the ECDSA verification function checks that the s portion received in the second transaction corresponds to the submitted instance of the r portion, and by performing both checks together, verifies that it corresponds to the reference instance.
[0279] According to a sixth optional embodiment of the present disclosure, a method according to the fifth embodiment dependent on the second embodiment, the code performing the following:
number
[0280] In this case, the code is configured to return a true result provided that both of the above checks are true, and a false result otherwise.
[0281] According to a seventh optional embodiment, there may be provided a method according to the fourth or fifth embodiment, in which the element is a reference instance of the r portion of the first ECDSA signature, in which the code is configured to perform the check that the submitted instance is equal to the reference instance by performing the same transformation on the submitted instance.
[0282] According to an eighth optional embodiment, there may be provided a method according to the seventh embodiment, wherein the element is a hash value that is a hash of a component that includes the reference instance of the r portion of the first ECDSA signature (the transformation is a hash).
[0283] According to a ninth optional embodiment of the present disclosure, there is provided a method according to the eighth embodiment dependent on the fifth embodiment, wherein the component is the reference instance r′ of the r portion of the first ECDSA signature, and the code is configured to:
number
[0284] In this case, the code is configured to return a true result provided that both of the above checks are true, and a false result otherwise.
[0285] H puz is the hash function used in the hash puzzle. H Sig is the hash function used in ECC signing and verification. puz and H sig may or may not be hash functions of the same form.
[0286] According to a tenth optional embodiment of the present disclosure, there may be provided a method according to the eighth embodiment dependent on the fifth embodiment, wherein the component is a combination f(r',d') of the reference instance r' of the r portion of the first ECDSA signature with a reference instance d' of a data value, and the received information in the second transaction further includes a submitted instance r of the r portion of the first ECDSA signature and a submitted instance d of the data value.
number
[0287] H puz and Hsig may or may not be the same type of hash function.
[0288] According to an eleventh optional embodiment of the present disclosure, there may be provided a method according to the tenth embodiment, wherein the bond f is a linkage and is:
number
[0289] According to a twelfth optional embodiment of the present disclosure, there may be provided a method according to the tenth or eleventh embodiment, wherein the data value includes a lock time value specifying a target time point, and the code is configured to return a true result with a further condition that the target time point is reached.
[0290] The locktime value may specify a target point in time in terms of human time, e.g., milliseconds, seconds, minutes, hours, days, weeks, months, or years. Alternatively, the locktime value may specify a target point in time in terms of a number of blocks. Either way, the specified point in time may be specified as an absolute time, or an amount of time that has elapsed since a given point, e.g., the point at which the first transaction was mined into a block of the blockchain.
[0291] According to a thirteenth optional embodiment of the present disclosure, there may be provided a method according to any one of the first to twelfth embodiments, wherein the step of obtaining the first public key includes a step of receiving the first public key as part of information in the second transaction.
[0292] Alternatively, a method may be provided in which the information in the second transaction includes both the s portion and a submitted instance of the r portion of the first ECDSA signature, and the obtaining step includes deriving the first public key from the submitted instances of the s portion and the r portion of the first ECDSA signature.
[0293] As another alternative, it is not excluded that the obtaining step may include, for example, receiving the first public key via a side channel associated with the second transaction, or receiving an index of the first public key or the identity of the owner of the first public key within the second transaction or via the side channel, and using this to search for the first public key.
[0294] According to a fourteenth optional embodiment, there may be provided a method according to any one of the first to thirteenth optional embodiments, wherein the code further specifies a reference instance of the r portion of the second ECDSA signature, and the code is configured to return a true result if any one of a number of alternative conditions is satisfied, where the alternative conditions are: i) verifying that, given the portion of the second transaction signed with the first ECDSA signature and the first public key, the s portion of the first ECDSA signature corresponds to a reference instance of the r portion of the first ECDSA signature; ii) verifying that, given a portion of the second transaction signed with the second ECDSA signature and a second public key corresponding to the second private key used to generate the second ECDSA signature, the s portion of the second ECDSA signature corresponds to a reference instance of the r portion of the second ECDSA signature; may include:
[0295] For example, different conditions may be mapped to different alternative statements, such as different alternative clauses of an agreement.
[0296] According to a 15th optional embodiment, there may be provided a method according to any of the first to 14th optional embodiments, wherein at least the s portion of the first ECDSA signature is generated by a second party using a temporary key given by the first party to the second party or vice versa, and a first private key that is the private key of the second party.
[0297] According to a sixteenth optional embodiment, there is provided a method according to the fifteenth optional embodiment, comprising:
number
[0298] According to a seventeenth optional embodiment, there may be provided a method according to the fifteenth or sixteenth optional embodiment depending on at least the fourteenth embodiment, wherein the submitted instance r of the r portion of the first ECDSA signature is also generated by the second party.
[0299] According to an 18th optional embodiment, there may be provided a method according to the 17th optional embodiment, dependent on at least the 10th, 11th or 12th embodiments, wherein the submitted instance d of the data value is also generated by the second party.
[0300] According to a 19th optional embodiment of the present disclosure, there may be provided a method according to any of the 15th to 18th embodiments, wherein the step of receiving the second transaction includes a step of receiving the second transaction from the second party.
[0301] According to an optional twentieth embodiment of the present disclosure, there may be provided a method according to any of the fifteenth to nineteenth embodiments, the method including a step of triggering a service for the first party on condition that the result returned by the code is true.
[0302] For example, the service may be commissioned by, performed on behalf of, and / or for the benefit of the first party. The service may be a computerized service and the step of triggering may include automatically triggering the service.
[0303] By giving the ephemeral key to the second party ("Bob"), this allows the first party ("Alice") to have Bob sign the service on her behalf, but without requiring Bob to disclose the ephemeral key k to a node or publish it on the blockchain. Furthermore, since the transaction is not tied to any particular private key (or its corresponding public key), this means that Alice could also give a copy of the ephemeral key to a third party ("Charlie"), and either Bob and Charlie could succeed in signing the service. This is possible because the r portion is used as the basis of the challenge, and the r portion is not mapped to any particular identity.
[0304] According to a 21st optional embodiment of the present disclosure, there may be provided a method according to any of the 15th to 20th embodiments, wherein the information received in the second transaction includes a further cryptographic signature of the second party signing a portion of the second transaction using a further private key of the second party, the further private key corresponding to a further public key.
[0305] The further signature may be an ECC signature or another type, for example an RSA signature.
[0306] According to a twenty-second optional embodiment of the present disclosure, there may be provided a method according to the twenty-first embodiment, wherein a mapping is available that enables the first party and / or a third party to look up the identity of the second party based on the further public key.
[0307] For example, the identity may be a personal name, a company name, a username or a network address of the second party. The third party may be, for example, a provider of the aforementioned services.
[0308] According to a twenty-third optional embodiment of the present disclosure, there may be provided a method according to the twenty-first or twenty-second embodiment, wherein the code is configured to verify the further cryptographic signature using the further public key, and to return a true value, with a further condition that the further cryptographic key is verified.
[0309] According to a 24th optional embodiment of the present disclosure, there may be provided a method according to any of the 15th to 23rd embodiments, wherein the information received in the second transaction includes a cryptographic signature of the first party that signs a portion of the second transaction using a private key of the first party.
[0310] In an embodiment, the method may include obtaining a public key corresponding to the private key of the first party, and the code is configured to verify the cryptographic signature of the second party and return a true result subject to a further condition of the cryptographic signature of the first party.
[0311] In embodiments, a mapping may be available that allows the second and / or third parties to look up the identity of the first party based on the public key of the first party. For example, the identity of the first party may be the personal name, company name, username, or network address of the first party.
[0312] According to a twenty-fifth optional embodiment of the present disclosure, there is provided a method according to any of the fifteenth to twenty-fourth embodiments, wherein the information received in the second transaction includes an additional ECDSA signature using the same first private key as the first ECDSA signature, but having a different value of the r portion; A method may be provided in which the code is configured to verify the further ECDSA signature using the first public key and to return a result of true subject to the further condition that the further ECDSA signature is verified.
[0313] The additional ECDSA signature may sign a different portion of the second transaction than the first ECDSA signature.
[0314] According to a twenty-sixth optional embodiment of the present disclosure, there may be provided a method according to any of the first to twenty-fifth embodiments, wherein the second transaction specifies an amount of digital assets, the amount being unlocked at least on the condition that the code returns the true result.
[0315] According to a twenty-seventh optional embodiment of the present disclosure, there is provided a method according to any one of the first to twenty-sixth embodiments, wherein each of the transactions has a data structure including one or more inputs and one or more outputs, each output including a lock script, and each input including an unlock script and a pointer to an output of another transaction; A method may be provided, in which the code is included in the lock script of the first transaction, the information received in the second transaction is included in the unlock script in an input of the second transaction, and the pointer in the input of the second transaction points to the output of the first transaction, in which the method includes validating the transaction, at least conditional on the code returning the true result, and in response to the validation, includes at least one of the following: including the second transaction in a pool of transactions for mining into one or more blocks by the validating node, and / or forwarding the second transaction to at least one other node in the blockchain network.
[0316] For each of a plurality of transactions including the first and second transactions, at least some of the nodes of the network are configured to propagate each transaction conditional on the transaction being valid, and at least some of the nodes of the network are configured to record each transaction in at least a partial copy of the blockchain conditional on the transaction being valid, the validity of the second transaction being conditional at least on the code returning the true result.
[0317] According to a twenty-eighth optional embodiment of the present disclosure, there may be provided a method according to the twenty-seventh embodiment, wherein one of the outputs of the second transaction includes an updated version of the code that specifies a reference instance of the r portion of an updated first ECDSA signature. In this case, the method comprises: receiving a third transaction of the set of transactions including information including at least a portion of the updated first ECDSA signature and obtaining an updated first public key, the updated first ECDSA signature signing a portion of the third transaction based on an updated first private key corresponding to the updated public key; executing an updated version of the code from the third transaction, the updated code being configured to return a value of true given the signed portion of the second transaction and the obtained first public key, provided that the updated first ECDSA signature applied to the updated first ECDSA signature verifies that the updated s portion corresponds to a reference instance of the r portion specified in the second transaction, regardless of which private key was used as the updated first private key; may include:
[0318] In an embodiment, one of the outputs of the third transaction may include a further updated version of the code that specifies a reference instance of the r portion of a further updated first ECDSA signature, etc., thus generating a forward chain or r-puzzle.
[0319] According to a twenty-ninth optional embodiment of the present disclosure, there may be provided a method according to any one of the first to twenty-sixth embodiments, wherein the transaction is structured according to an account-based model, and the code is included in a smart contract that is included in the first transaction.
[0320] In embodiments, in either model, a validator node may be a mining node, a forwarder node, and / or a storage node that stores at least a portion of the blockchain (e.g., a full-copy storage node stores a complete copy of the blockchain). In embodiments, the step of obtaining the first transaction may include receiving at least a portion of the first transaction from a first party, such as the first party mentioned above. In embodiments, the step of obtaining the first version may include receiving the first transaction from the first party. Alternatively, in embodiments, the step of obtaining the first transaction may include formulating the first transaction at the validator node. In embodiments, the step of receiving the first transaction may include receiving the reference instance of the r portion from at least the first party and formulating at the one of the nodes into the first transaction. In embodiments, the step of obtaining the first transaction may include formulating the first transaction at the validator node, including generating the r portion.
[0321] In an embodiment, the step of receiving the second transaction may include receiving the second transaction from a second party, such as the second party mentioned above. In an embodiment, the second transaction is at least partially generated by the second party. In an embodiment, the second transaction is generated by the second party. In an embodiment, the step of receiving the second transaction may include receiving the second transaction directly from the second party or via the first party or a third party. In an embodiment, the second transaction is generated by a third party based on at least the s portion of the first ECDSA signature (and, in an embodiment, the submitted instance and / or the data value of the r portion of the first ECDSA signature) provided to the third party by the second party.
[0322] According to a thirteenth embodiment of the teachings of the present specification, there is provided a computer program embodied on a computer-readable storage device and configured to perform the method of any of the first to twenty-ninth embodiments when executed on a node of a network.
[0323] According to a thirty-first embodiment, a node of the network comprises: a memory including one or more memory units; a processing device including one or more processing units; Including, A node is provided, wherein the memory stores code configured to execute on the processing device, the code configured to cause the processing device to perform any of the methods of the first to twenty-ninth embodiments.
[0324] According to a thirty-second embodiment of the teachings herein, there is provided a computer-implemented method for establishing a knowledge proof based on an Elliptic Curve Digital Signature Algorithm (ECDSA) verification function, the method comprising: sending a temporary key to a second party or receiving the temporary key from the second party; determining a reference instance for the r portion of a first ECDSA signature based on the temporary key; forming a first transaction including executable code, the code including an element that specifies a reference instance of the r portion of the first ECDSA signature; Including, the code is configured to operate on at least a portion of the first ECDSA signature from a second transaction and a first public key, the first ECDSA signature signing a message under a first private key corresponding to the first public key, the message being part of the second transaction; The code may be the following, regardless of which private key was used as the first private key: given a message received in the second transaction and the first public key, the ECDSA verification function, when applied to the first ECDSA signature, verifies that the s portion received in the second transaction corresponds to a reference instance of the r portion specified by the first transaction. A method is provided that is configured to return a true result if
[0325] In an embodiment, the method may further include steps performed on a computing device of the first party according to any embodiment or other embodiment described herein.
[0326] According to a thirty-third embodiment of the teachings herein, there is provided a set of transactions for recording in a blockchain, the set being embodied on one or more computer-readable data media, the set comprising: the first transaction includes executable code, the code including an element specifying a reference instance of the r portion of the first ECDSA signature; the second transaction includes information including at least the s portion of the first ECDSA signature; The first ECDSA signature signs a message based on a first private key corresponding to the first public key, the message being part of a second transaction. The code, when executed at a node of a blockchain network, is configured to return a result of true, regardless of whose public key was used as the first private key, provided that an ECDSA verification function, when applied to the first ECDSA signature, verifies that the s portion received in the second transaction corresponds to a reference instance of the r portion specified by the first transaction, given the message received in the second transaction and the first public key obtained.
[0327] In embodiments, the first and / or second transaction may further include features according to any implementation or other embodiment disclosed herein.
[0328] Other variations or uses of the disclosed technology may become apparent to those skilled in the art upon review of this specification, and the scope of the present disclosure is not limited by the described embodiments, but only by the appended claims.< / s> < / s> < / sig> < / h> < / sighashflag>
Claims
1. 1. A computer-implemented method for performing knowledge proofs based on Elliptic Curve Digital Signature Algorithm (ECDSA) verification functions, the method comprising: obtaining a first transaction including executable code, the code including an element specifying a reference instance of a portion r of a first ECDSA signature; receiving a second transaction including information including at least a portion s of the first ECDSA signature and obtaining a first public key, the first ECDSA signature signing a message under a first private key corresponding to the first public key, the message being part of the second transaction; Executing the code from the first transaction, regardless of which private key was used as the first private key, wherein the code performs the following: given a message received in the second transaction and the obtained first public key, the ECDSA verification function, when applied to the first ECDSA signature, verifies that the s portion received in the second transaction is a valid s portion relative to a reference instance of the r portion specified by the first transaction. returning a true result if The method includes:
2. The method of claim 1 , wherein the element is a reference instance of the r portion of the first ECDSA signature.
3. The ECDSA verification function performs the following: [Equation 37] where r′ is a reference instance of the r portion of the first ECDSA signature, s is the s portion of the first ECDSA signature, P is the first public key, m is the portion of the second transaction signed by the first ECDSA signature, and H sig is the hash function used to hash m in generating the first ECDSA signature, G is an elliptic curve generator, and [R'] x denotes the x-coordinate of R', ". " denotes elliptic curve scalar multiplication, 3. The method of claim 2, wherein the code is configured to return a true result conditional on the check performed by the ECDSA verification function being true, and to return a false result otherwise.
4. 3. The method of claim 1 or 2, wherein the information received in the second transaction further includes a submitted instance of the r portion of the first ECDSA signature, and the code is configured to check that the submitted instance of the r portion is equal to the reference instance.
5. 5. The method of claim 4, wherein the ECDSA verification function checks that the s portion received in the second transaction is a valid s portion for the submitted instance of the r portion, and both checks together verify the valid s portion.
6. The code does the following: [Equation 38] The ECDSA verification function performs the following: [0039] where r is the submitted instance of the r portion of the first ECDSA signature, r′ is the reference instance of the r portion of the first ECDSA signature, s is the s portion of the first ECDSA signature, P is the first public key, m is the portion of the second transaction signed by the first ECDSA signature, and H sig is the hash function used to hash m in generating the first ECDSA signature, G is an elliptic curve generator, and [R'] x denotes the x-coordinate of R', ". " denotes elliptic curve scalar multiplication, 6. A method according to claim 5 when dependent on claim 2, wherein the code is arranged to return a result of true if both the first check and the second check are true, and to return a result of false otherwise.
7. 6. The method of claim 4 or 5, wherein the element is a transformation of a reference instance of the r part of the first ECDSA signature, and the code is configured to perform the check that the submitted instance equals the reference instance by performing the same transformation on the submitted instance.
8. 8. The method of claim 7, wherein the element is a hash value that is a hash of a component that includes a reference instance of the r portion of the first ECDSA signature.
9. The component is a reference instance r' of the r portion of the first ECDSA signature, and the code performs the following: [0040] The ECDSA verification function performs the following: [0041] where r is the submitted instance of the r portion of the first ECDSA signature, s is the s portion of the first ECDSA signature, h is a hash value, and H puz is the hash function used to hash r' to generate h, P is the first public key, m is the portion of the second transaction signed with the first ECDSA signature, and H sig is the hash function used to hash m in generating the first ECDSA signature, G is an elliptic curve generator, and [R'] x denotes the x-coordinate of R', ". " denotes elliptic curve scalar multiplication, 9. A method according to claim 8 when dependent on claim 5, wherein the code is arranged to return a result of true if both the first check and the second check are true, and to return a result of false otherwise.
10. the component is a combination f(r',d') of a reference instance r' of the r portion of the first ECDSA signature and a reference instance d' of a data value, and the information received in the second transaction further includes a submitted instance r of the r portion of the first ECDSA signature and a submitted instance d of the data value, and the code is configured to execute: [0042] The ECDSA verification function performs the following: [0043] where s is the s portion of the first ECDSA signature, and h joint is the hash value, and H puz f(r',d') is hashed to joint , P is the first public key, m is the portion of the second transaction signed with the first ECDSA signature, and H sig is the hash function used to hash m in generating the first ECDSA signature, G is an elliptic curve generator, and [R'] x denotes the x-coordinate of R', ". " denotes elliptic curve scalar multiplication, 9. A method according to claim 8 when dependent on claim 5, wherein the code is arranged to return a result of true if both the first check and the second check are true, and to return a result of false otherwise.
11. The combination f is a linkage, [0044] The method of claim 10.
12. 12. A method according to claim 10 or 11, wherein the data value includes a locktime value specifying a target time point, and the code is arranged to return a true result subject to the further condition that the target time point is reached.
13. The method according to any preceding claim, wherein said step of obtaining the first public key comprises receiving said first public key as part of the information in the second transaction.
14. The code further specifies a reference instance for the r portion of the second ECDSA signature; The code is configured to return a true result if any one of a number of alternative conditions is satisfied, the alternative conditions including: i) verifying that, given a portion of the second transaction signed with the first ECDSA signature and the first public key, the s portion of the first ECDSA signature is a valid s portion with respect to a reference instance of the r portion of the first ECDSA signature; ii) verifying that, given a portion of the second transaction signed with the second ECDSA signature and a second public key corresponding to a second private key used to generate the second ECDSA signature, the s portion of the second ECDSA signature is a valid s portion relative to a reference instance of the r portion of the second ECDSA signature; The method according to any one of claims 1 to 13, comprising:
15. 15. The method of claim 1, wherein at least the s portion of the first ECDSA signature is generated by a second party using an ephemeral key given by the first party to the second party or vice versa, and a first private key, the private key of the second party. 【Request 16】 【Number 45】 where P is the first public key, V is the first private key, k is the ephemeral key, n is a prime modulus, G is an elliptic curve generator, m is the portion of the second transaction signed with the first ECDSA signature, H sig is the hash function used to hash m in generating the first ECDSA signature, and [R] x 16. The method of claim 15, wherein: denotes the x-coordinate of R, and "." denotes elliptic curve scalar multiplication.
17. 17. A method according to claim 15 or 16 depending at least from claim 4, wherein the submitted instance r of the r portion of the first ECDSA signature is also generated by the second party.
18. 18. A method according to claim 17 when dependent on at least claim 10, 11 or 12, wherein the submitted instance of a data value d is also generated by the second party.
19. The method according to any of claims 15 to 18, wherein the step of receiving the second transaction comprises the step of receiving the second transaction from the second party.
20. A method according to any one of claims 15 to 19, comprising the step of triggering a service for said first party on condition that the result returned by said code is true.
21. 21. The method of any of claims 15 to 20, wherein the information received in the second transaction includes a further cryptographic signature of the second party signing a portion of the second transaction using a further private key of the second party, the further private key corresponding to a further public key.
22. 22. The method of claim 21, wherein a mapping is available that enables the first party and / or a third party to look up the identity of the second party based on the further public key.
23. 23. A method according to claim 21 or 22, wherein the code is arranged to verify the further cryptographic signature using the further public key, and to return a true value subject to the further condition that the further cryptographic key is verified.
24. 24. The method of claim 15, wherein the information received in the second transaction includes a cryptographic signature of the first party using a private key of the first party to sign a portion of the second transaction.
25. the information received in the second transaction includes an additional ECDSA signature using the same first private key as the first ECDSA signature but having a different value of the r portion; A method according to any one of claims 15 to 24, wherein the code is arranged to verify the further ECDSA signature using the first public key, and to return a result of true subject to the further condition that the further ECDSA signature is verified.
26. The method of any preceding claim, wherein the second transaction specifies an amount of a digital asset, the amount being unlocked conditional on at least the code returning a true result.
27. each of the transactions has a data structure including one or more inputs and one or more outputs, each output including a lock script, and each input including an unlock script and a pointer to an output of another transaction; the code is included in the lock script of the first transaction, the information received in the second transaction is included in the unlock script in an input of the second transaction, and a pointer in the input of the second transaction points to the output of the first transaction; The method includes the steps of: validating the transaction, at least on the condition that the code returns a true result; In response to said verification, including the second transaction in a transaction pool for mining into one or more blocks by the validator nodes; and / or forwarding the second transaction to at least one other node of a blockchain network; and The method according to any one of claims 1 to 26, comprising:
28. one of the outputs of the second transaction includes an updated version of the code specifying a reference instance of the r portion of the updated first ECDSA signature, and the method further comprises: receiving a third transaction of the set of transactions including information including at least a portion of the updated first ECDSA signature and obtaining an updated first public key, the updated first ECDSA signature signing a portion of the third transaction based on an updated first private key corresponding to the updated public key; executing an updated version of the code from the third transaction, the updated code being configured to, given the signed portion of the second transaction and the obtained first public key, return a value of true provided that the updated first ECDSA applied to the updated first ECDSA signature verifies that the updated s portion is a valid s portion for a reference instance of the r portion specified in the second transaction, regardless of which private key was used as the updated first private key; 28. The method of claim 27, comprising:
29. 27. The method of any of claims 1 to 26, wherein a transaction is structured according to an account-based model, and the code is included in a smart contract that is included in the first transaction.
30. A computer program which, when executed by a node of a network, causes said node to carry out the method according to any of claims 1 to 29.
31. A node of the network, a memory including one or more memory units; a processing device including one or more processing units; Including, A node, wherein the memory stores code that, when executed on the processing device, is configured to cause the processing device to perform a method according to any of claims 1 to 29.
32. 1. A computer-implemented method for establishing a knowledge proof based on an Elliptic Curve Digital Signature Algorithm (ECDSA) verification function, the method comprising: sending a temporary key to a second party or receiving the temporary key from the second party; determining a reference instance for the r portion of a first ECDSA signature based on the temporary key; forming a first transaction including executable code, the code including an element that specifies a reference instance of the r portion of the first ECDSA signature; Including, the code is configured to operate on at least a portion of the first ECDSA signature from a second transaction and a first public key, the first ECDSA signature signing a message under a first private key corresponding to the first public key, the message being part of the second transaction; The code, regardless of which private key was used as the first private key, is as follows: given a message received in the second transaction and the first public key, the ECDSA verification function, when applied to the first ECDSA signature, verifies that the s portion received in the second transaction is a valid s portion relative to a reference instance of the r portion specified by the first transaction. The method is configured to return a true result if
Citation Information
Patent Citations
Duplicating smart contracts with termination condition
WO2018215876A1
Random number generation in a blockchain
WO2019034984A1
