Blockchain Transaction Dual-Spend Proof
The method addresses the risk of double use attempts in blockchain transactions by generating a blockchain transaction with unlocking inputs and including a signature and time indicators, thereby verifying the transaction order and reducing the risk of double use.
Patent Information
- Application Number
- JP2022554358
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-03-13
- Filing Date
- 2021-02-12
- Publication Date
- 2025-04-14
- Estimated Expiration
- 2041-02-12
AI Technical Summary
There is a risk of double use attempts in blockchain transactions, where a party attempts to use the output of a previous transaction multiple times, leading to transaction rejection and potential consequences such as fraud charges or being blacklisted.
A computer-implemented method is provided to test whether a blockchain transaction is a double use attempt by generating a first blockchain transaction with inputs that unlock the output of a previously transmitted transaction, and sending a signature and time indicators with the transaction to ensure the order of transaction issuance is verified.
This method reduces the risk of double use attempts by providing a mechanism for parties to verify the legitimacy of transactions and prevent malicious or accidental reuse of transaction outputs.
Smart Images

Figure 0007661357000001 
Figure 0007661357000002 
Figure 0007661357000003
Abstract
Description
[Technical field]
[0001] The present disclosure relates to a method for verifying whether a blockchain transaction is an attempt at double-spending. [Background technology]
[0002] Blockchain refers to a form of distributed data structure in which a copy of the blockchain is maintained at each of multiple nodes in a peer-to-peer (P2P) network. The blockchain includes a chain of blocks of data, with each block including one or more transactions. Each transaction may point to a previous transaction in a sequence that may span one or more blocks. Transactions may be submitted to the network for inclusion in a new block by a process known as "mining," which 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., some digital tokens. However, blockchains can also be exploited to layer 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 have increased the maximum data capacity 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 even audio or video data in the blockchain.
[0004] Each node in the network can have any one, two, or all of three roles: forwarding, mining, and storage. Forwarding nodes propagate transactions across the nodes of the network. Mining nodes validate transactions and insert them into candidate blocks that attempt to identify valid proof-of-work solutions. Storage nodes each store their own copy of the mined blocks of the blockchain. To record a transaction in the blockchain, a party sends the transaction to one of the nodes of the network for propagation. Mining nodes that receive a transaction may compete to mine the transaction into a new block. Each node is configured to respect the same node protocol, which includes one or more conditions for a transaction to be valid. Invalid transactions are not propagated and are not mined into a block. Assuming the transaction is valid and thereby accepted into the blockchain, the additional user data therefore remains stored at each of the nodes in the P2P network as an immutable public record. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] GB1915842.7 Summary of the Invention [Problem to be solved by the invention]
[0006] One of the fundamental principles of blockchain is that a party cannot double-spend an unspent transaction output (UTXO). Each blockchain transaction submitted to the blockchain network must contain an input that references an output of a previously submitted transaction, i.e., a transaction that has been accepted by the blockchain network. To be valid and accepted by the blockchain network, the referenced output must be an unspent transaction output. If the referenced output has already been spent, the transaction is rejected. This prevents double-spending of outputs recorded on the blockchain.
[0007] Blockchain transactions may be sent peer-to-peer between parties without being sent to the blockchain network. That is, a first party may send a blockchain transaction to a second party via an off-chain side channel. For example, the blockchain transaction may be a template transaction, and the second party may add inputs to the template transaction, for example, to fund the transaction or to prove the contents of the transaction. As another example, the second party may add outputs to the transaction, for example, to define the spending conditions of the transaction. The second party may complete the transaction and then submit the transaction to the blockchain network to be recorded in the blockchain.
[0008] A second party may attempt to (intentionally or inadvertently) double-spend an output of a previous transaction that is referenced by an input of a newly submitted transaction. For example, without the second party's knowledge, a first party may include an input in a transaction template that references a previously paid transaction output. When the second party submits the completed transaction to the blockchain network (e.g., after adding the output to the transaction template), the submitted transaction is rejected. This may have adverse effects on the second party. For example, the second party may have traded goods or services with the first party in return for digital assets sent to the second party via the transaction (or at least, believed to have been sent to the second party at the time of submitting the transaction to the blockchain). Other potential consequences include being accused of fraud or being banned from using the blockchain (being blacklisted).
[0009] There is therefore a need to mitigate the risk of dual use attempts. [Means for solving the problem]
[0010] According to one aspect disclosed herein, a computer-implemented method is provided for testing whether a blockchain transaction is an attempt at dual-spend, the method being executed by a first party and including the steps of: generating a first blockchain transaction, the first blockchain transaction including an input for unlocking an output of a blockchain transaction previously transmitted to one or more nodes of a blockchain network for inclusion in the blockchain; generating a signature based on the first blockchain transaction and one or more time indicators, each time indicator indicating when the first blockchain transaction was generated and / or transmitted to the second party; and transmitting the first blockchain transaction, the signature, and the one or more time indicators to the second party, wherein at least the first blockchain transaction is transmitted to the second party via an off-chain communication channel.
[0011] Building on the example provided above, the first party may be a customer and the second party may be a merchant. The first blockchain transaction may be used to transfer digital assets to the second party in return for goods or services provided by the merchant. The merchant may be configured to accept 0-conf transactions. A "0-conf" transaction is one that has not received confirmation from any node in the network that the transaction has been included in a block on the blockchain.
[0012] Returning to our example, a merchant accepts a first blockchain transaction as payment for goods or services without verifying that the first blockchain transaction is contained within the blockchain. However, this raises the risk that the first blockchain transaction will be an attempt at "double-spending". That is, the input of the first blockchain transaction uses the output of a previous blockchain transaction that has already been used. Sending the first blockchain transaction with a signature and an indicator (e.g., a timestamp) can prove the order of transaction issuance to mitigate the risk of a double-spending attempt. The signature is based on the transaction and the time when the first transaction was generated and / or sent to the merchant. This effectively means that the second party proves the time when the first blockchain transaction was generated and / or sent. In the case of a double-spending, the merchant can use the signature as proof that the first party intentionally double-spended the output of a previous transaction. Thus, the relevant authorities can take action against the first party. The merchant can also use the signature to prove, for example, to the merchant's bank or insurance company that the merchant is a victim of fraud.
[0013] The problem of dual-spend attempts also arises in peer-to-peer networks such as Internet of Things networks. Peer-to-peer (P2P) architectures offer a more secure and efficient solution compared to centralized architectures, whereby neighbors interact with each other directly without any centralized nodes or agents between them. Blockchain technology is the foundation for secure P2P communication and is expected to revolutionize the development of IoT systems. Blockchain allows for the integration of payments and control into one network, where existing infrastructure can be used to piggyback messages regarding changes in device state, and distributed control of data on the network allows for fast user-device interaction. Combined with blockchain technology, traditional IoT devices, which play their role in the physical world, can now simultaneously send messages and exchange value. A public blockchain acts as a global payment network and at the same time a universal commodity ledger with strong cryptographic security built into its protocol that automatically addresses some of the risks associated with IoT. If next-generation blockchain-based systems for IoT devices are to become a reality, blockchain-based control methods for IoT will need to overcome challenges inherent to open systems. These include device control mechanisms that may not be inherent to the blockchain itself. Such a control mechanism is described in GB1915842.7.
[0014] To ensure that communication between nodes occurs with minimal latency, IoT control mechanisms may rely on P2P transaction propagation, transaction malleability, and 0-conf transactions. However, a malicious or flawed node may want an action to be performed by other nodes on the network without paying for it or leaving a record of the interaction on-chain. In this scenario, a malicious node may create a transaction Tx1 that includes a command message and uses some inputs of a previous transaction. At the same time, the node broadcasts another transaction Tx1' that uses the same inputs, thus ensuring that the network will reject Tx1 once Tx1 is finalized by the responding node. In a trustworthy network, one can assume that nodes are not malicious in their intent, but the recipient of a partially completed transaction cannot guarantee that the transaction it broadcasts will be accepted once the node has performed an action (based on the command message) and finalized the transaction with an additional signature. Furthermore, there is no way to prevent the creator of a partially completed transaction from reusing inputs if no action has been performed and the transaction has not been broadcast.
[0015] According to another aspect disclosed herein, a computer-implemented method for determining whether to accept a blockchain transaction from a first party is provided, the method being executed by a second party and including the steps of: receiving the first blockchain transaction from the first party via an off-chain communication channel, the first blockchain transaction including an input for unlocking an output of a blockchain transaction previously transmitted to one or more nodes of a blockchain network for inclusion in the blockchain; determining whether the first party has transmitted to the second party (a) a signature generated based on the first blockchain transaction and one or more first time indicators, each first time indicator indicating when the first blockchain transaction was generated and / or transmitted, and (b) one or more time indicators; and accepting the first blockchain transaction based on one or more conditions, a first condition of the one or more conditions being that the first party has transmitted the signature and the one or more first time indicators.
[0016] The present invention mitigates the risk of double-spend attempts caused by malicious actors. To build the scenario described above, the first and second parties may be nodes of an IoT network, and a first blockchain transaction ("control transaction") is used by the first party (first node) to instruct the second party (second node) to control an end device. For example, the first node may be a master node and the second node may be a slave node. The nodes may be configured to accept and act on 0-conf transactions. If a malicious party gains control of the first node, the malicious party may attempt to control the second node by replaying transactions or by using spent outputs of previous transactions. The second node may be configured to only accept control transactions with a signature and an indicator. Alternatively, the second node may only accept transactions with a timestamp indicating a time within a threshold of the time the first blockchain transaction was received.
[0017] It will be appreciated that there are many scenarios in which the risk of double-spend attempts may arise when blockchain transactions are sent off-chain between parties, and the present invention is applicable to all such scenarios.
[0018] To aid in the understanding of embodiments of the present disclosure and to show how such embodiments may be put into effect, reference will now be made, by way of example only, to the accompanying drawings, in which: [Brief description of the drawings]
[0019] [Figure 1] FIG. 1 is a schematic block diagram of a system for implementing a blockchain. [Diagram 2] FIG. 1 illustrates generally some examples of transactions that may be recorded in a blockchain. [Diagram 3]FIG. 1 is a schematic block diagram of another system for implementing a blockchain. [Figure 4A] FIG. 2 is a schematic block diagram of a client application. [Figure 4B] FIG. 4B is a schematic mock-up of an exemplary user interface that may be presented by the client application of FIG. 4A. [Diagram 5] FIG. 1 illustrates a schematic diagram of an overlap between an IoT network and a blockchain network. [Figure 6] FIG. 1 illustrates a schematic diagram of a hierarchical network topology. [Figure 7a] FIG. 2 illustrates an example partial command transaction; [Figure 7b] FIG. 2 illustrates a schematic diagram of an exemplary complete command transaction. [Figure 8a] FIG. 13 is a schematic diagram of another exemplary partial command transaction. [Figure 8b] FIG. 13 is a schematic diagram of another exemplary complete command transaction. [Figure 9] FIG. 2 illustrates a schematic diagram of a command request and response cycle. [Figure 10a] FIG. 2 illustrates a schematic of a command and request cycle in which a malicious node has issued a dual-spend command transaction; [Figure 10b] FIG. 2 illustrates a schematic of a command and request cycle in which a malicious node has issued a dual-spend command transaction; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0020] Exemplary System Overview FIG. 1 generally illustrates an exemplary system 100 for implementing a blockchain 150. The system 100 includes a packet-switched network 101, typically a wide area network such as the Internet. The packet-switched network 101 includes a plurality 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's computing equipment, with different ones of the nodes 104 belonging to different peers. Each node 104 includes one or more processors, e.g., a processing unit including 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., computer-readable storage in the form of a non-transitory computer-readable medium. The memory may include one or more memory units using one or more memory media, e.g., a magnetic medium such as a hard disk, an electronic medium such as a solid-state drive (SSD), a flash memory, or an EEPROM, and / or an optical medium such as an optical disk drive.
[0021] The blockchain 150 comprises a chain 151 of blocks of data, with a respective copy of the blockchain 150 maintained at each of multiple nodes in the P2P network 106. Each block 151 in the chain includes one or more transactions 152, where a 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 comprises at least one input and at least one output. Each output specifies an amount that represents the amount of digital assets belonging to a user 103 that the output is cryptographically locked (requiring that user's signature to unlock and thereby redeem or spend). Each input points back to the output of a previous transaction 152, thereby linking the transactions.
[0022] At least some of the nodes 104 take on the role of forwarding nodes 104F that forward and thereby propagate transactions 152. At least some of the nodes 104 take on the role of miners 104M that mine blocks 151. At least some of the nodes 104 take on the role of storage nodes 104S (sometimes also referred to as "full copy" nodes), each of which stores a respective copy of the same blockchain 150 in their respective memories. 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 104F, a miner 104M, a storage node 104S, or any combination of two or all of these.
[0023] For a given current transaction 152j, the input (or each input) contains a pointer that references the output of a previous transaction 152i in the sequence of transactions, specifying that this output is to be redeemed or "used" in the current transaction 152j. In general, the previous transaction can be any transaction in the pool 154 or in any block 151. The previous transaction 152i does not necessarily have to exist at the time the current transaction 152j is created or sent to the network 106, but the previous transaction 152i must exist and be valid for the current transaction to be valid. Thus, "previous" in this specification refers to a predecessor in the logical sequence linked by the pointer, and not necessarily to a time of creation or a time of sending in the temporal sequence, and therefore does not necessarily preclude transactions 152i, 152j from being created or sent out of order (see the discussion below regarding orphan transactions). The previous transaction 152i may be equally referred to as an antecedent transaction or a predecessor transaction.
[0024] The input of the current transaction 152j also includes the signature of the user 103a to which the output of the previous transaction 152i was locked. The output of the current transaction 152j can then be cryptographically locked to the new user 103b. Thus, the current transaction 152j can transfer the amount defined in the input of the previous transaction 152i to the new user 103b as defined in the output of the current transaction 152j. In some cases, a transaction 152j can have multiple outputs to divide the input amount among multiple users (one of which can be the original user 103a to provide change). In some cases, a transaction can also have multiple inputs to collect amounts from multiple outputs of one or more previous transactions and redistribute them to one or more outputs of the current transaction.
[0025] The above is sometimes called an "output-based" transaction protocol, and sometimes called an Unspent Transaction Output (UTXO) type protocol (where the outputs are called UTXOs). A user's total balance is not defined in any one number stored in the blockchain, instead, the user needs a special "wallet" application 105 to collate the values of all of that user's UTXOs scattered across many different transactions 152 in the blockchain 151.
[0026] An alternative type of transaction protocol is sometimes called an "account-based" protocol, as part of an account-based transaction model. In the account-based case, each transaction defines the amount to be sent by referencing an absolute account balance, rather than by referencing the UTXO of the previous transaction in the sequence of past transactions. The current state of every account is stored by miners separately from the blockchain and is constantly updated. In such a system, transactions are ordered using the running transaction tally (also called "position") of the account. This value is signed by the sender as part of the sender's cryptographic signature and hashed as part of the transaction reference calculation. In addition to that, optional data fields may also be signed in the transaction. This data feed may point to a previous transaction, for example if the previous transaction ID is included in the data feed.
[0027] In either type of transaction protocol, 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 typically 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 at each of the nodes 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 contained within the input of the new transaction 152j matches a condition defined in the output of the previous transaction 152i that the new transaction uses, which typically includes at least checking that the cryptographic signature within 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 a custom script contained within the input and / or output. Alternatively, the condition may be fixed solely by the node protocol, or the condition may result from a combination of these. In any case, if the new transaction 152j is valid, the current node forwards the 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 thus forwarding the new transaction 152j to one or more further nodes 104, and so on. In this way, the new transaction is The option is propagated throughout the network of nodes 104.
[0028] In an output-based model, the definition of whether a given output (e.g., UTXO) is spent is whether that output has also been validly redeemed by an input of another forward transaction 152j according to the node protocol. Another condition for a transaction to be valid is that the output of the previous transaction 152j that the transaction is trying to spend or redeem has not already been spent / redeemed by another valid transaction. If not valid, the transaction 152j is not propagated or recorded in the blockchain. This prevents double-spending, where a spender tries 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, since the order of transactions is defined, the account balance has a single defined state at any point in time.
[0029] In addition to validation, at least some of the nodes 104M also compete to be the first to create a block of transactions in a process known as mining, 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. Typically, this 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 certain predefined number of leading zeros. A property of a hash function is that it has an unpredictable output for its input. This search can therefore only be performed by brute force, thus consuming a significant amount of processing resources at each node 104M trying to solve the puzzle.
[0030] The first miner node 104M that solves the puzzle announces this to the network 106 and provides the solution as a proof that can be easily checked by other nodes 104 in the network (once the solution to the hash is given, it is easy to check that it makes the output of the hash satisfy the condition). The pool 154 of transactions in which the winner solved the puzzle then becomes 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 announced solution in each such node. A block pointer 155 pointing to a previously created block 151n-1 in the chain is also assigned to the new block 151n. Proof of work helps to reduce the risk of double spends, since it takes a lot of effort to create a new block 151, and since any block containing double spends is likely to be rejected by other nodes 104, mining nodes 104M are incentivized not to allow double spends to be included in their blocks. Once created, blocks 151 cannot be altered because they are known and maintained at each of the storage nodes 104S in the P2P network 106 according to the same protocol. Block pointers 155 also impose a sequential order on the blocks 151. This therefore 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.
[0031] Note that different miners 104M competing to solve a puzzle at any given time may be doing so based on different snapshots of the unmined transaction pool 154 at any given time, depending on when they started searching for a solution. Every miner who solves the respective puzzle first defines which transactions 152 will be included in the next new block 151n, and the current pool 154 of unmined transactions is updated. Then, miners 104M continue to compete to create blocks from the newly defined unmined pool 154, and so on. There is also a protocol to resolve any "forks" that may occur, which is when two miners 104M solve their puzzles within a very short time of each other, such that competing views of the blockchain propagate. In essence, whichever prong of the fork grows the longest will be the final blockchain 150.
[0032] 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 thin air (as opposed to a regular transaction that 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 "generating" transaction. This transaction automatically forms part of a new block 151n. This reward incentivizes the miner 104M to participate in the proof-of-work race. Often, a regular (non-generating) transaction 152 also specifies an additional transaction fee in one of its outputs to further reward the winning miner 104M who created the block 151n in which the transaction is included.
[0033] Depending on the computational resources involved in mining, typically at least each of the miner nodes 104M takes the form of a server with one or more physical server units, or of 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 can take the form of a user terminal, or a group of user terminals networked together.
[0034] The memory of each node 104 stores software configured to execute on the processing unit of the node 104 to perform its respective role and process transactions 152 in accordance with the node protocol. It will be understood that any action attributed to a node 104 herein may be performed by software executing on the processing unit of the respective computing device. Additionally, the term "blockchain" as used herein is a general term referring to a type of technology in general and is not limited to any particular proprietary blockchain, protocol, or service.
[0035] Also connected to the network 101 are computer devices 102 of a number of parties 103 in the role of consuming users. They act as payers and payees in transactions, but are not necessarily involved 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 illustrative purposes: a first party 103a and its respective computer device 102a, and a second party 103b and its respective computer device 102b. It will be understood that many more such parties 103 and their respective computer devices 102 exist and are involved 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 is referred to herein as Alice and the second party 103b is referred to as Bob, although it will be understood that this is not a limitation and that any reference to Alice or Bob herein may be replaced with the "first party" and "second party," respectively.
[0036] The computer equipment 102 of each party 103 comprises a respective processing device comprising one or more processors, e.g., one or more CPUs, GPUs, other accelerator processors, application specific processors, and / or FPGAs. The computer equipment 102 of each party 103 further comprises a memory, i.e., computer readable storage in the form of a non-transitory computer readable medium. This memory may comprise one or more memory units using one or more memory media, e.g., magnetic media such as hard disks, electronic media such as SSDs, flash memories, or EEPROMs, and / or optical media such as optical disk drives. The memory on the computer equipment 102 of each party 103 stores software including a respective instance of at least one client application 105 configured to run on the processing device. It will be understood that any action attributed to a given party 103 herein may be performed using software running on the processing device of the respective computer equipment 102. The computer equipment 102 of each party 103 comprises at least one terminal, e.g., a desktop or laptop computer, a tablet, a smartphone, or a wearable device such as a smart watch. The computing equipment 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.
[0037] The client application or software 105 may be initially provided to the computing equipment 102 of any given party 103 on a suitable computer readable storage medium, for example downloaded from a server, or provided on a removable SSD, a flash memory key, a removable EEPROM, a removable magnetic disk drive, a magnetic floppy disk or tape, an optical disk such as a CD or DVD ROM, or a removable optical drive, or the like.
[0038] The client application 105 comprises at least a "wallet" functionality. It has two main functions. One of these is to allow each user party 103 to create, sign, and send transactions 152 that are to be propagated throughout the network of nodes 104 and thereby included within the blockchain 150. The other is to report to each party the amount of digital assets that each party currently owns. In an output-based system, this second function involves reconciling the amounts that belong to the party in question, as defined in the outputs of the various transactions 152 scattered throughout the blockchain 150.
[0039] An instance of a client application 105 on each computing device 102 is operatively coupled to at least one of the transfer nodes 104F of the P2P network 106. This allows the wallet function of the client 105 to send a transaction 152 to the network 106. The client 105 can 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, can actually inspect the transactions of other parties in the blockchain 150, since the blockchain 150 is a public facility that provides transaction authenticity in part through its public visibility). The wallet function on each computing device 102 is configured to formulate and send the transaction 152 according to a transaction protocol. Each node 104 executes software configured to validate the transaction 152 according to the node protocol, or, in the case of the transfer node 104F, to 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 together with a given node protocol implements a given transaction model. The same transaction protocol is used for all transactions 152 in the blockchain 150 (however, the transaction protocol may allow for different subtypes of transactions in the blockchain 150). The same node protocol is used by all nodes 104 in the network 106 (however, the node protocol may process transactions of different subtypes differently according to rules defined for that subtype, and different nodes may take on different roles and therefore implement different corresponding aspects of the protocol).
[0040] 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 a proof-of-work process as discussed above. Each block 151 also includes a block pointer 155 that points to a previously created block 151 in the chain to define a sequential order for the blocks 151. The blockchain 150 also includes a pool 154 of valid transactions waiting to be included in a new block by the proof-of-work process. Each transaction 152 (other than the generative transaction) includes a pointer to a previous transaction to define an order for the sequence of transactions (note: the sequence of transactions 152 is allowed to branch). The chain of blocks 151 dates back to the first block in the chain, a genesis block (Gb) 153. One or more original transactions 152 earlier in the chain 150 pointed to the genesis block 153, not to a previous transaction.
[0041] When a given party 103, for example Alice, wants to send a new transaction 152j to be included in the blockchain 150, Alice formulates the new transaction according to the relevant transaction protocol (using a wallet function in the client application 105 of the transaction). Alice then sends the transaction 152 from the client application 105 to one of one or more forwarding nodes 104F to which the party is connected. For example, this may be the forwarding node 104F that is closest to or best connected to Alice's computer 102. When any given node 104 receives the new transaction 152j, the node processes the transaction according to the node protocol and its respective role. This includes first checking whether the newly received transaction 152j meets certain conditions for being "valid", examples of which are discussed in more detail below. In some transaction protocols, the conditions for validity may be configurable on a per-transaction basis by a script included in the transaction 152. Alternatively, conditions may simply be a built-in feature of the node protocol, or may be defined by a combination of scripts and the node protocol.
[0042] Provided that the newly received transaction 152j passes the test to be considered valid (i.e., the transaction is "validated"), 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 104F. Additionally, any forwarding node 104F that receives the transaction 152j propagates the validated transaction 152 onward to one or more other nodes 104 in the P2P network 106. Because each forwarding node 104F applies the same protocol, this means that, assuming the transaction 152j is valid, it will be propagated throughout the P2P network 106 immediately.
[0043] Once admitted to the pool 154 in the copy of the blockchain 150 maintained in one or more storage nodes 104S, the miner nodes 104M begin competing to solve the proof-of-work puzzle on the latest version of the pool 154 that contains the new transaction 152 (other miners 104M may still be trying to solve the puzzle based on their old view of the pool 154, but whichever miner gets there first will define where the next new block 151 ends and the new pool 154 begins, and eventually a miner will solve the puzzle for the part of the pool 154 that contains Alice's transaction 152j). Once the proof-of-work is done for the pool 154 that contains the new transaction 152j, it becomes part of one of the blocks 151 in the blockchain 150 and is immutable. Since each transaction 152 contains a pointer to the previous transaction, the order of the transactions is also immutably recorded.
[0044] UTXO-based model Figure 2 shows an exemplary transaction protocol. This is an example of a UTXO-based protocol. A transaction 152 (abbreviated as "Tx") is a fundamental data structure of the blockchain 150 (each block 151 contains one or more transactions 152). The following is described by referring to an output-based or "UTXO"-based protocol. However, this does not limit all possible embodiments.
[0045] In a UTXO-based model, each transaction ("Tx") 152 comprises a data structure with one or more inputs 202 and one or more outputs 203. Each output 203 may include an unspent transaction output (UTXO) that can be used as a source for the input 202 of another new transaction (if the UTXO has not yet been redeemed). The UTXO includes a value that specifies an amount of a digital asset. This represents a set number of tokens on the (distributed) ledger. The UTXO may also include the transaction ID of the originating transaction, among other information. The transaction data structure may also include a header 201 that may include indicators of the size of the input fields 202 and the output fields 203. The header 201 may also include the ID of the transaction. In an embodiment, the transaction ID is a hash of the transaction data (excluding the transaction ID itself) and is stored in the header 201 of the raw transaction 152 submitted to the miner 104M.
[0046] Note that although each output in FIG. 2 is shown as a UTXO, a transaction may additionally or alternatively include one or more unspendable transaction outputs.
[0047] Suppose Alice 103a wants to create a transaction 152j that transfers an amount of the digital asset in question to Bob 103b. In FIG. 2, Alice's new transaction 152j is labeled "Tx1". This transaction takes the amount of the digital asset locked to Alice in the output 203 of the previous transaction 152i in the sequence and transfers at least a portion of it to Bob. The previous transaction 152i is labeled "Tx0" in FIG. 2. Tx0 and Tx1 are just arbitrary labels. They do not necessarily imply that Tx0 is the first transaction in the blockchain 151, nor that Tx1 is the immediate next transaction in the pool 154. Tx1 could refer to any previous (i.e., preceding) transaction that still has unspent outputs 203 locked to Alice.
[0048] The previous transaction Tx0 may already be valid and included in the blockchain 150 at the time Alice creates her new transaction Tx1, or at least by the time Alice submits her new transaction to the network 106. The previous transaction Tx0 may already be included in one of the blocks 151 at that time, or may still be waiting in the pool 154, in which case it will be included in the new block 151 shortly. Alternatively, Tx0 and Tx1 may be created together and submitted to the network 102, or Tx0 may be submitted after Tx1 if the node protocol allows for buffering of "orphan" transactions. The terms "previous" and "subsequent" 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). The terms may be equally replaced with "predecessor" and "successor", or "predecessor" and "descendant", "parent" and "child", etc. It does not necessarily imply the order in which they are created, sent to the network 106, or arrive at any given node 104. However, later transactions (descendant transactions or "children") that point to earlier transactions (predecessor transactions or "parents") are not enabled until and unless the parent transaction is enabled. A child that arrives at a node 104 before its parent is considered an orphan. The child 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.
[0049] One of the one or more outputs 203 of the previous transaction Tx0 includes a particular UTXO, here labeled 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 subsequent transaction for the subsequent transaction to be valid and thus successfully redeem the UTXO. 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 defines the unlocking conditions, and typically includes a condition that the unlocking script in the input of the subsequent transaction includes a cryptographic signature of the party to which the previous transaction was locked.
[0050] A lock script (aka scriptPubKey) is code written in a domain-specific language recognized by the node protocol. A specific example of such a language is called "Script" (capital S). A lock script specifies the information needed to use the transaction output 203, e.g., the requirements for Alice's signature. An unlock script appears in the transaction's output. An unlock script (aka scriptSig) is code written in a domain-specific language that provides the information needed to satisfy the criteria of a lock script. For example, an unlock script might include Bob's signature. An unlock script appears in the transaction's input 202.
[0051] Thus, in the illustrated example, UTXO0 in output 203 of Tx0 must have Alice’s signature Sig P in order for UTXO0 to be redeemed (or, more precisely, for a subsequent transaction that attempts to redeem UTXO0 to be valid). A Requires lock script [Checksig P A ]. [Checksig P A ] is the public key P from Alice’s public-private key pair. AThe inputs 202 of Tx1 include a pointer to Tx1 (e.g., by its transaction ID, TxID0, which in an embodiment is a hash of the entire transaction Tx0). The inputs 202 of Tx1 include an index that identifies UTXO0 within Tx0, to identify UTXO0 among any other possible outputs of Tx0. The inputs 202 of Tx1 include an unlock script that includes Alice's cryptographic signature, created by Alice applying her private key from her key pair to a predefined portion of data (sometimes called a "message" in cryptography). <Sig P A The data (or "message") that needs to be signed by Alice to provide a valid signature may be defined by the lock script, or by the node protocol, or by a combination of these.
[0052] When a new transaction Tx1 arrives at node 104, the node applies the node protocol. This 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 concatenating the two scripts as follows: <Sig P A > <P A >||[Checksig P A ] Here, "||" represents concatenation, "<...>" means to put data on the stack, and "[...]" is a function constructed by the unlock script (a stack-based language in this example). Similarly, the scripts could be executed one after the other using a common stack rather than concatenating the scripts. Either way, when executed together, the scripts use Alice's public key P, contained within 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. AIn order to perform this authentication, it is necessary that the expected portion of the data itself (the "message") is also contained within Tx0. In an embodiment, the signed data includes the entirety of Tx0 (so there is no need to include a separate element that specifies the signed portion of the data in plaintext, since it is essentially already there).
[0053] The details of public-private cryptographic authentication will be familiar to those skilled in the art. Essentially, if Alice signs a message by encrypting it with her private key, then given Alice's public key and the message in plaintext (the unencrypted message), another entity, such as node 104, can authenticate that the encrypted version of the message must have been signed by Alice. Signing typically involves hashing the message, signing the hash, and tagging this as the signature to the plaintext version of the message, thus allowing any holder of the public key to authenticate the signature.
[0054] If the unlock script in Tx1 satisfies one or more conditions specified in the lock script of Tx0 (thus, in the illustrated embodiment, Alice's signature is provided and authenticated in Tx1), the node 104 considers Tx1 valid. If the node is a mining node 104M, this means adding the node to the pool of transactions 154 waiting for proof of work. If the node is a forwarding node 104F, it forwards the transaction Tx1 to one or more other nodes 104 in the network 106 for it to be propagated throughout the network. Once Tx1 is validated and included in the blockchain 150, this defines the UTXO0 from Tx0 as spent. Note that Tx1 can only be valid if it uses unspent transaction outputs 203. If it attempts to use an output that has already been spent by another transaction 152, Tx1 becomes invalid even if all other conditions are met. Thus, the node 104 may not use the UTXO referenced in the previous transaction Tx0. O has already been spent (already forms a valid input to another valid transaction). This is one of the reasons why it is important for the blockchain 150 to impose a defined order on transactions 152. In practice, a given node 104 may maintain a separate database that marks which UTXOs 203 have been spent in which transactions 152, but what ultimately defines whether a UTXO has been spent is whether it already forms a valid input to another valid transaction in the blockchain 150.
[0055] Note that in the UTXO-based transaction model, a given UTXO must be spent in its entirety. One cannot "leave" a fraction of the amount defined in the UTXO spent, and another fraction is used. However, the amount from the UTXO may be split among multiple outputs of a subsequent transaction. For example, the amount defined in UTXO0 in Tx0 may be split among multiple UTXOs in Tx1. Thus, if Alice does not want to give Bob the entire amount defined in UTXO0, she can use the remainder to give herself change in the second output of Tx1, or to pay another party.
[0056] In practice, Alice typically also needs to include a fee to the winning miner, since the reward for the generating transaction alone is typically not enough to incentivize mining today. If Alice does not include a fee to the miner, Tx0 will likely be rejected by the miner nodes 104M and thus, while technically valid, will still not be propagated and included in the blockchain 150 (the miner protocol does not force the miner 104M to accept the transaction 152 if it 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, any difference between the total amount indicated 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 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, it is not necessarily precluded that a miner's fee may alternatively or additionally be explicitly specified in one of the UTXOs 203 of transaction 152 itself.
[0057] Note also that if the total amount specified in all outputs 203 of a given transaction 152 is greater than the total amount implied by all its inputs 202, this is another ground of invalidity in most transaction models. Thus, such a transaction is not propagated and is not mined into a block 151.
[0058] Alice and Bob's digital assets are composed of unspent UTXOs locked to them in any transaction 152 anywhere in the blockchain 150. Thus, typically, the assets of a given party 103 are scattered across the UTXOs of various transactions 152 throughout the blockchain 150. There is no one number stored anywhere in the blockchain 150 that defines the total balance of a given party 103. The role of the wallet function in the client application 105 is to collate the values of all the various UTXOs locked to each party that have not yet been used in another forward transaction. This can be done by querying a copy of the blockchain 150 as stored in one of the storage nodes 104S, for example, the storage node 104S that is closest to or best connected to the computing device 102 of each party.
[0059] Note that script code is often expressed diagrammatically (i.e., not in a precise language). For example, A]=OP_DUP OP_HASH160<H(Pa)> OP_EQUALVERIFY may be written as [Checksig PA], which stands for OP_CHECKSIG. The "OP_..." refers to a specific opcode in the 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). Upon execution, any occurrences of the signature ("sig") are removed from the script, but additional requirements such as a hash puzzle remain in the transaction that was verified by the "sig" input. As another example, OP_RETURN is a scripting language opcode for storing metadata in the transaction, thereby creating an unusable output of the transaction that can immutably record the metadata in the blockchain 150. For example, the metadata can include a document that is desired to be stored in the blockchain.
[0060] signature P A is a digital signature. In an embodiment, it is based on ECDSA using the elliptic curve secp256k1. The 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 to select which outputs are signed (and therefore fixed at the time of signing).
[0061] A lock script is sometimes referred to as a "scriptPubKey", referring to the fact that each transaction contains the public key of the party being locked. An unlock script is sometimes referred to as a "scriptSig", referring to the fact that it supplies the 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, the scripting language may be used to define any condition or conditions. Thus, the more general terms "lock script" and "unlock script" may be preferred.
[0062] Optional Side Channel FIG. 3 illustrates a further system 100 for implementing a blockchain 150. The system 100 is substantially the same as described with respect to FIG. 1, except that an additional communication function is included. The client applications on Alice's and Bob's computing devices 102a, 102b, respectively, are provided with an additional communication function. That is, it allows Alice 103a to establish a separate side channel 301 with Bob 103b (either party or at the instigation of a third party). The side channel 301 allows for the exchange of data apart from the P2P network. Such communication is sometimes referred to as "off-chain". For example, it can be used to exchange transactions 152 between Alice and Bob without the transaction being published (yet) on the network P2P 106 or progressing to the chain 150 until one of the parties chooses to broadcast it to the network 106. Alternatively or additionally, the side channel 301 can be used to exchange any other transaction-related data, such as keys, negotiated amounts or terms, data content, etc.
[0063] 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 mobile cellular network, a local area network, such as a local wireless network, or a direct wired or wireless link between Alice's device 102a and Bob's device 102b. In general, the side channel 301 referred to anywhere herein may comprise any link or 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 may be referred to as the side channel 301 as a whole. Thus, it should be noted that when Alice and Bob are said to exchange certain information or data, etc., over the side channel 301, this does not necessarily mean that all of these data must be transmitted over exactly the same links or the same type of network.
[0064] Client Software 4A illustrates an exemplary implementation of a client application 105 for implementing embodiments of the presently disclosed schemes. The client application 105 comprises a transaction engine 401 and a user interface (UI) layer 402. The transaction engine 401 is configured to implement the underlying transaction-related functionality of the client 105, such as formulating transactions 152, receiving and / or sending transactions and / or other data via side channels 301, and / or sending transactions to be propagated over the P2P network 106, in accordance with the schemes discussed above and in more detail below.
[0065] The UI layer 402 may be configured to render a user interface via user input / output (I / O) means of each user's computing device 102, including outputting information to each user 103 via user output means of the device 102 and receiving input from each user 103 via user input means of the device 102. For example, the user output means may comprise one or more display screens (touch screen or non-touch screen) for providing visual output, one or more speakers for providing audio output, and / or one or more haptic output devices for providing tactile output, etc. The user input means may comprise, for example, one or more touch screen input arrays (same or different as those used for the output means), one or more cursor-based devices such as a mouse, trackpad, or trackball, one or more microphones and speech or voice recognition algorithms for receiving speech or audio input, one or more gesture-based input devices for receiving input in the form of manual or physical gestures, or one or more mechanical buttons, switches, or joysticks, etc.
[0066] NOTE: Although various functions herein may be described as being integrated into the same client application 105, this is not necessarily limiting and instead they may be implemented, for example, as a suite of two or more different applications, one plugging into the other or interacting via an API (Application Programming Interface). For example, the functionality of the transaction engine 401 may be implemented in a separate application from the UI layer 402, or the functionality of a given module, such as the transaction engine 401, may be split between two or more applications. It is also not excluded that some or all of the described functionality may be implemented, for example, in the operating system layer. Where reference is made anywhere in this specification to a single or given application 105, etc., it will be understood that this is merely an example and that, more generally, the described functionality may be implemented in any form of software.
[0067] 4B provides a mock-up of an example user interface (UI) 400 that may be rendered by a UI layer 402 of a client application 105a on Alice's device 102a. It will be understood that a similar UI may be rendered by a client 105b on Bob's device 102b or any other party's device.
[0068] 4B illustrates a UI 400 from Alice's perspective. The UI 400 may comprise one or more UI elements 411, 412, 413 rendered as separate UI elements via user output means.
[0069] For example, the UI elements may include one or more user selectable elements 411, which may be different on-screen buttons, different options in a menu, etc. User input means are arranged to allow the user 103 (in this case, Alice 103a) to select or otherwise manipulate one of the options, such as by clicking or touching the UI element on the screen or speaking the name of the desired option (Note: the term "manual" as used herein is meant only in contrast to automatic and is not necessarily limited to the use of hands). The options allow the user (Alice) to generate transactions and send them to another user (Bob), and generate signatures for the transactions according to the described embodiment.
[0070] Alternatively or additionally, the UI elements may include one or more data entry fields 412, via which a user may enter data to be included in the generated transaction and / or a message to be signed. These data entry fields may be rendered via user output means, e.g., on-screen, and data may be entered into the fields via user input means, e.g., a keyboard or touch screen. Alternatively, data may be received orally, e.g., based on speech recognition.
[0071] Alternatively or additionally, the UI elements may include one or more information elements 413 that are output to output information to the user, which / these may be rendered on a screen or audibly, for example.
[0072] It will be understood that the particular means of rendering the various UI elements, selecting options, and inputting data is not important. The functionality of these UI elements will be discussed in more detail shortly below. It will also be understood that the UI 400 shown in FIG. 4B is merely a stylized mockup, and may in fact include one or more additional UI elements that are not shown for the sake of brevity.
[0073] Dual Use Proof An embodiment of the present invention will be described with reference to the exemplary system of Figure 3. A first party (Alice) 103a is configured to communicate with a second party (103b) via an off-chain communication channel, e.g., a side channel 301. It will be understood that some or all of the actions attributed to Alice 103a and Bob 103b are performed by the respective computing equipment of Alice 103a and Bob 103b.
[0074] Alice 103a generates a first blockchain transaction Tx1. The first transaction Tx1 includes an input that references an output of a previous transaction. As described with reference to FIG. 2, the previous transaction Tx0 is a transaction that has already been sent to one or more nodes 104 of the blockchain network 106. Note that the previous transaction does not necessarily have to be included in a block of the blockchain 150. It is sufficient that the previous transaction has been sent to one or more nodes 104. When a transaction is submitted to a node 104 of the network 106, the node first adds the transaction to their respective transaction memory pool (also known as a "mempool"). The mining node 104M attempts to form a block 151 from the transactions included in the mempool.
[0075] Alice 103a also generates a signature for the message. The message is based at least in part on the first transaction Tx1. For example, the message to be signed may include part or all of the first transaction Tx1. Additionally or alternatively, the message may include a transaction identifier TxID1 of the first transaction Tx1. The message is also based at least in part on one or more time indicators. Each time indicator indicates (or represents or corresponds to) a time when the first transaction Tx1 was generated and / or sent to the second party 103b. For example, the time indicator may be a timestamp, e.g., the time (e.g., UNIX time) when the first transaction Tx1 was generated by Alice 103a. As another example, the time indicator may be the height of the current block of the blockchain 150. The height of a block is the number of blocks preceding a particular block 151 in the blockchain 150. For example, the originating block 153 has a height of zero because it has zero blocks preceding it. Such time indicators have, on average, a granularity of 10 minutes, since a new block is currently added to the blockchain 150 approximately every 10 minutes. The time indicator may generally be any indicator that at least approximately indicates when a transaction was generated or sent. Other examples of time indicators include blockchain-related time indicators, such as a current total number of transactions submitted to the blockchain, a current total number of unspent transaction outputs (UTXOs) on the blockchain 150, a current blockchain size, a current hash rate, a total number of unique addresses, etc., and / or blockchain-related time indicators, such as a current date and / or time, a current GBP-USD exchange rate, a company's stock price, a snapshot of a stock market index, etc. One, some, or all of the above time indicators may be used to generate a signature.
[0076] The message may include the first transaction Tx1 concatenated with one or more time indicators. Additionally or alternatively, the message may include an identifier TxID1 of the first transaction Tx1 concatenated with one or more time indicators.
[0077] Alice 103a sends the first transaction Tx1, a signature, and one or more indicators on which the signature is based to Bob 103b. Alice 103a sends the first transaction Tx1 to Bob 103b via a side channel 301 (i.e., an off-chain channel). Alice 103a may also send the signature and indicators via the same side channel 301. Alice 103a may instead use a different side channel. In some examples, Alice 103a may include the signature and / or indicators in a different blockchain transaction and submit the transaction to the blockchain network 106. The different blockchain transaction serves as an immutable record of the signature and indicators in case of a dispute with Bob 103b.
[0078] When Bob 103b receives the first transaction from Alice 103a, it checks whether Alice 103a also sent a signature and a time indicator. The particular time indicator may be specified by Bob 103b or by the protocol that Alice 103a and Bob 103b adhere to (or are intended to adhere to).
[0079] In general, Alice 103a may use any signature scheme to generate the signature. Preferably, Alice 103a signs the message using a private key that corresponds to a public key associated with (or that may be linked to) Alice 103a. Alice 103a may use the Elliptic Curve Digital Signature Algorithm (ECDSA) to sign the message with Alice 103a's private key. The public key may be a certified public key. The public key may be known by or accessible to Bob 103b prior to receiving the first transaction.
[0080] In some examples, the first transaction may be a partial transaction, i.e., a partially completed blockchain transaction. That is, a partial transaction may lack one or more inputs and / or outputs necessary for the transaction to be accepted by the nodes 104 of the blockchain network 106. For example, a partial transaction may not include any outputs. As another example, a partial transaction may include one or more outputs that together lock an amount of digital assets that is greater than the amount of digital assets unlocked by the inputs of the partial transaction.
[0081] In another example, a partial transaction may be a transaction that is technically a valid transaction and may be accepted onto the blockchain, but may also be added to by Bob 103b. That is, a partial transaction may be configured to allow Bob 103b to add one or more inputs or one or more outputs to the transaction. Alice 103a may use different signature flags to sign different components of the transaction, thus allowing Bob 103b to add inputs and / or outputs depending on which flags were used. For example, the signature flag "SIGHASH_ANYONECANPAY" is a signature hash type that signs only the current input, thus allowing Bob 103b to add other inputs and outputs.
[0082] Bob 103b may accept and act on the first transaction Tx1, i.e., perform one or more actions in response to receiving the first transaction. For example, Bob 103b may send something (goods, services, (digital) assets, etc.) to Alice 103a or provide access to something (e.g., a transport network, an office, or other type of building) in return for the first transaction Tx1. Additionally or alternatively, Bob 103b may add one or more inputs and / or one or more outputs to the first transaction Tx1 in response to receiving the first transaction Tx1. As another example, Bob 103b may be configured to initiate a process in response to receiving the first transaction Tx1 without initiating control of a device controllable by Bob 103b. That is, Bob 103b may be configured to control one or more devices connected to Bob 103b (e.g., via a wired or wireless connection). Control of devices in response to receiving a transaction is described below. Any of the above actions may be performed automatically by Bob in response to receiving the first transaction Tx1.
[0083] Bob 103b may only act on the first transaction under one or more conditions. That is, Bob 103b may choose whether to accept the first transaction only if at least one condition is met. A first condition that must be met for Bob 103b to accept the first transaction is that Alice 103a must have sent a signature (i.e., a signature based on the first transaction and a time indicator) and a time indicator to Bob 103b. The condition may be met if Alice 103a sends the signature and indicator together with (e.g., at the same time as) the first transaction. Alternatively, Alice 103a has previously sent the signature and time indicator to Bob 103b if the time indicator indicates when the first transaction was generated. Bob 103b may reject the first transaction if Alice 103a has not sent the signature and time indicator.
[0084] Another example of a condition that may have to be met for Bob 103b to accept the first transaction is that one, some, or all of the time indicators indicate that the first transaction was generated and / or transmitted to Bob 103b within a threshold period from when Bob 103b actually received the first transaction. That is, Bob 103b may determine for himself one or more time indicators, each corresponding to one of the time indicators transmitted by Alice 103a, and then check that there is no large discrepancy between the received and determined time indicators. For example, Alice 103a may transmit the UNIX time at which the first transaction was generated. Bob 103b may determine the UNIX time at which the first transaction was received. If the two times differ by more than a predetermined (i.e., specified) threshold, Bob 103b may reject the first transaction.
[0085] Another example of a condition that may have to be met for Bob 103b to accept the first transaction is that the signature must have been generated using a private key corresponding to the public key associated with Alice 103a. Various techniques are known in the art for verifying that a signature was generated using a private key corresponding to a particular public key. Bob 103b may use the expected public key to verify that the signature was indeed signed using the corresponding private key. Bob 103b may already have Alice's public key, or Bob 103b may access it from a public record. As an example, Alice's public key may be certified by a certificate authority and recorded, for example, in the (OP_RETURN) output of the blockchain transaction 152. If the signature was not generated using a private key corresponding to the expected public key, Bob 103b may reject the first transaction.
[0086] As described above, the first transaction may be a partial transaction. If one, some, or all of the conditions for accepting the first transaction are met, Bob 103b may add one or more inputs and / or outputs to the first transaction to complete the transaction. Bob 103b may then submit the completed transaction to the blockchain network 106. Additionally or alternatively, Bob may send the completed transaction back to Alice 103a. Alice 103a may then submit the completed transaction to the blockchain network 106.
[0087] FIG. 5 illustrates another exemplary system 500 for implementing an embodiment of the present invention. The exemplary system 500 comprises a first network 501 of one or more end devices (i.e., computing devices) 502 and one or more bridge nodes 503 (i.e., computing devices that run a blockchain client application 105 and thus act as a bridge between the blockchain network 106 and the first network 501). For clarity, the first network 501 is referred to as an IoT network, i.e., a network of computing devices interconnected by the Internet. However, it will be understood that the first network does not have to be an IoT network, but can generally be any P2P network. Typically, the end devices 502 and the bridge nodes 503 are incorporated into everyday devices. The end devices 502 may take one of a variety of forms, for example, a user device (e.g., a smart TV, a smart speaker, a toy, a wearable, etc.), a smart appliance (e.g., a refrigerator, a washing machine, an oven, etc.), a meter or a sensor (e.g., a smart thermostat, a smart lighting, a security sensor, etc.). Similarly, the bridge nodes 503 may take a variety of forms, including, but not limited to, the same forms that the end devices may take. The nodes 503 may also take the form of dedicated server equipment, base stations, access points, routers, etc. In some examples, each device may have a fixed network (e.g., IP) address. For example, one, some, or all of the end devices may be stationary devices (e.g., smart lights, or smart central heating controllers, etc.) as opposed to mobile devices. In this exemplary system 500, Alice 103a and Bob 103b each take the form of a bridge node 503.
[0088] The IoT network is a packet-switched network 101, typically a wide area internetwork such as the Internet. Nodes 503 and devices 502 of the packet-switched network 101 are arranged to form a peer-to-peer (P2P) overlay network 501 within the packet-switched network 101. Each node 503 comprises a respective computing device, each computing device comprising 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 503 also comprises a memory, i.e., computer-readable storage in the form of a non-transitory computer-readable medium. The memory may comprise 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 memories, or EEPROMs, and / or optical media such as optical disk drives.
[0089] Each node 503 in the IoT network is also a blockchain node 104. These nodes 503 are deployed as bridge nodes (gateway nodes) that act as a bridge (gateway) between the first network 501 and the blockchain network 106. A blockchain node 104 may be a "listening node". A listening node runs a client application 105 that holds a full copy of the blockchain and verifies and propagates new transactions and blocks, but does not actively mine or generate new blocks. Alternatively, a node may be a "simplified payment verification node" (SPV node). An SPV node runs a light client that can generate broadcast Bitcoin transactions and indirectly monitor addresses, but does not hold a full copy of the blockchain.
[0090] Each node 503 in the IoT network is configured to directly or indirectly control an end device 502. A node 503 directly connected to an end device 502 can directly control that device. A node 503 not directly connected to an end device 502 can only indirectly control that device, for example, by forwarding control messages to the end node via one or more intermediate nodes. Each node 503 is connected to one or more mining nodes 104M.
[0091] 5 also illustrates a network 504 of mining nodes 104M that is a subset of the blockchain network 106. Mining nodes are discussed above with reference to Figures 1 through 3. The mining nodes 104M are configured to mine valid transactions (e.g., transactions submitted from IoT nodes) into the blockchain 150.
[0092] As shown in Figure 5, node 503 forms part of both the P2P network 501 and the blockchain P2P network 106, while mining node 104M forms part only of the blockchain P2P network 106. Although end device 502 is shown in Figure 5 as forming part only of the P2P IoT network 501, it is not excluded that end device 502 could also be a blockchain node 104.
[0093] FIG. 6 illustrates an exemplary IoT network 501 topology. The IoT network 501 may control a master node 503a, one or more sets 601 of one or more intermediate nodes 503b, 503c, and a set of end devices 502. The master node 503a is configured to control one or more intermediate nodes 503b, 503c. If the IoT network 501 comprises multiple sets (e.g., tiers) 601a, 601b of intermediate nodes, the master node 503a is configured to directly control a first set (tier) 601a of intermediate nodes ("server nodes" 503b) and one or more further sets (tiers) 601b of intermediate nodes (e.g., tiers of "slave nodes" 503c). The master node 503a is a control node with the ability to override and control the server nodes and slave nodes. Each server node 503b is a node with the ability to control a slave node 503c. Each slave node 503c is a node under the control of the server node 503b and the master node 503a. For example, to instruct the end device 502a, the master node 503a issues a command to the slave node 503c via the servant node 503b.
[0094] Although the exemplary IoT network of FIG. 6 shows only two layers of intermediate nodes (server nodes and slave nodes), other examples may include one or more additional sets of intermediate nodes, for example, between the master node 503a and the server node 503b, and / or between the server node 503b and the slave node 503c. As shown, each node is connected to one or more other nodes via respective connections 602, and each end device 502 is connected to one or more slave nodes via respective connections 602. Hereinafter, one or more nodes (e.g., the master node) are referred to as control nodes. Each control node is a node 503 that can instruct other nodes to perform actions by issuing commands.
[0095] The IoT network nodes 503 may correspond to a hierarchy in scope of function, precedence of command / privileges, and / or span of access. In some implementations, a hierarchical set of SPVs implements an "IoT Controller" with a three-level hierarchy corresponding to the master node 503b, server node 503b, and slave node 503c in FIG. 5 and FIG. 6. The master node 503a instructs one or more server nodes 503b, each of which instructs one or more slave nodes 503c. Each slave node 503c receives instructions from one or more server nodes 503b. All slave nodes 503c communicate with one or more IoT end devices 502, which are the direct channel of communication between the IoT Controller 503 and the IoT end devices 502. The state of execution of the IoT Controller 503 is recorded in a blockchain transaction Tx. Each IoT node, master, server, or slave, has the ability to create and broadcast a corresponding transaction Tx to the blockchain network 106. Each slave node monitors for trigger and / or confirmation signals from the end devices 502, and every IoT node 503 has the ability to interact with any other IoT node for the purpose of executing the overall logic of the IoT controller.
[0096] The master node, server node, and slave node can each independently connect to a node 104 on the blockchain network 106, operate a blockchain wallet 105 (e.g., to monitor blockchain addresses), and possibly run a full node (although this is not required). The master node 503a is configured to monitor the activity of other IoT nodes directly and indirectly under its control, issue commands to these nodes in the form of blockchain transactions Tx, and respond to alerts. The server node 503b is configured to monitor multiple addresses, including addresses not directly controlled by the server node 503b. The server node 503b can be commanded to perform actions by the master node 503a. The slave node 503c is configured to monitor the activity of end devices 502 directly under its control. The slave node 503c is under the direct command of the server node 503b and can also be commanded to perform actions by the master node 503a. The slave node 503c serves as a gateway node for the end devices 502 (i.e., a gateway between the end devices and the blockchain network 106). End devices 502 are configured to connect to nearby slave devices, which report their state using an off-chain messaging protocol.
[0097] A distinction is made between the IoT node 503 and the end device 502 in that the end device 502 is controlled by the IoT node 503 but does not itself control the IoT node 503, although it should be noted that the end device 502 may also be a node 104 of the blockchain network 106. That is, in some examples, the end device 502 may run a blockchain protocol client or wallet application 105.
[0098] The IoT network 501 strikes a balance between centralization and decentralization by combining a command and control hierarchy with the use of a blockchain network infrastructure. Users of the network 501 can create their own multi-level control hierarchies, including client-server and peer-to-peer relationships between devices. The network architecture comprises three layers: the IoT network 501, the blockchain P2P network 104 (i.e., full and lightweight blockchain clients, e.g., master nodes, servant nodes, and slave nodes are lightweight clients that operate SPV wallets 105), and the blockchain mining network 504 (a subset of the blockchain P2P network that validates, propagates, and stores transactions propagated by IoT nodes). The blockchain network 106 serves as a back-end infrastructure, and there is an overlap between the IoT network 501 and the blockchain P2P network 106.
[0099] The first network (e.g., an IoT network) comprises one or more bridge nodes and one or more devices that may be controlled by one or more of the bridge nodes. The bridge nodes are also nodes of the blockchain network. That is, they are part of the IoT network and the blockchain network in the sense that they can connect to both the IoT network (e.g., to communicate with other network nodes and devices) and the blockchain network (e.g., to send transactions to the blockchain and to identify and read transactions recorded on the blockchain). These nodes act as gateways or bridges between the first network and the blockchain network. It is not necessary, but is not excluded, to also have the role of a mining node, a forwarding node, or a storage node of the blockchain network. In some examples, one or more of the devices of the first network may also be nodes of the blockchain network.
[0100] The requesting node (first bridge node) generates a blockchain transaction (first transaction). The transaction is signed by the requesting node and includes an output including command data. The command data includes an identifier of the device to be controlled and a command message that specifies the command. For example, the device may be a smart washing machine and the command message may be an instruction to start a wash cycle. The transaction may be sent to the blockchain and / or sent off-chain to a second node (e.g., a responding node or an authorizing node). The responding node is a bridge node that directly controls the end device with the specified identifier. The authorizing node is a bridge node that has the authority to grant approval for the command to control the end device. Continuing with the washing machine example, the second node may be a smart home hub that controls the washing machine. The first node may be a user device, for example, a laptop, a mobile phone, etc.
[0101] The first blockchain transaction may be a partially completed transaction. Partial completion in this context means that additional inputs (e.g., signatures) may need to be added to complete the transaction. In some cases, the partial transaction may be invalid without the additional inputs, meaning that if submitted to the blockchain network, it would be rejected by the network.
[0102] The responding node obtains the first transaction, for example, from the blockchain itself (if the first transaction was sent to the blockchain) or directly from the requesting node. The responding node then identifies the device to be controlled using the device identifier in the command data and the command message specifying the command. The responding node then sends the command to the identified end device. In other words, the responding node instructs the end device to perform an action based on the command data in the first transaction.
[0103] Preferably, the responding node updates the first blockchain transaction by signing the obtained first transaction, and then sends the updated transaction to the blockchain network. The updated transaction serves as a record of the command request and an acknowledgment of the command executed by the end device.
[0104] Blockchain transactions are templates for digitally signed messages that can be propagated across a global network without discrimination. Nodes use the blockchain as a data carrier network by encoding commands, status updates, and other relevant actions into the outputs of transactions (e.g., unspendable outputs). To minimize communication latency, transactions that encode command data are sent peer-to-peer (i.e., directly between nodes) before being broadcast to the blockchain network.
[0105] The bridge nodes of the first network together operate a decentralized IoT communication protocol using blockchain transactions. The blockchain protocol enables high volume, low fee micro-transaction throughput, as well as a scalable network infrastructure, thus allowing devices to be reliably connected on a global scale while communicating at minimal cost. By combining a multi-level control hierarchy with a blockchain-based communication protocol, the request and IoT communication protocol provides large scale P2P communication using low fee micro-transactions, integration of value transfer and control into one platform, low barrier to entry for IoT network devices, secure time-stamped storage of IoT communication data, and IoT metadata accessible for auditing and operational monitoring.
[0106] Embodiments of the present disclosure provide a protocol for nodes of a network (e.g., an IoT network) 501 to use blockchain transactions Tx to issue command requests, instruct devices based on those command requests, and issue command acknowledgments. Although embodiments are described with reference to an IoT network 501, in general, the teachings of the present disclosure may be applied to any network that includes nodes operating a blockchain protocol client application 105 and end devices controllable by at least a subset of those nodes.
[0107] A first bridge node 503 (e.g., a master node 503a, or a server node 503b) of the network 501 generates a first transaction Tx1 including an input signed by the first node and an output including command data. The command data includes an identifier of the end device 502 to be controlled and a command message for controlling the end device 502. The first node may be the originator of the command. That is, the first node may generate the command data.
[0108] The first node may transmit the first transaction Tx1 to a second bridge node 503 (e.g., slave node 503c) of the first network 501 that controls the end device 502. The first transaction Tx1 may be transmitted off-chain, i.e., without being transmitted to the blockchain. For example, the first transaction Tx1 may be transmitted directly from the first node to the second node, e.g., via the Internet. For example, the first node may be the server node 503b and the second node may be the slave node 503c. Alternatively, the first transaction Tx1 may be transmitted indirectly, e.g., via one or more intermediate nodes. As an example, the first transaction Tx1 may be transmitted from the master node 503a to the slave node 503c via the server node 503b. The second node may be connected to the end device 502 via a wired or wireless network, e.g., via an Ethernet or Wi-Fi connection.
[0109] 1-3, in these examples, the first node may be constituted by Alice's 103a's computer equipment 102a, and the second node may be constituted by Bob's 103b's computer equipment 102b. As previously described, Alice and Bob may use a side channel (e.g., side channel 301) to exchange transactions without the transactions being published (yet) on the blockchain network 106 or progressing to the chain 150 until one of the parties chooses to broadcast the transaction to the network 106.
[0110] The second node may obtain the first transaction Tx1 directly or indirectly from the first node, e.g., the first transaction Tx1 may be forwarded to the second node via one or more intermediate nodes. The second node uses the command data to send a control instruction to the end device 502 identified by a device identifier ("device ID") in the command data. The control message in the command data may define a desired action of the end device 502. The control message may be configured to cause the second node to send a particular one of several possible instructions to the end device 502.
[0111] Alternatively, the second node may be configured to send a single command to the end device 502, i.e., the second node only sends the same command to the end device. This is the case, for example, when the end device 502 is a simple device such as a sensor and the command is a request for a sensor reading. The command (i.e., the command to the end device) may be sent to the device off-chain via a wired or wireless connection, for example, using Wi-Fi. Alternatively, if the device is also a node in the network, the command may be sent via a blockchain transaction Tx.
[0112] In some embodiments, a request and response cycle for device and controller communication may be implemented by the first and second nodes. A request (command) is issued as a partially completed transaction that includes an output that includes the command data (e.g., an OP_RETURN payload). A response (acknowledgment of the command) is a broadcast of the completed transaction that includes the signatures of both the requesting and responding nodes. Transaction malleability makes this method of communication possible, as message recipients can add inputs and outputs but cannot modify the command data (e.g., the OP_RETURN payload).
[0113] The first transaction Tx1 sent from the first node to the second node may be sent without a second output. That is, the transaction includes a single output (an output that includes the command data). To complete the partial transaction, the second node may update the transaction by adding an input and an output to the first transaction. The input includes the signature of the second node, i.e., a signature generated using the private key of the second node. The output is an output locked to the public key of the second node, e.g., a P2PKH output. To spend a P2PKH output, the input of the spend transaction must include a public key such that the hash of the public key (e.g., OP_HASH160) matches the public key hash in the P2PKH output. The P2PKH output requires the spender to provide two items (not necessarily in this order): a public key such that the hash of the public key matches an address in the P2PKH output, and a valid signature for the public key and the transaction message. The public key may correspond to the private key used to generate the signature. Alternatively, the signature may be linked to the first public key and the output may be locked to a different public key. The second node may then send the completed transaction to the blockchain network 106. The completed transaction (called a command transaction in these embodiments) is available in the blockchain 150 for other nodes, e.g., the first node, to see and serves as a record of the command executed by the device. That is, once the transaction is broadcast, an independent observer can see which public key issued the command / message and which public key responded to it.
[0114] 7a and 7b show an exemplary partial first transaction Tx1 (partial) and an exemplary updated first transaction Tx1 (complete). The partial first transaction includes a single input 701a and a single output 702a. The updated first transaction includes an input 701b and an output 702b added by a second node. To achieve a desired level of transaction malleability, a SIGHASH_SINGLE signature type may be used. For example, a node with public key PK0 sends an instruction to a node with public key PK1. The instruction is encoded in an unusable output (e.g., an OP_RETURN output) of the transaction that is signed using the SIGHASH_SINGLE signature type (FIG. 10a). The partially completed transaction is valid. Once the instruction is completed, the second node with PK1 adds the output locked to its address. The second node with PK1 then finalizes the transaction by signing the entire transaction using the SIGHASH_ALL signature type (see FIG. 10b).
[0115] In an alternative embodiment, the first transaction Tx1 sent from the first node to the second node may be sent with a second output, which is locked to the public key of the second node. For example, the second output may be a P2PKH to the public key of the second node.
[0116] To complete the first transaction Tx1, the second node updates the first transaction by adding an input to the first transaction, where the first transaction Tx1 includes two inputs and two outputs. The second input includes the public key of the second node. The public key in the second input may or may not be the same as the public key to which the second output is locked. Once completed, the updated first transaction (referred to in these embodiments as a command transaction) is sent to the blockchain network 106 for inclusion in the blockchain 150. Once the command transaction is broadcast, any independent observer can see which public key issued the command / message and which public key responded to it.
[0117] The second output, locked to the public key of the second node, may transfer an amount of digital assets that is greater than the amount of digital assets referenced by the first input of the first transaction. In that case, the first transaction Tx1 is a partially completed transaction that is not considered valid by other nodes of the blockchain network 106. That is, the first transaction Tx1 does not satisfy the consensus rules followed by the blockchain nodes and therefore is not mined into block 152 of the blockchain 150. When updating the first transaction Tx1, the second node must ensure that the total amount of digital assets referenced by the first and second inputs is greater than the amount of digital assets locked in the second output.
[0118] 8a and 8b show an exemplary partial first transaction Tx1 (partial) and an exemplary updated first transaction Tx1 (complete). The first transaction includes command data in a first output 802a and a second output 802b locked to the public key of the second node. The updated first transaction includes an additional input 801b added by the second node. If a first node with PK0 sends an instruction to a second node with PK1 that it wants executed by the second node with only PK1, they can send a partially completed transaction that locks both outputs 802a and 802b but does not pay a fee (and therefore is not mined or propagated). To redeem the digital assets locked in PK1, the second node with PK1 needs to provide an input 801b that pays a fee. To issue a command using a partially completed transaction, <Sig PK0 The SIGHASH flag for the first output 802a is set to SIGHASH_ANYONECANPAY and includes an OP_RETURN output with command data. This means that the command data included in the first output 802a is fixed, but anyone can add additional inputs. The public key that received the command can add an additional input 801b to redeem the funds in input 801a. To secure the new input 801b and prevent further transaction malleability, the recipient of the funds adds a minimum value (dust) input and signs the transaction output with SIGHASH_ALL.
[0119] Note that the SIGHASH flag is a flag that is added to a signature in a transaction input to indicate which parts of the transaction the signature signs. The default is SIGHASH_ALL (all parts of the transaction except the ScriptSig are signed). Unsigned parts of the transaction may be modified.
[0120] More specifically, the SIGHASH flag is a byte that is appended to the end of the signature, i.e., if SIG is the signature found in the transaction, then SIG = [DER encoded ECDSA signature] + [1 byte SIGHASH flag]. The SIGHASH byte is also appended to the transaction before creating the hash value, i.e., ECDSA Sig = [rs], where s=k -1 (H(Tx||SIGHASH)+sk·r) where sk and k are the private key and the ephemeral key, respectively.
[0121] An exemplary request and response algorithm is provided below with reference to Figures 9, 10a, and 10b. The control device 503b is configured to communicate with other nodes on the network 501 and can calculate the shortest path for communication to any other node on the network. For example, the PK serv PK slave is the controller closest to the device with device_ID.
[0122] Step 1: Public Key PK serv The control device 503b having the public key PK slave to a second control device 503c having a command ID of 1. The IoT messages contained within the transaction specify the command and the target device using the device_ID.
[0123] Step 2: Second control device (PK slave ) checks that the signature on the transaction is valid and that the message contained in the IoT message payload is valid according to the rules of the network 501.
[0124] Step 3: Second Control Device (PK slave) sends a command message ("Msg") to the device (device_ID) via off-chain communication (e.g., wired connection, Bluetooth, IP-to-IP).
[0125] Step 4: Once the action requested by the command is completed, the device (device_ID) sends a command completion or acknowledgment message ("ack") to the second control device (PK slave ) back to
[0126] Step 5: Second Controller (PK slave ) adds a second input and a signature, finalizing the transaction (see Figure 10b), which signals that the second controller has confirmed the completion of the command.
[0127] Step 6: Second Controller (PK slave ) broadcasts the finalized transaction to the blockchain (mining) network 504.
[0128] When the second node (e.g., a slave node) gets the command transaction, the second node sends the command (Msg) to the device identified by the device identifier (Device_ID) in the command data. In some examples, the device 502 may send an acknowledgement message (Ack) to the second node to indicate that it has received and / or executed the command. In these examples, the second node may only update the first transaction (and then broadcast the updated transaction) on the condition that it has received an acknowledgement from the device. This provides further corroborating evidence that the end device executed the command.
[0129] Due to the resource constraints that most everyday small electronic devices have, they may not even be able to easily monitor the blockchain 150 and / or communicate with IoT network components outside their immediate vicinity, and thus control of the end device 502 is performed locally (from the second node to the device) and off-chain. Messages to and from end devices may take the form of raw command data (e.g., OP_RETURN payload) without additional transaction metadata. This ensures that data packets containing messages remain small and no computationally intensive operations (such as elliptic curve mathematics) are required. In some embodiments, the command data included within the transaction is encrypted.
[0130] In summary, nodes 503 on the IoT network 501 communicate not only directly using transactions containing IoT command data, but also by connecting to the blockchain network 106 to broadcast transactions. The blockchain 150 is used as a persistent data store for recording commands and status updates from the IoT network components, as well as for issuing reports and alerts related to the IoT devices 502. The protocol may utilize one or more of the following features:
[0131] As described above, Alice 103a and Bob 103b may each perform actions related to the bridge node 503 in FIG. 5. That is, Alice 103a and Bob 103b may each include or operate a respective bridge node. Alice may be the master node 503a or the intermediate node 503b, and Bob may be the intermediate node 503b, 503c. In the scenario shown in FIG. 9, Alice 103a operates the server node 503b and transmits a partial transaction Tx1 to Bob 103b operating the slave node 503c. The partial transaction Tx1 includes a command for controlling the end device 502. In a fully trusted system, Bob 103b may assume that Alice 103a is not acting maliciously and may therefore accept the partial transaction Tx1, control the end device 502 based on the command, and submit the completed transaction Tx1 to the blockchain network 106 for storing a record of the command on the blockchain 150. However, the system may not be completely reliable or may be susceptible to faulty nodes.
[0132] 10a and 10b show an exemplary system compromised by a malicious actor 1001. In the example of FIG. 10a, the server node 503b that issues a partial transaction Tx1 to the slave node 503c is controlled by the malicious actor 1001. The malicious actor 1001 instructs the slave node 503c to issue a command transaction Tx1, and at the same time submits the same command transaction Tx1' to the blockchain network 106. That is, the malicious actor 1001 issues a double-spend transaction. Not knowing that the command transaction Tx1 is a double-spend, the slave node 503 instructs the end device 502 to execute the command. As shown in FIG. 10b, the transaction Tx1' reaches the blockchain network 106 before the slave node 503c has a chance to send the complete transaction Tx1 to the blockchain network 106. In the example of FIG. 10b, the end device 502 returns an acknowledgement message to the slave node 503c. In response, the slave node 503c completes the command transaction Tx1 and submits it to the blockchain network 106. However, the command transaction Tx1′ issued by the server node 502b controlled by the malicious actor 1001 has already been propagated to other nodes 104M of the blockchain network 106. Therefore, when these nodes 104M receive the command transaction Tx1 from the slave node 503c, they reject it as it would be an attempt at double spending. This means that there is no record on the blockchain of any command being executed.
[0133] To mitigate the risk of double-spend transactions, Bob 103b (e.g., slave node 503c) requests Alice 130a (e.g., server node 503b) to send a signature and one or more time indicators for the command transaction. In some examples, the condition for Bob 103b to instruct the end device 502 under Bob 103b's control to execute the command is that Alice 103a has sent the signature and the time indicator along with the command transaction. If Alice 103a does not send the signature and the time indicator, Bob 103b may reject the command transaction and not issue the command to the end device 502. As another example, Bob 103b may update the command transaction, e.g., complete the command transaction, only if Alice 103a has sent the signature and the time indicator along with the (partial) command transaction. If Alice 103a does not send the signature and the time indicator, Bob 103b may reject the command transaction and not update the command transaction. In this way, a malicious actor 1001 cannot cause Bob 103b to execute a command without any record of the command being recorded on the blockchain 150.
[0134] In some examples, Bob 103b may update the partial transaction and submit it to the blockchain network 106 only after the command instruction (or message) has been sent to the end device. In other examples, Bob 103b may update the partial transaction and submit it to the blockchain network 106 only after receiving an acknowledgement from the end device that the instruction has been executed.
[0135] In summary, although 0-conf double spend attempts cannot be completely prevented, the present invention proves the order of transaction issuance to mitigate the risk of double spend attempts.As a specific example, assume that Node1 wants to issue a command by propagating transaction Tx1 to Node2, the partially complete transaction Tx1 is sent from Node1 to Node2 along with two other pieces of data: a signature and a timestamp. Sig(TxID1||t),t,Tx1 Here, TxID1=H 2 (Tx1) (transaction ID), H(·) is a hash function, and t is UNIX time. More specifically, H 2 (Tx1)=SHA256(SHA256(Tx1)). This additional signature and timestamp can be stored and later used as proof that Node1 sent Tx1 to Node2 at about time t. In case of double-spend, this additional data can be used to penalize Node1 or at least evaluate the network performance problem if performed by a non-malicious node. Note that in the context of IoT network 501, a P2P replay attack is equivalent to a double-spend attack in blockchain network 106. The inclusion of a timestamp in the command transaction prevents the replay of authentic data, since large discrepancies in data transmission times are easily detected by the receiving node. In some examples, all devices on the network (e.g., bridge nodes and end devices of an IoT network) are configured to keep a local time-stamped list of TxIDs from when they were first seen on the network.
[0136] conclusion It will be understood that the above embodiments have been described by way of example only. More generally, there may be provided a method, apparatus or program according to any one or more of the following statements:
[0137] Statement 1. A computer-implemented method for testing whether a blockchain transaction is an attempt at dual spend, the method being executed by a first party and comprising: generating a first blockchain transaction, the first blockchain transaction including an input for unlocking outputs of blockchain transactions previously sent to one or more nodes of a blockchain network for inclusion in the blockchain; generating a signature based on the first blockchain transaction and one or more time indicators, each time indicator indicating when the first blockchain transaction was generated and / or sent; and sending the first blockchain transaction to a second party and sending the signature and the one or more time indicators to the second node, wherein at least the first blockchain transaction is sent to the second party via an off-chain communication channel.
[0138] Sending via an off-chain communication channel means sending via a channel other than the blockchain network. For example, sending a blockchain transaction via an off-chain communication channel means sending the transaction without sending it to a node of the blockchain network for inclusion in the blockchain. By way of example, the transaction may be sent via TLS communication, email, a messaging application, Wi-Fi, Bluetooth, NFC, etc.
[0139] The blockchain may include previous blockchain transactions, or alternatively, previous blockchain transactions may be transactions in a memory pool (mempool) of each of one or more nodes of the blockchain network.
[0140] Statement 2. The method of statement 1, wherein the one or more time indicators include a timestamp and / or a height of a current block of the blockchain.
[0141] Statement 3. The method of Statement 1 or Statement 2, wherein the signature and / or at least one time indicator is transmitted to a second party via an off-chain communication channel.
[0142] The off-chain communication channel used to transmit the signature and / or the at least one time indicator may be the same communication channel or a different communication channel.
[0143] Statement 4. The method of any preceding statement, wherein generating a signature based on the first blockchain transaction includes generating a signature based on a transaction identifier of the first blockchain transaction.
[0144] Statement 5. The method of any preceding statement, wherein the signature is generated using a private key that corresponds to a public key associated with the first party.
[0145] Statement 6. The method of any preceding statement, wherein the first blockchain transaction is a partial blockchain transaction that requires one or more inputs and / or one or more outputs to be added to the partial blockchain transaction in order for the partial blockchain transaction to be accepted by one or more nodes of the blockchain network.
[0146] A partial blockchain transaction may also be referred to as a partially completed blockchain transaction.
[0147] Statement 7. The method of any preceding statement, wherein a second party is configured to control one or more devices, and the first blockchain transaction includes an output including command data, and the command data includes a command message for causing the second party to control at least one of the one or more devices.
[0148] The command message may be configured to cause a second party to transmit a control instruction to at least one of the one or more devices. The command message may be encrypted.
[0149] Statement 8. The method of any preceding statement, wherein the first party and the second party are respective nodes of a first network, and the first network is a peer-to-peer network.
[0150] Statement 9. The method of any preceding statement, wherein the first network and the blockchain network are different networks.
[0151] Statement 10. The method of statement 9, wherein the first and second parties are nodes of the first network and the blockchain network, respectively.
[0152] Statement 11. The method of statements 7 and 10, wherein the first network includes one or more devices, each device having a respective device identifier, and the command data includes a respective identifier of at least one of the one or more devices.
[0153] Statement 12. The method of statement 11, wherein the first network includes a master tier including a master node, one or more intermediate tiers each including a plurality of intermediate nodes, and a device tier including one or more devices, the first party is the master node or a respective one of the plurality of intermediate nodes, and the second party is a respective one of the plurality of intermediate nodes.
[0154] Statement 13. The method of statement 7 and any statement dependent thereon, wherein one or more devices are Internet of Things devices.
[0155] Statement 14. A computer-implemented method for determining whether to accept a blockchain transaction from a first party, the method being executed by a second party and comprising: receiving the first blockchain transaction from the first party via an off-chain communication channel, the first blockchain transaction including an input for unlocking outputs of a blockchain transaction previously sent to one or more nodes of a blockchain network for inclusion in the blockchain; determining whether the first party has sent to the second party (a) a signature generated based on the first blockchain transaction and one or more first time indicators, each first time indicator indicating when the first blockchain transaction was generated and / or sent, and (b) the one or more time indicators; and accepting the first blockchain transaction based on one or more conditions, a first condition of the one or more conditions being that the first party sent the signature and the one or more first time indicators.
[0156] Note that the off-chain communication channel can be a transport layer security (TLS) communication channel. Other options include Bluetooth or other short-range communication methods.
[0157] Statement 15. The method of statement 14, including determining one or more second time indicators, each second time indicator indicating when the first blockchain transaction was received, and a second condition of the one or more conditions is that, based on the first and second time indicators, the first transaction is determined to have been received within a threshold period of time after the first transaction was generated and / or transmitted.
[0158] The threshold period may be any suitable period (e.g., 1 second, 10 seconds, 1 hour, etc.) and may depend on the particular use case. The second party may set the threshold, or the threshold may be set by a protocol adhered to by the first and second parties.
[0159] Statement 16. The method of statement 14 or statement 15, including determining whether the signature was generated using a private key that corresponds to a public key associated with the first party, and a third condition of the one or more conditions is that the signature was generated using a private key that corresponds to the public key associated with the first party.
[0160] Statement 17. The method of any of statements 14-16, wherein the first blockchain transaction is a partial blockchain transaction, the partial blockchain transaction is a blockchain transaction that requires one or more inputs and / or one or more outputs to be added to the partial blockchain transaction in order for the partial blockchain transaction to be accepted by one or more nodes of the blockchain network for inclusion in the blockchain, and accepting the first blockchain transaction by the second party includes updating the first blockchain transaction by adding the one or more inputs and / or the one or more outputs to the first blockchain transaction and sending the first blockchain transaction to the first party and / or one or more nodes of the blockchain network for inclusion in the blockchain.
[0161] Statement 18. The method of any of statements 14-17, wherein a second party is configured to control one or more devices, the first blockchain transaction includes an output including command data, the command data includes a command message for causing the second party to control at least one of the one or more devices, and accepting the first blockchain transaction by the second party includes sending a control instruction to at least one of the one or more devices.
[0162] The control instructions may be transmitted to at least one of the one or more devices via an off-chain communication channel that may or may not be the same off-chain communication channel over which the first blockchain transaction is transmitted from the first party to the second party.
[0163] Statement 19. The method of statement 17 or statement 18, wherein the updating of the first blockchain transaction is performed in response to the sending of a control instruction to at least one of one or more devices.
[0164] Statement 20. The method of statement 19, including receiving a command completion message from at least one of the one or more devices, wherein the update of the first blockchain transaction is performed in response to receiving the command completion message.
[0165] Statement 21. The method of any of statements 14-20, wherein the first party and the second party are respective nodes of a first network, and the first network is a peer-to-peer network.
[0166] Statement 22. The method of statement 21, wherein the first and second parties are nodes of the first network and the blockchain network, respectively.
[0167] The first network and the blockchain network may be different networks. The first network may include one or more devices, each device having a respective device identifier, and the command data includes a respective identifier of at least one of the one or more devices.
[0168] Statement 23. The method of statement 22, wherein the first network includes a master tier including a master node, one or more intermediate tiers each including a plurality of intermediate nodes, and a device tier including one or more devices, the first party is the master node or a respective one of the plurality of intermediate nodes, and the second party is a respective one of the plurality of intermediate nodes.
[0169] Statement 24. A computing device comprising a memory having one or more memory units and a processing device having one or more processing units, the memory storing code configured to be executed on the processing device, the code configured to execute, on the processing device, the method of any of statements 1 to 23.
[0170] Statement 25. A computer program embodied on a computer readable storage and configured to perform the method of any of statements 1 to 23 when executed on the computing device of statement 24.
[0171] Other variations or uses of the disclosed techniques may become apparent to those of ordinary skill in the art given the disclosure herein. The scope of the present disclosure is not limited by the described embodiments, but only by the accompanying statements. [Explanation of symbols]
[0172] 100 Systems 101 Packet Switching Network, Network 102 Computer terminals, computer equipment, equipment, computers 102a Computer equipment, Alice's device 102b Computer Equipment, Bob's Devices 103 User, Parties, User Parties 103a User, First Party, Alice 103b User, second party, Bob 104 nodes, blockchain nodes 104F Forwarding Node 104M Minor, Minor Node, Node 104S Storage Node 105 Wallet application, client application, client application or software, client, blockchain wallet, SPV wallet, blockchain protocol client application 105a Client Applications 105b Client 106 Peer-to-Peer (P2P) overlay network, network, P2P network, network P2P, P2P overlay network, blockchain network, blockchain P2P network 150 Blockchain, Chain 151 Blocks 152 Transactions 152i Previous Transaction 152j Current Transaction 153 Starting Block (Gb), Starting Block 154 Pool, transaction pool, outstanding pool, transaction pool 155 Block Pointer 201 Header 202 Input 203 Output, UTXO 301 Side Channel 400 User Interface (UI), UI 401 Transaction Engine 402 User Interface (UI) Layer, UI Layer 411 UI Elements, User Selectable Elements 412 UI elements, data entry fields 413 UI elements, information elements 500 Systems 501 first network, peer-to-peer (P2P) overlay network, P2P network, P2P IoT network, IoT network 502 End Devices, Devices, IoT End Devices 502a End Device 503 Bridge node, Node, IoT controller, IoT node 503a Masternode 503b Intermediate node, server node, servant node 503c Intermediate node, slave node 504 Network, Blockchain Mining Network 601 Sets 601a Set 601b Set 602 Connection 1001 Malicious Actors
Claims
1. 1. A computer-implemented method for testing whether a blockchain transaction is an attempt at dual spend, the method being performed by a first party and comprising: generating a first blockchain transaction, the first blockchain transaction including an input for unlocking an output of a blockchain transaction previously sent to one or more nodes of a blockchain network for inclusion in the blockchain; generating a signature based on the first blockchain transaction and one or more time indicators, each time indicator indicating when the first blockchain transaction was generated and / or transmitted to a second party; transmitting the first blockchain transaction, the signature, and the one or more time indicators to the second party, where at least the first blockchain transaction is transmitted to the second party via an off-chain communication channel; 4. A computer-implemented method comprising:
2. The method of claim 1 , wherein the one or more time indicators include a timestamp and / or a current block height of a blockchain.
3. 3. The method of claim 1 or 2, wherein the signature and / or at least one of the time indicators is transmitted to the second party via an off-chain communication channel.
4. 4. The method of claim 1, wherein generating the signature based on the first blockchain transaction comprises generating the signature based on a transaction identifier of the first blockchain transaction.
5. 5. The method of claim 1, wherein the signature is generated using a private key that corresponds to a public key associated with the first party.
6. 6. The method of claim 1, wherein the first blockchain transaction is a partial blockchain transaction that requires one or more inputs and / or one or more outputs to be added to the partial blockchain transaction in order for the partial blockchain transaction to be accepted by one or more nodes of the blockchain network.
7. 7. The method of claim 1, wherein the second party is configured to control one or more devices, and the first blockchain transaction includes an output including command data, the command data including a command message for causing the second party to control at least one of the one or more devices.
8. 8. The method of claim 1, wherein the first party and the second party are respective nodes of a first network, the first network being a peer-to-peer network.
9. The method of claim 8 , wherein the first network and the blockchain network are different networks.
10. 10. The method of claim 9, wherein the first and second parties are nodes of the first network and the blockchain network, respectively.
11. The method of claim 10, when citing claim 7, wherein the first network includes the one or more devices, each device having a respective device identifier, and the command data includes a respective identifier of at least one of the one or more devices.
12. 12. The method of claim 11, wherein the first network includes a master tier including a master node, one or more intermediate tiers each including a plurality of intermediate nodes, and a device tier including the one or more devices, the first party being the master node or a respective one of the plurality of intermediate nodes, and the second party being a respective one of the plurality of intermediate nodes.
13. The method of claim 7, any one of claims 8 to 10, and claims 11 and 12, when taken in conjunction with claim 7, wherein the one or more devices are Internet of Things devices.
14. 1. A computer-implemented method for determining whether to accept a blockchain transaction from a first party, the method being performed by a second party, the method comprising: receiving a first blockchain transaction from the first party via an off-chain communication channel, the first blockchain transaction including an input for unlocking an output of a blockchain transaction previously sent to one or more nodes of a blockchain network for inclusion in the blockchain; determining whether the first party has sent to the second party (a) a signature generated based on the first blockchain transaction and one or more first time indicators, each first time indicator indicating when the first blockchain transaction was generated and / or sent, and (b) the one or more time indicators; accepting the first blockchain transaction based on one or more conditions, a first condition of the one or more conditions being that the first party has sent the signature and the one or more first time indicators; 4. A computer-implemented method comprising:
15. 15. The method of claim 14, further comprising determining one or more second time indicators, each second time indicator indicating when the first blockchain transaction was received, and a second condition of the one or more conditions being that, based on the first and second time indicators, the first blockchain transaction is determined to have been received within a threshold period of time after the first blockchain transaction was generated and / or transmitted.
16. 16. The method of claim 14 or 15, further comprising determining whether the signature was generated using a private key corresponding to a public key associated with the first party, wherein a third condition of the one or more conditions is that the signature was generated using the private key corresponding to the public key associated with the first party.
17. the first blockchain transaction is a partial blockchain transaction that requires one or more inputs and / or one or more outputs to be added to the partial blockchain transaction in order for the partial blockchain transaction to be accepted by one or more nodes of the blockchain network for inclusion within the blockchain; and accepting the first blockchain transaction by the second party; updating the first blockchain transaction by adding one or more inputs and / or one or more outputs to the first blockchain transaction; transmitting the first blockchain transaction to the first party and / or one or more nodes of the blockchain network for inclusion within the blockchain; Including, 17. The method according to any one of claims 14 to 16.
18. 18. The method of any one of claims 14 to 17, wherein the second party is configured to control one or more devices, the first blockchain transaction includes an output including command data, the command data includes a command message for causing the second party to control at least one of the one or more devices, and accepting the first blockchain transaction by the second party includes sending a control instruction to the at least one of the one or more devices.
19. The method of claim 18, when citing claim 17, wherein the update of the first blockchain transaction is performed in response to the transmission of the control instruction to the at least one of the one or more devices.
20. 20. The method of claim 19, further comprising receiving a command completion message from the at least one of the one or more devices, wherein the update of the first blockchain transaction is performed in response to receiving the command completion message.
21. 21. The method of claim 14, wherein the first party and the second party are respective nodes of a first network, the first network being a peer-to-peer network.
22. 22. The method of claim 21 , wherein the first and second parties are nodes of the first network and the blockchain network, respectively.
23. 23. The method of claim 22, wherein the first network includes a master tier including a master node, one or more intermediate tiers each including a plurality of intermediate nodes, and a device tier including the one or more devices, the first party being the master node or a respective one of the plurality of intermediate nodes, and the second party being a respective one of the plurality of intermediate nodes.
24. a memory comprising one or more memory units; a processing device comprising one or more processing units; 14. A computing device comprising: said memory storing code configured to be executed on said processing device, said code configured to execute, on said processing device, a method according to any one of claims 1 to 13.
25. A memory having one or more memory units; a processing device comprising one or more processing units; 24. A computing device comprising: said memory storing code configured to be executed on said processing unit, said code configured to execute, on said processing unit, a method according to any one of claims 14 to 23.
26. A computer program embodied on a computer readable storage and configured to perform the method of any one of claims 1 to 13 when executed on a computing device according to claim 24.
27. A computer program embodied on a computer readable storage and configured to perform the method of any one of claims 14 to 23 when executed on a computing device as described in claim 25.
Citation Information
Patent Citations
Request and response protocol using blockchain transactions
GB201915842D0
Blockchain-enabled systems and methods
JP2019528590A
Systems and methods for detecting replay attacks
JP2020505799A
System and method for protecting information
JP2020507222A