WO2025108656A1 - Double-spend checks - Google Patents
Double-spend checks Download PDFInfo
- Publication number
- WO2025108656A1 WO2025108656A1 PCT/EP2024/080257 EP2024080257W WO2025108656A1 WO 2025108656 A1 WO2025108656 A1 WO 2025108656A1 EP 2024080257 W EP2024080257 W EP 2024080257W WO 2025108656 A1 WO2025108656 A1 WO 2025108656A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- blockchain
- outpoint
- blockchain transaction
- computer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/22—Payment schemes or models
- G06Q20/223—Payment schemes or models based on the use of peer-to-peer networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/04—Payment circuits
- G06Q20/06—Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
- G06Q20/065—Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/30—Payment architectures, schemes or protocols characterised by the use of specific devices or networks
- G06Q20/36—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
- G06Q20/367—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
- G06Q20/3678—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes e-cash details, e.g. blinded, divisible or detecting double spending
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/50—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q2220/00—Business processing using cryptography
Definitions
- the present disclosure relates to a method, system and computer program for determining whether an input of a blockchain transaction have been checked or not.
- An Unspent Transaction Outpoint set is a dynamic set of unspent transaction outpoints that is not necessarily consistent across the network. As members of the set are removed, new members are added. As part of transaction validation, a blockchain node (e.g., a Bitcoin node) is required to check whether the inputs of a transaction are in their Unspent Transaction Outpoint set, i.e., have been spent or not. If an input of a transaction are in an Unspent Transaction Outpoint set, the outpoint is spendable such that the blockchain node can continue with validation of other inputs/outpoints of the transaction, or with validating the transaction if all the inputs of the transactions have been validated.
- a blockchain node e.g., a Bitcoin node
- the outpoint may not be spendable (already spent or not a valid output) or the outpoint may not have been seen yet by the blockchain node. This check requires a lookup operation in a set. This set is often large.
- a computer-implemented method comprising: partitioning an Unspent Transaction Outpoint (UTXO) set of a blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction.
- UXO Unspent Transaction Outpoint
- the Unspent Transaction Outpoint set may also be referred to as a Unspent Transaction Output set.
- a transaction output is referenced using a combination of a transaction identifier (TxID) of the transaction containing the output, and an index of the output within that transaction.
- TxID transaction identifier
- the combination of the TxID and index is referred to as an outpoint.
- Figure 1 is a schematic block diagram of a system for implementing a blockchain
- Figure 2 schematically illustrates some examples of transactions which may be recorded in a blockchain
- Figure 3 is a schematic block diagram of some node software for processing transactions
- Figure 4 is a method flow diagram.
- Some examples described herein perform a lookup operation for checking whether the inputs of a transaction are in a UTXO set. This can be performed by a blockchain node (e.g., Bitcoin node) as part of a transaction validation. Examples described herein provide a method for improving the efficiency of the lookup operation. In some examples, efficiency is improved by A) splitting the lookup operation into multiple smaller lookup operations. In some examples, efficiency is improved by B) conducting look operations in spent transactions. In some examples, A) and B) are performed in parallel.
- Double spend checks are performed during a blockchain (e.g., Bitcoin) transaction validation.
- blockchain networks e.g., Bitcoin networks
- the size of an UTXO set is going to become increasingly large.
- a Teranode block will be able to spend at least 600 million UTXOs, and therefore the set is required to be capable of handling at least this number of transactions.
- a simple lookup may become a significant bottleneck in terms of transaction throughput.
- two efficiency improvements can be used, as described herein:
- the two improvements can be implemented separately, or together and executed in parallel to gain maximum efficiency.
- A) is discussed in section 1.1 and B) is discussed in section 1.2.
- An Unspent Traction Outpoint set is a dynamic set of unspent transaction outputs that is not necessarily consistent across the network. As members of the set are removed, new members are added.
- the Unspent Transaction Outpoint set can be partitioned in a number of different ways, using different schemes. Searches can then be performed in parallel in each partition, which reduces the amount of time to perform the lookup operation. As described herein, operations performed "in parallel" may be performed at least partially (and in some cases, fully) overlapping in time.
- One way to partition the set can be in chronological order, where members (i.e. UTXOs) are ordered based on their creation time (block height), and new members of the set are added to the latest section of the partition (or a new section if the previous section is full).
- Each section can have a fixed size or a variable size that could depend on a variable, for example, the block height.
- an outpoint is given, it is passed on to each section for a lookup operation.
- the outputs from all lookup operations are aggregated using "OR" to obtain the final result that determines the validity of the full transaction.
- An alternative implementation is to stop all operations when one of the outputs of the lockup operations indicates that an entry has been found.
- Another way to partition the set can be based on outpoint references (TXID and index), for example based on alphabetical order.
- TXID and index for example based on alphabetical order.
- the advantage of this partition scheme is that when an outpoint is given, it is passed on to only one of the sections for a lookup operation based on the TXID of the outpoint. While it does not require parallelisation of many lookups, it does require a pre-ordered set of unspent transaction outputs.
- a search can be performed, in parallel, in at least two of the partitions to look for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction. If the search in the partitions of the set of Unspent Transaction Outpoints returns a positive result, this indicates that the outpoint is spendable. The method can proceed to continue with validation of other inputs/outpoints, or if the input/outpoint is the final input/outpoint in the transaction, the method can proceed with validating the transaction. If the search in the partitions of the set of Unspent Transaction Outpoints returns a positive result, this indicates that the outpoint may not be spendable (already spent or not a valid output), or that the outpoint may not have been seen yet.
- a spent output or a spent outpoint refers to an output of a transaction that has been validly spent by an input of a later transaction.
- a Spent Transaction Outpoint (STXO) set is a list of spent outputs (also referred to as spent outpoints).
- STXO Spent Transaction Outpoint
- STXO Spent Transaction Outpoint
- STXO is an append-only set. That is, once an output is added as a member of a STXO set, it will always remain a member, and the size of the set grows monotonically with the size of the blockchain.
- a check against Unspent Transaction Outpoint set is to look for a guaranteed positive result.
- a check against STXO set is to look for a guaranteed negative result.
- a lookup in an STXO set serves as a supporting operation in parallel to the UTXO set lookup (this can be useful as looking up in an STXO set may not be able to provide a conclusive result).
- the Unspent Transaction Outpoint set lookups of other outpoints in the full transaction can stop, which can save some computation.
- the set size for the lookup can be reduced by only keeping the recent spent transactions (which is a smaller set than the entire STXO set).
- the risk of a successful double spend attempt is typically only within a short time period (e.g., the first few seconds) of a transaction first appearing on the network. After this point, the transaction will be seen in all nodes, and a double spend attempt will likely be unsuccessful.
- the cost of adding a quick look up on this small set is negligible, and when a match is found, the Unspent Transaction Outpoint set lookups of other outpoints in the full transaction can stop, which can save some computation.
- the STXO set (or STXO set limited to spent transactions in a recent time period) can be partitioned into multiple sections to parallelising the lookup operations. Similar partitioning schemes can be used as described above.
- the STXO set can be partitioned in chronological order, where members (i.e. STXOs) are ordered based on their creation time (block height), and new members of the set are added to the latest section of the partition (or a new section if the previous section is full).
- Each section can have a fixed size or a variable size that could depend on a variable, for example, the block height.
- STXO reduced size STXO
- Another way to partition the STXO (or reduced size STXO) set can be based on outpoint references (TXID and index), for example based on alphabetical order.
- TXID and index outpoint references
- the advantage of this partition scheme is that when an outpoint is given, it is passed on to only one of the sections for a lookup operation based on the TXID of the outpoint. While it does not require parallelisation of many lookups, it does require a pre-ordered STXO set.
- a search can be performed, in parallel, in at least two of the partitions to look for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction. If the search in the partitions of the STXO set (or recent STXO set) returns a positive result, this indicates that the outpoint is not spendable. The method can proceed to reject the transaction. If the search in the partitions of the STXO set (or recent STXO set) returns a negative result, this indicates that the outpoint may be spendable or that the outpoint does not exist.
- Table 1 summarises the different lookup results in an Unspent Transaction Outpoint set and STXO set.
- Table 1 Summary of different lookup results in an Unspent Transaction Outpoint set and STXO set.
- a method flow chart is shown in Figure 4.
- the method may be carried out, for example, by a blockchain node or an apparatus at a blockchain node.
- the method comprises partitioning a UTXO set of a blockchain into at least two partitions.
- the method comprises performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction.
- a blockchain refers to a form of distributed data structure, wherein a duplicate copy of the blockchain is maintained at each of a plurality of nodes in a distributed peer-to-peer (P2P) network (referred to below as a "blockchain network”) and widely publicised.
- the blockchain comprises a chain of blocks of data, wherein each block comprises one or more transactions.
- Each transaction other than so-called “coinbase transactions”, points back to a preceding transaction in a sequence which may span one or more blocks going back to one or more coinbase transactions.
- Coinbase transactions are discussed further below.
- New blocks are created by a process often referred to as “mining”, which involves each of a plurality of the nodes competing to perform "proof-of-work", i.e. solving a cryptographic puzzle based on a representation of a defined set of ordered and validated pending transactions waiting to be included in a new block of the blockchain.
- mining a process often referred to as "mining”
- proof-of-work i.e. solving a cryptographic puzzle based on a representation of a defined set of ordered and validated pending transactions waiting to be included in a new block of the blockchain.
- the blockchain may be pruned at some nodes, and the publication of blocks can be achieved through the publication of mere block headers.
- the transactions in the blockchain may be used for one or more of the following purposes: to convey a digital asset (i.e. a number of digital tokens), to order a set of entries in a virtualised ledger or registry, to receive and process timestamp entries, and/or to timeorder index pointers.
- a blockchain can also be exploited in order to layer additional functionality on top of the blockchain.
- blockchain protocols may allow for storage of additional user data or indexes to data in a transaction. There is no pre-specified limit to the maximum data capacity that can be stored within a single transaction, and therefore increasingly more complex data can be incorporated. For instance this may be used to store an electronic document in the blockchain, or audio or video data.
- the data structure of a given transaction comprises one or more inputs and one or more outputs.
- Any spendable output comprises an element specifying an amount of the digital asset that is derivable from the proceeding sequence of transactions.
- the spendable output is sometimes referred to as a UTXO ("unspent transaction output").
- the output may further comprise a locking script specifying a condition for the future redemption of the output.
- a locking script is a predicate defining the conditions necessary to validate and transfer digital tokens or assets.
- Each input of a transaction (other than a coinbase transaction) comprises a pointer (i.e.
- a reference to such an output in a preceding transaction, and may further comprise an unlocking script for unlocking the locking script of the pointed-to output.
- the first transaction comprises at least one output specifying an amount of the digital asset, and comprising a locking script defining one or more conditions of unlocking the output.
- the second, target transaction comprises at least one input, comprising a pointer to the output of the first transaction, and an unlocking script for unlocking the output of the first transaction.
- one of the criteria for validity applied at each node will be that the unlocking script meets all of the one or more conditions defined in the locking script of the first transaction. Another will be that the output of the first transaction has not already been redeemed by another, earlier valid transaction. Any node that finds the target transaction invalid according to any of these conditions will not propagate it (as a valid transaction, but possibly to register an invalid transaction) nor include it in a new block to be recorded in the blockchain.
- FIG. 1 shows an example system 100 for implementing a blockchain 150.
- the system 100 may comprise a packet-switched network 101, typically a wide-area internetwork such as the Internet.
- the packet-switched network 101 comprises a plurality of blockchain nodes 104 (often referred to as "miners") that may be arranged to form a peer-to-peer (P2P) network 106 within the packet-switched network 101.
- the blockchain nodes 104 may be arranged as a near-complete graph. Each blockchain node 104 is therefore highly connected to other blockchain nodes 104.
- Each blockchain node 104 comprises computer equipment of a peer, with different ones of the nodes 104 belonging to different peers.
- Each blockchain node 104 comprises processing apparatus 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), and other equipment such as application specific integrated circuits (ASICs).
- Each node also comprises memory, i.e. computer-readable storage in the form of a non-transitory computer-readable medium or media.
- the memory may comprise one or more memory units employing 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), flash memory or EEPROM; and/or an optical medium such as an optical disk drive.
- the blockchain 150 comprises a chain of blocks of data 151, wherein a respective copy of the blockchain 150 is maintained at each of a plurality of blockchain nodes 104 in the distributed or blockchain network 106.
- maintaining a copy of the blockchain 150 does not necessarily mean storing the blockchain 150 in full. Instead, the blockchain 150 may be pruned of data so long as each blockchain node 150 stores the block header (discussed below) of each block 151.
- Each block 151 in the chain comprises one or more transactions 152, wherein a transaction in this context refers to a kind of data structure. The nature of the data structure will depend on the type of transaction protocol used as part of a transaction model or scheme. A given blockchain will use one particular transaction protocol throughout.
- a blockchain node 104 may be configured to forward transactions 152 to other blockchain nodes 104, and thereby cause transactions 152 to be propagated throughout the network 106.
- a blockchain node 104 may be configured to create blocks 151 and to store a respective copy of the same blockchain 150 in their respective memory.
- a blockchain node 104 may also maintain an ordered set (or "pool") 154 of transactions 152 waiting to be incorporated into blocks 151.
- the ordered pool 154 is often referred to as a "mempool”. This term herein is not intended to limit to any particular blockchain, protocol or model. It refers to the ordered set of transactions which a node 104 has accepted as valid and for which the node 104 is obliged not to accept any other transactions attempting to spend the same output.
- the (or each) input comprises a pointer referencing the output of a preceding transaction 152i in the sequence of transactions, specifying that this output is to be redeemed or "spent" in the present transaction 152j.
- Spending or redeeming does not necessarily imply transfer of a financial asset, though that is certainly one common application. More generally spending could be described as consuming the output, or assigning it to one or more outputs in another, onward transaction.
- the preceding transaction could be any transaction in the ordered set 154 or any block 151.
- the preceding transaction 152i need not necessarily exist at the time the present transaction 152j is created or even sent to the network 106, though the preceding transaction 152i will need to exist and be validated in order for the present transaction to be valid.
- "preceding" herein refers to a predecessor in a logical sequence linked by pointers, not necessarily the time of creation or sending in a temporal sequence, and hence it does not necessarily exclude that the transactions 152i, 152j be created or sent out-of-order (see discussion below on orphan transactions).
- the preceding transaction 152i could equally be called the antecedent or predecessor transaction.
- each of the blockchain nodes 104 takes the form of a server comprising one or more physical server units, or even whole a data centre.
- any given blockchain node 104 could take the form of a user terminal or a group of user terminals networked together.
- the memory of each blockchain node 104 stores software configured to run on the processing apparatus of the blockchain node 104 in order to perform its respective role or roles and handle transactions 152 in accordance with the blockchain node protocol. It will be understood that any action attributed herein to a blockchain node 104 may be performed by the software run on the processing apparatus of the respective computer equipment.
- the node software may be implemented in one or more applications at the application layer, or a lower layer such as the operating system layer or a protocol layer, or any combination of these.
- Any given blockchain node may be configured to perform one or more of the following operations: validating transactions, storing transactions, propagating transactions to other peers, performing consensus (e.g. proof-of-work) / mining operations.
- each type of operation is performed by a different node 104. That is, nodes may emphasize in particular operation. For example, a nodes 104 may focus on transaction validation and propagation, or on block mining.
- a blockchain node 104 may perform more than one of these operations in parallel. Any reference to a blockchain node 104 may refer to an entity that is configured to perform at least one of these operations.
- Some or all of the parties 103 may be connected as part of a different network, e.g. a network overlaid on top of the blockchain network 106.
- Users of the blockchain network (often referred to as “clients") may be said to be part of a system that includes the blockchain network 106; however, these users are not blockchain nodes 104 as they do not perform the roles required of the blockchain nodes. Instead, each party 103 may interact with the blockchain network 106 and thereby utilize the blockchain 150 by connecting to (i.e. communicating with) a blockchain node 106.
- Two parties 103 and their respective equipment 102 are shown for illustrative purposes: a first party 103a and his/her respective computer equipment 102a, and a second party 103b and his/her respective computer equipment 102b. It will be understood that many more such parties 103 and their respective computer equipment 102 may be present and participating in the system 100, but for convenience they are not illustrated.
- Each party 103 may be an individual or an organization. Purely by way of illustration the first party 103a is referred to herein as Alice and the second party 103b is referred to as Bob, but it will be appreciated that this is not limiting and any reference herein to Alice or Bob may be replaced with "first party" and "second "party” respectively.
- the computer equipment 102 of each party 103 comprises respective processing apparatus 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 memory, i.e. computer-readable storage in the form of a non-transitory computer-readable medium or media.
- This memory may comprise one or more memory units employing one or more memory media, e.g. a magnetic medium such as hard disk; an electronic medium such as an SSD, flash memory or EEPROM; and/or an optical medium such as an optical disc drive.
- the memory on the computer equipment 102 of each party 103 stores software comprising a respective instance of at least one client application 105 arranged to run on the processing apparatus.
- any action attributed herein to a given party 103 may be performed using the software run on the processing apparatus of the respective computer equipment 102.
- the computer equipment 102 of each party 103 comprises at least one user terminal, e.g. a desktop or laptop computer, a tablet, a smartphone, or a wearable device such as a smartwatch.
- the computer equipment 102 of a given party 103 may also comprise one or more other networked resources, such as cloud computing resources accessed via the user terminal.
- the client application 105 may be initially provided to the computer equipment 102 of any given party 103 on suitable computer-readable storage medium or media, e.g. downloaded from a server, or provided on a removable storage device such as a removable SSD, flash memory key, removable EEPROM, removable magnetic disk drive, magnetic floppy disk or tape, optical disk such as a CD or DVD ROM, or a removable optical drive, etc.
- suitable computer-readable storage medium or media e.g. downloaded from a server, or provided on a removable storage device such as a removable SSD, flash memory key, removable EEPROM, removable magnetic disk drive, magnetic floppy disk or tape, optical disk such as a CD or DVD ROM, or a removable optical drive, etc.
- the client application 105 comprises at least a "wallet” function.
- This has two main functionalities. One of these is to enable the respective party 103 to create, authorise (for example sign) and send transactions 152 to one or more bitcoin nodes 104 to then be propagated throughout the network of blockchain nodes 104 and thereby included in the blockchain 150. The other is to report back to the respective party the amount of the digital asset that he or she currently owns.
- this second functionality comprises collating the amounts defined in the outputs of the various 152 transactions scattered throughout the blockchain 150 that belong to the party in question.
- client functionality may be described as being integrated into a given client application 105, this is not necessarily limiting and instead any client functionality described herein may instead be implemented in a suite of two or more distinct applications, e.g. interfacing via an API, or one being a plug-in to the other. More generally the client functionality could be implemented at the application layer or a lower layer such as the operating system, or any combination of these. The following will be described in terms of a client application 105 but it will be appreciated that this is not limiting.
- the instance of the client application or software 105 on each computer equipment 102 is operatively coupled to at least one of the blockchain nodes 104 of the network 106. This enables the wallet function of the client 105 to send transactions 152 to the network 106.
- the client 105 is also able to contact blockchain nodes 104 in order to query the blockchain 150 for any transactions of which the respective party 103 is the recipient (or indeed inspect other parties' transactions in the blockchain 150, since in embodiments the blockchain 150 is a public facility which provides trust in transactions in part through its public visibility).
- the wallet function on each computer equipment 102 is configured to formulate and send transactions 152 according to a transaction protocol.
- each blockchain node 104 runs software configured to validate transactions 152 according to the blockchain node protocol, and to forward transactions 152 in order to propagate them throughout the blockchain network 106.
- the transaction protocol and the node protocol correspond to one another, and a given transaction protocol goes with a given node protocol, together implementing a given transaction model.
- the same transaction protocol is used for all transactions 152 in the blockchain 150.
- the same node protocol is used by all the nodes 104 in the network 106.
- An alternative type of transaction protocol operated by some blockchain networks may be referred to as an "account-based" protocol, as part of an account-based transaction model.
- each transaction does not define the amount to be transferred by referring back to the UTXO of a preceding transaction in a sequence of past transactions, but rather by reference to an absolute account balance.
- the current state of all accounts is stored, by the nodes of that network, separate to the blockchain and is updated constantly.
- transactions are ordered using a running transaction tally of the account (also called the "position" or "nonce").
- This value is signed by the sender as part of their cryptographic signature and is hashed as part of the transaction reference calculation.
- an optional data field may also be signed the transaction. This data field may point back to a previous transaction, for example if the previous transaction ID is included in the data field.
- Some account-based transaction models share several similarities with the output-based transaction model described herein.
- the data field of an account-based transaction may point back to a previous transaction, which is equivalent to the input of an output-based transaction which references an outpoint a previous transaction.
- both models enable linking between transactions.
- an account-based transaction contains a "recipient” field (in which a receiving address of an account is specified) and a "value” field (in which an amount of digital asset may be specified). Together the recipient and value fields are equivalent to the output of an outputbased transaction which may be used to assign an amount of digital asset to a blockchain address.
- an account-based transaction has a "signature" field which includes a signature for the transaction.
- the signature is generated using the sender's private key and confirms the sender has authorized this transaction. This is equivalent to an input / unlocking script of an output-based transaction which, typically, includes a signature for the transaction.
- an output-based transaction which, typically, includes a signature for the transaction.
- the signatures are checked to determine whether the transaction is valid and can be recorded on the blockchain.
- a "smart contact” refers to a transaction that contains a script configured to perform one or more actions (e.g. send or "release" a digital asset to a recipient address) in response to one or more inputs (provided by a transaction) meeting one or more conditions defined by the smart contact's script.
- the smart contract exists as a transaction on the blockchain, and can be called (or triggered) by subsequent transactions.
- a smart contract may be considered equivalent to a locking script of an output-based transaction, which can be triggered by a subsequent transaction, and checks whether one or more conditions defined by the locking script are met by the input of the subsequent transaction.
- FIG. 2 illustrates an example transaction protocol.
- This is an example of a UTXO-based protocol.
- a transaction 152 (abbreviated "Tx") is the fundamental data structure of the blockchain 150 (each block 151 comprising one or more transactions 152). The following will be described by reference to an output-based or "UTXO" based protocol. However, this is not limiting to all possible embodiments. Note that while the example UTXO-based protocol is described with reference to bitcoin, it may equally be implemented on other example blockchain networks.
- each transaction (“Tx") 152 comprises a data structure comprising one or more inputs 202, and one or more outputs 203.
- Each output 203 may comprise an unspent transaction output (UTXO), which can be used as the source for the input 202 of another new transaction (if the UTXO has not already been redeemed).
- the UTXO includes a value specifying an amount of a digital asset. This represents a set number of tokens on the distributed ledger.
- the UTXO may also contain the transaction ID of the transaction from which it came, amongst other information.
- the transaction data structure may also comprise a header 201, which may comprise an indicator of the size of the input field(s) 202 and output field(s) 203.
- the header 201 may also include an ID of the transaction. In embodiments the transaction ID is the hash of the transaction data (excluding the transaction ID itself) and stored in the header 201 of the raw transaction 152 submitted to the nodes 104.
- TxT new transaction 152j
- the preceding transaction 152i is labelled “Txo" in Figure 2.
- TAT? and Txi are just arbitrary labels. They do not necessarily mean that Txo is the first transaction in the blockchain 151, nor that Txi is the immediate next transaction in the pool 154. Txi could point back to any preceding (i.e. antecedent) transaction that still has an unspent output 203 locked to Alice.
- One of the one or more outputs 203 of the preceding transaction Txo comprises a particular UTXO, labelled here UTXOo.
- Each UTXO comprises a value specifying an amount of the digital asset represented by the UTXO, and a locking script which defines a condition which must be met by an unlocking script in the input 202 of a subsequent transaction in order for the subsequent transaction to be validated, and therefore for the UTXO to be successfully redeemed.
- the locking script (aka scriptPubKey) is a piece of code written in the domain specific language recognized by the node protocol. A particular example of such a language is called "Script" (capital S) which is used by the blockchain network.
- the locking script specifies what information is required to spend a transaction output 203, for example the requirement of Alice's signature. Locking scripts appear in the outputs of transactions.
- the unlocking script (aka scriptSig) is a piece of code written the domain specific language that provides the information required to satisfy the locking script criteria. For example, it may contain Bob's signature. Unlocking scripts appear in the input 202 of transactions.
- UTXOo in the output 203 of TAT? comprises a locking script [Checksig PA which requires a signature Sig PA of Alice in order for UTXOo to be redeemed (strictly, in order for a subsequent transaction attempting to redeem UTXOo to be valid).
- [Checksig PA contains a representation (i.e. a hash) of the public key PA from a publicprivate key pair of Alice.
- the input 202 of Txi comprises a pointer pointing back to Txi (e.g. by means of its transaction ID, TxIDo, which in embodiments is the hash of the whole transaction Txo).
- the input 202 of Txi comprises an index identifying UTXOo within Txo, to identify it amongst any other possible outputs of Txo.
- the input 202 of Txi further comprises an unlocking script ⁇ Sig PA> which comprises a cryptographic signature of Alice, created by Alice applying her private key from the key pair to a predefined portion of data (sometimes called the "message" in cryptography).
- the data (or "message") that needs to be signed by Alice to provide a valid signature may be defined by the locking script, or by the node protocol, or by a combination of these.
- the node applies the node protocol. This comprises running the locking script and unlocking script together to check whether the unlocking script meets the condition defined in the locking script (where this condition may comprise one or more criteria).
- script code is often represented schematically (i.e. not using the exact language).
- operation codes opcodes
- "OP_" refers to a particular opcode of the Script language.
- OP_RETURN is an opcode of the Script language that when preceded by OP_FALSE at the beginning of a locking script creates an unspendable output of a transaction that can store data within the transaction, and thereby record the data immutably in the blockchain 150.
- the data could comprise a document which it is desired to store in the blockchain.
- an input of a transaction contains a digital signature corresponding to a public key PA. In embodiments this is based on the ECDSA using the elliptic curve secp256kl.
- a digital signature signs a particular piece of data. In some embodiments, for a given transaction the signature will sign part of the transaction input, and some or all of the transaction outputs. The particular parts of the outputs it signs depends on the SIGHASH flag.
- the SIGHASH flag is usually a 4-byte code included at the end of a signature to select which outputs are signed (and thus fixed at the time of signing).
- the locking script is sometimes called "scriptPubKey” referring to the fact that it typically comprises the public key of the party to whom the respective transaction is locked.
- the unlocking script is sometimes called “scriptSig” referring to the fact that it typically supplies the corresponding signature.
- the scripting language could be used to define any one or more conditions. Hence the more general terms “locking script” and “unlocking script” may be preferred.
- Figure 3 illustrates an example of the node software 350 that is run on each blockchain node 104 of the network 106, in the example of a UTXO- or output-based model. Note that another entity may run node software 350 without being classed as a node 104 on the network 106, i.e. without performing the actions required of a node 104.
- the node software 350 may contain, but is not limited to, a protocol engine 351, a script engine 352, a stack 353, an application-level decision engine 354, and a set of one or more blockchain-related functional modules 355.
- Each node 104 may run node software that contains one or more of: a consensus module 355C (for example, proof-of-work), a propagation module 355P and a storage module 355S (for example, a database).
- the consensus module 355C may contain a validation module (not shown) configured to validate transactions according to the blockchain protocol.
- the validation module may instead be separate from the consensus module 355C.
- One or more of the modules may operate in parallel.
- a node 104 may contain additional modules.
- the protocol engine 351 is typically configured to recognize the different fields of a transaction 152 and process them in accordance with the node protocol. When a transaction 152j (Txj) is received having an input pointing to an output (e.g.
- the protocol engine 351 identifies the unlocking script in Txj and passes it to the script engine 352.
- the protocol engine 351 also identifies and retrieves Tx t based on the pointer in the input of Txj.
- Tx t may be published on the blockchain 150, in which case the protocol engine may retrieve Tx t from a copy of a block 151 of the blockchain 150 stored at the node 104. Alternatively, Tx t may yet to have been published on the blockchain 150. In that case, the protocol engine 351 may retrieve Tx t from the ordered set 154 of unpublished transactions maintained by the nodel04.
- the script engine 351 identifies the locking script in the referenced output of Tx t and passes this to the script engine 352.
- the script engine 352 thus has the locking script of Tx t and the unlocking script from the corresponding input of Txj.
- transactions labelled Tx 0 and Tx are illustrated in Figure 2, but the same could apply for any pair of transactions.
- the script engine 352 runs the two scripts together as discussed previously, which will include placing data onto and retrieving data from the stack 353 in accordance with the stack-based scripting language being used (e.g. Script).
- the script engine 352 determines whether or not the unlocking script meets the one or more criteria defined in the locking script - i.e. does it "unlock” the output in which the locking script is included? The script engine 352 returns a result of this determination to the protocol engine 351. If the script engine 352 determines that the unlocking script does meet the one or more criteria specified in the corresponding locking script, then it returns the result "true”. Otherwise it returns the result "false”.
- the result "true” from the script engine 352 is one of the conditions for validity of the transaction.
- protocol-level conditions evaluated by the protocol engine 351 that must be met as well; such as that the total amount of digital asset specified in the output(s) of TXj does not exceed the total amount pointed to by its inputs, and that the pointed-to output of Tx t has not already been spent by another valid transaction.
- the protocol engine 351 evaluates the result from the script engine 352 together with the one or more protocol-level conditions, and only if they are all true does it validate the transaction Txj.
- the protocol engine 351 outputs an indication of whether the transaction is valid to the application-level decision engine 354.
- the decision engine 354 may select to control both of the consensus module 355C and the propagation module 355P to perform their respective blockchain-related function in respect of Txj. This comprises the consensus module 355C adding Txj to the node's respective ordered set of transactions 154 for incorporating in a block 151, and the propagation module 355P forwarding Txj to another blockchain node 104 in the network 106.
- the application-level decision engine 354 may apply one or more additional conditions before triggering either or both of these functions. E.g. the decision engine may only select to publish the transaction on condition that the transaction is both valid and leaves enough of a transaction fee.
- true and “false” herein do not necessarily limit to returning a result represented in the form of only a single binary digit (bit), though that is certainly one possible implementation. More generally, “true” can refer to any state indicative of a successful or affirmative outcome, and “false” can refer to any state indicative of an unsuccessful or non-affirmative outcome. For instance in an account-based model, a result of "true” could be indicated by a combination of an implicit, protocol-level validation of a signature and an additional affirmative output of a smart contract (the overall result being deemed to signal true if both individual outcomes are true).
- the blockchain network 106 is the bitcoin network and bitcoin nodes 104 perform at least all of the described functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150. It is not excluded that there may be other network entities (or network elements) that only perform one or some but not all of these functions. That is, a network entity may perform the function of propagating and/or storing blocks without creating and publishing blocks (recall that these entities are not considered nodes of the preferred Bitcoin network 106).
- the blockchain network 106 may not be the bitcoin network.
- a node may perform at least one or some but not all of the functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150.
- a "node" may be used to refer to a network entity that is configured to create and publish blocks 151 but not store and/or propagate those blocks 151 to other nodes.
- any reference to the term "bitcoin node” 104 above may be replaced with the term “network entity” or “network element”, wherein such an entity/element is configured to perform some or all of the roles of creating, publishing, propagating and storing blocks.
- the functions of such a network entity/element may be implemented in hardware in the same way described above with reference to a blockchain node 104.
- proof- of-work is just one type of consensus mechanism and in general embodiments may use any type of suitable consensus mechanism such as, for example, proof-of-stake, delegated proof-of-stake, proof-of-capacity, or proof-of-elapsed time.
- proof- of-stake uses a randomized process to determine which blockchain node 104 is given the opportunity to produce the next block 151.
- the chosen node is often referred to as a validator.
- Blockchain nodes can lock up their tokens for a certain time in order to have the chance of becoming a validator. Generally, the node who locks the biggest stake for the longest period of time has the best chance of becoming the next validator.
- Statement 1 A computer-implemented method comprising: partitioning an Unspent Transaction Outpoint (UTXO) set of a blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction.
- the method further comprises partitioning a Spent Transaction Outpoint set (STXO) set of the blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of the first blockchain transaction
- Statement 2 The computer-implemented method of Statement 1 or Statement l's first example, comprising: partitioning the UTXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the UTXO set.
- Statement 3 The computer-implemented method of Statement 1 or Statement l's first example, comprising: partitioning the UTXO set into the at least two partitions according to outpoint references.
- Statement 4 The computer-implemented method of any preceding Statement or example, comprising: partitioning a Spent Transaction Outpoint set (STXO) set of the blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a second blockchain transaction.
- STXO Spent Transaction Outpoint set
- Statement 5 The computer-implemented method of Statement 4, comprising: partitioning the STXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the STXO set.
- Statement 6 The computer-implemented method of Statement 4, comprising: partitioning the STXO set into the at least two partitions according to outpoint references.
- Statement 7 A computer-implemented method according to any preceding Statement or example, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a third blockchain transaction is in the STXO of the blockchain; rejecting the third blockchain transaction.
- Statement 8 The computer-implemented method of Statement 7, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is in the UTXO set; accepting the fourth blockchain transaction.
- Statement 9 The computer-implemented method according to Statement 8, comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is not in the STXO set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is in the UTXO set.
- Statement 10 The computer-implemented method of any preceding Statement or example, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a fifth blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the fifth blockchain transaction is not in an UTXO set; determining that the outpoint for the fifth blockchain transaction is unspendable.
- Statement 11 The computer-implemented method according to Statement 10, comprising performing in parallel: the determining that the output of a previous blockchain transaction referenced by the outpoint for the fifth blockchain transaction is not in the STXO set and the determining that the output of a previous blockchain transaction referenced by the outpoint for the fifth blockchain transaction is not in the UTXO set.
- Statement 12 Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of Statements 1 to 11 or Statement l's first example.
- Statement 13 A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of Statements 1 to 11 or Statement l's first example.
- Statement 1' A computer-implemented method comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction is in a Spent Transaction Outpoint set (STXO) of a blockchain; and rejecting the first blockchain transaction.
- Statement 2' The computer-implemented method of Statement 1', comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a second blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the second blockchain transaction is in an Unspent Transaction Outpoint (UTXO) set; and accepting the second blockchain transaction.
- STXO Spent Transaction Outpoint set
- Statement 3' The computer-implemented method according to Statement 2', comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the second blockchain transaction is not in the STXO set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the second blockchain transaction is in the UTXO set.
- Statement 4' The computer-implemented method of any Statements l'-3' comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a third blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the third blockchain transaction is not in an UTXO set; determining that the outpoint for the third blockchain transaction is unspendable.
- Statement 5' The computer-implemented method according to Statement 4', comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the third blockchain transaction is not in the STXO set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the third blockchain transaction is not in the UTXO set.
- Statement 6' The computer-implemented method of any of Statements 2' to 5', comprising: partitioning the UTXO set into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction.
- Statement 7' The computer-implemented method of Statement 6', comprising: partitioning the UTXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the UTXO set.
- Statement 8' The computer-implemented method of Statement 6', comprising: partitioning the UTXO set into the at least two partitions according to outpoint references.
- Statement 9' The computer-implemented method of any of Statements 1' to 8', comprising: partitioning the STXO set into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction.
- Statement 10' The computer-implemented method of Statement 9', comprising: partitioning the STXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the STXO set.
- Statement 11' The computer-implemented method of Statement 9', comprising: partitioning the STXO set into the at least two partitions according to outpoint references.
- Statement 12' Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of Statements 1' to 11'.
- Statement 13' A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of Statements 1' to 11'.
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Finance (AREA)
- Physics & Mathematics (AREA)
- Strategic Management (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computer Security & Cryptography (AREA)
- General Business, Economics & Management (AREA)
- Signal Processing (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Control Of Vending Devices And Auxiliary Devices For Vending Devices (AREA)
Abstract
A computer-implemented method, comprising: partitioning an Unspent Transaction Outpoint (UTXO) set of a blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction; partitioning a Spent Transaction Outpoint set (STXO) set of the blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of the first blockchain transaction.
Description
DOUBLE-SPEND CHECKS
TECHNICAL FIELD
The present disclosure relates to a method, system and computer program for determining whether an input of a blockchain transaction have been checked or not.
BACKGROUND
An Unspent Transaction Outpoint set is a dynamic set of unspent transaction outpoints that is not necessarily consistent across the network. As members of the set are removed, new members are added. As part of transaction validation, a blockchain node (e.g., a Bitcoin node) is required to check whether the inputs of a transaction are in their Unspent Transaction Outpoint set, i.e., have been spent or not. If an input of a transaction are in an Unspent Transaction Outpoint set, the outpoint is spendable such that the blockchain node can continue with validation of other inputs/outpoints of the transaction, or with validating the transaction if all the inputs of the transactions have been validated. If the input of the transaction is not in an Unspent Transaction Outpoint set, the outpoint may not be spendable (already spent or not a valid output) or the outpoint may not have been seen yet by the blockchain node. This check requires a lookup operation in a set. This set is often large.
SUMMARY
According to one aspect disclosed herein, there is provided a computer-implemented method, comprising: partitioning an Unspent Transaction Outpoint (UTXO) set of a blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction.
The Unspent Transaction Outpoint set may also be referred to as a Unspent Transaction Output set. A transaction output is referenced using a combination of a transaction identifier (TxID) of the transaction containing the output, and an index of the output within that transaction. The combination of the TxID and index is referred to as an outpoint.
BRIEF DESCRIPTION OF THE DRAWINGS
To assist understanding of embodiments of the present disclosure and to show how such embodiments may be put into effect, reference is made, by way of example only, to the accompanying drawings in which:
Figure 1 is a schematic block diagram of a system for implementing a blockchain,
Figure 2 schematically illustrates some examples of transactions which may be recorded in a blockchain,
Figure 3 is a schematic block diagram of some node software for processing transactions, and
Figure 4 is a method flow diagram.
DETAILED DESCRIPTION OF EMBODIMENTS
1. SPEND CHECKS
Some examples described herein perform a lookup operation for checking whether the inputs of a transaction are in a UTXO set. This can be performed by a blockchain node (e.g., Bitcoin node) as part of a transaction validation. Examples described herein provide a method for improving the efficiency of the lookup operation. In some examples, efficiency is improved by A) splitting the lookup operation into multiple smaller lookup operations. In some examples, efficiency is improved by B) conducting look operations in spent transactions. In some examples, A) and B) are performed in parallel.
Double spend checks are performed during a blockchain (e.g., Bitcoin) transaction validation. As, blockchain networks (e.g., Bitcoin networks) scale up in size, the size of an UTXO set is going to become increasingly large. For example, a Teranode block will be able to spend at least 600 million UTXOs, and therefore the set is required to be capable of handling at least this number of transactions. As a result, even a simple lookup may become
a significant bottleneck in terms of transaction throughput. To overcome this potential bottleneck, two efficiency improvements can be used, as described herein:
A) Splitting a lookup operation into smaller ones by partitioning the UTXO set (within a Bitcoin node) into sections.
B) Perform lookup operations on the set of spent outputs (as opposed to the set of unspent outputs).
The two improvements can be implemented separately, or together and executed in parallel to gain maximum efficiency.
A) is discussed in section 1.1 and B) is discussed in section 1.2.
1.1 PARTITIONING UTXO SET
An Unspent Traction Outpoint set is a dynamic set of unspent transaction outputs that is not necessarily consistent across the network. As members of the set are removed, new members are added. The Unspent Transaction Outpoint set can be partitioned in a number of different ways, using different schemes. Searches can then be performed in parallel in each partition, which reduces the amount of time to perform the lookup operation. As described herein, operations performed "in parallel" may be performed at least partially (and in some cases, fully) overlapping in time.
One way to partition the set can be in chronological order, where members (i.e. UTXOs) are ordered based on their creation time (block height), and new members of the set are added to the latest section of the partition (or a new section if the previous section is full). Each section can have a fixed size or a variable size that could depend on a variable, for example, the block height. When an outpoint is given, it is passed on to each section for a lookup operation. The outputs from all lookup operations are aggregated using "OR" to obtain the final result that determines the validity of the full transaction.
An alternative implementation is to stop all operations when one of the outputs of the lockup operations indicates that an entry has been found.
Another way to partition the set can be based on outpoint references (TXID and index), for example based on alphabetical order. The advantage of this partition scheme is that when an outpoint is given, it is passed on to only one of the sections for a lookup operation based on the TXID of the outpoint. While it does not require parallelisation of many lookups, it does require a pre-ordered set of unspent transaction outputs.
When the set of Unspent Transaction Outpoints has been partitioned, a search can be performed, in parallel, in at least two of the partitions to look for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction. If the search in the partitions of the set of Unspent Transaction Outpoints returns a positive result, this indicates that the outpoint is spendable. The method can proceed to continue with validation of other inputs/outpoints, or if the input/outpoint is the final input/outpoint in the transaction, the method can proceed with validating the transaction. If the search in the partitions of the set of Unspent Transaction Outpoints returns a positive result, this indicates that the outpoint may not be spendable (already spent or not a valid output), or that the outpoint may not have been seen yet.
1.2 SPENT TRANSACTION OUTPOINT SET
Herein, a spent output or a spent outpoint refers to an output of a transaction that has been validly spent by an input of a later transaction. A Spent Transaction Outpoint (STXO) set is a list of spent outputs (also referred to as spent outpoints). Unlike an Unspent Transaction Outpoint set, a Spent Transaction Outpoint (STXO) set is an append-only set. That is, once an output is added as a member of a STXO set, it will always remain a member, and the size of the set grows monotonically with the size of the blockchain. When conducting a double spend check, a check against Unspent Transaction Outpoint set is to look for a guaranteed positive result. A check against STXO set is to look for a guaranteed negative result. In other words, upon receiving a match from the STXO set, one can be sure that the input/outpoint has been spent and therefore fails the double spend check. If an outpoint of a previous blockchain transaction referenced by an input of a blockchain transaction is in the STXO of the blockchain, it can be determined that the input/outpoint of the blockchain transaction
has been spent, and therefore fails the double spend check. The transaction may then be rejected by a blockchain node.
However, if there is no match from the STXO set, one still needs to check with the UTXO set. In some examples, a lookup in an STXO set serves as a supporting operation in parallel to the UTXO set lookup (this can be useful as looking up in an STXO set may not be able to provide a conclusive result). When a match is found in the STXO set, the Unspent Transaction Outpoint set lookups of other outpoints in the full transaction can stop, which can save some computation.
In some examples, the set size for the lookup can be reduced by only keeping the recent spent transactions (which is a smaller set than the entire STXO set). The risk of a successful double spend attempt (where the network simultaneously has two versions of a transaction) is typically only within a short time period (e.g., the first few seconds) of a transaction first appearing on the network. After this point, the transaction will be seen in all nodes, and a double spend attempt will likely be unsuccessful. The cost of adding a quick look up on this small set is negligible, and when a match is found, the Unspent Transaction Outpoint set lookups of other outpoints in the full transaction can stop, which can save some computation.
As described in the above section regarding partitioning Unspent Transaction Outpoint sets, the STXO set (or STXO set limited to spent transactions in a recent time period) can be partitioned into multiple sections to parallelising the lookup operations. Similar partitioning schemes can be used as described above.
The STXO set can be partitioned in chronological order, where members (i.e. STXOs) are ordered based on their creation time (block height), and new members of the set are added to the latest section of the partition (or a new section if the previous section is full). Each section can have a fixed size or a variable size that could depend on a variable, for example, the block height. When an outpoint is given, it is passed on to each partition for a lookup operation in the partitioned STXO set. The outputs from all lookup operations are
aggregated using "OR" to obtain the final result that determines the validity of the full transaction.
Another way to partition the STXO (or reduced size STXO) set can be based on outpoint references (TXID and index), for example based on alphabetical order. The advantage of this partition scheme is that when an outpoint is given, it is passed on to only one of the sections for a lookup operation based on the TXID of the outpoint. While it does not require parallelisation of many lookups, it does require a pre-ordered STXO set.
When the STXO set (or recent STXO set) has been partitioned, a search can be performed, in parallel, in at least two of the partitions to look for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction. If the search in the partitions of the STXO set (or recent STXO set) returns a positive result, this indicates that the outpoint is not spendable. The method can proceed to reject the transaction. If the search in the partitions of the STXO set (or recent STXO set) returns a negative result, this indicates that the outpoint may be spendable or that the outpoint does not exist.
Table 1 summarises the different lookup results in an Unspent Transaction Outpoint set and STXO set.
Table 1: Summary of different lookup results in an Unspent Transaction Outpoint set and STXO set.
A method flow chart is shown in Figure 4. The method may be carried out, for example, by a blockchain node or an apparatus at a blockchain node.
At SI, the method comprises partitioning a UTXO set of a blockchain into at least two partitions.
At S2, the method comprises performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction.
2. EXAMPLE SYSTEM OVERVIEW
A blockchain refers to a form of distributed data structure, wherein a duplicate copy of the blockchain is maintained at each of a plurality of nodes in a distributed peer-to-peer (P2P) network (referred to below as a "blockchain network") and widely publicised. The blockchain comprises a chain of blocks of data, wherein each block comprises one or more transactions. Each transaction, other than so-called "coinbase transactions", points back to a preceding transaction in a sequence which may span one or more blocks going back to one or more coinbase transactions. Coinbase transactions are discussed further below.
Transactions that are submitted to the blockchain network are included in new blocks. New blocks are created by a process often referred to as "mining", which involves each of a plurality of the nodes competing to perform "proof-of-work", i.e. solving a cryptographic puzzle based on a representation of a defined set of ordered and validated pending transactions waiting to be included in a new block of the blockchain. It should be noted that the blockchain may be pruned at some nodes, and the publication of blocks can be achieved through the publication of mere block headers.
The transactions in the blockchain may be used for one or more of the following purposes: to convey a digital asset (i.e. a number of digital tokens), to order a set of entries in a virtualised ledger or registry, to receive and process timestamp entries, and/or to timeorder index pointers. A blockchain can also be exploited in order to layer additional functionality on top of the blockchain. For example, blockchain protocols may allow for storage of additional user data or indexes to data in a transaction. There is no pre-specified limit to the maximum data capacity that can be stored within a single transaction, and therefore increasingly more complex data can be incorporated. For instance this may be used to store an electronic document in the blockchain, or audio or video data.
In an "output-based" model (sometimes referred to as a UTXO-based model), the data structure of a given transaction comprises one or more inputs and one or more outputs. Any spendable output comprises an element specifying an amount of the digital asset that is derivable from the proceeding sequence of transactions. The spendable output is sometimes referred to as a UTXO ("unspent transaction output"). The output may further comprise a locking script specifying a condition for the future redemption of the output. A locking script is a predicate defining the conditions necessary to validate and transfer digital tokens or assets. Each input of a transaction (other than a coinbase transaction) comprises a pointer (i.e. a reference) to such an output in a preceding transaction, and may further comprise an unlocking script for unlocking the locking script of the pointed-to output. So consider a pair of transactions, call them a first and a second transaction (or "target" transaction). The first transaction comprises at least one output specifying an amount of the digital asset, and comprising a locking script defining one or more conditions of unlocking the output. The second, target transaction comprises at least one input, comprising a pointer to the output of the first transaction, and an unlocking script for unlocking the output of the first transaction.
In such a model, when the second, target transaction is sent to the blockchain network to be propagated and recorded in the blockchain, one of the criteria for validity applied at each node will be that the unlocking script meets all of the one or more conditions defined in the locking script of the first transaction. Another will be that the output of the first transaction has not already been redeemed by another, earlier valid transaction. Any node that finds the target transaction invalid according to any of these conditions will not propagate it (as a valid transaction, but possibly to register an invalid transaction) nor include it in a new block to be recorded in the blockchain.
An alternative type of transaction model is an account-based model. In this case each transaction does not define the amount to be transferred by referring back to the UTXO of a preceding transaction in a sequence of past transactions, but rather by reference to an absolute account balance. The current state of all accounts is stored by the nodes separate to the blockchain and is updated constantly.
Figure 1 shows an example system 100 for implementing a blockchain 150. The system 100 may comprise a packet-switched network 101, typically a wide-area internetwork such as the Internet. The packet-switched network 101 comprises a plurality of blockchain nodes 104 (often referred to as "miners") that may be arranged to form a peer-to-peer (P2P) network 106 within the packet-switched network 101. Whilst not illustrated, the blockchain nodes 104 may be arranged as a near-complete graph. Each blockchain node 104 is therefore highly connected to other blockchain nodes 104.
Each blockchain node 104 comprises computer equipment of a peer, with different ones of the nodes 104 belonging to different peers. Each blockchain node 104 comprises processing apparatus 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), and other equipment such as application specific integrated circuits (ASICs). Each node also comprises memory, i.e. computer-readable storage in the form of a non-transitory computer-readable medium or media. The memory may comprise one or more memory units employing 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), flash memory or EEPROM; and/or an optical medium such as an optical disk drive.
The blockchain 150 comprises a chain of blocks of data 151, wherein a respective copy of the blockchain 150 is maintained at each of a plurality of blockchain nodes 104 in the distributed or blockchain network 106. As mentioned above, maintaining a copy of the blockchain 150 does not necessarily mean storing the blockchain 150 in full. Instead, the blockchain 150 may be pruned of data so long as each blockchain node 150 stores the block header (discussed below) of each block 151. Each block 151 in the chain comprises one or more transactions 152, wherein a transaction in this context refers to a kind of data structure. The nature of the data structure will depend on the type of transaction protocol used as part of a transaction model or scheme. A given blockchain will use one particular transaction protocol throughout.
A blockchain node 104 may be configured to forward transactions 152 to other blockchain nodes 104, and thereby cause transactions 152 to be propagated throughout the network 106. A blockchain node 104 may be configured to create blocks 151 and to store a respective copy of the same blockchain 150 in their respective memory. A blockchain node 104 may also maintain an ordered set (or "pool") 154 of transactions 152 waiting to be incorporated into blocks 151. The ordered pool 154 is often referred to as a "mempool". This term herein is not intended to limit to any particular blockchain, protocol or model. It refers to the ordered set of transactions which a node 104 has accepted as valid and for which the node 104 is obliged not to accept any other transactions attempting to spend the same output.
In a given present transaction 152j, the (or each) input comprises a pointer referencing the output of a preceding transaction 152i in the sequence of transactions, specifying that this output is to be redeemed or "spent" in the present transaction 152j. Spending or redeeming does not necessarily imply transfer of a financial asset, though that is certainly one common application. More generally spending could be described as consuming the output, or assigning it to one or more outputs in another, onward transaction. In general, the preceding transaction could be any transaction in the ordered set 154 or any block 151. The preceding transaction 152i need not necessarily exist at the time the present transaction 152j is created or even sent to the network 106, though the preceding transaction 152i will need to exist and be validated in order for the present transaction to be valid. Hence "preceding" herein refers to a predecessor in a logical sequence linked by pointers, not necessarily the time of creation or sending in a temporal sequence, and hence it does not necessarily exclude that the transactions 152i, 152j be created or sent out-of-order (see discussion below on orphan transactions). The preceding transaction 152i could equally be called the antecedent or predecessor transaction.
Due to the resources involved in transaction validation and publication, typically at least each of the blockchain nodes 104 takes the form of a server comprising one or more physical server units, or even whole a data centre. However in principle any given blockchain node 104 could take the form of a user terminal or a group of user terminals networked together.
The memory of each blockchain node 104 stores software configured to run on the processing apparatus of the blockchain node 104 in order to perform its respective role or roles and handle transactions 152 in accordance with the blockchain node protocol. It will be understood that any action attributed herein to a blockchain node 104 may be performed by the software run on the processing apparatus of the respective computer equipment. The node software may be implemented in one or more applications at the application layer, or a lower layer such as the operating system layer or a protocol layer, or any combination of these.
Any given blockchain node may be configured to perform one or more of the following operations: validating transactions, storing transactions, propagating transactions to other peers, performing consensus (e.g. proof-of-work) / mining operations. In some examples, each type of operation is performed by a different node 104. That is, nodes may specialise in particular operation. For example, a nodes 104 may focus on transaction validation and propagation, or on block mining. In some examples, a blockchain node 104 may perform more than one of these operations in parallel. Any reference to a blockchain node 104 may refer to an entity that is configured to perform at least one of these operations.
Also connected to the network 101 is the computer equipment 102 of each of a plurality of parties 103 in the role of consuming users. These users may interact with the blockchain network 106 but do not participate in validating transactions or constructing blocks. Some of these users or agents 103 may act as senders and recipients in transactions. Other users may interact with the blockchain 150 without necessarily acting as senders or recipients. For instance, some parties may act as storage entities that store a copy of the blockchain 150 (e.g. having obtained a copy of the blockchain from a blockchain node 104).
Some or all of the parties 103 may be connected as part of a different network, e.g. a network overlaid on top of the blockchain network 106. Users of the blockchain network (often referred to as "clients") may be said to be part of a system that includes the blockchain network 106; however, these users are not blockchain nodes 104 as they do not perform the roles required of the blockchain nodes. Instead, each party 103 may interact
with the blockchain network 106 and thereby utilize the blockchain 150 by connecting to (i.e. communicating with) a blockchain node 106. Two parties 103 and their respective equipment 102 are shown for illustrative purposes: a first party 103a and his/her respective computer equipment 102a, and a second party 103b and his/her respective computer equipment 102b. It will be understood that many more such parties 103 and their respective computer equipment 102 may be present and participating in the system 100, but for convenience they are not illustrated. Each party 103 may be an individual or an organization. Purely by way of illustration the first party 103a is referred to herein as Alice and the second party 103b is referred to as Bob, but it will be appreciated that this is not limiting and any reference herein to Alice or Bob may be replaced with "first party" and "second "party" respectively.
The computer equipment 102 of each party 103 comprises respective processing apparatus 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 memory, i.e. computer-readable storage in the form of a non-transitory computer-readable medium or media. This memory may comprise one or more memory units employing one or more memory media, e.g. a magnetic medium such as hard disk; an electronic medium such as an SSD, flash memory or EEPROM; and/or an optical medium such as an optical disc drive. The memory on the computer equipment 102 of each party 103 stores software comprising a respective instance of at least one client application 105 arranged to run on the processing apparatus. It will be understood that any action attributed herein to a given party 103 may be performed using the software run on the processing apparatus of the respective computer equipment 102. The computer equipment 102 of each party 103 comprises at least one user terminal, e.g. a desktop or laptop computer, a tablet, a smartphone, or a wearable device such as a smartwatch. The computer equipment 102 of a given party 103 may also comprise one or more other networked resources, such as cloud computing resources accessed via the user terminal.
The client application 105 may be initially provided to the computer equipment 102 of any given party 103 on suitable computer-readable storage medium or media, e.g. downloaded from a server, or provided on a removable storage device such as a removable SSD, flash
memory key, removable EEPROM, removable magnetic disk drive, magnetic floppy disk or tape, optical disk such as a CD or DVD ROM, or a removable optical drive, etc.
The client application 105 comprises at least a "wallet" function. This has two main functionalities. One of these is to enable the respective party 103 to create, authorise (for example sign) and send transactions 152 to one or more bitcoin nodes 104 to then be propagated throughout the network of blockchain nodes 104 and thereby included in the blockchain 150. The other is to report back to the respective party the amount of the digital asset that he or she currently owns. In an output-based system, this second functionality comprises collating the amounts defined in the outputs of the various 152 transactions scattered throughout the blockchain 150 that belong to the party in question.
Note: whilst the various client functionality may be described as being integrated into a given client application 105, this is not necessarily limiting and instead any client functionality described herein may instead be implemented in a suite of two or more distinct applications, e.g. interfacing via an API, or one being a plug-in to the other. More generally the client functionality could be implemented at the application layer or a lower layer such as the operating system, or any combination of these. The following will be described in terms of a client application 105 but it will be appreciated that this is not limiting.
The instance of the client application or software 105 on each computer equipment 102 is operatively coupled to at least one of the blockchain nodes 104 of the network 106. This enables the wallet function of the client 105 to send transactions 152 to the network 106. The client 105 is also able to contact blockchain nodes 104 in order to query the blockchain 150 for any transactions of which the respective party 103 is the recipient (or indeed inspect other parties' transactions in the blockchain 150, since in embodiments the blockchain 150 is a public facility which provides trust in transactions in part through its public visibility). The wallet function on each computer equipment 102 is configured to formulate and send transactions 152 according to a transaction protocol. As set out above, each blockchain node 104 runs software configured to validate transactions 152 according to the blockchain node protocol, and to forward transactions 152 in order to propagate them throughout the
blockchain network 106. The transaction protocol and the node protocol correspond to one another, and a given transaction protocol goes with a given node protocol, together implementing a given transaction model. The same transaction protocol is used for all transactions 152 in the blockchain 150. The same node protocol is used by all the nodes 104 in the network 106.
An alternative type of transaction protocol operated by some blockchain networks may be referred to as an "account-based" protocol, as part of an account-based transaction model. In the account-based case, each transaction does not define the amount to be transferred by referring back to the UTXO of a preceding transaction in a sequence of past transactions, but rather by reference to an absolute account balance. The current state of all accounts is stored, by the nodes of that network, separate to the blockchain and is updated constantly. In such a system, transactions are ordered using a running transaction tally of the account (also called the "position" or "nonce"). This value is signed by the sender as part of their cryptographic signature and is hashed as part of the transaction reference calculation. In addition, an optional data field may also be signed the transaction. This data field may point back to a previous transaction, for example if the previous transaction ID is included in the data field.
Some account-based transaction models share several similarities with the output-based transaction model described herein. For example, as mentioned above, the data field of an account-based transaction may point back to a previous transaction, which is equivalent to the input of an output-based transaction which references an outpoint a previous transaction. Thus both models enable linking between transactions. As another example, an account-based transaction contains a "recipient" field (in which a receiving address of an account is specified) and a "value" field (in which an amount of digital asset may be specified). Together the recipient and value fields are equivalent to the output of an outputbased transaction which may be used to assign an amount of digital asset to a blockchain address. Similarly, an account-based transaction has a "signature" field which includes a signature for the transaction. The signature is generated using the sender's private key and confirms the sender has authorized this transaction. This is equivalent to an input / unlocking script of an output-based transaction which, typically, includes a signature for the
transaction. When both types of transaction are submitted to their respective blockchain networks, the signatures are checked to determine whether the transaction is valid and can be recorded on the blockchain. On an account-based blockchain, a "smart contact" refers to a transaction that contains a script configured to perform one or more actions (e.g. send or "release" a digital asset to a recipient address) in response to one or more inputs (provided by a transaction) meeting one or more conditions defined by the smart contact's script. The smart contract exists as a transaction on the blockchain, and can be called (or triggered) by subsequent transactions. Thus, in some examples, a smart contract may be considered equivalent to a locking script of an output-based transaction, which can be triggered by a subsequent transaction, and checks whether one or more conditions defined by the locking script are met by the input of the subsequent transaction.
3. UTXO-BASED MODEL
Figure 2 illustrates an example transaction protocol. This is an example of a UTXO-based protocol. A transaction 152 (abbreviated "Tx") is the fundamental data structure of the blockchain 150 (each block 151 comprising one or more transactions 152). The following will be described by reference to an output-based or "UTXO" based protocol. However, this is not limiting to all possible embodiments. Note that while the example UTXO-based protocol is described with reference to bitcoin, it may equally be implemented on other example blockchain networks.
In a UTXO-based model, each transaction ("Tx") 152 comprises a data structure comprising one or more inputs 202, and one or more outputs 203. Each output 203 may comprise an unspent transaction output (UTXO), which can be used as the source for the input 202 of another new transaction (if the UTXO has not already been redeemed). The UTXO includes a value specifying an amount of a digital asset. This represents a set number of tokens on the distributed ledger. The UTXO may also contain the transaction ID of the transaction from which it came, amongst other information. The transaction data structure may also comprise a header 201, which may comprise an indicator of the size of the input field(s) 202 and output field(s) 203. The header 201 may also include an ID of the transaction. In embodiments the transaction ID is the hash of the transaction data (excluding the
transaction ID itself) and stored in the header 201 of the raw transaction 152 submitted to the nodes 104.
Say Alice 103a wishes to create a transaction 152j transferring an amount of the digital asset in question to Bob 103b. In Figure 2 Alice's new transaction 152j is labelled " TxT. It takes an amount of the digital asset that is locked to Alice in the output 203 of a preceding transaction 152i in the sequence, and transfers at least some of this to Bob. The preceding transaction 152i is labelled “Txo" in Figure 2. TAT? and Txi are just arbitrary labels. They do not necessarily mean that Txo is the first transaction in the blockchain 151, nor that Txi is the immediate next transaction in the pool 154. Txi could point back to any preceding (i.e. antecedent) transaction that still has an unspent output 203 locked to Alice.
The terms "preceding" and "subsequent" as used herein in the context of the sequence of transactions refer to the order of the transactions in the sequence as defined by the transaction pointers specified in the transactions (which transaction points back to which other transaction, and so forth). They could equally be replaced with "predecessor" and "successor", or "antecedent" and "descendant", "parent" and "child", or such like. It does not necessarily imply an order in which they are created, sent to the network 106, or arrive at any given blockchain node 104. Nevertheless, a subsequent transaction (the descendent transaction or "child") which points to a preceding transaction (the antecedent transaction or "parent") will not be validated until and unless the parent transaction is validated. A child that arrives at a blockchain node 104 before its parent is considered an orphan. It may be discarded or buffered for a certain time to wait for the parent, depending on the node protocol and/or node behaviour.
One of the one or more outputs 203 of the preceding transaction Txo comprises a particular UTXO, labelled here UTXOo. Each UTXO comprises a value specifying an amount of the digital asset represented by the UTXO, and a locking script which defines a condition which must be met by an unlocking script in the input 202 of a subsequent transaction in order for the subsequent transaction to be validated, and therefore for the UTXO to be successfully redeemed.
The locking script (aka scriptPubKey) is a piece of code written in the domain specific language recognized by the node protocol. A particular example of such a language is called "Script" (capital S) which is used by the blockchain network. The locking script specifies what information is required to spend a transaction output 203, for example the requirement of Alice's signature. Locking scripts appear in the outputs of transactions. The unlocking script (aka scriptSig) is a piece of code written the domain specific language that provides the information required to satisfy the locking script criteria. For example, it may contain Bob's signature. Unlocking scripts appear in the input 202 of transactions.
So in the example illustrated, UTXOo in the output 203 of TAT? comprises a locking script [Checksig PA which requires a signature Sig PA of Alice in order for UTXOo to be redeemed (strictly, in order for a subsequent transaction attempting to redeem UTXOo to be valid). [Checksig PA contains a representation (i.e. a hash) of the public key PA from a publicprivate key pair of Alice. The input 202 of Txi comprises a pointer pointing back to Txi (e.g. by means of its transaction ID, TxIDo, which in embodiments is the hash of the whole transaction Txo). The input 202 of Txi comprises an index identifying UTXOo within Txo, to identify it amongst any other possible outputs of Txo. The input 202 of Txi further comprises an unlocking script <Sig PA> which comprises a cryptographic signature of Alice, created by Alice applying her private key from the key pair to a predefined portion of data (sometimes called the "message" in cryptography). The data (or "message") that needs to be signed by Alice to provide a valid signature may be defined by the locking script, or by the node protocol, or by a combination of these.
When the new transaction Txi arrives at a blockchain node 104, the node applies the node protocol. This comprises running the locking script and unlocking script together to check whether the unlocking script meets the condition defined in the locking script (where this condition may comprise one or more criteria).
Note that the script code is often represented schematically (i.e. not using the exact language). For example, one may use operation codes (opcodes) to represent a particular function. "OP_..." refers to a particular opcode of the Script language. As an example, OP_RETURN is an opcode of the Script language that when preceded by OP_FALSE at the
beginning of a locking script creates an unspendable output of a transaction that can store data within the transaction, and thereby record the data immutably in the blockchain 150. E.g. the data could comprise a document which it is desired to store in the blockchain.
Typically an input of a transaction contains a digital signature corresponding to a public key PA. In embodiments this is based on the ECDSA using the elliptic curve secp256kl. A digital signature signs a particular piece of data. In some embodiments, for a given transaction the signature will sign part of the transaction input, and some or all of the transaction outputs. The particular parts of the outputs it signs depends on the SIGHASH flag. The SIGHASH flag is usually a 4-byte code included at the end of a signature to select which outputs are signed (and thus fixed at the time of signing).
The locking script is sometimes called "scriptPubKey" referring to the fact that it typically comprises the public key of the party to whom the respective transaction is locked. The unlocking script is sometimes called "scriptSig" referring to the fact that it typically supplies the corresponding signature. However, more generally it is not essential in all applications of a blockchain 150 that the condition for a UTXO to be redeemed comprises authenticating a signature. More generally the scripting language could be used to define any one or more conditions. Hence the more general terms "locking script" and "unlocking script" may be preferred.
4. NODE SOFTWARE
Figure 3 illustrates an example of the node software 350 that is run on each blockchain node 104 of the network 106, in the example of a UTXO- or output-based model. Note that another entity may run node software 350 without being classed as a node 104 on the network 106, i.e. without performing the actions required of a node 104. The node software 350 may contain, but is not limited to, a protocol engine 351, a script engine 352, a stack 353, an application-level decision engine 354, and a set of one or more blockchain-related functional modules 355. Each node 104 may run node software that contains one or more of: a consensus module 355C (for example, proof-of-work), a propagation module 355P and a storage module 355S (for example, a database). The consensus module 355C may contain a validation module (not shown) configured to validate transactions according to the
blockchain protocol. The validation module may instead be separate from the consensus module 355C. One or more of the modules may operate in parallel. A node 104 may contain additional modules. The protocol engine 351 is typically configured to recognize the different fields of a transaction 152 and process them in accordance with the node protocol. When a transaction 152j (Txj) is received having an input pointing to an output (e.g. UTXO) of another, preceding transaction 152i (Txm- ), then the protocol engine 351 identifies the unlocking script in Txj and passes it to the script engine 352. The protocol engine 351 also identifies and retrieves Txt based on the pointer in the input of Txj. Txt may be published on the blockchain 150, in which case the protocol engine may retrieve Txt from a copy of a block 151 of the blockchain 150 stored at the node 104. Alternatively, Txt may yet to have been published on the blockchain 150. In that case, the protocol engine 351 may retrieve Txt from the ordered set 154 of unpublished transactions maintained by the nodel04.
Either way, the script engine 351 identifies the locking script in the referenced output of Txt and passes this to the script engine 352.
The script engine 352 thus has the locking script of Txt and the unlocking script from the corresponding input of Txj. For example, transactions labelled Tx0 and Tx are illustrated in Figure 2, but the same could apply for any pair of transactions. The script engine 352 runs the two scripts together as discussed previously, which will include placing data onto and retrieving data from the stack 353 in accordance with the stack-based scripting language being used (e.g. Script).
By running the scripts together, the script engine 352 determines whether or not the unlocking script meets the one or more criteria defined in the locking script - i.e. does it "unlock" the output in which the locking script is included? The script engine 352 returns a result of this determination to the protocol engine 351. If the script engine 352 determines that the unlocking script does meet the one or more criteria specified in the corresponding locking script, then it returns the result "true". Otherwise it returns the result "false".
In an output-based model, the result "true" from the script engine 352 is one of the conditions for validity of the transaction. Typically there are also one or more further,
protocol-level conditions evaluated by the protocol engine 351 that must be met as well; such as that the total amount of digital asset specified in the output(s) of TXj does not exceed the total amount pointed to by its inputs, and that the pointed-to output of Txt has not already been spent by another valid transaction. The protocol engine 351 evaluates the result from the script engine 352 together with the one or more protocol-level conditions, and only if they are all true does it validate the transaction Txj. The protocol engine 351 outputs an indication of whether the transaction is valid to the application-level decision engine 354. Only on condition that Txj is indeed validated, the decision engine 354 may select to control both of the consensus module 355C and the propagation module 355P to perform their respective blockchain-related function in respect of Txj. This comprises the consensus module 355C adding Txj to the node's respective ordered set of transactions 154 for incorporating in a block 151, and the propagation module 355P forwarding Txj to another blockchain node 104 in the network 106. Optionally, in embodiments the application-level decision engine 354 may apply one or more additional conditions before triggering either or both of these functions. E.g. the decision engine may only select to publish the transaction on condition that the transaction is both valid and leaves enough of a transaction fee.
Note also that the terms "true" and "false" herein do not necessarily limit to returning a result represented in the form of only a single binary digit (bit), though that is certainly one possible implementation. More generally, "true" can refer to any state indicative of a successful or affirmative outcome, and "false" can refer to any state indicative of an unsuccessful or non-affirmative outcome. For instance in an account-based model, a result of "true" could be indicated by a combination of an implicit, protocol-level validation of a signature and an additional affirmative output of a smart contract (the overall result being deemed to signal true if both individual outcomes are true).
7. FURTHER REMARKS
Other variants or use cases of the disclosed techniques may become apparent to the person skilled in the art once given the disclosure herein. The scope of the disclosure is not limited by the described embodiments but only by the accompanying claims.
For instance, some embodiments above have been described in terms of a bitcoin network 106, bitcoin blockchain 150 and bitcoin nodes 104. However it will be appreciated that the bitcoin blockchain is one particular example of a blockchain 150 and the above description may apply generally to any blockchain. That is, the present invention is in by no way limited to the bitcoin blockchain. More generally, any reference above to bitcoin network 106, bitcoin blockchain 150 and bitcoin nodes 104 may be replaced with reference to a blockchain network 106, blockchain 150 and blockchain node 104 respectively. The blockchain, blockchain network and/or blockchain nodes may share some or all of the described properties of the bitcoin blockchain 150, bitcoin network 106 and bitcoin nodes 104 as described above.
In preferred embodiments of the invention, the blockchain network 106 is the bitcoin network and bitcoin nodes 104 perform at least all of the described functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150. It is not excluded that there may be other network entities (or network elements) that only perform one or some but not all of these functions. That is, a network entity may perform the function of propagating and/or storing blocks without creating and publishing blocks (recall that these entities are not considered nodes of the preferred bitcoin network 106).
In other embodiments of the invention, the blockchain network 106 may not be the bitcoin network. In these embodiments, it is not excluded that a node may perform at least one or some but not all of the functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150. For instance, on those other blockchain networks a "node" may be used to refer to a network entity that is configured to create and publish blocks 151 but not store and/or propagate those blocks 151 to other nodes.
Even more generally, any reference to the term "bitcoin node" 104 above may be replaced with the term "network entity" or "network element", wherein such an entity/element is configured to perform some or all of the roles of creating, publishing, propagating and storing blocks. The functions of such a network entity/element may be implemented in hardware in the same way described above with reference to a blockchain node 104.
Some embodiments have been described in terms of the blockchain network implementing a proof-of-work consensus mechanism to secure the underlying blockchain. However proof- of-work is just one type of consensus mechanism and in general embodiments may use any type of suitable consensus mechanism such as, for example, proof-of-stake, delegated proof-of-stake, proof-of-capacity, or proof-of-elapsed time. As a particular example, proof- of-stake uses a randomized process to determine which blockchain node 104 is given the opportunity to produce the next block 151. The chosen node is often referred to as a validator. Blockchain nodes can lock up their tokens for a certain time in order to have the chance of becoming a validator. Generally, the node who locks the biggest stake for the longest period of time has the best chance of becoming the next validator.
It will be appreciated that the above embodiments have been described by way of example only. More generally there may be provided a method, apparatus or program in accordance with any one or more of the following Statements.
Statement 1: A computer-implemented method comprising: partitioning an Unspent Transaction Outpoint (UTXO) set of a blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction. According to a first example of Statement 1, the method further comprises partitioning a Spent Transaction Outpoint set (STXO) set of the blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of the first blockchain transaction
Statement 2: The computer-implemented method of Statement 1 or Statement l's first example, comprising: partitioning the UTXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the UTXO set.
Statement 3: The computer-implemented method of Statement 1 or Statement l's first example, comprising: partitioning the UTXO set into the at least two partitions according to outpoint references.
Statement 4: The computer-implemented method of any preceding Statement or example, comprising: partitioning a Spent Transaction Outpoint set (STXO) set of the blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a second blockchain transaction.
Statement 5: The computer-implemented method of Statement 4, comprising: partitioning the STXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the STXO set.
Statement 6: The computer-implemented method of Statement 4, comprising: partitioning the STXO set into the at least two partitions according to outpoint references.
Statement 7: A computer-implemented method according to any preceding Statement or example, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a third blockchain transaction is in the STXO of the blockchain; rejecting the third blockchain transaction.
Statement 8: The computer-implemented method of Statement 7, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is in the UTXO set; accepting the fourth blockchain transaction.
Statement 9: The computer-implemented method according to Statement 8, comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is not in the STXO
set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is in the UTXO set.
Statement 10: The computer-implemented method of any preceding Statement or example, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a fifth blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the fifth blockchain transaction is not in an UTXO set; determining that the outpoint for the fifth blockchain transaction is unspendable.
Statement 11: The computer-implemented method according to Statement 10, comprising performing in parallel: the determining that the output of a previous blockchain transaction referenced by the outpoint for the fifth blockchain transaction is not in the STXO set and the determining that the output of a previous blockchain transaction referenced by the outpoint for the fifth blockchain transaction is not in the UTXO set.
Statement 12: Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of Statements 1 to 11 or Statement l's first example.
Statement 13: A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of Statements 1 to 11 or Statement l's first example.
Statement 1': A computer-implemented method comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction is in a Spent Transaction Outpoint set (STXO) of a blockchain; and rejecting the first blockchain transaction.
Statement 2': The computer-implemented method of Statement 1', comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a second blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the second blockchain transaction is in an Unspent Transaction Outpoint (UTXO) set; and accepting the second blockchain transaction.
Statement 3': The computer-implemented method according to Statement 2', comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the second blockchain transaction is not in the STXO set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the second blockchain transaction is in the UTXO set.
Statement 4': The computer-implemented method of any Statements l'-3' comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a third blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the third blockchain transaction is not in an UTXO set; determining that the outpoint for the third blockchain transaction is unspendable.
Statement 5': The computer-implemented method according to Statement 4', comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the third blockchain transaction is not in the STXO set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the third blockchain transaction is not in the UTXO set.
Statement 6': The computer-implemented method of any of Statements 2' to 5', comprising: partitioning the UTXO set into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction.
Statement 7': The computer-implemented method of Statement 6', comprising: partitioning the UTXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the UTXO set.
Statement 8': The computer-implemented method of Statement 6', comprising: partitioning the UTXO set into the at least two partitions according to outpoint references.
Statement 9': The computer-implemented method of any of Statements 1' to 8', comprising: partitioning the STXO set into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction.
Statement 10': The computer-implemented method of Statement 9', comprising: partitioning the STXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the STXO set.
Statement 11': The computer-implemented method of Statement 9', comprising: partitioning the STXO set into the at least two partitions according to outpoint references.
Statement 12': Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of Statements 1' to 11'.
Statement 13': A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of Statements 1' to 11'.
Claims
1. A computer-implemented method, comprising: partitioning an Unspent Transaction Outpoint (UTXO) set of a blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a first blockchain transaction; partitioning a Spent Transaction Outpoint set (STXO) set of the blockchain into at least two partitions; performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of the first blockchain transaction.
2. The computer-implemented method of claim 1, comprising: partitioning the UTXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the UTXO set.
3. The computer-implemented method of claim 1, comprising: partitioning the UTXO set into the at least two partitions according to outpoint references.
4. The computer-implemented method of any preceding claim, comprising:
performing, in parallel, a search in each of the at least two partitions for an outpoint of a previous blockchain transaction referenced by an input of a second blockchain transaction.
5. The computer-implemented method of any preceding claim, comprising: partitioning the STXO set into the at least two partitions according to a respective block height of each of a plurality of blocks, wherein each block comprises at least one outpoint in the STXO set.
6. The computer-implemented method of any preceding claim, comprising: partitioning the STXO set into the at least two partitions according to outpoint references.
7. A computer-implemented method according to any preceding claim, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a third blockchain transaction is in the STXO of the blockchain; rejecting the third blockchain transaction.
8. The computer-implemented method of claim 7, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a fourth blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is in the UTXO set; accepting the fourth blockchain transaction.
9. The computer-implemented method according to claim 8, comprising performing in parallel: the determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is not in the STXO set and the determining that the outpoint of a previous blockchain transaction referenced by the input of the fourth blockchain transaction is in the UTXO set.
10. The computer-implemented method of any preceding claim, comprising: determining that an outpoint of a previous blockchain transaction referenced by an input of a fifth blockchain transaction is not in the STXO set; determining that the outpoint of a previous blockchain transaction referenced by the input of the fifth blockchain transaction is not in an UTXO set; determining that the outpoint for the fifth blockchain transaction is unspendable.
11. The computer-implemented method according to claim 10, comprising performing in parallel: the determining that the output of a previous blockchain transaction referenced by the outpoint for the fifth blockchain transaction is not in the STXO set and the determining that the output of a previous blockchain transaction referenced by the outpoint for the fifth blockchain transaction is not in the UTXO set.
12. Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of claims 1 to 11.
13. A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of claims 1 to 11.
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| GB2318001.1A GB2635752A (en) | 2023-11-24 | 2023-11-24 | Double-spend checks |
| GB2318001.1 | 2023-11-24 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025108656A1 true WO2025108656A1 (en) | 2025-05-30 |
Family
ID=89429294
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/EP2024/080257 Pending WO2025108656A1 (en) | 2023-11-24 | 2024-10-25 | Double-spend checks |
Country Status (2)
| Country | Link |
|---|---|
| GB (1) | GB2635752A (en) |
| WO (1) | WO2025108656A1 (en) |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20210281397A1 (en) * | 2017-12-26 | 2021-09-09 | Akamai Technologies, Inc. | Concurrent transaction processing in a high performance distributed system of record |
-
2023
- 2023-11-24 GB GB2318001.1A patent/GB2635752A/en active Pending
-
2024
- 2024-10-25 WO PCT/EP2024/080257 patent/WO2025108656A1/en active Pending
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20210281397A1 (en) * | 2017-12-26 | 2021-09-09 | Akamai Technologies, Inc. | Concurrent transaction processing in a high performance distributed system of record |
Non-Patent Citations (3)
| Title |
|---|
| CHEN HUAN ET AL: "MiniChain: A lightweight protocol to combat the UTXO growth in public blockchain", JOURNAL OF PARALLEL AND DISTRIBUTED COMPUTING, ELSEVIER, AMSTERDAM, NL, vol. 143, 19 May 2020 (2020-05-19), pages 67 - 76, XP086171679, ISSN: 0743-7315, [retrieved on 20200519], DOI: 10.1016/J.JPDC.2020.05.001 * |
| LOVEJOY JAMES ET AL: "A High Performance Payment Processing System Designed for Central Bank Digital Currencies", 3 February 2022 (2022-02-03), pages 1 - 35, XP093240742, Retrieved from the Internet <URL:https://www.media.mit.edu/publications/a-high-performance-payment-processing-system-designed-for-central-bank-digital-currencies/> [retrieved on 20250117] * |
| SWAROOPA REDDY B ET AL: "CompactChain:An Efficient Stateless Chain for UTXO-model Blockchain", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 12 November 2022 (2022-11-12), pages 1 - 10, XP091367970 * |
Also Published As
| Publication number | Publication date |
|---|---|
| GB2635752A (en) | 2025-05-28 |
| GB202318001D0 (en) | 2024-01-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US20240281806A1 (en) | Multi-party blockchain address scheme | |
| US20250278727A1 (en) | Multi-criteria blockchain protocol | |
| EP4360246A1 (en) | Tiered consensus | |
| EP4348927A1 (en) | Partial sha-based hash function | |
| WO2024041866A1 (en) | Blockchain transaction | |
| GB2635752A (en) | Double-spend checks | |
| EP4445552A1 (en) | Data structure for orphan transactions | |
| EP4568163A1 (en) | Blockchain transaction clean-up service | |
| EP4568164A1 (en) | Blockchain transaction clean-up service | |
| US20240235848A1 (en) | Multi-party blockchain address scheme | |
| EP4560514A1 (en) | Blockchain node and methods for block validation using array transaction databases | |
| US20240291669A1 (en) | Multi-party blockchain address scheme | |
| EP4560513A1 (en) | Blockchain node and methods for block validation using a graph datastore | |
| GB2636144A (en) | Explicit value transactions | |
| GB2632259A (en) | Shared secrets using blockchain | |
| WO2024165258A1 (en) | Blockchain transaction verification | |
| JP2025540388A (en) | Computer-Implemented Method and System | |
| WO2024256138A1 (en) | Versioned transactions | |
| WO2024193954A1 (en) | Determining a system state using a blockchain | |
| WO2024199877A1 (en) | Block production | |
| WO2024193952A1 (en) | Determining a system state using a blockchain | |
| EP4445542A1 (en) | Blockchain script engine | |
| WO2024041862A1 (en) | Blockchain transaction | |
| EP4413688A1 (en) | Implementing a layer 2 token protocol using a layer 1 blockchain | |
| WO2025185892A1 (en) | Method for processing blockchain transactions |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 24798470 Country of ref document: EP Kind code of ref document: A1 |
