GB2618767A - Optimizing blockchain transaction size - Google Patents
Optimizing blockchain transaction size Download PDFInfo
- Publication number
- GB2618767A GB2618767A GB2206033.9A GB202206033A GB2618767A GB 2618767 A GB2618767 A GB 2618767A GB 202206033 A GB202206033 A GB 202206033A GB 2618767 A GB2618767 A GB 2618767A
- Authority
- GB
- United Kingdom
- Prior art keywords
- transaction
- fee
- value
- input
- output
- 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
- 238000000034 method Methods 0.000 claims abstract description 80
- 238000004422 calculation algorithm Methods 0.000 claims description 102
- 230000006870 function Effects 0.000 claims description 70
- 238000012545 processing Methods 0.000 claims description 18
- 239000011159 matrix material Substances 0.000 claims description 15
- 230000008569 process Effects 0.000 claims description 15
- 238000002922 simulated annealing Methods 0.000 claims description 14
- 238000004891 communication Methods 0.000 claims description 13
- 238000013459 approach Methods 0.000 claims description 8
- 230000001419 dependent effect Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 2
- 241000282326 Felis catus Species 0.000 claims 1
- 238000013515 script Methods 0.000 description 96
- 230000008859 change Effects 0.000 description 47
- 239000000428 dust Substances 0.000 description 26
- 230000000644 propagated effect Effects 0.000 description 14
- 230000003287 optical effect Effects 0.000 description 6
- 239000003795 chemical substances by application Substances 0.000 description 5
- 238000012546 transfer Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 4
- 230000008901 benefit Effects 0.000 description 4
- 238000007596 consolidation process Methods 0.000 description 4
- 230000002349 favourable effect Effects 0.000 description 4
- 230000001902 propagating effect Effects 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 238000013475 authorization Methods 0.000 description 3
- 230000007423 decrease Effects 0.000 description 3
- 230000002068 genetic effect Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000010410 dusting Methods 0.000 description 2
- 238000005065 mining Methods 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 238000010200 validation analysis Methods 0.000 description 2
- 206010010071 Coma Diseases 0.000 description 1
- 241000749151 Neurocallis Species 0.000 description 1
- 241001125929 Trisopterus luscus Species 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000012550 audit Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000000354 decomposition reaction Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 239000004576 sand Substances 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 238000009827 uniform distribution Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
- G06Q10/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
-
- 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; CALCULATING OR 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
-
- 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
- H04L9/3247—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 involving digital signatures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2209/00—Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
- H04L2209/56—Financial cryptography, e.g. electronic payment or e-cash
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Computer Security & Cryptography (AREA)
- Strategic Management (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- Economics (AREA)
- Accounting & Taxation (AREA)
- Human Resources & Organizations (AREA)
- Computer Networks & Wireless Communication (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- Development Economics (AREA)
- Tourism & Hospitality (AREA)
- Quality & Reliability (AREA)
- Operations Research (AREA)
- Marketing (AREA)
- Entrepreneurship & Innovation (AREA)
- Game Theory and Decision Science (AREA)
- Finance (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
A computer-implemented method of determining an optimal set of input values for funding a set of respective blockchain transactions. Each input is an unspent transaction output (UTXO). A total amount of the input values for a given transaction must be at least equal to the transaction fees. The method comprises, for a plurality of different sets of input values, determining the set of input values that minimises a function when evaluated based on the set of blockchain transactions. The function is based on i) the total amount of fees of the respective transaction, ii) a maximum of the respective associated data fees, iii) is a total value of all input values used for respective inputs to the set of transactions, iv) a total number of spendable outputs across the set of transactions, v) an initial number of instances of each input value available to the optimizer, and vi) a total number of transactions in the set of transactions.
Description
OPTIMIZING BLOCKCHAIN TRANSACTION SIZE
TECHNICAL FIELD
The present disclosure relates to a method of optimizing a size of a blockchain transaction by minimising a number of inputs and/or outputs of the transaction.
BACKGROUND
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 time-order 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.
Nodes of the blockchain network (which are often referred to as "miners") perform a distributed transaction registration and verification process, which will be described in more detail later. In summary, during this process a node validates transactions and inserts them into a block template for which they attempt to identify a valid proof-of-work solution. Once a valid solution is found, a new block is propagated to other nodes of the network, thus enabling each node to record the new block on the blockchain. In order to have a transaction recorded in the blockchain, a user (e.g. a blockchain client application) sends the transaction to one of the nodes of the network to be propagated. Nodes which receive the transaction may race to find a proof-of-work solution incorporating the validated transaction into a new block. Each node is configured to enforce the same node protocol, which will include one or more conditions for a transaction to be valid. Invalid transactions will not be propagated nor incorporated into blocks. Assuming the transaction is validated and thereby accepted onto the blockchain, then the transaction (including any user data) will thus remain registered and indexed at each of the nodes in the blockchain network as an immutable public record.
The node who successfully solved the proof-of-work puzzle to create the latest block is typically rewarded with a new transaction called the "coinbase transaction" which distributes an amount of the digital asset, i.e. a number of tokens. The detection and rejection of invalid transactions is enforced by the actions of competing nodes who act as agents of the network and are incentivised to report and block malfeasance. The widespread publication of information allows users to continuously audit the performance of nodes. The publication of the mere block headers allows participants to ensure the ongoing integrity of the blockchain.
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.
SUMMARY
It is a feature of most blockchains that a transaction has an associated transaction fee based on the size of the transaction. Each input to a transaction is an unspent transaction output (UTXO) from a previous transaction and has an associated value. Similarly, each spendable output of a transaction itself is a UTXO with an associated value. The sum of the value(s) associated with the one or more inputs must be at least equal to the sum of the value(s) associated with the one or more outputs and the transaction fee. One option for meeting this condition is to add more inputs until the condition is met. However, adding more inputs increases the transaction size, and hence the transaction fee. Moreover, adding more inputs may necessitate the need for more outputs, which also increase the transaction size, and hence the transaction fee.
The present disclosure provides techniques for optimising the transaction size by minimising the number of inputs and/or or outputs of a transaction whilst still satisfying the fee-based condition, given a particular set of UTX05 available for serving as inputs to the transaction. Minimising the transaction size provides storage savings (e.g. for the blockchain nodes) and bandwidth benefits (e.g. when initially sending the transaction to the blockchain nodes, and when those blockchain nodes distribute to the transaction to other nodes). Minimizing the transaction size also has the additional benefit in reducing the transaction fee for the sending party.
The present disclosure also provides techniques for identifying the optimal value (i.e. the denomination) of the inputs for a given funding scenario. This allows the creation of predefined UTX0s, spendable when needed for a particular scenario. This pre-processing allows faster transaction creation (therefore faster transaction throughput) when needed.
There are two extremes for funding a transaction in terms of input values. At one extreme, a single UXTO is used as an input to the transaction. This is beneficial in terms of input size (or number of inputs), but in most scenarios would require the creation of a change output to reclaim at least some of the value locked by the UTXO. This is unsuitable for funding many transactions at a high rate. At the other extreme, one could maintain a pool of UTX0s each with the lowest possible value (e.g. one Satoshi). This allows the exact transaction fee to be covered. However, this is inefficient in terms of the size of the transaction as the transaction would typically require a large number of these lowest value UTX0s. The techniques described herein provide a trade-off between the two extremes.
According to one aspect disclosed herein, there is provided a computer-implemented method of determining an optimal set of input values for use as funding a set of respective blockchain transactions, wherein each transaction requires at least one input and at least one output, each respective input being a respective unspent transaction output, UTXO, having a respective input value, wherein each transaction comprises respective target data having an respective associated data fee, each input to a transaction has an associated input fee and each output of a transaction has an associated output fee, and wherein a total amount of respective input values of the respective (JTX05 input to a respective transaction is required to be at least equal to a total amount of fees of the respective transaction, and wherein the method comprises: for a plurality of different respective sets of input values, determining the respective set of input values that minimises a function when evaluated based on the set of respective blockchain transactions, wherein the function is based on i) the total amount of fees of the respective transaction, ii) a maximum of the respective associated data fees, iii) is a total value of all input values used for respective inputs to the set of transactions, iv) a total number of spendable outputs across the set of transactions, v) an initial number of instances of each input value available to the optimizer, and vi) a total number of transactions in the set of transactions.
The optimizer (e.g. a user, service provider, etc.) determines the optimal split of UTXO values (i.e. denominations) that can be used to fund many data payloads of varying sizes, up to a maximum size associated with the maximum data fee. Determining the optimal split enables UTX05 to be quickly accessed (for fast and parallelisable transaction processing) while keeping the transaction size (and therefore fees) low. In other words, by determining in advance the right denominations for funding transactions up to a certain size, the optimizer is then able to complete transaction templates (by adding one or more inputs) faster than if choosing from a random set of denominations, reaching a balance between the amount of fees spent and transaction throughput (i.e. number of completed transaction templates per second).
In some embodiments, the optimizer has access to (e.g. control of) a plurality of UTX0s split into the denominations determined by optimizing the function described above. For instance, the optimizer may control the private keys necessary for spending the UTX05, or at least have awareness of which UTX0s are available for funding the transaction. As mentioned, each input has an associated input fee and each output has an associated output fee. Each spendable output (i.e. an output having a respective value) may be required to have a predetermined minimum value. This is sometimes referred to as a dust limit. The transaction contains target data having an associated data fee. The target data is generally any data of the transaction other than the data associated with the input(s) and output(s), which have their own associated fees. The target data may therefore include components of the transaction which are inherent to the transaction (e.g. a version number). The target data may also include user-defined data, e.g. an image, text, etc. Some techniques for funding a transaction may rely on simply adding enough UTX0s to the transaction until the data fees are covered. However this would not necessarily result in an optimal transaction size. In contrast, according to some embodiments, the optimizer is configured to determine, from the available UTX0s, the minimum number of inputs and outputs of the transaction, and the associated values of those inputs and outputs, that satisfy the fee requirements of the transaction. That is, given a set of UTX05 of certain values, and target data having an associated fee, the optimizer determines how to optimally fund the transaction (by adding one or more input UTX05) whilst minimising the size of the transaction (in terms of number of inputs and outputs).
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 schematically illustrates an example service for building and submitting transactions to the blockchain, Figure 4 is a visualisation of a simulated annealing algorithm, Figure 5 is a schematic block diagram of a system for implementing the described embodiments and Figure 6 shows a transaction fees graph with respect to the leftover fee.
DETAILED DESCRIPTION OF EMBODIMENTS
1. EXAMPLE SYSTEM OVERVIEW 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 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. In one common type of transaction protocol, the data structure of each transaction 152 comprises at least one input and at least one output. Each output specifies an amount representing a quantity of a digital asset as property, an example of which is a user 103 to whom the output is cryptographically locked (requiring a signature or other solution of that user in order to be unlocked and thereby redeemed or spent). Each input points back to the output of a preceding transaction 152, thereby linking the transactions.
Each block 151 also comprises a block pointer 155 pointing back to the previously created block 151 in the chain so as to define a sequential order to the blocks 151. Each transaction 152 (other than a coinbase transaction) comprises a pointer back to a previous transaction so as to define an order to sequences of transactions (N.B. sequences of transactions 152 are allowed to branch). The chain of blocks 151 goes all the way back to a genesis block (Gb) 153 which was the first block in the chain. One or more original transactions 152 early on in the chain 150 pointed to the genesis block 153 rather than a preceding transaction.
Each of the blockchain nodes 104 is configured to forward transactions 152 to other blockchain nodes 104, and thereby cause transactions 152 to be propagated throughout the network 106. Each blockchain node 104 is configured to create blocks 151 and to store a respective copy of the same blockchain 150 in their respective memory. Each blockchain node 104 also maintains 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.
The input of the present transaction 152j also comprises the input authorisation, for example the signature of the user 103a to whom the output of the preceding transaction 152i is locked. In turn, the output of the present transaction 152j can be cryptographically locked to a new user or entity 103b. The present transaction 152j can thus transfer the amount defined in the input of the preceding transaction 152i to the new user or entity 103b as defined in the output of the present transaction 152j. In some cases a transaction 152 may have multiple outputs to split the input amount between multiple users or entities (one of whom could be the original user or entity 103a in order to give change). In some cases a transaction can also have multiple inputs to gather together the amounts from multiple outputs of one or more preceding transactions, and redistribute to one or more outputs of the current transaction.
According to an output-based transaction protocol such as bitcoin, when a party 103, such as an individual user or an organization, wishes to enact a new transaction 152j (either manually or by an automated process employed by the party), then the enacting party sends the new transaction from its computer terminal 102 to a recipient. The enacting party or the recipient will eventually send this transaction to one or more of the blockchain nodes 104 of the network 106 (which nowadays are typically servers or data centres, but could in principle be other user terminals). It is also not excluded that the party 103 enacting the new transaction 152j could send the transaction directly to one or more of the blockchain nodes 104 and, in some examples, not to the recipient. A blockchain node 104 that receives a transaction checks whether the transaction is valid according to a blockchain node protocol which is applied at each of the blockchain nodes 104. The blockchain node protocol typically requires the blockchain node 104 to check that a cryptographic signature in the new transaction 152j matches the expected signature, which depends on the previous transaction 152i in an ordered sequence of transactions 152. In such an output-based transaction protocol, this may comprise checking that the cryptographic signature or other authorisation of the party 103 included in the input of the new transaction 152j matches a condition defined in the output of the preceding transaction 152i which the new transaction spends (or "assigns"), wherein this condition typically comprises at least checking that the cryptographic signature or other authorisation in the input of the new transaction 152j unlocks the output of the previous transaction 152i to which the input of the new transaction is linked to. The condition may be at least partially defined by a script included in the output of the preceding transaction 152i. Alternatively it could simply be fixed by the blockchain node protocol alone, or it could be due to a combination of these. Either way, if the new transaction 152j is valid, the blockchain node 104 forwards it to one or more other blockchain nodes 104 in the blockchain network 106. These other blockchain nodes 104 apply the same test according to the same blockchain node protocol, and so forward the new transaction 152j on to one or more further nodes 104, and so forth. In this way the new transaction is propagated throughout the network of blockchain nodes 104.
In an output-based model, the definition of whether a given output (e.g. UTXO) is assigned (or "spent") is whether it has yet been validly redeemed by the input of another, onward transaction 152j according to the blockchain node protocol. Another condition for a transaction to be valid is that the output of the preceding transaction 152i which it attempts to redeem has not already been redeemed by another transaction. Again if not valid, the transaction 152j will not be propagated (unless flagged as invalid and propagated for alerting) or recorded in the blockchain 150. This guards against double-spending whereby the transactor tries to assign the output of the same transaction more than once. An account-based model on the other hand guards against double-spending by maintaining an account balance. Because again there is a defined order of transactions, the account balance has a single defined state at any one time.
In addition to validating transactions, blockchain nodes 104 also race to be the first to create blocks of transactions in a process commonly referred to as mining, which is supported by "proof-of-work". At a blockchain node 104, new transactions are added to an ordered pool 154 of valid transactions that have not yet appeared in a block 151 recorded on the blockchain 150. The blockchain nodes then race to assemble a new valid block 151 of transactions 152 from the ordered set of transactions 154 by attempting to solve a cryptographic puzzle. Typically this comprises searching for a "nonce" value such that when the nonce is concatenated with a representation of the ordered pool of pending transactions 154 and hashed, then the output of the hash meets a predetermined condition.
E.g. the predetermined condition may be that the output of the hash has a certain predefined number of leading zeros. Note that this is just one particular type of proof-ofwork puzzle, and other types are not excluded. A property of a hash function is that it has an unpredictable output with respect to its input. Therefore this search can only be performed by brute force, thus consuming a substantive amount of processing resource at each blockchain node 104 that is trying to solve the puzzle.
The first blockchain node 104 to solve the puzzle announces this to the network 106, providing the solution as proof which can then be easily checked by the other blockchain nodes 104 in the network (once given the solution to a hash it is straightforward to check that it causes the output of the hash to meet the condition). The first blockchain node 104 propagates a block to a threshold consensus of other nodes that accept the block and thus enforce the protocol rules. The ordered set of transactions 154 then becomes recorded as a new block 151 in the blockchain 150 by each of the blockchain nodes 104. A block pointer 155 is also assigned to the new block 151n pointing back to the previously created block 151n-1 in the chain. The significant amount of effort, for example in the form of hash, required to create a proof-of-work solution signals the intent of the first node 104 to follow the rules of the blockchain protocol. Such rules include not accepting a transaction as valid if it spends or assigns the same output as a previously validated transaction, otherwise known as double-spending. Once created, the block 151 cannot be modified since it is recognized and maintained at each of the blockchain nodes 104 in the blockchain network 106. The block pointer 155 also imposes a sequential order to the blocks 151. Since the transactions 152 are recorded in the ordered blocks at each blockchain node 104 in a network 106, this therefore provides an immutable public ledger of the transactions.
Note that different blockchain nodes 104 racing to solve the puzzle at any given time may be doing so based on different snapshots of the pool of yet-to-be published transactions 154 at any given time, depending on when they started searching for a solution or the order in which the transactions were received. Whoever solves their respective puzzle first defines which transactions 152 are included in the next new block 151n and in which order, and the current pool 154 of unpublished transactions is updated. The blockchain nodes 104 then continue to race to create a block from the newly-defined ordered pool of unpublished transactions 154, and so forth. A protocol also exists for resolving any "fork" that may arise, which is where two blockchain nodes104 solve their puzzle within a very short time of one another such that a conflicting view of the blockchain gets propagated between nodes 104. In short, whichever prong of the fork grows the longest becomes the definitive blockchain 150. Note this should not affect the users or agents of the network as the same transactions will appear in both forks.
According to the bitcoin blockchain (and most other blockchains) a node that successfully constructs a new block 104 is granted the ability to newly assign an additional, accepted amount of the digital asset in a new special kind of transaction which distributes an additional defined quantity of the digital asset (as opposed to an inter-agent, or inter-user transaction which transfers an amount of the digital asset from one agent or user to another). This special type of transaction is usually referred to as a "coinbase transaction", but may also be termed an "initiation transaction" or "generation transaction". It typically forms the first transaction of the new block 151n. The proof-of-work signals the intent of the node that constructs the new block to follow the protocol rules allowing this special transaction to be redeemed later. The blockchain protocol rules may require a maturity period, for example 100 blocks, before this special transaction may be redeemed. Often a regular (non-generation) transaction 152 will also specify an additional transaction fee in one of its outputs, to further reward the blockchain node 104 that created the block 151n in which that transaction was published. This fee is normally referred to as the "transaction fee", and is discussed blow.
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.
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.
When a given party 103, say Alice, wishes to send a new transaction 152j to be included in the blockchain 150, then she formulates the new transaction in accordance with the relevant transaction protocol (using the wallet function in her client application 105). She then sends the transaction 152 from the client application 105 to one or more blockchain nodes 104 to which she is connected. E.g. this could be the blockchain node 104 that is best connected to Alice's computer 102. When any given blockchain node 104 receives a new transaction 1521, it handles it in accordance with the blockchain node protocol and its respective role. This comprises first checking whether the newly received transaction 152j meets a certain condition for being "valid", examples of which will be discussed in more detail shortly. In some transaction protocols, the condition for validation may be configurable on a per-transaction basis by scripts included in the transactions 152. Alternatively the condition could simply be a built-in feature of the node protocol, or be defined by a combination of the script and the node protocol.
On condition that the newly received transaction 152j passes the test for being deemed valid (i.e. on condition that it is "validated"), any blockchain node 104 that receives the transaction 152j will add the new validated transaction 152 to the ordered set of transactions 154 maintained at that blockchain node 104. Further, any blockchain node 104 that receives the transaction 152j will propagate the validated transaction 152 onward to one or more other blockchain nodes 104 in the network 106. Since each blockchain node 104 applies the same protocol, then assuming the transaction 152j is valid, this means it will soon be propagated throughout the whole network 106.
Once admitted to the ordered pool of pending transactions 154 maintained at a given blockchain node 104, that blockchain node 104 will start competing to solve the proof-of-work puzzle on the latest version of their respective pool of 154 including the new transaction 152 (recall that other blockchain nodes 104 may be trying to solve the puzzle based on a different pool of transactions154, but whoever gets there first will define the set of transactions that are included in the latest block 151. Eventually a blockchain node 104 will solve the puzzle for a part of the ordered pool 154 which includes Alice's transaction 152j). Once the proof-of-work has been done for the pool 154 including the new transaction 152j, it immutably becomes part of one of the blocks 151 in the blockchain 150. Each transaction 152 comprises a pointer back to an earlier transaction, so the order of the transactions is also immutably recorded.
Different blockchain nodes 104 may receive different instances of a given transaction first and therefore have conflicting views of which instance is 'valid' before one instance is published in a new block 151, at which point all blockchain nodes 104 agree that the published instance is the only valid instance. If a blockchain node 104 accepts one instance as valid, and then discovers that a second instance has been recorded in the blockchain 150 then that blockchain node 104 must accept this and will discard (i.e. treat as invalid) the instance which it had initially accepted (i.e. the one that has not been published in a block 151).
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"). 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.
2. 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 " Tx? . 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. Tx() and Tx/ are just arbitrary labels. They do not necessarily mean that Txois the first transaction in the blockchain 151, nor that Txi is the immediate next transaction in the pool 154. Tx/ could point back to any preceding (i.e. antecedent) transaction that still has an unspent output 203 locked to Alice.
The preceding transaction Tx° may already have been validated and included in a block 151 of the blockchain 150 at the time when Alice creates her new transaction Tri, or at least by the time she sends it to the network 106. It may already have been included in one of the blocks 151 at that time, or it may be still waiting in the ordered set 154 in which case it will soon be included in a new block 151. Alternatively TKO and Tx/ could be created and sent to the network 106 together, or Txo could even be sent after DO if the node protocol allows for buffering "orphan" transactions. 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 UTX0o. 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. Typically the locking script locks the amount to a particular party (the beneficiary of the transaction in which it is included). I.e. the locking script defines an unlocking condition, typically comprising a condition that the unlocking script in the input of the subsequent transaction comprises the cryptographic signature of the party to whom the preceding transaction is locked.
The locking script (aka scriptPubl<ey) 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. Unlocking 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, UTX00 in the output 203 of Txo comprises a locking script [Checksig PA] which requires a signature Sig PA of Alice in order for U7'XO0 to be redeemed (strictly, in order for a subsequent transaction attempting to redeem UTX00 to be valid).
[Checksig PA] contains a representation (i.e. a hash) of the public key PA from a public-private key pair of Alice. The input 202 of Tx' comprises a pointer pointing back to Tx' (e.g. by means of its transaction ID, TxIDo, which in embodiments is the hash of the whole transaction Txo). The input 202 of Tx/ comprises an index identifying UTX0owithin Txo, to identify it amongst any other possible outputs of Txo. The input 202 of Tx/ 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 Tx' 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). In embodiments this involves concatenating the two scripts: <Sig PA> <PA> I I [Checksig PA] where "I I" represents a concatenation and "<...>" means place the data on the stack, and "[...]" is a function comprised by the locking script (in this example a stack-based language).
Equivalently the scripts may be run one after the other, with a common stack, rather than concatenating the scripts. Either way, when run together, the scripts use the public key PA of Alice, as included in the locking script in the output of Tvo, to authenticate that the unlocking script in the input of Tx] contains the signature of Alice signing the expected portion of data. The expected portion of data itself (the "message") also needs to be included in order to perform this authentication. In embodiments the signed data comprises the whole of Tx/ (so a separate element does not need to be included specifying the signed portion of data in the clear, as it is already inherently present).
The details of authentication by public-private cryptography will be familiar to a person skilled in the art. Basically, if Alice has signed a message using her private key, then given Alice's public key and the message in the clear, another entity such as a node 104 is able to authenticate that the message must have been signed by Alice. Signing typically comprises hashing the message, signing the hash, and tagging this onto the message as a signature, thus enabling any holder of the public key to authenticate the signature. Note therefore that any reference herein to signing a particular piece of data or part of a transaction, or such like, can in embodiments mean signing a hash of that piece of data or part of the transaction.
If the unlocking script in Tx/ meets the one or more conditions specified in the locking script of Txo (so in the example shown, if Alice's signature is provided in Tx/ and authenticated), then the blockchain node 104 deems Tx/ valid. This means that the blockchain node 104 will add Tio to the ordered pool of pending transactions 154. The blockchain node 104 will also forward the transaction at to one or more other blockchain nodes 104 in the network 106, so that it will be propagated throughout the network 106. Once Tx/ has been validated and included in the blockchain 150, this defines UTX00 from Txoas spent. Note that Tx/ can only be valid if it spends an unspent transaction output 203. If it attempts to spend an output that has already been spent by another transaction 152, then Tx/will be invalid even if all the other conditions are met. Hence the blockchain node 104 also needs to check whether the referenced UTXO in the preceding transaction Txo is already spent (i.e. whether it has already formed a valid input to another valid transaction). This is one reason why it is important for the blockchain 150 to impose a defined order on the transactions 152. In practice a given blockchain node 104 may maintain a separate database marking which UTX05 203 in which transactions 152 have been spent, but ultimately what defines whether a UTXO has been spent is whether it has already formed a valid input to another valid transaction in the blockchain 150.
If the total amount specified in all the outputs 203 of a given transaction 152 is greater than the total amount pointed to by all its inputs 202, this is another basis for invalidity in most transaction models. Therefore such transactions will not be propagated nor included in a block 151.
Note that in UTXO-based transaction models, a given UTXO needs to be spent as a whole. It cannot "leave behind" a fraction of the amount defined in the UTXO as spent while another fraction is spent. However the amount from the UTXO can be split between multiple outputs of the next transaction. E.g. the amount defined in UTX00 in Txo can be split between multiple UTX0s in Txl. Hence if Alice does not want to give Bob all of the amount defined in UTX00, she can use the remainder to give herself change in a second output of Tx', or pay another party.
In practice Alice will also usually need to include a fee for the bitcoin node 104 that successfully includes her transaction 104 in a block 151. If Alice does not include such a fee, Tx° may be rejected by the blockchain nodes 104, and hence although technically valid, may not be propagated and included in the blockchain 150 (the node protocol does not force blockchain nodes 104 to accept transactions 152 if they don't want). In some protocols, the transaction fee does not require its own separate output 203 (i.e. does not need a separate UTXO). Instead any difference between the total amount pointed to by the input(s) 202 and the total amount of specified in the output(s) 203 of a given transaction 152 is automatically given to the blockchain node 104 publishing the transaction. E.g. say a pointer to UTX0ois the only input to Tx/, and Tx/ has only one output UTX0f. If the amount of the digital asset specified in UTX09 is greater than the amount specified in UTX0i, then the difference may be assigned (or spent) by the node 104 that wins the proof-of-work race to create the block containing UTX01. Alternatively or additionally however, it is not necessarily excluded that a transaction fee could be specified explicitly in its own one of the UTX05 203 of the transaction 152.
Alice and Bob's digital assets consist of the UTX0s locked to them in any transactions 152 anywhere in the blockchain 150. Hence typically, the assets of a given party 103 are scattered throughout the UTX05 of various transactions 152 throughout the blockchain 150.
There is no one number stored anywhere in the blockchain 150 that defines the total balance of a given party 103. It is the role of the wallet function in the client application 105 to collate together the values of all the various UTX05 which are locked to the respective party and have not yet been spent in another onward transaction. It can do this by querying the copy of the blockchain 150 as stored at any of the bitcoin nodes 104.
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 secp256k1. 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.
3. SIDE CHANNEL As shown in Figure 1, the client application on each of Alice and Bob's computer equipment 102a, 120b, respectively, may comprise additional communication functionality. This additional functionality enables Alice 103a to establish a separate side channel 107 with Bob 103b (at the instigation of either party or a third party). The side channel 107 enables exchange of data separately from the blockchain network. Such communication is sometimes referred to as "off-chain" communication. For instance this may be used to exchange a transaction 152 between Alice and Bob without the transaction (yet) being registered onto the blockchain network 106 or making its way onto the chain 150, until one of the parties chooses to broadcast it to the network 106. Sharing a transaction in this way is sometimes referred to as sharing a "transaction template". A transaction template may lack one or more inputs and/or outputs that are required in order to form a complete transaction. Alternatively or additionally, the side channel 107 may be used to exchange any other transaction related data, such as keys, negotiated amounts or terms, data content, etc. The side channel 107 may be established via the same packet-switched network 101 as the blockchain network 106. Alternatively or additionally, the side channel 301 may be established via a different network such as a mobile cellular network, or a local area network such as a local wireless network, or even a direct wired or wireless link between Alice and Bob's devices 102a, 102b. Generally, the side channel 107 as referred to anywhere herein may comprise any one or more links via one or more networking technologies or communication media for exchanging data "off-chain", i.e. separately from the blockchain network 106. Where more than one link is used, then the bundle or collection of off-chain links as a whole may be referred to as the side channel 107. Note therefore that if it is said that Alice and Bob exchange certain pieces of information or data, or such like, over the side channel 107, then this does not necessarily imply all these pieces of data have to be send over exactly the same link or even the same type of network.
4. TRANSACTION FUNDING 4.1 Data funding Generally speaking, UTXO-based blockchains can be seen as a cash system, where each unspent transaction outputs (UTXO) is a coin that can be spent only once. Each payment transaction consumes one or more UTX05 and creates one or more new UTX05.
Figure 3 illustrates an example system 300 which may be used to increase scalability. The system comprises a funding service 301 that manages UTX05 using a service called a transaction builder (TxBuilder) 302 which holds a cache of several unspent transaction outputs (UTX05). Given some data, the purpose of the TxBuilder 302 is to embed the data in a transaction that can be then published on the blockchain 150.
The TxBuilder 302 receives funds (i.e., UTX05) from the funding service 301 split into fixed values el__ ek. These UTX0s are cached by the TxBuilder 302 into k buckets according to their values el, ..., ek, each bucket having a maximum capacity of Q UTX05. Herein, el, ek are referred to as denominations. Assume a client 303 (e.g. user application 105) requires storage of data D, the executed protocol steps are shown in Figure 3 and are detailed below: 1. The client 303 calls the TxBuilder 302, requesting storage of data D. 2. The TxBuilder 302 creates a transaction that embeds the data D: a. The TxBuilder 302 funds the transaction using the cached UTX0s from the Funding Service 301 and adds the required change outputs.
b. If it does not have enough UTX0s of a certain denomination type in the cache, the TxBuilder 302 requests more denominations from the Funding Service 301.
3. The TxBuilder 302 sends the transaction to the funding service 301.
4. The funding service 301 sends the transaction to the broadcaster service 304.
5. The transaction is broadcast to the Bitcoin SV blockchain using the mAPI service.
S 6. The client 303 is notified that the data has been stored together with an inclusion proof (e.g. transaction ID containing the data together with a Merkle inclusion proof).
Each of the funding service 301, transaction builder 302, client 303 and broadcaster service 304 are components that may be implemented in hardware or software.
4.2 Dust limit Some blockchains have a dust limit. The dust limit prevents transactions with very low value from being published. The reason for having a dust limit is that under the standard fee policies, a very low value output would require a higher fee to spend than the value of the output itself, making these transactions uneconomical to spend (the cost of the unlocking script would be higher than the UTXO value).
Another reason for setting a dust limit is to prevent dusting attacks. Dusting attacks are used by scammers to deanonymize transactions, revealing individuals or organizations behind a wallet. Scammers can "dust" a large number of addresses, wait for wallets to spend these dust outputs and then perform analysis to reveal which of these addresses belong to the same wallet.
4.3 Consolidation transactions A consolidation transaction is a transaction that reduces the number of UTX0s by a margin that is more valuable for the network than the corresponding transaction fee. From a node's point of view the size of the UTXO database matters because the larger it is the higher the cost of maintaining it, for this reason it is in a node's economic interest to trim the UTXO where possible. Consolidation transactions, which have many inputs and few outputs, result in a shrinking of the UTXO database.
In general, a transaction is considered a consolidation transaction if: * The input/output ratio is at least 1 to 100 (at least 100 inputs for each output).
* It only uses standard P2PKH inputs or bare multi-sig outputs with no more than two signatures.
* It only uses inputs confirmed for at least 6 blocks.
5. OPTIMISATION ALGORITHMS 5.1 Change-Making Problem (CMP) The change-making problem (CMP) addresses the question of minimising the number of coins of certain denominations that sum up to an amount S. The question can be formulated as a minimisation problem. Given a set of denominations e1, ek and an amount S, solve: min wi i=1 subject to k wtei = S, 1-1 where wi is the number of denominations of value ei. This problem can be solved with dynamic programming in a similar manner as the 0-1 Knapsack problem. Let cmp [8, I] be the minimum number of coins used to fund the amount > using the firstS denominations.
We define cmp[8, X] as follows: cmp[i, X] = 1 1, es = E cmp[o -1, E], e5 > E min(cmp [15 -1, E], 1 + cmp[S,E -ed), otherwise co, 6' = 0 We discuss each case: * The first case is trivial, and says that we cannot solve the minimisation problem without any denominations. We use infinity co to denote this.
* In the second case, if the 8th denomination es equals the amount E, then I is paid for using es. Thus, the minimum number of coins we use is 1.
* In the third case the 6th denomination is too large to pay for E. Then the minimum number of coins is attained using the first 8 objects is equal to the maximum value attained using the first -1 objects.
* Finally, in the fourth case either the minimum value is attained using the first -1 denominations or by including the 6th denomination ed.
5.2 Simulated Annealing Many problems are computationally intractable (NP-hard) through a deterministic algorithm. To approximate the solution of such difficult problems we can use heuristic algorithms such as Simulated Annealing, Tabu Search or Genetic algorithms that have proven to give reliable results to optimisation problems.
Simulated Annealing (SA) results in a fast convergence to an answer. This is a heuristic algorithm designed to approximate the global minimum of a function f (x) that has a large domain D of values x. In order to heuristically search for values f (x) close to the global minimum we start with an initial approximator x0 G V and parameters T0, Train and 0 < p < 1. To and Train are called temperatures and p is the percentage at which the temperature decreases from T0 to Truth,. The search for the global minimum also depends on a function neighbour that outputs a value the function f is evaluated on.
The pseudocode of the algorithm is the following: 1. Define xb"t e xo, T To.
2. While T > Tint, execute: a. Find an approximator in the neighbourhood of xb"t: xflew <-neighbour(xb"t).
b. Compute f (xnew).
c. Compute Af = f (xn",,) -f (xb,t).
i. If Af < 0, then the value x"w improves on the output of the function f and it becomes the current best approximator Xbest Xnew* _af H. If Al > 0, then we define the exponential value p = e T. If p is larger or equal than a value c randomly sampled from the uniform distribution U(0,1), then we assign the new approximator to xbest: xt,"t d. T T (1 -p).
3. Output f (xbest)* We expand on the steps above to give the intuition of this algorithm. If we want to improve on the value f (xb"t), we derive a new approximator x", from the current best approximator xbest in Step 3.a. lithe neighbouring approximator x"w improves on the value f (xbest), we update the approximator)(best in Step 3.c.i.
The idea of this algorithm is that if x"w does not improve on the value f ( x 1 then we bestn may still accept it as long as p > c in Step 3.c.ii. This condition allows for the algorithm to escape local minima of f at the cost of temporarily increasing the value of f in order to approximate the global minimum. This is shown in Figure 4.
The value T starts at a positive value To and is decreased by multiplication with the drop rate p in Step 3.d, until it reaches a value T,nim close to 0. This ensures that at the start of the algorithm we escape local minima more frequently in Step 3.c.ii. As T decreases and approaches 0, the value of p approaches 0 and accepting non-optimal approximators xnew becomes less likely. In this case the algorithm focuses on improving the global minimum approximator using Step 3.c.i. When implementing the algorithm, we may define the function neighbour. This is problem dependent.
6. OPTIMISING TRANSACTION SIZE Embodiments of the present disclosure relate to optimizing a size of a transaction, and determining a set of precomputed denominations that provides the best trade-off between transaction size and time to identify and retrieve UTX05. This is useful for high-throughput applications or applications that need parallelisable transaction creation. Figure 5 illustrates Xnew* an example system 500 for implementing the described embodiments. As shown, the system 500 includes an optimizer 502 that has access to a store of UTXOS 501. The optimizer 502 is configured to connect directly or indirectly to the blockchain network 106. In an example implementation, the optimizer 502 may take the form of, or comprise, the transaction builder 302 of Figure 3. In this implementation, the optimizer 502 may additionally comprise one or both of the funding service 301 and the broadcaster service 304. The optimizer may be operated by a user such as Alice 103a or Bob 103b. In general, the optimizer may be implemented in hardware or software, or a combination.
The optimizer 502 obtains a transaction template. The optimizer 502 may generate the transaction template or receive the transaction template from a different entity, e.g. a client application 303, a user 103, etc. The transaction template may have a structure similar to that shown in Figure 2. The transaction template includes at least one input and at least one output. Each input to the transaction has an associated value. Each output of the transaction may be a spendable output or an unspendable output. An unspendable output has no associated value, whereas a spendable output does. The transaction template includes target data. Each input has an associated input fee that contributes to a total transaction fee. Each output also has an associated output fee that contributes to the total transaction fee. Similarly, the target data has an associated data fee that contributes to the total transaction fee. The fees are typically based on the size of the relevant field, e.g. a fee per byte. The total amount of the value(s) of the input(s) must be at least equal to a sum of the total amount of the value(s) of the output(s) and the transaction fee. If not, the transaction may (or will) be rejected when submitted to the network 106.
The UTXO store 501 contains a plurality of UTX05 which are available for being input to the transaction. The UTXO store 501 may be operated by the optimizer 502. The optimizer 502 is configured to communicate with the UTXO store to determine which UTX05 are available. In some examples, the UTXO store contains UTX0s of only certain values, e.g. of only a single value. That is, the UTXO store contains UTX05 of predetermined values and only UTXO of those predetermined values are added to the UTXO store. In other examples, the UTXO store contains UTX0s of varying values. In other words, the UTXO store contains UTXO of any value and there is no processing involved in adding or removing UTX05 of certain values. In some examples, the UTX05 are ordered from smallest value to highest value (or vice versa) in order to make searching of the UTXO store 501 more efficient.
The optimizer 502 determines the number of inputs of each particular value that are required to fund the transaction. The optimizer 502 also determines the number of additional outputs of each particular value (i.e. other than the output containing the target data) that are required. One or more additional outputs may be required so as to prevent excess fee leakage and/or create UTX05 of certain values for future use. In other words, the optimizer 502 determines a number of inputs and outputs having a first value, a number of inputs and outputs having a second value, and so on, for each value of UTXO available to the optimizer 502. Note that the number of inputs and outputs of a certain value may be zero. Similarly, the number of inputs having a certain value may be different to the number of outputs having the same value.
Moreover, rather than just determining any number of inputs and outputs of particular values, the optimizer 502 determines the minimum number of inputs of each value and the minimum number of outputs of each value that satisfies a set of funding criteria. This is done by minimising, for each different UTXO value, a sum of a) the number of each different input UTXO value multiplied by the associated input fee, and b) a sum of bi) the number of each different output UTXO value multiplied by the associated output fee, and bii) a leftover fee. The minimization is subject to several constraints, discussed below.
Once the optimizer 502 has determined the optimal number of inputs and outputs of different values, the optimizer 502 causes the completed transaction to be sent to the blockchain network 106. For example, the optimizer may submit the transaction to the network 106. Or, the optimizer may send the transaction to a different entity or component (e.g. broadcaster service 304) to be sent to the network 106.
In some embodiments, described in mathematical terms, the optimizer 502 may determine which UTX0s to use to fund the transaction by minimizing the following equation: min ( wi fee +Ivy; feeout + fee, where w1 is the number of UTX05 input to the transaction having a respective value corresponding to the index i, feet, is the input fee, wi' is the number of UTX0s of the transaction (i.e. the outputs) having a respective value corresponding to index i, fee,,,, is the output fee, and fee, is the leftover fee. The leftover fee is discussed below.
The equation is minimised subject to the following conditions: i) a total value of the UTX0s input to the transaction must be at least equal to the data fees and the leftover amount, the number of each input UTXO must be zero or more, the number of each output UTXO must be zero or more, and the leftover amount must be between zero and a maximum of a predetermined upper bound and a sum of the input fee and the output fee.
Minimizing the equation thus outputs a respective number of input UTX05 at each value and a respective number of output UTX05 at each value (where the number of a UTXO at a given value may be zero). It is particular advantageous to use a set of predetermined UTXO values to fund the transaction.
The leftover fee is calculated based on a leftover amount. For each possible solution to the equation, the respective values of the transaction's input(s) are summed to give a total input value. The respective values of the transaction's output(s) are summed to give a total output value. The total transaction fee is determined based on the input fees, the output fees and the data fees. The leftover amount is then determined as the difference between the total input value and the sum of the total output value and the total transaction fee.
The optimizer 502 may then determine the leftover fee by inputting the leftover amount into a fee decision algorithm.
The fee decision algorithm outputs one of three leftover amounts. If the leftover amount is less that the total of a single input fee and a single output fee, then the fee decision algorithm outputs the leftover amount as the leftover fee. If the leftover amount is instead more than the total of a single output fee and the dust limit, then the fee decision algorithm outputs the sum of a single output fee and a single input fee as the leftover fee. If the leftover amount takes any other value, the fee decision algorithm outputs infinity as the leftover fee. This signals that there are not enough inputs, and that the equation can minimised further. In other words, the minimisation of the equation requires a different number of inputs and outputs.
The above equation may be solved using a dynamic programming approach, as described in section 7.4 below. For instance, a modified change-making problem algorithm may be used to solve the equation. The change-making problem algorithm per se is well-known. However in its original form it is not suitable for solving the equation above. This is because it does not take into account the specific features of the blockchain, including fees for adding inputs and outputs to a transaction, and the dust limit. The present disclosure thus recognises how the change-making problem algorithm is to be adapted in order to solve the equation and optimise transaction funding.
In other embodiments, the optimizer 502 may be configured to execute a fee decision algorithm. The fee decision algorithm determines, based on the state of the transaction template, a leftover amount (or leftover value). The respective values of the transaction's input(s) are summed to give a total input value. The respective values of the transaction's output(s) are summed to give a total output value. The total transaction fee is determined based on the input fees, the output fees and the data fees. The leftover amount is then determined as the difference between the total input value and the sum of the total output value and the total transaction fee. The fee decision algorithm may itself calculate the leftover amount, or it may receive the leftover amount as an input to the algorithm.
Based on the leftover amount, the fee decision algorithm determines whether one or more additional inputs and/or one or more additional outputs are required. The fee decision algorithm minimises the transaction size by only adding the additional input(s) and output(s) if required to satisfy the fee condition associated with the transaction.
In some examples, at the time of executing the fee decision algorithm, the transaction template has a single input and a single output. In some examples, the single output is an unspendable output with no value.
The fee decision algorithm then takes one of three options, the first option being more favourable than the second, and the second option being more favourable than the third. As a first option, if the leftover amount is less that the total of a single input fee and a single output fee, no additional input or output is added to the transaction. The optimizer 502 thus causes the transaction template to be sent to the network 106. In some examples, this means that the leftover amount is left to the blockchain node 104 that incorporates the transaction into a new block 151.
As a second option, if the leftover amount is greater than a single output fee and the dust limit, then an additional output is added to the transaction by the optimizer 502 and the transaction is sent to the network 106. The additional output may be assigned a value equal to or less than the leftover amount (but at least equal to the dust limit).
As a third option, if the leftover amount is less than a single output fee and the dust limit, but more than the total of a single input fee and a single output fee, then an additional input and an additional output is added to the transaction by the optimizer 502. The transaction is then sent to the network 106. The additional output may be assigned a value equal to or less than the leftover amount (but at least equal to the dust limit).
In some embodiments, the fee decision algorithm may be ran after a transaction builder algorithm has been run, where the transaction builder algorithm first attempts to optimise the transaction size, with the fee decision algorithm then optimizing transaction size by determining what action to take with the leftover amount.
In some examples, the UTXO store comprises UTX05 of varying values, and the first input of the transaction template is determined by (i.e. selected by) a variable input section algorithm (an example of a transaction builder algorithm). The optimizer 502 is configured to execute the variable input section algorithm. When executed, the algorithm determines whether a UTXO is available that has a value which results in the leftover amount being less than a single output fee. If such a UTXO is available, the UTXO is selected as an input to the transaction and the fee decision algorithm is executed. If such a UTXO is not available, the selection algorithm determines whether a UTXO is available which results in the leftover amount being more than a single output fee and the dust limit. If a UTXO is available which meets this criteria, the UTXO is selected and the fee decision algorithm is executed. If such a UTXO is not available, the selection algorithm determines whether a UTXO is available that has a value which results in the leftover amount more than a single output fee but less than a combined total of a single input fee and a single output fee. If such a UTXO is available which meets this criteria, it is selected and the fee decision algorithm is executed. If such a UTXO is not available, the selection algorithm determines whether a UTXO is available which has a value that results in the leftover amount being more than the combined input and output fee, and less than a single output fee and the dust limit. If available, this UTXO is selected and the fee decision algorithm is executed.
In these examples, if the UTXO store does not include a UTXO large enough to cover the transaction fees, one or more additional UTX05 are selected as inputs to the transaction.
In some examples, the UTXO store consists of UTX05 of a single value, and the first input of the transaction template is determined by (i.e. selected by) a single-value input selection algorithm (another example of a transaction builder algorithm). This section algorithm determines how many of these single value UTX05 are required as inputs to the transaction. When executed by the optimizer 502, the selection algorithm determines the smallest quantity of UTX0s such that the total value of that quantity of UTX0s having the single value is greater than a sum of i) the data fee and ii) the total value of input fees associated with that quantity of UTX0s. The optimizer 502 adds the UTX0s to the transaction and executes the fee decision algorithm.
In some examples, the UTXO store comprises UTX05 of set values. That is, each UTXO has a value equal to one of a predefined set of values. For example, the UTXO store may comprise UTX0s that have one of two predefined values, or three predefined values, etc. In other words, the UTXO values are not random. Each value is associated with a respective index, with the lowest value associated with the lowest index and the highest value associated with the highest index. In these examples, the input(s) of the transaction template may be determined by (i.e. selected by) a multiple-value input selection algorithm (another example of a transaction builder algorithm).
Starting with the highest index (corresponding to the highest value of UTX05), the selection algorithm determines the smallest quantity of UTX0s at that highest value such that the total value of that quantity of UTX05 is greater than a sum of i) the data fee and ii) the total value of input fees associated with that quantity of UTX05. If the UTXO store includes that smallest quantity of UTX05, the selection algorithm adds the UTX05 to the transaction and executes the fee decision algorithm. If the UTXO store does not include the smallest equation of UTX05 at the highest value, the selection algorithm adds to the transaction all of the UTX05 at the highest value that are stored in the UTXO store. For instance, if three UTX0s are required but the UTXO store only contains two, then the two UTX0s are added to the transaction.
Then, the process is repeated for the next highest index (i.e. the penultimate index) corresponding to the next highest value of UTX05. The data fee is reassigned a fee equal to the data fee, plus the fees associated with the number of inputs added to the transaction, minus the total value of the inputs added to the transaction. Thus the selection algorithm determines the smallest quantity of UTX0s at the next highest value such that the total value of that quantity of UTX0s is greater than a sum of i) the re-assigned data fee and ii) the total value of input fees associated with that quantity of UTX05. If the UTXO store includes that smallest quantity of UTX0s, the selection algorithm adds the UTX0s to the transaction and executes the fee decision algorithm. If the UTXO store does not include the smallest equation of UTX0s at the highest value, the selection algorithm adds to the transaction all of the UTX05 at the highest value that are stored in the UTXO store. The process of updating the data fee, determining the smallest quantity of UTX0s at the next highest value, and adding UTX05 to the transaction continues until the fee decision algorithm is executed.
In some examples, the UTXO store comprises UTX05 of varying values. In other examples, the UTXO store comprises UTX05 of set values. That is, each UTXO has a value equal to one of a predefined set of values. For example, the UTXO store may comprise UTX05 that have one of two predefined values, or three predefined values, etc. In other words, the UTXO values are not random.
The optimizer 502 may use the embodiments above to optimize a plurality of transactions. In some examples, each transaction has the same type and size of target data and therefore has the same associated data fee. Therefore the same number and value of the input UTX05 and output UTX05 may be used for each of the plurality of transactions.
As stated above, embodiments relate to determining the optimal set of denominations (UTXO values) for a given funding scenario, i.e. for a transaction with target data up to a maximum data size! maximum data fee. The funding scenario may be defined by a predefined set of expected transactions (or transaction sizes). This optimal set of denominations may then be used as the UTXO pool accessible by the optimizer 502, as described above. That is, given the optimal set of denominations, the optimizer may determine the number of, and the value of, the inputs and outputs of a given transaction so as to minimise the size of that transaction.
The optimizer 502 determines the optimal set of denominations (also referred to as UTXO values or input values) by minimizing a function. The function may be referred to as a "denomination function". The denomination function is evaluated based on a plurality (likely many) different sets of denominations. Each pair of sets of denominations differs in at least one denomination. For illustrative purposes, one set may contain denominations 1, 2 and 3, another set may contain denominations, 1, 3 and 5, another set may contain denominations 9, 17, and 100, and so on. That is, two or more sets may contain one or more denominations of the same value. Similarly, two or more sets may contain no denominations of the same value. In some examples, the smallest denomination is at least equal to the dust limit.
The denomination function is based on the following variables: i) the total amount of fees of the respective transaction (taking into account all input fees, output fees, and data fees); ii) the maximum data fee that any given transaction fee will have due to the target data included in that transaction; Hi) the total value of all denominations required to fund a set of transactions; iv) a total number of spendable (i.e. change outputs) of across the set of transactions; v) an initial number of instances of each denomination available to the optimizer; and vi) a total number of transactions that are to be funded using the set of denominations. 10 In some examples, the optimizer 502 obtains the UTX05 used to fund a transaction from a separate pool of UTX0s (e.g. maintained by the funding service 301). In these examples, the denomination function may also be dependent upon the number of communications between the optimizer and the UTXO pool (or host of the UTXO pool), where each communication is a request for the initial number of instances of each denomination.
The denomination function is evaluated using a plurality of different sets of denominations. The set of denominations that results in the minimum value of the function is the optimal set of denominations. The optimal set of denominations may be used by the optimizer 502 when funding one or more transactions, e.g. using one of the algorithms described above or below in section 7.4 and 7.5.
The denomination function is first evaluated with an initial set of denominations, then a second set of denominations (which differs from the initial set), then a third set (which differs from the first and second sets), and so on. In some examples, a "neighbour function" may be used to determine each next set of denominations to be evaluated. Each denomination is assigned an index, e.g. from 1 to k (where k is the total number of denominations). The neighbour function works by sampling an index from 1 to k, then selecting the corresponding denomination to form part of the next set.
The number of denominations per set (k) may be predefined at the start of the computation, e.g. fixed at three, five, ten, etc. In other examples, the number of denominations in each set may vary. For example, the heuristic algorithm (e.g. the neighbour function) may determine the best value for k.
In general any suitable heuristic technique may be used to minimise the denomination function. For instance, a genetic algorithm may be used. Alternatively, a simulated annealing algorithm may be used, as described in section 7.5 below.
7. EXAMPLE IMPLEMENTATIONS The section shows how some example transactions can be optimally funded using the described embodiments. We assume throughout that we want to create a transaction that contains the data payload D. The length of the data can be variable in size, encrypted or not. We define the optimal funding of such a transaction as finding the set of UTX05 that minimises transaction fees. This task is two layered: 1. Given a set of UTX05, which UTX0s should be spent to minimise the transaction fees? 2. Which is the best set of UTX05 that on average minimises transaction fees (as given in Question 1) for many funding requests of data payloads with varying sizes? 7.1 Setup We define an example scenario with reference to Figure 3. Assume a client service 303 calls the TxBuilder 302 requiring funding for data D. The TxBuilder 302 then constructs a transaction with the necessary inputs and change outputs. For example, the transaction may take the following form: Tx Inputs Outputs Value Unlocking Script Value Locking Script ini <Sigp <pi> outi [P2PKH Pout] biz <Si82> <Pp 0 OP FALSE OP RETURN <D> in <Sign> <pn> Fees: n * f eein + f eemit + f eeD where are amounts controlled by the Funding service 301, and the first output is the change returning outi Satoshis to the service 301. Each unlocking script (i.e., each input) has an associated transaction fee feetn and similarly the P2PKH locking script (i.e., output 0) has an associated fee f eemit. Furthermore, the UTX05 unlocked by the inputs need to cover the data fees f ee D associated with data D (i.e., output 1). More concretely, we have: ini in2 inu = outi feeout +n.fee + feeD + E The column "Value" shown as being part of the Input is not part of the transaction, but is shown to illustrate the amount of Satoshis to unlock. The row "Fee"s is not part of the transaction, but is shown to illustrate the amount of transaction fees.
As it is very unlikely that the sum of the available input values int equals the required fees (fee"t + n * feet n+ feeD), we usually provide a higher amount of 40atoshis than required. We use the notation e to denote any remaining amount of 40atoshis that can be used to cover fees for a change output), or it can be left to the miner as additional fees. We call E an excess term or leftover amount.
E =lint -(mai + feemtt + n * feet, + f eeD) We consider the following example: * in1 = 300 SAT, in2 = 448 SAT; * teem = 74 SAT, feema = 17 SAT; * data D has size 800 bytes, the fee rate is 0.5 SAT/byte, and consequently f eeD = 400 SAT.
We can pay for f eeD using int and in2. We derive the value of the change output outi from the formula: + in2 = outi + feennt + 2 * fee," + f eeD + e Then E = 183 SAT. e can be left as additional fee to the miner or returned to the payer as change. Paying an additional feeout to create the new output, we can create an additional 10 change output worth 164 SAT (e -fee").
Hereinafter, the following assumptions are made: * feeD also includes the fees necessary to pay for the transaction header and auxiliary information (nVersion, locktime, number of inputs, number of outputs).
* We consider the specific case of data funding, but the techniques are generalisable to fund transactions that have several spendable outputs.
* fee"t < feet < lct, where /d is the dust limit. The inequalities hold when using P2PKH unlocking scripts and locking scripts where at a rate of 0.5 SAT/byte we have: o fee", = 17 SAT, corresponding to a standard P2PKH output: * 25 bytes for P2PKH locking script (20 bytes for public key hash + opcodes) * 8 bytes to encode the value (in satoshis) * 1 byte for variable-length script size o feetn = 74 SAT, corresponding to a P2PKH unlocking script which is at most 148 bytes: * 40 bytes for spending UTXO reference (32 bytes TxID + sequence number) * up to 108 bytes for P2PKH unlocking script (up to 73 bytes ECDSA signature + 33 bytes public key + opcodes) * 1 byte for variable-length script size o The dust limit in Bitcoin is currently set at /d = 135 SAT for P2PKH scripts.
* feeant, fee and Id are fixed constants because we fix the script type, whereas f eeD can vary.
7.2 Variable UTXO values One option to create a transaction that funds storing data D on-chain is to spend the required outputs from a UTXO pool containing UTX05 of variable amounts. We show four example funding scenarios. For the purpose of simplifying computations, we assume the data transaction fees fees = 226 SAT.
7.2.1 Example 1
The UTXO pool contains 3 UTX05 with values 200 SAT, 310 SAT and 430 SAT.
The funding of data D that minimises transaction fees is to select in1 = 310 SAT, which covers feet,/ fees and an additional E = 10 SAT fee is left to the miner. The transaction is: Tx Inputs Outputs Value Script Value Script ini = 310 SAT [unlocking script] 0 SAT OP FALSE OP RETURN <D> Fees: 300 SAT = feet + fees E = 10 SAT (left to miner) In this example we cannot add a change because fee 011t > E. It is worth noting that using the higher UTXO, worth 430 SAT, would allow to create a change output and collect the change. However, the cost of the new output (feeout = 17 SAT) would be higher than leaving the current e to the miner.
7.2.2 Example 2
The UTXO pool contains 3 UTX05 with values 200 SAT, 500 SAT and 800 SAT.
The funding of data D that minimises transaction fees is in1 = 500 SAT, which covers feet, fees and the output fee feeout for a change output. The transaction is: Tx Inputs Outputs Value Script Value Script ini = 500 SAT [unlocking script] 183 SAT [locking script] 0 SAT OP FALSE OP RETURN <D> Fees: 300 SAT = feei + feemit + fees e = 200 SAT (feeout + change) An alternative (more expensive) solution would be to only have the data output and omit the change. This would lead to an additional 200 SAT fee left to the miner (change + feeout).
7.2.3 Example 3
The UTXO pool contains 3 UTX0s with values 200 SAT, 250 SAT and 350 SAT.
The funding of data D that minimises transaction fees is to select in1 = 350 SAT which covers fees,, fees and an additional £ = SO SAT fee is left to the miner. The transaction is: Tx Inputs Outputs Value Script Value Script ini = 350 SAT [unlocking script] 0 SAT OP FALSE OP RETURN <D> Fees: 300 SAT = feei + fees e = 50 SAT (left to miner) In this example feeont < E, so we can add a change output, but doing so would result in an output that is less than the dust limit /d which is not allowed by policy.
7.2.4 Example 4
The UTXO pool contains 3 UTX05 with values 250 SAT, 280 SAT and 290 SAT.
The funding of data D that minimises transaction fees is to select ini= 250 SAT and in2 = 280 SAT which cover 2f eein, feeD and the output fee fee"t for a change output. The transaction is: Tx Inputs Outputs Value Script Value Script ini = 250 SAT [unlocking script] 139 SAT [locking script] in2 = 280 SAT [unlocking script] 0 SAT OP FALSE OP RETURN <D> Fees: 300 SAT = fee, + recant + feeD E = 230 SAT (feet n+ feeant + change) In this example we needed to combine two inputs to cover all required transaction fees. This scenario is more expensive in comparison to the above examples as we have to pay a fee feet, for each input.
7.3 Implementation The examples discussed can be generalised according the following formula: = fee + feeD + E, where the value of the input in1 is used to cover the fees for the input feet, and the fees for the data f eeD. As already mentioned, any remaining amount of satoshis is called excess term a The excess term e can be left to the miner as additional reward or it can be returned to the transaction funder in the form of change output. As the choice of the funding a UTXO (ini) determines the value of E, choosing the optimal in1 is important in this process. The reason is that this determines what can be done with a leave it to the miner or return it to the funding service 301 as change output.
Assuming a dust limit Id > fee in we identify four scenarios (see Figure 5), depending on the value of a 1. E < feeout (solid line) In this case we cannot add a change output since e is not enough to cover the additional transaction fee fee"t to create the output locking script for the change transaction. E is left to the miner as additional reward.
2. feemit e C f eetn+ feeout (small dashed line) Also in this case we cannot add a change output, e would be enough to cover the additional transaction fee fee"t but the resulting output is below the dust limit 1. E is left to the miner as additional reward.
3. feetn+ fee", E < f ee out + Id (double line) In this case is favourable to create a change output and collect a As the resulting change would still be below the dust limit /d, an additional input in2 is required to increase E above the threshold /d. With the addition of another input, the total transaction fee becomes 2 * fee + feecut + feeD, and the remaining s is returned as output change.
4. E feeout + Id (large dashed line) Also in this case is favourable to create a change output and collect a Differently from the previous case, here the change is already above the dust limit and there is no need to add an additional input. The total transaction fees therefore are teem+ feema + leen and the remaining E is output change.
The 4 scenarios determine if the excess term can be collected in a change output or has to be left to the miner as additional fee. They can be summarised in a function as follows: fee_decision Input: E Output: additional transaction fees 1. If e < f eem + feema then output e.
2. Otherwise if feein+ feema E < feema + id then output feema + feetn.
3. Otherwise, output fee".
fee decision is a specific example of the fee decision algorithm described in section 6.
Based on the four scenarios described in Figure 5, the funding protocol chooses the funding UTXO in1, among the ones available in the pool, that reduces the fees to be paid to the miner. Given feetn+ Jeep (the minimum amount to be paid to publish a transaction embedding data I)) we build the transaction with minimum fees. This is done by ordering the strategies from the best (lowest additional transaction fee) to the worst (highest additional transaction fee) that should be used when selecting from the available UTX05 for funding the transaction: 7.4 Dynamic programming approach The approach presented in this section is based on the CMP algorithm presented in Section 5.1 above. CMP has two limitations. Firstly, it assumes that there are no transaction fees and secondly it does not take advantage of change. These limitations may lead to non-optimal transaction funding by not minimising fees. This is particularly relevant in blockchain transactions, as inputs and outputs have an associated fee.
Define the weights wi to be the number of inputs spending UTX05 of denomination el, and the weights w[ to be the number of outputs of the denomination ei. The spent UTX05 pay for feeD, input fees, output values, output fees and the excess term. This is captured by the following relation: + *** + wkek = f eep + w{ei + *** + wkr ek +1wi f eeb, +I eeout + E We subtract the term vv," et + *** + wk' ek +Eiwi f eep, + It ee"t from both sides of the equation: + *** + wkek -we1 -*** -wkr ek -1w, f eein -1w: feeout = f eeD +E Furthermore, we rewrite the equation as follows: wi(ei -f eetn) + * * * + w k(ek -f eetn) -144(et + fee") -* -w k' (ek + f eemit) = f eeD + e This is the equation that the inputs, outputs and the excess term have to satisfy. Then the minimisation problem we solve is the following: min ( 1 wi fee in +1w fee i i. --out ± fee, subject to wi(e1 -fee,)+ *** + wk(ek -feem) -w( e1 + fee,") -*** -wk (ek + fee") = f eeD + E, vv" w[ E 0 < E < max{E,feeout + f cent} where feet = fee_decision(e) fore < f eepi + feemit and E ld fee,, otherwise fee, = Do. The value E is an upper bound for the excess term which has to be chosen as input to the problem. We detail this later.
We discuss the minimisation problem: * The first line of the problem says that we want to minimise transaction fees by reducing the values of w" mit or f ee,.
* The second line introduces the first constraint of the minimisation: we can minimise fees subject to covering the data fees feeD and any excess term s.
* The second and third constraints bound the values of nib wi and E. When the upper bound E is very high (e.g. E = 2 * ek + feemit), then wir = *** = wpr = 0 and consequently if a change output is created, it values a This choice can be made if in practice splitting the output into denominations is too expensive in terms of transaction fees. This can be the case if too many UTX0s of small denomination values have to be created. Then it is better to create an additional transaction that spends multiple UTX0s of value e and turns them into denominations.
On the other hand, if E fee"t + feetn then a < fee", + teeth, and the minimisation will create outputs using the value of the denominations. The value a is left to the miner as additional transaction fees.
The minimisation introduces two problems that require us to change the CMP algorithm: * the terms w; (e k + f eecut) are deducted (so increasing wi decreases the total value) and * the excess term a is variable. 20 One option is to use the minimisation algorithm described below.
Step 1: Deducting values The function below shows how to minimise transaction fees for each transaction that covers data fees E < f eeD. We assume a = 0 and discuss the excess term in Step 2.
compute_cmp_negative Inputs: ...,ek, f eeD 1. Execute the CMP algorithm defined in Section 5.1 on the denominations {el - -fee} with S = (ek -fees,) * fees.
This outputs a matrix cmps,[6, EL 5 < k, E < S. Each element of the matrix at position (5,E) represents the minimum number UTX0s we have to spend to cover a fee >: < S using the first 6 denominations. We discuss the value S below.
2. Execute the CMP algorithm in Section 5.1 on the denominations {e, + feest,...,ek + f eesut} with S = (ek-1+ f eeout) * f eeD.
This outputs a matrix cmp"t[8, C], 8 < k, C < S. Each element of the matrix at position (6, C) represents the minimum number UTX0s we have to spend to cover a fee C < S using the first 6 denominations. We discuss the value S below.
We use the following notation: Eut = cmp (C + E)i = cmpiak, C +E] and cut = cmPout[k, 3. Define the one-dimensional array cmp"g computing the minimum transaction fees as follows: 4.
cmp"g [E] = min (E in * fees,/ vid + + cut f ee out) , E 5 fees where C = wl(e, + fee")+ * ** + wkr (ek + fee,",t) and C +1 = wi(ei - + *** + wk(ek -f cern).
Then either the fee >: is covered with no change and then EL, * fees, is the minimum transaction fee, or the fee E is covered by deducting C from the amount C +X. In the latter case, the minimum transaction fee required to cover >: is given by (C + E) * f eein+ Cant * feeout.
5. Output the array cmp"g.
Then the transaction that covers the data fees feeD has the minimum transaction fee crnPneg [f cep].
The amounts (ek -fee) * fees and (ek_i + feeout) * fees represent the worst case scenario where to cover feeD we need to spend wk:= fees UTX05 of value ek and create wkr_i:= fees outputs of value ek_i such that ek -recut-(ek_i + f eeout) = 1.
This means we only cover 1 SAT unit with each input, output pair. By creating the transaction with fees inputs, subtracting the outputs and associated input and output fees, 15 we then cover f eeD. We have wk(ek -feetu) -wkr _i(ek_i + feeout) = fees.
The transaction below illustrates the values C and C + E: Tx Inputs Outputs Value Script Value Script ini [unlocking script] 0 SAT OP FALSE OP RETURN <D> in2 [unlocking script] outi [locking script] *** outco"t [locking script] in(c+s)iy, [unlocking script] Fees: (C + E)112. * feet + Cour. f eeout + I SAT The inputs spend C + I input fees. The total change outputs cover C -output fees.
Step 2: Excess term Finally, we solve the minimisation problem for variable excess terms 0 < e < max{E,f eemit + feeDO using the following function: compute_cmp_final Inputs: el, e2, ...,ek, f eeD, E 1. Execute compute_neg_final with inputs e1, ...,ek and f eeD + max{E,f ee", + feen}. This outputs the array cm/3,2,g.
2. Define the one-dimensional array cmp at computing the minimum transaction fees as follows: cmP finat [I] = Ci.E<max t+feeinj cmPneg [I + e] + fees, I f eeD tEm[ein em, 3. Output the array cmp Then the minimum transaction fee to cover the data fees feed for variable excess E is crriP f inal[f ee Di-Once cmp f buil has been computed, for each data fee E < feed we can create a transaction in worst case time 0(f eed lei). Furthermore, each transaction has minimum fees and its construction is faster than the Greedy approach describe above if f ee /el is lower than k. The CMP algorithm requires 0(kS) space. We can further optimise this by rewriting the recurrence as: / 00, = 0 1, e5 =E cmp [6 mod 2,E] cmp[(6 -1) mod 2,E], es > E min(cmp[(6 -1) mod 2,E], 1 + cmp[6 mod 2,E -es]), otherwise This gives a space complexity of only 0(S) requiring the allocation of a matrix of size 2 X S. We discuss the optimisation and refer to Section 5.1 for the CMP algorithm. In Section 2.2.1 the computation of cmp[6, X] depends only on the value cmp[6 -1,E] and cmp[6,E -es].
Thus, to compute the (5 row of the matrix cmp we only need the current row 6 and the previous row 8 -1. Using this observation, we only need two rows in the matrix, the (6 mod 2)th row acting like the 5 row and the (6 -1 mod 2)th row acting like the 6 -1 row.
If we do not want the change output to be split into denominations, it is sufficient to set E = 2 * ek + feemit. In this case the solution is to fund f cep only with denominations of value e k * The advantage of splitting the output into denominations is that the UTX0s can then be directly stored in the funding service UTXO pool. If we choose not to split the change output into denominations, then an additional transaction has to be created in order to split the funds into denominations. Whereas both options require additional transaction fees (either because we have more outputs, or because we create another transaction), it requires less fees to split the output into denominations and avoid creating another transaction.
7.5 Finding denominations This section describes a technique for finding the set of denominations that minimise the size of transactions and consequently minimise the transaction fees feeD.
7.5.1 Methodology We define a function [that measures the fitness of a set of denominations el, ... Jek when used to fund a large number of transactions N of different sizes. In genetic algorithms, the fitness measures how close a given solution is to the optimum solution of the desired problem. The output of the function [aggregates several measurements of the set to fund each of the N transactions. We want to find the set of denominations that gives the minimum value of the function f. Because there are infinitely many sets of denominations ek that can be used, finding the set that minimises the function f is intractable to solve using a deterministic algorithm. Thus, to find the set we use the heuristic Simulated Annealing (SA) algorithm introduced in Section 5.2.
7.5.2 Setup To run SA, we need to define the function f we wish to minimise and the function neighbour that selects at each iteration the next evaluation point for f.
We assume that the TxBuilder 302 is initially loaded with Q instances of each denomination Depending on which denominations are used in transactions, our experimental results show how many instances Q should the TxBuilder 302 load for each denomination ei. We fund a collection of N transactions each with different data fees feeD and define: * M the maximum value [CCD can take, * F the total transaction fees paid, * S the total value of all unlocked UTX05 used to fund all N transactions, and * 0 the total number of change outputs. The change outputs will have to be split into denominations.
Every time the TxBuilder 302 terminates to supply of UTX05 of denomination ei, it communicates with the funding service 301 asking for Q UTX05 of denomination ei. We define C as the number of communications between the funding service 301 and the TxBuilder 302 needed to fund all N transactions.
The function f is evaluated on the set el, ..., ek and returns a positive number: l(F+SM±o±c, /14 We discuss the definition of the function: * The first term of this equation computes the expected transaction fees normalised by the maximum size of a transaction fee M. * The second term measures how many funds need to be allocated to fund a transaction normalised by the maximum size of a transaction fee M. * The third term adds a penalisation term for the change outputs, since they will have to be split into denominations. This adds computational overhead.
* The last term measures the impact of the number of communications C, each requiring Q instances of a denomination to be transferred to the Tx Builder from the Funding Service.
* We divide the sum of all four terms by the number of transactions N to obtain to obtain a value that indicates the fitness of the set el, ..., ek per transaction.
Finally, the function neighbour takes as input a set of denominations el, ek and derives a new set. It executes the following three steps: 1. Sample with equal probability an integer i E {1, k} 2. Sample with equal probability an integer e E {/d,/d + 1, ...,M} 3. Return the set of denominations {el__ e, ei+1, ek) 7.5.3 Parameters 15 20 25 To run the SA algorithm using the optimal decomposition in Section 7.4.3, we choose the following parameters. These can be changed depending on specifications, without requiring any change of the algorithms.
* Set the maximum excess value to E = 2 * ek + fee". Since f increases in value with the number of communications, it will not be optimal to use only one denomination ek as we will see in the results below.
* Set the number of transactions to N = 3000 and the quantity Q = N lk for each denomination. This number is chosen based on the number of UTX0s we expect to load in the TxBuilder N = Q k.
* Assume the fee per byte is set to 0.5 SAT/byte, the dust limit /d is set to 135 SAT, and the transaction fees for the unlocking and locking scripts are -fees = 74 SAT and fee"t = 17 SAT respectively, corresponding to P2PKH scripts.
* The data fees are normally distributed with mean fees = 191 SAT.
We analyse two examples: when the standard deviation of the set of fees fees is 1 and when it is 30.
7.5.4 Experimental Results 7.5.4.1 Standard deviation 1 In this case 99.7% of data have fees tees between 189 and 193 SAT. This applies when the data fees are expected to mostly stay constant for all data transactions. The table below shows the results we have obtained by running the SA algorithm depending on the number of denominations k = 1, 3, 5 and 7.
k f (el, ... , ek) Set of Observed Qt. per et S (total funds required) F (total transaction fees) Initial Q denominations C1, ..., ek 1 1.54 272 3000 816000 SAT 816000 SAT 3000 3 1.25 280, 442, 461 2940, 60, 0 849720 SAT 839934 SAT 1000 1.33 151, 235, 262, 0, 0, 74, 2926, 0 806482 SAT 806482 SAT 600 269, 991 7 1.39 231, 267, 272, 0, 2993, 7, 0, 0, 0, 801035 SAT 801035 SAT 428 435, 449, 553, 0 We make some observations: * Since the standard deviation is only 1 the data fees feeD do not vary significantly and hence the simulation algorithm correctly identified that even if we choose 3,5 or 7 denominations, the optimal strategy is to use a single denomination based on the usage column.
* The best denomination to choose is 267 SAT (as used in the set of 7 denominations). This is because it minimises S and F and moreover is used 2993 times. Furthermore, if we rerun the simulation using the single denomination 267, we obtain S = 802335 and F = 801460 and a usage of 3005. The values of S and Pare lower than for the denomination of value 272 SAT.
* The 267 SAT denomination is exactly covering the data fee feeD in the case it reaches 193 SAT and one locking script fee feein = 74 SAT.
Based on the observations, we can USE a single denomination el = 267 SAT in all N = 3000 transactions. Then Q1 = 3000 = N/1.
7.5.4.2 Standard deviation 30 In this case 99.7% of data have fees feeD between 101 and 281 SAT. This setting applies when the data fees can vary considerably, and a better diversification of denominations is appropriate. The table below shows the results we have obtained by running the SA algorithm depending on the number of denominations k = 1, 3, 5 and 7.
k f(ei,...,ek) Set of Observed Qi per et S (total funds required) F (total transaction fees) Q denominations 1 1.75 309 3305 1021245 SAT 948212 SAT 3000 3 0.91 277, 314, 359 1983, 903, 119 875554 SAT 874792 SAT 1000 0.96 239, 253, 270, 306, 542, 477, 700, 843355 SAT 842655 SAT 600 351 1050, 236 7 0.84 173, 230, 240, 262, 36, 290, 269, 836487 SAT 835806 SAT 428 271, 296, 330 850, 371, 838, We make the following observations: * In our testing, out of 3000 transactions, only a maximum of 5 change outputs were created using the 3, Sand 7 denominations.
* Furthermore the sets of 3, 5, and 7 denominations yield a significant improvement of the value of the function f in comparison to using only one denomination.
* The sets of 3, 5, and 7 denominations, reduce the total required funding S and the total transaction fees F. In particular, the sets of 5 and 7 denominations perform best.
The set of 7 denominations gives an overall lower value of the function f, optimising the total required funds and transactions fees. This is due to a good diversification of denominations.
8. EXAMPLE USE CASES
This section shows how the algorithms of the previous sections can be used in two funding examples using single denominations. We assume a data payload of constant size, hence why single denominations are appropriate. Furthermore, because the data payload has constant size, we can compute the value of the single denomination with precision.
8.1 Use case 1 As reference we use the transaction published here: https://test.whatsonchain. com/tx/817a3b51d7923e0a25978737473f80970c3268f1337750c 6d3c8c0edf7a6960f The total number of bytes of the hex codes relating to the transaction's data is 382 bytes requiring a fee of 191 SAT using a 0.5 SAT/byte fee rate. Using the notation introduced above, the data fee feeD is 191 SAT.
Any P2PKH input using a compressed public key contains: the previous hash TxId (32 bytes), the outpoint value (4 bytes), the script length (1 byte), the locking script (at most 107 bytes [10]) and the nSequence value (4 bytes). Thus, a P2PKH input requires at most 148 bytes.
The input fee is feet is 74 SAT computed at a 0.5 SAT/byte fee rate.
Furthermore, any P2PKH output contains: the nValue field (8 bytes), the script length (1 byte), and the unlocking script (25 bytes). Thus, a P2PKH output requires 34 bytes. The output fee fee"t is 17 SAT.
To cover the data fee f eeD it is then enough to fix a single denomination el of value 191+74 SAT, i.e. 265 SAT. Thus, using el of value 265 SAT we cover all necessary fees (f eeD and fee) and we do not require any change outputs.
8.2 Example 2
This example builds upon Example 1, and additional to funding data, we also require the funding of a P2PKH input and output. The P2PKH input and output are used to deterministically chain the transactions. The input unlocks a fixed dust amount d of 135 SAT and similarly the output has a value d.
Thus, the single denomination el needs to account for!CCD of 191 SAT, one P2PKH input fee feetn of 74 SAT and one P2PKH output fee fee", of 17 SAT. Furthermore, the single denomination needs to also cover its own input fee fee in of 74 SAT. Thus, el= 191 + 2 74 + 17 SAT, i.e. el = 356 SAT. An example transaction is given below: Tx Inputs Outputs Value Script Value Script d = 135 SAT ini unlocking script 135 SAT outi locking script el = 356 SAT in2 unlocking script 0 SAT OP FALSE OP RETURN cD> Fees: 356 SAT By using el as the single denomination, we cover all necessary fees and do not require any change outputs.
9. 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.
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 of determining an optimal set of input values for use as funding a set of respective blockchain transactions, wherein each transaction requires at least one input and at least one output, each respective input being a respective unspent transaction output, UTXO, having a respective input value, wherein each transaction comprises respective target data having an respective associated data fee, each input to a transaction has an associated input fee and each output of a transaction has an associated output fee, and wherein a total amount of respective input values of the respective UTX05 input to a respective transaction is required to be at least equal to a total amount of fees of the respective transaction, and wherein the method comprises: for a plurality of different respective sets of input values, determining the respective set of input values that minimises a function when evaluated based on the set of respective blockchain transactions, wherein the function is based on i) the total amount of fees of the respective transaction, ii) a maximum of the respective associated data fees, iii) is a total value of all input values used for respective inputs to the set of transactions, iv) a total number of spendable outputs across the set of transactions, v) an initial number of instances of each input value available to the optimizer, and vi) a total number of transactions in the set of transactions.
Evaluating the function based on the set of respective blockchain transactions means evaluating the function based on the predefined transaction fees associated with the set of respective blockchain transactions.
Statement 2. The method of statement 1, wherein the optimizer is configured to obtain each UTXO form a pool of UTX05, and wherein the function is also based on vii) a number of communications between the optimizer and the pool of UTX05 required to obtain a total number of instances of each input value needed to fund the set of transactions.
Statement 3. The method of statement 1 or statement 2, wherein said determining comprises: a) evaluating the function based on the set of respective blockchain transactions, given an initial set of input values; b) determining a respective next set of input values by changing one or more of the input values in the initial set of input values; c) evaluating the function based on the set of respective blockchain transactions, given the respective next set of input values; and repeating steps b and c until the function is minimised for the set of respective blockchain transactions, wherein the respective next set of inputs values used in step c is used as the initial set of input values in step b.
Statement 4. The method of any preceding statement, wherein the function is minimised using a heuristic function.
Statement 5. The method of statement 4, wherein the heuristic function is a simulated annealing algorithm.
Statement 6. The method of statement 2 or any statement dependent thereon, wherein the function is of the following form: fF S Uri+17+0+C *Q) f(ei, ek) -where F is the total amount of fees of the respective transaction, M is the maximum of the respective associated data fees, S is the total value of all input values used for respective inputs to the set of transactions, 0 is the total number of spendable outputs of across the set of transactions, Q is the total number of instances of each input value needed to fund the set of transactions, N is the total number of transactions in the set of transactions, C is the number of communications between the optimizer and the pool of UTX0s required to obtain the total number of instances of each input value needed to fund the set of transactions, and ei is a respective input value associated with index i.
Statement 7. The method of any preceding statement, comprising, given the optimal set of input values, minimising a number of inputs and/or outputs of a target transaction by: determining a respective number of each respective UTXO having a respective value to be used as a respective input to the target transaction and a respective number of each output of the transaction having a respective value, by minimising, for each different respective value of the respective UTX05 and for each different respective value of each output, a sum of a) a number of each respective UTXO having a respective value multiplied by the associated input fee, and b) a sum of bi) a number of each respective output having a respective value multiplied by the associated output fee, and bii) a leftover fee, wherein said minimising is subject to the following constraints: i) a total amount of the respective values of the respective UTX05 must be at least equal to the data fees and a leftover amount, wherein the leftover amount is based on based on a total amount of respective values of one or more respective UTX0s input to the transaction, a total amount of respective values of one or more respective outputs of the transaction, and a total amount of fees of the transaction, ii) the determined respective number of each UTXO must be non-negative, iii) the determined respective number of each output must be non-negative, and iv) the leftover amount must be between zero and a maximum of a predetermined upper bound and a sum of the associated input fee and the associated output fee.
Statement 8. The method of statement 7, wherein said determining comprises minimizing the following equation: min ( 1 w; feet, +Iwi i f eeout + fee, wherein each respective value is associated with a respective index i based on the respective value, and where wi is the respective number of each respective UTXO having a respective value corresponding to the index i, feein is the associated input fee, w; is the respective number of each output of the transaction having a respective value corresponding to index i, f eeout is the associated output fee, and fee, is the leftover fee.
Statement 9. The method of statement 8, wherein:
constraint i) is defined by wi(ei -feetn)+ *** + wk(ek -feet)-w( e1 f eeont) -* ** -wk (ek + fee") = fees + E, where ei is the respective value corresponding to index i, fees is the associated data fee, and E is the leftover amount; constraint ii) and constraint iii) are defined by wt, w; E N"; constraint iv) is defined by 0 < E < max[E, f ee"t + f ee in}, where E is the predetermined upper bound.
Statement 10. The method of statement 7 or any statement dependent thereon, comprising calculating the leftover fee based on the leftover amount, wherein: If the leftover amount is less than a sum of the associated input fee and the associated output fee, the leftover fee is the leftover amount; otherwise, if the leftover amount is less than a sum of the associated output fee and a predetermined minimum value, the leftover fee is the sum of the associated input fee and the associated output fee; otherwise, the leftover fee is equal to infinity.
Statement 11. The method of statement 7 or any statement dependent thereon, wherein said determining is performed using a dynamic programming approach.
Statement 12. The method of statement 11, wherein a change-making problem algorithm, onp[8, EL is defined as follows: cmp[S,E] = 1 co, 8=0 1, e8=E cmp[o -1,E], es > E min(cmp [1:5' -1, E], 1 + cmp[5,E -e5]), otherwise where 8 is an index representing a respective position of a respective UTXO in a sequence ordered based on the respective value of the respective UTXO, E is the total amount of fees of the transaction, and es is the respective value at position 6 in the sequence, and wherein said determining comprises determining a minimum total transaction fee to cover the data fee by: calculating a first matrix, trap in[8, EL for a set of first input values {el -f eein, ek -fee}, where k is the respective index corresponding to a highest respective value of the respective UTX05; calculating a second matrix, cmp"t[an, for a set of second input fel + feeout,...,ek + feeoutb calculating an array, cmpflog [I] = min (Ein * teeth, mm (C + E)in * f eon, + cut * c>o f e emit), where Ein = cmpt[k,E], (C + )* = cmpth[k,C + E] and Caut = cmpont[k,C], and where C = 144(e1 + feema) + * * * + wic(ek f ee out) and C + E = feein)+ + wk(ek -teeth), and calculating the array cmPrinat[E] = o<E<InaxiErr + El ± fliel "r+f",,,,} cniPneg[E f ee E, where cmp t[feeD] is the minimum transaction fee to cover the data fee.
Statement 13. The method of statement 12, wherein a change-making problem algorithm, cmp [8, EL is defined as follows: / co, = 0 1, e5= E cmp [8 mod 2,E] cmp[(8 -1) mod 2, X], e5 > E min(cmp[(8 -1) mod 2, E], 1 + cmp[6' mod 2,E -es]), otherwise where 8 is an index representing a respective position of a respective UTXO in a sequence ordered based on the respective value of the respective UTXO, E is the total amount of fees of the transaction, and e5 is the respective value at position 6 in the sequence, and wherein said determining comprises determining a minimum total transaction fee to cover the data fee by: calculating a first matrix, cmp tn[6,1], for a set of first input values {e, -f eeni, , ek -fee}, where k is the respective index corresponding to a highest respective value of the respective UTX05; calculating a second matrix, cmp"t[6',E], for a set of second input le, + f e.....ek + f 0}; calculating an array, cmp".q[E] = min (Ein * teenymild (C + E) in * teeth+ Com * f coma), where Ei = cmp1dk,E1, (C + E)in = cmpth[k, C + E] and Cant = cmpoitt[k,C], and where C = wir(ei + fee",) + * * * + v14(ek + f e e"t) and C + E = w,(e, -feet) + * ** + w k(e k -teeth), and calculating the array Mal r final [E] = min cmpiteg [E + El + 0.sE<maxfE,f ee,""t+ f ee in} f e e E, where cmpfi e e D] is the minimum transaction fee to cover the data fee.
Statement 14. The method of any of statements 1 to 6, comprising, given the optimal set of input values, minimising a number of inputs and/or outputs of a target transaction by executing a fee decision algorithm, wherein the fee decision algorithm determines whether an additional output of the target transaction is required, and wherein said executing comprises: determining a leftover amount based on the total amount of respective values of one or more respective UTX05 input to the target transaction, the total amount of respective values of one or more respective outputs of the target transaction, and the total amount of fees of the target transaction, if the leftover amount if less than a total of the associated input fee and the associated output fee, causing the target transaction to be sent to a blockchain network without the additional output, if the leftover amount is greater than the associated output fee, causing the target transaction to be sent to the blockchain network with the additional output; and if the leftover amount is greater than the total of the associated input fee and the associated output fee and less than the associated output fee and a predetermined minimum value, causing the target transaction to be sent to the blockchain network with the additional output and an additional input.
Statement 15. The method of statement 14, comprising executing a variable-value input selection algorithm, wherein the variable input selection algorithm determines a first one of the at least one inputs of the target transaction, and wherein said executing comprises: if available, selecting a respective UTXO having a respective value which results in the leftover amount being less than the associated output fee; if not, then, if available, selecting a respective UTXO having a respective value which results in the leftover amount being greater than the associated output fee and the predetermined minimum value; if not, then, if available, selecting a respective UTXO having a respective value which results in the leftover amount being greater than the associated output fee and less the total of the associated input fee and the associated output fee; if not, selecting a respective UTXO having a respective value which results in the leftover amount being greater than the total of the associated input fee and the associated output fee and less than the associated output fee and the predetermined minimum value; adding the selected respective UTXO as the first input to the blockchain transaction; and causing the fee decision algorithm to be executed.
Statement 16. The method of statement 15, comprising: if the plurality of UTX0s does not include a respective UTXO having a respective value large enough to cover the total amount of fees of the target transaction, adding one or more additional UTX0s as one or more additional inputs to the transaction.
Statement 17. The method of statement 14, wherein the respective value of each of the plurality of UTX05 is a respective one of one or more predetermined values, each predetermined value being associated with a respective index based on the predetermined value and wherein the method comprises executing a multiple-value input selection algorithm, wherein said executing comprises: starting with a highest one of the predetermined values, performing a process of steps: a) determining a minimum number, wherein the minimum number corresponds to a smallest number of the respective (JTX0s having that predetermined value that results in i) a total value of that predetermined value multiplied by the minimum number, being greater than ii) the data fee summed with a total amount of the associated input fees multiplied by the minimum number; b) if the plurality of UTX0s comprises at least the first minimum number of respective UTX05 having that predetermined value, adding the first minimum number of UTX0s having that predetermined value as respective inputs of the transaction, and causing the fee decision algorithm to be executed; c) if the plurality of UTX05 comprises a second number of respective UTX05 having that predetermined value which is less than the first minimum number of respective UTX05 having that predetermined value, adding the second number of respective UTX05 having that predetermined value as respective inputs of the transaction, and repeating the process of steps a), b) and c) for a next highest one of the predetermined values, wherein the data fee is replaced with a total of the data fee, summed with the second number multiplied by the associated input fee, minus the second number multiplied by that predetermined value, wherein the process is repeated for each next highest one of the predetermined values until the fee decision algorithm is executed.
Statement 18. The method of any of statements 7 to 17, wherein the predetermined minimum value is set by the blockchain protocol.
Statement 19. The method of any of statements 7 to 17, wherein the plurality of UTX0s are ordered monotonically by respective value.
Statement 20. The method of any of statements 7 to 17, comprising using the method to optimize a respective size of a plurality of respective blockchain transactions, each respective blockchain transaction having respective target data having the same associated data fee.
Statement 21. 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 20.
Statement 22. 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 20.
Claims (22)
- CLAIMS1. A computer-implemented method of determining an optimal set of input values for use as funding a set of respective blockchain transactions, wherein each transaction requires at least one input and at least one output, each respective input being a respective unspent transaction output, UTXO, having a respective input value, wherein each transaction comprises respective target data having an respective associated data fee, each input to a transaction has an associated input fee and each output of a transaction has an associated output fee, and wherein a total amount of respective input values of the respective UTX05 input to a respective transaction is required to be at least equal to a total amount of fees of the respective transaction, and wherein the method comprises: for a plurality of different respective sets of input values, determining the respective set of input values that minimises a function when evaluated based on the set of respective blockchain transactions, wherein the function is based on i) the total amount of fees of the respective transaction, ii) a maximum of the respective associated data fees, iii) is a total value of all input values used for respective inputs to the set of transactions, iv) a total number of spendable outputs across the set of transactions, v) an initial number of instances of each input value available to the optimizer, and vi) a total number of transactions in the set of transactions.
- 2. The method of claim 1, wherein the optimizer is configured to obtain each UTXO form a pool of UTX05, and wherein the function is also based on vii) a number of communications between the optimizer and the pool of UTX05 required to obtain a total number of instances of each input value needed to fund the set of transactions.
- 3. The method of claim 1 or claim 2, wherein said determining comprises: a) evaluating the function based on the set of respective blockchain transactions, given an initial set of input values; b) determining a respective next set of input values by changing one or more of the input values in the initial set of input values; c) evaluating the function based on the set of respective blockchain transactions, given the respective next set of input values; and repeating steps b and c until the function is minimised for the set of respective blockchain transactions, wherein the respective next set of inputs values used in step c is used as the initial set of input values in step b.
- 4. The method of any preceding claim, wherein the function is minimised using a heuristic function.
- 5. The method of claim 4, wherein the heuristic function is a simulated annealing algorithm.
- 6. The method of claim 2 or any claim dependent thereon, wherein the function is of the following form: fF S Uri+A7+0+C *Q) ek) where F is the total amount of fees of the respective transaction, M is the maximum of the respective associated data fees, S is the total value of all input values used for respective inputs to the set of transactions, 0 is the total number of spendable outputs of across the set of transactions, Q is the total number of instances of each input value needed to fund the set of transactions, N is the total number of transactions in the set of transactions, C is the number of communications between the optimizer and the pool of UTX05 required to obtain the total number of instances of each input value needed to fund the set of transactions, and ei is a respective input value associated with index i.
- 7. The method of any preceding claim, comprising, given the optimal set of input values, minimising a number of inputs and/or outputs of a target transaction by: determining a respective number of each respective UTXO having a respective value to be used as a respective input to the target transaction and a respective number of each output of the transaction having a respective value, by minimising, for each different respective value of the respective UTX05 and for each different respective value of each output, a sum of a) a number of each respective UTXO having a respective value multiplied by the associated input fee, and b) a sum of bi) a number of each respective output having a respective value multiplied by the associated output fee, and bii) a leftover fee, wherein said minimising is subject to the following constraints: i) a total amount of the respective values of the respective UTX05 must be at least equal to the data fees and a leftover amount, wherein the leftover amount is based on based on a total amount of respective values of one or more respective UTX05 input to the transaction, a total amount of respective values of one or more respective outputs of the transaction, and a total amount of fees of the transaction, ii) the determined respective number of each UTXO must be non-negative, iii) the determined respective number of each output must be non-negative, and iv) the leftover amount must be between zero and a maximum of a predetermined upper bound and a sum of the associated input fee and the associated output fee.
- 8. The method of claim 7, wherein said determining comprises minimizing the following equation: min wi f eejii+Iwi (I feeout + fee, wherein each respective value is associated with a respective index i based on the respective value, and where wi is the respective number of each respective UTXO having a respective value corresponding to the index i, f eeit, is the associated input fee, wi is the respective number of each output of the transaction having a respective value corresponding to index i, f eeout is the associated output fee, and fee( is the leftover fee.
- 9. The method of claim 8, wherein: constraint 1)15 defined by wi(ei -fee) + * * * + wk(ek -feebi) -w(ei + f eeout) -* ** - (ek + fee.) = f eeD + E, where e1 is the respective value corresponding to index i, f eeD is the associated data fee, and £ is the leftover amount; constraint ii) and constraint iii) are defined by mit, iv; E constraint iv) is defined by 0 E < maxtE,fee"t + feebil, where E is the predetermined upper bound.
- 10. The method of claim 7 or any claim dependent thereon, comprising calculating the leftover fee based on the leftover amount, wherein: lithe leftover amount is less than a sum of the associated input fee and the associated output fee, the leftover fee is the leftover amount; otherwise, if the leftover amount is less than a sum of the associated output fee and a predetermined minimum value, the leftover fee is the sum of the associated input fee and the associated output fee; otherwise, the leftover fee is equal to infinity.
- 11. The method of claim 7 or any claim dependent thereon, wherein said determining is performed using a dynamic programming approach.
- 12. The method of claim 11, wherein a change-making problem algorithm, cmp[5,E], is defined as follows: cmp[8,E] = 1 0 D, 5 = 0 1, es = E cmp[6 -1, Et es > E min (cmp [8 -1, Et 1 + cmp[5, -e5]), otherwise where S is an index representing a respective position of a respective UTXO in a sequence ordered based on the respective value of the respective UTXO, E is the total amount of fees of the transaction, and es is the respective value at position 6 in the sequence, and wherein said determining comprises determining a minimum total transaction fee to cover the data fee by: calculating a first matrix, cmp1n[6,1], for a set of first input values {e} -feetn, ...,ek -fee}, where k is the respective index corresponding to a highest respective value of the respective UTX05; calculating a second matrix, cinp"t [5, n, for a set of second input fel + f eeout, ek + f eeoutl; calculating an array, cmp".q[E] = min (Ein * feet, min (C E)in * feet, + Cout * c>o f eeout), where Ein = cmpin[k,E], (C + X) = cmpin[k,C + E] and cut = cmpout[k,C], and where C = (el + feeout) + * * * + wk(e k + fee") and C + E = wi(ei -feein) + * ** + w k(e k -f ee tn), and calculating the array cmp ftnat[E] = min EmPneg + El + 05e<max(E,fee0"t+feeitj fee,, where cmp f i[f eeD] is the minimum transaction fee to cover the data fee.
- 13. The method of claim 12, wherein a change-making problem algorithm, cmp[6,E], is defined as follows: 100, = 0 1, es = E cmp[8 mod 2,E] cmp[(6 -1) mod 2,E1, es > E min(cmp [(5 -1) mod 2,E], 1 + crnp[6 mod 2,E -es]), otherwise where S is an index representing a respective position of a respective UTXO in a sequence ordered based on the respective value of the respective UTXO, E is the total amount of fees of the transaction, and es is the respective value at position 6 in the sequence, and wherein said determining comprises determining a minimum total transaction fee to cover the data fee by: calculating a first matrix, cmpin[6, EL for a set of first input values fel - -feein}, where k is the respective index corresponding to a highest respective value of the respective UTX05; calculating a second matrix, cmp0t[5, E], for a set of second input fel + f ee out, ..., ek + f eeoutb ± Cola calculating an array, cmpaeg[E] = min (Et, * feet,, min (C + E)t" * fee c>o f eeout), where Ein = cmptn[k,E], (C + E) = cmptn[k,C + El and cat = cmpout[k,C], and where C = w(ei f ee out) + * * * + wk(e k + f ee out) and C + E = wje, -f ee in) + + wk(ek feein), and calculating the array cmpriaa/[E] = min i:1E<niaxte,feeari+f eeinl cmpaea + El + fee,, where cmpitual[feep] is the minimum transaction fee to cover the data fee.
- 14. The method of any of claims 1 to 6, comprising, given the optimal set of input values, minimising a number of inputs and/or outputs of a target transaction by executing a fee decision algorithm, wherein the fee decision algorithm determines whether an additional output of the target transaction is required, and wherein said executing comprises: determining a leftover amount based on the total amount of respective values of one or more respective UTX0s input to the target transaction, the total amount of respective values of one or more respective outputs of the target transaction, and the total amount of fees of the target transaction, if the leftover amount if less than a total of the associated input fee and the associated output fee, causing the target transaction to be sent to a blockchain network without the additional output, if the leftover amount is greater than the associated output fee, causing the target transaction to be sent to the blockchain network with the additional output; and if the leftover amount is greater than the total of the associated input fee and the associated output fee and less than the associated output fee and a predetermined minimum value, causing the target transaction to be sent to the blockchain network with the additional output and an additional input.
- 15. The method of claim 14, comprising executing a variable-value input selection algorithm, wherein the variable input selection algorithm determines a first one of the at least one inputs of the target transaction, and wherein said executing comprises: if available, selecting a respective UTXO having a respective value which results in the leftover amount being less than the associated output fee; if not, then, if available, selecting a respective UTXO having a respective value which results in the leftover amount being greater than the associated output fee and the predetermined minimum value; if not, then, if available, selecting a respective UTXO having a respective value which results in the leftover amount being greater than the associated output fee and less the total of the associated input fee and the associated output fee; if not, selecting a respective UTXO having a respective value which results in the leftover amount being greater than the total of the associated input fee and the associated output fee and less than the associated output fee and the predetermined minimum value; adding the selected respective UTXO as the first input to the blockchain transaction; and causing the fee decision algorithm to be executed.
- 16. The method of claim 15, comprising: if the plurality of UTX05 does not include a respective UTXO having a respective value large enough to cover the total amount of fees of the target transaction, adding one or more additional UTX05 as one or more additional inputs to the transaction.
- 17. The method of claim 14, wherein the respective value of each of the plurality of UTX05 is a respective one of one or more predetermined values, each predetermined value being associated with a respective index based on the predetermined value and wherein the method comprises executing a multiple-value input selection algorithm, wherein said executing comprises: starting with a highest one of the predetermined values, performing a process of steps: a) determining a minimum number, wherein the minimum number corresponds to a smallest number of the respective UTX05 having that predetermined value that results in i) a total value of that predetermined value multiplied by the minimum number, being greater than ii) the data fee summed with a total amount of the associated input fees multiplied by the minimum number; b) lithe plurality of UTX05 comprises at least the first minimum number of respective UTX05 having that predetermined value, adding the first minimum number of UTX05 having that predetermined value as respective inputs of the transaction, and causing the fee decision algorithm to be executed; c) if the plurality of UTX05 comprises a second number of respective UTX05 having that predetermined value which is less than the first minimum number of respective UTX0s having that predetermined value, adding the second number of respective UTX0s having that predetermined value as respective inputs of the transaction, and repeating the process of steps a), b) and c) for a next highest one of the predetermined values, wherein the data fee is replaced with a total of the data fee, summed with the second number multiplied by the associated input fee, minus the second number multiplied by that predetermined value, wherein the process is repeated for each next highest one of the predetermined values until the fee decision algorithm is executed.
- 18. The method of any of claims 7 to 17, wherein the predetermined minimum value is set by the blockchain protocol.
- 19. The method of any of claims] to 17, wherein the plurality of UTX0s are ordered monotonically by respective value.
- 20. The method of any of claims] to 17, comprising using the method to optimize a respective size of a plurality of respective blockchain transactions, each respective blockchain transaction having respective target data having the same associated data fee.
- 21. 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 20.
- 22. 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 20.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
GB2206033.9A GB2618767A (en) | 2022-04-26 | 2022-04-26 | Optimizing blockchain transaction size |
PCT/EP2023/058859 WO2023208546A1 (en) | 2022-04-26 | 2023-04-04 | Optimizing blockchain transaction size |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
GB2206033.9A GB2618767A (en) | 2022-04-26 | 2022-04-26 | Optimizing blockchain transaction size |
Publications (2)
Publication Number | Publication Date |
---|---|
GB202206033D0 GB202206033D0 (en) | 2022-06-08 |
GB2618767A true GB2618767A (en) | 2023-11-22 |
Family
ID=81851826
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
GB2206033.9A Pending GB2618767A (en) | 2022-04-26 | 2022-04-26 | Optimizing blockchain transaction size |
Country Status (2)
Country | Link |
---|---|
GB (1) | GB2618767A (en) |
WO (1) | WO2023208546A1 (en) |
-
2022
- 2022-04-26 GB GB2206033.9A patent/GB2618767A/en active Pending
-
2023
- 2023-04-04 WO PCT/EP2023/058859 patent/WO2023208546A1/en unknown
Non-Patent Citations (1)
Title |
---|
None * |
Also Published As
Publication number | Publication date |
---|---|
WO2023208546A1 (en) | 2023-11-02 |
GB202206033D0 (en) | 2022-06-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP4005144A1 (en) | Digital contracts using blockchain transactions | |
US20220337427A1 (en) | Cryptographically linked identities | |
WO2023072965A1 (en) | Methods and systems for distributed blockchain functionalities | |
US20220309504A1 (en) | Multi-criteria blockchain protocol | |
WO2023072959A1 (en) | Methods and systems for distributed blockchain functionalities | |
KR20240100373A (en) | Methods and systems for distributed blockchain functions | |
JP2024525196A (en) | Multi-level Blockchain | |
GB2618767A (en) | Optimizing blockchain transaction size | |
WO2022268430A1 (en) | Tiered consensus | |
GB2618766A (en) | Optimizing blockchain transaction size | |
JP2023529467A (en) | custom transaction script | |
GB2618765A (en) | Optimizing blockchain transaction size | |
US20230196373A1 (en) | Probabilistic membership test for blockchain transaction outputs | |
WO2024110153A1 (en) | Payment channel aggregator | |
WO2023072778A1 (en) | Sharded merkle tree | |
WO2024110166A1 (en) | Payment channel aggregator | |
WO2024052065A1 (en) | Determining shared secrets using a blockchain | |
WO2023072774A1 (en) | Methods and systems for distributed blockchain functionalities | |
WO2023072948A1 (en) | Methods and systems for distributed blockchain functionalities | |
WO2024041866A1 (en) | Blockchain transaction | |
WO2023156101A1 (en) | Blockchain transaction | |
GB2621858A (en) | Blockchain transaction | |
Sello et al. | Erdos: A Novel Blockchain Consensus Algorithm with Equitable Node Selection and Deterministic Block Finalization | |
WO2024052047A1 (en) | Blockchain-based token protocol | |
WO2023227529A1 (en) | Hash masks |