GB2615596A - Blockchain-implemented hash function - Google Patents

Blockchain-implemented hash function Download PDF

Info

Publication number
GB2615596A
GB2615596A GB2201957.4A GB202201957A GB2615596A GB 2615596 A GB2615596 A GB 2615596A GB 202201957 A GB202201957 A GB 202201957A GB 2615596 A GB2615596 A GB 2615596A
Authority
GB
United Kingdom
Prior art keywords
script
transaction
public key
hash
parameter
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
Application number
GB2201957.4A
Other versions
GB202201957D0 (en
Inventor
Zhang Wei
Burns Alec
Steven Wright Craig
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nchain Licensing AG
Original Assignee
Nchain Licensing AG
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nchain Licensing AG filed Critical Nchain Licensing AG
Priority to GB2201957.4A priority Critical patent/GB2615596A/en
Priority to PCT/EP2022/055704 priority patent/WO2022214255A1/en
Priority to JP2023561211A priority patent/JP2024513084A/ja
Priority to EP22713576.1A priority patent/EP4320804A1/en
Priority to CN202280025794.XA priority patent/CN117121434A/en
Publication of GB202201957D0 publication Critical patent/GB202201957D0/en
Publication of GB2615596A publication Critical patent/GB2615596A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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/3236Cryptographic 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 using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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/3247Cryptographic 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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/3247Cryptographic 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
    • H04L9/3252Cryptographic 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 using DSA or related signature schemes, e.g. elliptic based signatures, ElGamal or Schnorr schemes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

A method of implementing a universal hash function (UHF) using blockchain transactions, the method comprising generating a first blockchain transaction and submitting the first blockchain transaction to one or more nodes of a blockchain transaction, wherein the first blockchain transaction comprises a locking script configured to, when executed together with an unlocking script of a second blockchain transaction comprising a target data item, generate a hash result of the target data item. The locking script comprises a UHF script configured to generate the hash result by: i) generating a first intermediate result based on a multiplication of the target data item by a first parameter; ii) generating a second intermediate result based on an addition of a second parameter to the first intermediate result; iii) generating a third intermediate result based on a modulo of the second intermediate result by a third parameter; and iv) generating the hash result based on a modulo of the third intermediate result by a fourth parameter. The UHF script is more efficient and requires less computation than the HASH160 operation code (opcode) in a pay-to-public-key-hash (P2PKH) locking script because it only involves one multiplication, one addition and two modular operations.

Description

Intellectual Property Office Application No G132201957.4 RTM Date:14 July 2022 The following terms are registered trade marks and should be read as such wherever they occur in this document: Bitcoin Intellectual Property Office is an operating name of the Patent Office www.gov.uk/ipo
BLOCKCHAIN-IMPLEMENTED HASH FUNCTION
TECHNICAL FIELD
The present disclosure relates to a method for implementing a hash function using blockchain transactions.
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
A hash function is a function that takes an input of arbitrary length and gives an output of fixed length. There are two general uses of hash functions. One use is to convert key-value pairs to index-value pairs for table lookup, in which case keys are hashed to indices. Multiplicative hashing is commonly used in programming for this purpose. The other major use is in cryptography, in which case the hash functions are generally referred to as cryptographic hash functions. In this case, security requirements result in more complicated hash functions. As an example, SHA256 is a cryptographic hash function used in blockchain technology.
Cryptographic hash functions, such as SHA256, are frequently used in locking scripts of blockchain transactions. For example, a well-known locking script is the pay-to-public-key-hash (P2PKI-1) locking script which uses the OP_HASH160 opcode discussed below.
Most blockchains, e.g. Bitcoin, have a limited scripting language which consists of a limited number of functions, i.e. operators. For instance, in Bitcoin these functions are known as opcodes. At the time of writing, the Bitcoin scripting language (Script) is limited to just five opcodes that can be used to implement a hash function. OP RIPEMD160 is an opcode configured to hash an input using the RIPEMD-160 hash function. OP_SHA1 is an opcode configured to hash an input using the SHA-1 hash function. OP_SHA256 is an opcode configured to hash an input using the SHA-256 hash function. OP_HASH160 is an opcode configured to first hash an input using the SHA-256 hash function and then with the RIPEMD-160 hash function. Finally, OP_HASH256 is an opcode configured to hash an input twice using the SHA-256 hash function. See, for example, https://wiki.bitcoinsvio/index.php/Opcodes_used_in_Bitcoin_Script. Other blockchains are similarly limited. There are many scenarios where it would be beneficial to use a hash function that is not limited to those that are implemented by the existing set of opcodes.
However it is not desirable to introduce new opcodes as this would undermine the stability of the blockchain and reduce its trustworthiness. It would therefore be desirable to expand the range of hash functions that can be implemented, in script, using the existing set of opcodes (or functions more generally).
Moreover, some of the available opcodes (e.g. OP_HASH256) involve applying several cryptographic hash functions to an input and are thus computationally expensive. It would therefore be desirable to be able to implement a hash function that is less computationally expensive than those that involve multiple cryptographic hash operations.
According to one aspect disclosed herein, there is provided a computer-implemented method of implementing a hash function, HF, using blockchain transactions, wherein the method is performed by a first party and comprises: generating a first blockchain transaction; and submitting the first blockchain transaction to one or more nodes of a blockchain transaction, wherein the first blockchain transaction comprises a locking script configured to, when executed together with an unlocking script of a second blockchain transaction comprising a target data item, generate a hash result of the target data item, wherein the locking script comprises a HF script configured to generate the hash result by performing at least the steps of: generating a first intermediate result based on a multiplication of the target data item by a first parameter, generating a second intermediate result based on an addition of a second parameter to the first intermediate result, generating a third intermediate result based on a modulo of the second intermediate result by a third parameter; and generating the hash result based on a modulo of the third intermediate result by a fourth parameter.
Universal hashing refers to an algorithm that selects a hash function from a set of hash functions, then calculates the output based on the selected hash function, for any given input. The main goals for universal hashing are to reduce the likelihood of collisions and to avoid worst case inputs (for some hash functions, there exists a set of worst-case inputs for which it would take much longer than average to compute their hash values).
The hash function (HF) script of the first blockchain transaction is configured to implement a hash function. In some embodiments, the hash function involves multiplying an input by a first parameter (a), adding a second parameter (b), taking mod p, and then taking mod n. In some examples, other (minor) operations may be performed. Thus HF script is configured to implement a new hash function compared to those currently available as part of the blockchain's primitive scripting language. In addition, the HF script is computationally less computationally expensive compared to the existing hash functions offered on some blockchains (e.g. OP_HASH160).
In some embodiments, the HF script is used as part of a P2PKH script instead of the OP HASH160 opcode, and therefore achieves the same result (locking an output to a public key hash) with less computation.
In some embodiments, a plurality of different blockchain addresses may be generated from the same public key using the universal hash function. Each address may be used to lock a different output of a transaction, and/or to lock different outputs of different transactions. Each different output may include an instance of the HF script, with each instance including (and therefore being locked to) a different one of the addresses.
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 3A is a schematic block diagram of a client application, Figure 3B is a schematic mock-up of an example user interface that may be presented by the client application of Figure 3A, Figure 4 is a schematic block diagram of some node software for processing transactions, Figure 5 is a schematic block diagram of an example system for submitting blockchain transactions to a blockchain, Figure 6 is a schematic block diagram of another example system for submitting blockchain transactions to a blockchain, Figure 7 schematically illustrates a hierarchical deterministic set of keys, Figure 8 is an example script for converting to a binary representation, Figure 9 is an example script for performing a point scalar multiplication, Figure 10 is an example script for performing an inverse modulo calculation, Figure 11 is an example script for performing a point addition of two different points, Figure 12 is an example script for performing a point addition of two same points, Figure 13 is an example script for performing a point addition of two points, Figure 14 is an example script for converting data into a compressed key format, Figure 15 schematically illustrates a hybrid hashing index scheme.
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. 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, 1521 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 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 (e.g. 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 1521 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-of-work 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 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 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, CPUs, 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 [EPROM; 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 [EPROM, 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 152j, 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 "De in Figure 2. Tx() and Tx/are just arbitrary labels. They do not necessarily mean that Txo is the first transaction in the blockchain 151, nor that Tx] is the immediate next transaction in the pool 154. Tx1 could point back to any preceding (i.e. antecedent) transaction that still has an unspent output 203 locked to Alice.
The preceding transaction Tx0 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 Txo and Tti could be created and sent to the network 106 together, or Tvo could even be sent after Tvi 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 scriptPubKey) is a piece of code written in the domain specific language recognized by the node protocol. A particular example of such a language is called "Script" (capital S) which is used by the blockchain network. The locking script specifies what information is required to spend a transaction output 203, for example the requirement of Alice's signature. 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, UTX0oin the output 203 of Txocomprises a locking script [Checksig PA] which requires a signature Sig PA of Alice in order for UTX00 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, Tx1,00, which in embodiments is the hash of the whole transaction Txo). The input 202 of Tx/ comprises an index identifying UTX00 within 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 [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 Tx°, 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 Tx /to the ordered pool of pending transactions 154. The blockchain node 104 will also forward the transaction Tx] 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 Tx° as spent. Note that Tx1 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 Txl 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 Txocan be split between multiple UTX0s in Tx/. 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 UTX0o is the only input to Txl, and Tx/ has only one output UTX01. If the amount of the digital asset specified in UTX00 is greater than the amount specified in UTX01, then the difference may be assigned by the node 104 that wins the proof-of-work race to create the block containing UTX0I. 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 UTX05 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. CLIENT SOFTWARE Figure 3A illustrates an example implementation of the client application 105 for implementing embodiments of the presently disclosed scheme. The client application 105 comprises a transaction engine 401 and a user interface (UI) layer 402. The transaction engine 401 is configured to implement the underlying transaction-related functionality of the client 105, such as to formulate transactions 152, receive and/or send transactions and/or other data over the side channel 301, and/or send transactions to one or more nodes 104 to be propagated through the blockchain network 106, in accordance with the schemes discussed above and as discussed in further detail shortly.
The Ul layer 402 is configured to render a user interface via a user input/output (I/O) means of the respective user's computer equipment 102, including outputting information to the respective user 103 via a user output means of the equipment 102, and receiving inputs back from the respective user 103 via a user input means of the equipment 102. For example the user output means could comprise one or more display screens (touch or non-touch screen) for providing a visual output, one or more speakers for providing an audio output, and/or one or more haptic output devices for providing a tactile output, etc. The user input means could comprise for example the input array of one or more touch screens (the same or different as that/those used for the output means); one or more cursor-based devices such as mouse, trackpad or trackball; one or more microphones and speech or voice recognition algorithms for receiving a speech or vocal input; one or more gesture-based input devices for receiving the input in the form of manual or bodily gestures; or one or more mechanical buttons, switches or joysticks, etc. Note: whilst the various functionality herein may be described as being integrated into the same client application 105, this is not necessarily limiting and instead they could be implemented in a suite of two or more distinct applications, e.g. one being a plug-in to the other or interfacing via an API (application programming interface). For instance, the functionality of the transaction engine 401 may be implemented in a separate application than the Ul layer 402, or the functionality of a given module such as the transaction engine 401 could be split between more than one application. Nor is it excluded that some or all of the described functionality could be implemented at, say, the operating system layer.
Where reference is made anywhere herein to a single or given application 105, or such like, it will be appreciated that this is just by way of example, and more generally the described functionality could be implemented in any form of software.
Figure 3B gives a mock-up of an example of the user interface (UI) 500 which may be rendered by the Ul layer 402 of the client application 105a on Alice's equipment 102a. It will be appreciated that a similar Ul may be rendered by the client 105b on Bob's equipment 102b, or that of any other party.
By way of illustration Figure 3B shows the Ul 500 from Alice's perspective. The Ul SOO may comprise one or more Ul elements 501, 502, 502 rendered as distinct Ul elements via the user output means.
For example, the Ul elements may comprise one or more user-selectable elements 501 which may be, such as different on-screen buttons, or different options in a menu, or such like. The user input means is arranged to enable the user 103 (in this case Alice 103a) to select or otherwise operate one of the options, such as by clicking or touching the Ul element on-screen, or speaking a name of the desired option (N.B. the term "manual" as used herein is meant only to contrast against automatic, and does not necessarily limit to the use of the hand or hands).
Alternatively or additionally, the Ul elements may comprise one or more data entry fields 502, through which the user can enter data. These data entry fields are rendered via the user output means, e.g. on-screen, and the data can be entered into the fields through the user input means, e.g. a keyboard or touchscreen. Alternatively the data could be received orally for example based on speech recognition.
Alternatively or additionally, the Ul elements may comprise one or more information elements 503 output to output information to the user. E.g. this/these could be rendered on screen or audibly.
It will be appreciated that the particular means of rendering the various Ul elements, selecting the options and entering data is not material. The functionality of these Ul elements will be discussed in more detail shortly. It will also be appreciated that the Ul 500 shown in Figure 3 is only a schematized mock-up and in practice it may comprise one or more further Ul elements, which for conciseness are not illustrated.
5. NODE SOFTWARE Figure 4 illustrates an example of the node software 450 that is run on each blockchain node 104 of the network 106, in the example of a UTX0-or output-based model. Note that another entity may run node software 450 without being classed as a node 104 on the network 106, i.e. without performing the actions required of a node 104. The node software 450 may contain, but is not limited to, a protocol engine 451, a script engine 452, a stack 453, an application-level decision engine 454, and a set atone or more blockchain-related functional modules 455. Each node 104 may run node software that contains, but is not limited to, all three of: a consensus module 455C (for example, proof-of-work), a propagation module 455P and a storage module 4555 (for example, a database). The protocol engine 401 is typically configured to recognize the different fields of a transaction 152 and process them in accordance with the node protocol. When a transaction 152j (Tx) is received having an input pointing to an output (e.g. UTXO) of another, preceding transaction 152i (Txm_i), then the protocol engine 451 identifies the unlocking script in Txf and passes it to the script engine 452. The protocol engine 451 also identifies and retrieves Txt based on the pointer in the input of Tx. Txt may be published on the blockchain 150, in which case the protocol engine may retrieve Txi from a copy of a block 151 of the blockchain 150 stored at the node 104. Alternatively, Txt may yet to have been published on the blockchain 150. In that case, the protocol engine 451 may retrieve Txt from the ordered set 154 of unpublished transactions maintained by the node104. Either way, the script engine 451 identifies the locking script in the referenced output of Txi and passes this to the script engine 452.
The script engine 452 thus has the locking script of Mei and the unlocking script from the corresponding input of Tx. For example, transactions labelled Tx° and Txj_ are illustrated in Figure 2, but the same could apply for any pair of transactions. The script engine 452 runs the two scripts together as discussed previously, which will include placing data onto and retrieving data from the stack 453 in accordance with the stack-based scripting language being used (e.g. Script).
By running the scripts together, the script engine 452 determines whether or not the unlocking script meets the one or more criteria defined in the locking script -i.e. does it "unlock" the output in which the locking script is included? The script engine 452 returns a result of this determination to the protocol engine 451. If the script engine 452 determines that the unlocking script does meet the one or more criteria specified in the corresponding locking script, then it returns the result "true". Otherwise it returns the result "false".
In an output-based model, the result "true" from the script engine 452 is one of the conditions for validity of the transaction. Typically there are also one or more further, protocol-level conditions evaluated by the protocol engine 451 that must be met as well; such as that the total amount of digital asset specified in the output(s) of Txj does not exceed the total amount pointed to by its inputs, and that the pointed-to output of Tx i has not already been spent by another valid transaction. The protocol engine 451 evaluates the result from the script engine 452 together with the one or more protocol-level conditions, and only if they are all true does it validate the transaction Tx. The protocol engine 451 outputs an indication of whether the transaction is valid to the application-level decision engine 454. Only on condition that Txj is indeed validated, the decision engine 454 may select to control both of the consensus module 455C and the propagation module 455P to perform their respective blockchain-related function in respect of Txj. This comprises the consensus module 455C adding Txj to the node's respective ordered set of transactions 154 for incorporating in a block 151, and the propagation module 455P forwarding Txj to another blockchain node 104 in the network 106. Optionally, in embodiments the application-level decision engine 454 may apply one or more additional conditions before triggering either or both of these functions. E.g. the decision engine may only select to publish the transaction on condition that the transaction is both valid and leaves enough of a transaction fee.
Note also that the terms "true" and "false" herein do not necessarily limit to returning a result represented in the form of only a single binary digit (bit), though that is certainly one possible implementation. More generally, "true" can refer to any state indicative of a successful or affirmative outcome, and "false" can refer to any state indicative of an unsuccessful or non-affirmative outcome. For instance in an account-based model, a result of "true" could be indicated by a combination of an implicit, protocol-level validation of a signature and an additional affirmative output of a smart contract (the overall result being deemed to signal true if both individual outcomes are true).
6. DEFINITIONS Definition 1-multiplicative hash: Suppose we have a table size of 2"1, a modulo 2', and an odd integer a E {1, ..., 2' -1}. Then the multiplicative hash function h is defined to be ha(x) = Kax mod 2n)/2"-m] That is, given x, 1. calculate ax mod 2 -taking the least significant n bits of ax, and 2. right-shift (n. -in) bits -taking the most significant m bits of the result from step 1.
Definition 2-delta function for a hash function Let f: A -> B be a hash function. For any two elements x,y E A, We define 11, if x y and f (x) = f (y) ( f (x' Y) (0, otherwise.
Definition 3 -delta function for a set of hash functions Let H be a set of hash functions. We define (51-i (x, = Ef EH af Y) * Definition 4 -universal hash Let H be a set of hash functions from A to B. We say that 11 is universal if for all x,y in A, (11[(x,Y) IHI/IBI * Note that SR (x, y) counts the number of hash functions in the set that would induce a collision on x # y, while IHI/IBI indicates the abundance of hash functions relative to the size of the range.
Example
Let H = if:Z,n Zn, x 1-> ((ax + b) mod p) mod n I aC Zp/{0}, b C Zp}, where p m is a prime and m > n. Then H is universal.
Note that IHI = p(p -1), and IBI = n. The proof can be found in Universal Classes of Hash Functions, J. L Carter M. N. Wegman.
Definition 5 -cryptographic hash A hash function H is cryptographically secure if it is 1. pre-image resistant -given h = H (m), it is computationally difficult to find m; 2. second pre-image resistant -given h = H (m) and m, it is computationally difficult to find m' such that Wm') = h; and 3. collision resistant -it is computationally difficult to find a pair of messages m and m' such that H (m) = H (m1).
7. IN-SCRIPT HASH FUNCTION Figure 5 illustrates an example system 500 for implementing a hash function using blockchain transactions. The system comprises a first party, e.g. Alice 103a, and a second party, e.g. Bob 103b. The system also comprises one or more nodes 104 of a blockchain network 106. Note that Alice 103a and Bob 103b are merely used as convenient labels for the first party and second party respectively, and need not necessarily be configured to perform all of the actions described as being associated with Alice 103a and Bob 103b above with reference to Figures 1 to 4, though that is not excluded.
As shown, Alice 103a is configured to generate a first blockchain transaction TO and to submit the first blockchain transaction Tv/ to the blockchain network 106. The first blockchain transaction comprises one or more inputs and one or more outputs. At least one of the outputs (a "first output") comprises a locking script (a "first locking script") comprising a hash function (HF) script. Note that "first" here is used merely as a label and does not necessarily imply any form of ordering. The HF script is a portion of script configured to, when executed alongside an unlocking script of a second transaction Tx2 generate (i.e. compute, calculate, etc.) a hash (a "hash result") of an input (a "target input") included in the unlocking script. The target input may be any type of data item, e.g. a number, a string, etc. For example, the target input may be a public key. The first locking script may consist of the HF script, or it may comprise the HF script and one or more data items and/or additional portions of script. For example, the HF script may form part of a larger script.
In Figure 5, the second transaction Tx2 is shown as being transmitted to the blockchain network 106 by Bob 103b. It is also not excluded that the second transaction Tx2 may be submitted to the blockchain network 106 by Alice 103a.
The HF script is configured to perform at least four mathematical operations. Each operation may be performed by a single function (e.g. opcode) of the blockchain scripting language (e.g. Bitcoin Script). Alternatively, some or all of the operations may be performed by more than one function. The first operation involves computing a first intermediate result by multiplying the target data item by a first parameter. The first operation may consist of said multiplication. Alternatively, the first operation may involve one or more additional sub-operations (e.g. addition, subtractions, etc.). The second operation involves computing a second intermediate result by adding a second parameter to the first intermediate result. The second operation may consist of said addition. The third operation involves computing a third intermediate result based on performing a first modulo operation on the second intermediate result using a third parameter. In other words, the third intermediate result is based on the remainder after dividing the second intermediate result by the third parameter. The third operation may consist of said first modulo operation. The fourth operation involves computing the hash result based on performing a second modulo operation on the third intermediate result using a fourth parameter. In other words, the fourth intermediate result is based on the remainder after dividing the third intermediate result by the fourth parameter. The fourth operation may consist of said second modulo operation. In some examples, the hash function implemented by the HF script may be referred to as a "universal hash function" because it satisfies the definition of a universal hash (Definition 4).
For instance, the HF script may take the following form: < a > OP MUL < b > OP ADD <79> OP MOD <n> OP MOD, where a is the first parameter, b is the second parameter, p is the third parameter and it is the fourth parameter. The skilled person will be familiar with the opcodes.
The HF script may be configured to output one, some or all of the first intermediate result, second intermediate result, third intermediate result, and fourth intermediate result. For instance, the result(s) may be output to memory. The memory may be a memory stack in the case that the scripting language is a stack-based scripting language. In some examples, only the hash result is output, e.g. to memory.
The first parameter a may be any non-zero number, and may be chosen randomly. The second parameter b may be any number, and may be chosen randomly. The third parameter p may be any positive number, e.g. a prime number, such as a prime number associated with a particular elliptic curve. For example, p may be the prime number that defines the Secp256k1 elliptic curve which is used by some blockchains. The fourth parameter n takes the form of 2L, where L is chosen to define the length of the hash result. In general, L may be any suitable number, e.g. 160, 256, 512, etc. Further details of some example values of the parameters are provided further below.
In some embodiments, the first locking script may comprise an expected hash result. The expected hash result is generated by applying the universal hash function to an expected data item (e.g. an expected value). Here, "expected" means predetermined. Alice 103a may generate the expected hash result herself, or she may obtain it from elsewhere, e.g. a different party, the blockchain itself, a webpage, etc. The universal hash function is applied to the expected data item "off-chain", i.e. not using blockchain transactions. For instance, the expected hash result may be calculated on Alice's computing equipment 105a.
The first locking script is configured to require the hash result generated by the HF script (i.e. during script execution) to match the expected hash result. That is, a condition of the unlocking script of the second transaction Tx2 unlocking the first locking script of the first blockchain transaction is that the unlocking script comprises the expected data item, and that the expected data item hashes to the expected hash result. This may be implemented using a hash puzzle. Implementing a hash puzzle, per se, will be familiar to the skilled person.
The expected data item may be an expected public key, e.g. Bob's public key PKB. In this example, the expected hash result may be used as a blockchain address. As well as requiring the expected data item to be an expected public key, the first locking script may require the unlocking script of Tx2 to comprise a signature generating using a private key corresponding to the expected public key. For instance, the first locking script may require the unlocking script to comprise Bob's public keyPKB (which hashes to the expected hash result), and Bob's signature generated using Bob's private key.s.k.B. This form of locking script is often referred to as a pay-to-public-key-hash (P2PKH) script. Note however that the first blockchain transaction does not necessarily need to involve a payment to Bob 103b, and can in general be used for any purpose, such as sending messages to Bob 103b, storing data on the blockchain 150, etc. For instance, the first locking script may take the following form: Or DUP [UPIFam,m] <UPWam,m(PK)> OP_EQUALVERIFY OP_CHECKSIG where WHFam) is shorthand for the HF script, and cUHF",b,p,n(PK)/ is the expected hash result generated by applying the universal hash function (UHF) to an expected public key.
The first locking script therefore requires the unlocking script to take the following form: <Signature> <PK > , which is the same as the standard P2PKH script.
Until now, P2PKH scripts have taken the following form: OP DUP OP HASH160 <HASH160(PK)> OP EQUALVERIFY OP CHECKSIG In this script, OP_HASH1 6 0 takes a given public key PK and outputs its hash value. The hash value is then compared with the expected hash value given in the script, <MASI116 0 ( PK.) >. MASI116 0 is a composite function (i.e. algorithm), which can be described as: 1. applying SHA256 to the input public key; 2. applying RIPEMD160 to the output of Step 1; 3. adding prefix to the output of Step 2 to indicate network type (mainnet, testnet, regtest); 4. applying double 5HA256 to the output of Step 3; 5. taking the firsts bytes of the output of Step 4 as the checksum; 6. adding the checksum to the output of Step 3; and 7. applying base58-encoding to the output of step 6.
Note that Step 7 is reversible. That is, given the output of Step 7, one can apply base58-decoding to work out the output of step 6. However, it is not computationally feasible to reverse all the way to obtain the input public key due to the one-way-ness of the cryptographic functions used.
The main purpose of HASH160 in the locking script is to ensure that only the expected public key will be used in the unlocking script. As it is shown above, HASH160 requires four hashes (one SHA256, one RIPEMD160 and one double SHA256). The universal hash function implemented by the HF script achieves the same result with less computation. The HF script is also much more efficient than HASH160 in a P2PKH because it only involves one multiplication, one addition and two modular operations.
Returning now to the parameters of the HF script, in some examples the third parameter p may be chosen to be the prime that comes with Secp256k1, the elliptic curve used in Bitcoin, 2 3 7 y = x + mod p where p = 232 29 28 27 26 24 1.
The fourth parameter may be chosen to be n = 2160 so that the output of the function has the same length as the output of HASH160.
The first and second parameters a and b may be chosen randomly from Z p by users as long as a is not zero, a, b ER ZpV01. Note that the range and the size of a affects the collision probability, which is explained below.
In the following, q is used to denote the order of the group that is defined by Secp256k1, which contains q points, where q is a prime. This implies that there are q -1 non-identity points. Since none of them has order 2 (because q is an odd prime), one can conclude that each point has its inverse that is not equal to itself. This implies that there are (q -1)/2 non-identity points with distinct x-coordinates, which can be represented as (xi, +3/1) for i = 1, , (q -1)/2.
A public key may be represented in a compressed form as (xi, +) or (xi, -). Note that knowing Secp2S6k1, one can work out what the y-coordinate can be and use the sign to identify the unique y value. We assume that xi E [0,p -1], and we use -xi as the input to the universal hash function for (xi, -).
This establishes the input space for the universal hash function, D cZin, where m = p, and IDI = q -1. Equipped with the notations, one can make the following claim: Given h = UHF",b,p,(x), the probability of a randomly chosen public key x' E D with UHF",b4,,,(x1) = h is less than 12.
Note that if it = 2160,12 then the probability is less than -, which is negligible. This implies that it can achieve collision resistance and achieve more efficiency than HASH160 by dropping the one-way-ness requirement. The one-way-ness comes naturally with the discrete logarithm problem, which will be explained in detail after the following proof.
lithe public key x' E V is chosen randomly, then one only needs to show that the number of x' that satisfies the equation UHF",b,p,(x1) = h is less than IDI/n.
The equation with constraints one needs to solve is ax' + b h mod p mod n, (1) with conditions: 1 < a < p -1 (2) 0 < b < p -1 (3) 0 < h < n -1 (4) -p < x' < p (5) The last inequality is the range needed for counting the number of solutions of x'. As explained earlier, the sign of x indicates which value the y-coordinate takes. The first step is to convert modular arithmetic to integer arithmetic. There exists an integer k1 such that ax' + b h + kin mod p (6) -p < h + kin < p (7) From (4) and (7), one has - p -n < kin <p (8) - -<Ic1< -n n 2p The number of possible values of k1 is therefore bounded by Similarly, there exists an integer k2 such that ax' + b = h + kin + k2P (9) From (2), (3) and (5), one has: -ap < ax' + b < ap + p (10) Combining with (7) and (9), one has: -ap -p < k2p < ap + p (11) -a -1 < k2 < a + 1 (12) (9) also implies that h -b + k1n + k2p is divisible by a, and can be written as h -b + + k2p E 0 mod a (13) For any chosen value of 1(1, there is k2 -(I1 -b + kin)p' mod a. This gives a unique solution of k2 E [0, a) and maximum another two solutions in [-a, a]. When k2 = 0 is a solution, then a and -a are another two solutions. Given the constraint from (12), it can be concluded that the maximum number of values k2 can take is 3. Therefore, the total number of values x' can take is bounded by Therefore, the probability of a randomly chosen public key x' that satisfies the equation UHFaiit,,p,n(xl) = h is bounded by 6p 1 6 x 2(q -1) 12 = . n ID I n(q -1) n The last inequality is derived from the fact that p < 2q -2 and IDI = q -1, where p is the prime from Secp256k1, and q is the order of the corresponding group.
Note that, the result can be generalised by leaving the upper bound of the probability in the form 6p nIDI where p and n are the moduli in the universal hash function and IDI is the size of the input space.
Furthermore, one can justify why it can be assumed that the public key is randomly chosen. It is straightforward to calculate a public key that matches a given universal hash output.
However, it is computationally infeasible to work out the private key for that public key.
Therefore, in order to successfully produce a signature corresponding to a given universal hash output, one has to generate a private key first, and then check whether the corresponding public key has the matching hash value. Assuming the difficulty in discrete logarithm problem, one can say that a public key can only be randomly chosen in this context.
The above description has provided proof that using a universal hash function in place of HASH160 in script is secure in the sense that probability of collision can be negligible. Moreover, it has been justified that the one-way-ness can be effectively achieved through discrete logarithm problem from ECDSA signature. Therefore, some embodiments provide a more efficient implementation of a P2PKH script using a universal hash function.
Figure 6 illustrates an example system 600 for generating public keys in-script. In these embodiments, the first locking script of the first transaction Ed may comprise a public key derivation (PKD) script, and the PKD script may comprise the HF script. The PKD script is configured to, when executed, generate a child public key PKchud based on a parent public key PKpp",, included in the unlocking script of the second transaction Tx2. That is, the unlocking script of the second transaction may include a parent public key PKp",t, e.g. a public key owned by Alice 103a or Bob 103b, and the PIC) script is configured to compute a child public keyPIchud of the parent public key PKparent * In these examples, the target data item comprises a chain codeof cp a parent public key, the parent public key PKparent, arent and an index of the child public key. The first locking script may be configured to output the child public key Plchad, e.g. to memory, such as a stack.
Figure 7 illustrates an example of a hierarchical deterministic (HD) set of keys, also known as a HD wallet. Here, the master key is generated based on a seed. The child keys in each set of child keys are each generated based on the master key. The grandchild keys in each respective set of grandchild keys are each generated based on a respective set of the child keys. In this example, the master key is the parent key. However, the labels "parent" and "child" may be used to refer to a public key in an nth level and public key an (n + 1)th level, wherein the public key in the (n + 1)th level is generated based on the public key in the nth level.
The PKD script may be configured to generate a child public key using the following equation: P Kchito = PKparent Ul I Faip,p,n(Cparent II Pparent II index) * G Where UHFam,pm. is implemented by the HF script, Cparent II parent II index is the target data item, and UHFam,p,(cparent II Pparent II index) is the hash result. As can be seen from the above formula, the PKD script is configured to perform point multiplication (-) of the hash result and the generator point G. The PKD script is also configured to perform point addition (+) of the parent public key with the result of that multiplication.
In some examples, the PKD script may be configured to generate a child public key using the following equation: PKchild = PKparent UHF a,b,p,2512-JCParent II Pparent II index) * G where UHFam,m2512_Left(Cparent II Parent II index) is left 256 bytes of the hash result generated by the HF script. Note that in this example it = 2512.
As an example, the PKD script may take the following pseudo form: OP DUP < 0x20 > OP SPLIT OP SWAP OP ROT [UHF,b,m2s121 < 0x20 > OP LEFT [Hex to binary] [Point scalar multiplication] [Point addition] where the input is the parent chain code, index and the parent public key, and the result will be the child public key, as described above.
The HF script fragment [UHFam,p,2512] may be simply implemented as < a > OP MUL < b > OP ADD < p > OP MOD < n512 > OP MOD where a and b are integers of at least 512 bits, and ideally p is chosen to be a multiple of n to ensure the uniform distribution of the output. [Hex to binary], [Point scalar multiplication], and [Point addition] are pseudo scripts, examples of which are provided below.
The PKD script may be used as an alternative child keys of a HD wallet. Bitcoin improvement proposal (BIP) 32 HD wallets has been widely used in the blockchain ecosystem. It offers a mechanism to derive a large number of ECDSA key pairs from a single secret seed. The key derivation algorithm uses HMAC-SHA512 to generate two strings of 256 bits from a parent chain code, a parent public key and an index, HMAC-SHA512L(cparent,iparent P and MAC-SHA512R(C parent, P s -parent II index). The left 256-bit string uasreedi n11 child H y pair derivation, while the right 256-bit string is used as the chain code for further key pair derivations. It is not clear why HMAC-SHA512 is chosen for BIP32 other than that it offers the required bit-length of the outputs. HMAC-SHA512 is designed as a symmetric authentication scheme to ensure the authenticity and integrity of a message between parties. In the context of an HD wallet, there is no requirement of authenticity or integrity. Therefore, HMAC-SHA512 can be replaced with the universal hash function that has n = 2512. This enables in-script key derivation in a hierarchical deterministic manner that was not previously feasible as SHA512 is not available as an opcode in the blockchain scripting language.
A benefit of deriving keys explicitly on chain is that a party can prove the link between two public keys that they own, and therefore there is an immutable record of that proof. This is especially useful in the context of public key infrastructure (PKI), where a single public key (e.g. an identity key) can be certified. For example, a party can prove that a public key used to sign a transaction is linked to a certified public key. By virtue of this proof of a link being on chain, related public keys can be certified by extension.
Another benefit of calculating a child public key on chain is that this child public key can be used to sign transactions but never explicitly be stored on chain. As a result, if an adversary is searching for transactions containing a given child public key, they would not find the transactions that use this method, thus increasing privacy.
Returning now to the example PKD script provided above. The first opcodes OP PUP < 0x20 > OP SPLIT OP SWAP OP ROT duplicate the input parent keyP -parent, as the parent key is required twice in the calculation of the child key chad. It then splits the copy into its x and y coordinates, which correspond to the left and right 32 bytes respectively, and places these at the bottom of the stack, as this is the required format for the final function [Point addition]. After these opcodes are executed, the state of the stack is the following: < Parent > < Pparent(x) > < Pparent(Y) > The HF script fragment [UHF am,p,2512 is then executed. After execution of this function, the state of the stack is the following: < UHFa,1,,p,2512 (Cparent IIPparent llindex) > < Pparent(x) > < Pparent(Y) > Then the next opcodes < 0x20 > OP SPLIT OP DROP drop the right 32 bytes of the result of the HF script. The state of the stack after this point is now the following: < UHFa,b,p,2512-Left (Cparent IIPparent llindex) > < Pparent(X) > < Pparent(Y) > The resulting number UHF",b,m2.512_Left(Cparent IIPparent Ilindex) is then changed from hexadecimal to binary. Note that if the hash result is already in binary, this conversion is not necessary. Next, in order to calculate the [Point scalar multiplication], the input to the function is required to be in binary, so a function (i.e. the binary conversion script) is defined to convert the hexadecimal result of the HMAC into bytes each representing a binary digit.
An example script for this conversion is shown in Figure 8.
The following is an illustrative example of the [Hex to binary] function when executed. In this example, the hexadecimal < 0x07 > is converted into its binary representation 0111.
In this case, n = 1. The left hand columns represent the stack and the right hand columns represent the altstack. The flow of the stack is from left to right and then top to bottom.
< Ox07 > OP DUP < Ox01 > OP IF < Ox03 > < Ox01 > OP DUP OP 2 < Ox01 > OP 2 OP MOD < Ox07 > OP TOALTSTACK OP MOD OP 1SUB 0P2
OP DIV
< OX01 > OP IF <OxOl > < OX01 > OP CAT
OP TOALTSTACK
OP FROMALTS TACK < Ox01 > OP ISUB OP 2
OP DIV
< Ox03 > < OX01 > <0x03 > < Ox01 > < Ox0101 > OP DUP OP 2
OP MOD OP IF
< Ox01 >
OP FROMALTSTACK
< Ox0101 > < Ox01 > < Ox01 >
OP CAT
OP TOALTS TACK OP ISUB OP _2 OP DIV < Ox00 > < Ox010101 > OP 2 OP MOD OP ELSE < OX00 >
OP FROMALTS TACK OP CAT
< Ox00010101 > The function converts the hexadecimal < 0x07 > to its binary representation < Ox00010101 > where each byte represents one bit. Note that the Ox prefix denotes that the bytes following it are a hexadecimal number, and so < Ox00010101 > isn't actually equivalent to 0x07 in binary, but the way that the next opcodes read this representation will treat it as such. If it is read exactly as it is written, < Ox00010101 > is equivalent to the decimal 65793. The state of the stack after execution of the function [Hex to binary] is the following: < Binary representation of UHF am,p,2 3'12 _Lei t (Cparent IIPparent Iiindex) > < Pparent (X) > < Pparent(Y) > The function [Hex to binary] results in a string where each byte now represents one bit. For this particular example PKD script, the string must be split into an array using the following opcodes: [OP 1 OP SPLIT OP SWAP] 256 where the square brackets to a power indicate the number of times this should be repeated, which in this case is 256 times. This results in a binary array of length 256 where the byte representing the least significant bit is at the top of the stack. Each byte in the array represents one bit and is either < Ox01 > or < Ox00 >. The above described process involves concatenating the binary representation in the conversion to binary and then splitting the result into an array. The reason for this split is that the result is required to be in little endian format. This result may be achieved without concatenation, but it would require keeping track of the depth of the stack and then to keep bringing stack items to the top, whilst keeping the order. It is much simpler to concatenate the result into one string, utilise the altstack, and split it afterwards, as achieved by the scripts above.
The following illustrates an example of how to perform the point scalar multiplication in Script. The [Point scalar multiplication] function (i.e. the PSM script). The [Point scalar multiplication] function takes the HMAC function result (in some examples, only the left 32 bytes of the HMAC function result) as a binary representation and returns UHFa,b,p,2512-Left(Cparent IIPparent Ilindex). For simplicity of notation, the following definition is used: q:= UH Fam,p,2512 -Le f t(Cparent IIPparent Ilindex). Then the corresponding point q * G can be calculated. To calculate q * G in script, first pre-calculate qo = 2° * G, q1 = 21 * G, q255 = 2255 * G. This allows for the calculation of any possible q * G for 0 < q < 2256. This is because, taking a binary representation as input, if the ith digit of the binary representation is 1, the corresponding 2 will be added to the current state of the calculation of q * G. If the ith digit is 0, the corresponding 21 will not be added to the current state of the calculation of q G. An example PSM script for achieving this is illustrated in Figure 9. Assuming an input q in the form of a little-endian binary array, the examples script in Figure 9 calculates q * G, where < qt(x) > represents the x-coordinate of 21 * G and < qt(y) > represents the y-coordinate of 2' * G. This function adds the point 21 * G to the current state of q * G when the corresponding bit of q is equal to 1. This function uses [Point addition] (i.e. the point addition script), which is described below. The [Point scalar multiplication] function begins by pushing < Ox00 >< Ox00 > to the stack, the purpose of which is to act as an initial point, which in this case is the identity element. Since the [Point addition] takes two points as input, without pushing < Ox00 >< Ox00 > to the stack initially, the first execution of this will only have one input and will result in an error. In essence, < Ox00 >< Ox00 > acts as the identity element, since [Point addition] is defined in a way that if one point is < Ox00 >< Ox00 >, then the function simply outputs the other point. Note that the reason it is safe to choose this notation as the identity is because the point (0,0) is not a point on the secp256k1 elliptic curve. The state of the stack at this point is now the following: < (q * G) (y) > < Pparent(X) > < Pparent(Y) > where the top two items are the x-and y-coordinates of the result of the calculation of q * G. The [Point addition] function is the final function used in the child key derivation. It takes the result of [Point scalar multiplication] and the P -parent key, which has been stored at the bottom of the stack since it was duplicated in the first few opcodes of the function [Pchad derivation], and returns Peryild to the stack. There are a few functions that need to be calculated before defining the full function. These are: * [inverse mod p] * [Different Point addition] * [Same Point addition] First, an example of an inverse modulo p in script is described, which will be used in the addition of two points. Fermat's little theorem states that = MP-2 mod p. Note that p here is not the same as the fourth parameter of the HF script. Assuming that the input p is known, then the code shown in Figure 11 can be used to find the inverse of in modulo p, that is, to calculate mP-2 mod p. < >< pn_2 > * ** < pc, > represents an array, where each item of the array corresponds to the binary index of (p -2), that is, p' = p -2 = p02° ± pi21 ±***± p,1211-1, where the opcodes in Figure 10 calculate the function [Inverse mod p] given the input < m >.
In this example, n is 256, which is the binary length of p. The opcode < + 1) > combined with OP ROLL brings < m > to the top of the stack after the binary array of p -2 is pushed onto the stack. p -2 is pushed to the stack at this point to ensure this inverse function is self-contained and so can easily be applied in other cases. Again, the notation of the square brackets to the power indicate the number of times this code is repeated.
Figure 11 illustrates an example script for performing a point addition. In this case, the example script performs a point addition of two different points. When adding two different points, the input is <Y2 >< x2 >< Yi >< x1 >, where each coordinate is a 32-byte hexadecimal. Then the code in Figure 12 calculates the function [Different Point addition], returning < 313 >< x3 > to the stack. The following illustrates the state of the stack at the end of every line in the code of Figure 11. The state of the stack begins with the input, and then each row of the example code is executed in turn.
<Xi> <Yi> <X2 > < Y2 > OP 3 OP PICK OP OVER
OP SUB
[Inverse mod p1 < Xj. > <Yi> <Y2> OP 5 OP PICK OP 4
OP PICK OP SUB
<Y2 Yi> < (X2 -Xj.)-1 > < Xi > < Y1 > < X2 > <Y2>
OP MUL OP DUP OP DUP OP MUL
< (y2 -y1)2 (x2 -x1)2 > < (Y2 -Y1)(x2 -r1)-1 > < xl > < Yi > < x2 > < Y 2 > < x3 > < (372 -y1)(x2 -X1)-1 > < Xi > < Y1 > < X2 > < Y 2> OP 3 OP PICK OP 6
OP PICK OP ADD OP SUB < p >
OP MOD
OP DUP OP 4 OP PICK OP SUE OP 3
OP ROLL OP MUL
< (Y2 -Yi)(x2 -x1)1 (x, -x3) > < x3 > < xi > < Yi > < x2 > < Y2 > OP 4 OP PICK OP SUB < p > OP MOD
OP SWAP
[OP 3 OP ROLL OP DROP] < x3 > < Y3 > < x3 > < Y3 > < x1 > < Yi> < Y2> This completes the calculation of adding different points in script.
Figure 12 illustrates another example script for performing a point addition. In this case, the example script performs a point addition of the same point. When adding two same points, the input is < Yi >< x1 >< Yi >< xj. >, where each coordinate is a 32-byte hexadecimal.
Then the code in Figure 12 calculates the function [Same Point addition], returning < Y2 >< x2 > to the stack. The following illustrates the state of the stack at the end of every line in the code of Figure 12. The state of the stack begins with the input, and then each row of the example code is executed in turn. Note that a (not the same as the first parameter of the HF script) is a constant that is defined by the elliptic curve, which in this example is secp256k1, and so a = 7.
<x1 > OP DUP <3x + a 0P2 0P3
OP MUL OP ROLL
OP 3 OP MUL < y1 > OP MUL <Yi> [Inverse mod p] < a > OP MUL <x1 > < >
OP ADD
< > <Yi> < (34 + 0(41)-1 > < xi > < Yi >
OP DUP
OP DUP
OP Mtn, < (34 + a)2 (23/1)-2 > < (34 + a)(2y0 -1 > < xi > < y1 > 0P3 OP PICK 0P2 OP MUL OP SUB < p > OP MOD < x2 > < (34 + a)(2y1)-1 > < xi > < Yt > OP 3
OP PICK OP OVER OP SUB
< xi -x2> < x2 > < (34 + a)(2y1)1 > < xi > < Yi > 0P3 OP ROLL OP MUL 0P4 OP PICK OP SUB < p > OP MOD OP SWAP < x2 > < Y2 > <xl> <Yl> [0P3 OP ROLL OP DROP]' < x2 > < Y2 > Figure 13 illustrates another example script for performing a point addition. In this case, the example script performs a check of whether the two points to be added are the same point or different points, and the acts accordingly. Note that the bold text in Figure 13 explain what that line of code is doing, and the numbers (i) correspond to the definition of point addition given above. The input is assumed to be in the form < y2 >< x2 >< Yi >< X1 >, where each coordinate is a 32-byte hexadecimal.
The first line is a check for the second point being < Ox00 >< Ox00 >, which in the chosen notation is the point at infinity, since it is known that this point is not on the secp256k1 curve. If the second point is the point at infinity, then the first point < Yi >< x]. > is returned to the stack, which corresponds to definition (4) of point addition. Note that in the example code, the point at infinity only ever appears as the second point.
Then the first line inside the first OP ELSE checks if the x-coordinates are equivalent. If they are, a check of whether the y-coordinates are also equivalent is performed. If it finds that they are, then a check of whether y = 0 is performed, in which case the point at infinity is returned, which corresponds to definition (3) of point addition. If y # 0, then the code adds a point to itself, which is the function [Same Point addition] defined above, and corresponds to definition (2) of point addition definition. Next, if the y values are different, then the points must be inverse to each other, returning the point at infinity, so < Ox00 >< 0x00 > is returned. This corresponds to definition (3) of point addition. Finally, if the x values are different, the code executes different point addition [Different Point addition], corresponding to definition (1) of point addition.
This completes the calculation of point addition in script, and ultimately completes the calculation of child keys in script. The final state of the stack is now the following: < Pchild (X) > < chad(Y) > Figure 14 illustrates an example script for converting the data on the stack into a compressed key format. The example function takes the x and y coordinate of a key as inputs, and returns the compressed public key format. For an input < P(y)>< P(x) >, the opcodes in Figure 14 defines the function [Compressed Key format]. The first 3 opcodes check if the y coordinate of the child key is even or odd. Then the next opcodes append the x -coordinate with the correct prefix depending on this result. This results in the compressed child key, giving the final state of the stack to be the following: < 'child > Alternatively, if in fact the result is desired to be in uncompressed format, the following function may be used: [Uncompressed Key format] = OP_SWAP OP_CAT < 0x04 > OP_SWAP OFICAT In some embodiments, the HF script may be used to generate keys in key-value pairs, which can be used for a look-up table. Many applications, including wallets, require efficient lookup operations to identify spent, unspent, or application-related public keys. One efficient way to construct a look-up table is to use universal hash functions to create keys in key-value pairs. The in-script universal hashing approach described above effectively puts a copy of the keys in the key-value pairs on chain. This allows a seamless integration to a local lookup table as they share the same keys (hash values). For applications with smaller volume of public keys, they can reduce the number of bytes of the universal hash outputs by trimming the hash values while keeping the full value on chain.
For example, Alice 103a may store the expected hash result, or a shortened version of the expected hash result (e.g. the first four leading bytes), in a look-up table together with (i.e. mapped to a corresponding expected public key and/or a transaction identifier of the first transaction. In other words, the (shortened) expected hash result is the key of a key-value pair, where the value is the expected public key and/or transaction identifier. The look-up table may comprise several key-value pairs of this type, for different hash results, public keys and transaction identifiers. Alice 103a may use the (shortened) expected hash value as a look-up to find the corresponding public key and/or transaction identifier.
The examples described so far have only considered generating a single expected hash result for a given public key. That is, the examples have only described generating <UHF,,,b,p),(PK)/ where <UHF,,,b,p,"(PK):, is the expected hash result generated by applying the universal hash function (UHF) to an expected public key, PK. This is used to lock an output of a transaction to the public key, such that the public key and (optionally) a corresponding signature is required to unlock the output. The following will describe how to use the UHF to derive multiple expected hash results for a given public key. These expected hash results will be referred to as blockchain addresses.
As discussed above, the UHF is dependent on four parameters, a, b, n and q. The examples above describe how a single address (expected hash result) can be generated from a public key by applying the UHF to the public key with a fixed set of parameters. Now, by changing the values of the parameters, multiple addresses may be derived from the same public key. That is, the value of the parameters a, b, n and q may be changed in order to generate different addresses. In some examples, only a single parameter is changed. In other examples, more than the value of more than one parameter is changed. For instance, the values of all of the parameters may be changed.
An address may be generated for every possible value of the parameter a. Similarly, an address may be generated for every possible value of the parameter b. In some examples, an address may be generated for every possible combination of a and b. In these examples, the values of the parameters n and q may be fixed. Alternatively, the values of the parameters n and q may be varied.
The parameters may take any suitable value, including any value discussed above.
The different addresses may be used to lock different transaction outputs. For example, one or more outputs of the same transaction may be locked using a different one of the addresses derived from the same public key. Additionally or alternatively, one or more outputs of one or more different transactions may be locked using a different one of the addresses derived from the same public key.
The locking script that locks the outputs takes the same form as described above. For examples, the locking script may take the following form: OLDDLIP [UHFam,Thi.,] <UHFam,p,n(PK)/ OPEQUALVERIEv OPCRECKS C Where [U H Fam,p,n] is shorthand for: < a > OP MUD < b > OP ADD < p > OP MOD < n > OP MOD.
The values of a, b, n and q are defined in the locking script and correspond to the values used to generate the corresponding address. That is, the values of the parameters that are used to generate an address are the same values that appear in the locking script that comprises that same address.
The corresponding unlocking script takes the following form: <Signature> <PK > One can see that the form of the unlocking script stays the same for each address. That is, although the address changes depending on the parameters used to derive the address, the locking script is still unlocked using the public key from which the address is derived, and a signature corresponding to the public key (i.e. generated using a private key corresponding to the public key).
Referring back to Figure 5, Alice 103a may generate a plurality of addresses using Bob's same public key. Each address is generated by hashing the public key using the universal hash function, wherein the value of at least one parameter of the UHF is changed for each different address. The first transaction that is generated by Alice 103a and submitted to the network 106 may include multiple outputs, each of which comprises an instance of a locking script which locks the output to one of the addresses. That is, the locking script includes the address and requires an unlocking script to include a public key which will be hashed by the HF script to give the address. Additionally or alternatively, Alice 103a may generate one or more additional transactions. Each transaction includes at least one output locked to one of the addresses derived from Bob's public key.
In some examples, the addresses may be generated by hashing the result of the universal hash function with a cryptographic hash function. That is, Alice 103a may derive a plurality of addresses using the universal hash function (again, changing the value of one or more parameters of the UHF to generate each different address), and then hash each of those addresses using the cryptographic hash function. For convenience, the addresses output by the UHF will now be referred to as "intermediate addresses", or "intermediate hash results". So, Alice 103a generates a plurality of different intermediate addresses and hashes each intermediate address to generate a corresponding final address. In these examples it is the final address that is used as the blockchain address, i.e. the address that appears in the output of the blockchain transaction.
In these examples, each locking script is configured to generate the intermediate address and then hash the intermediate address to generate the final address. The final address is compared with an expected final address that is included in the locking script. Depending on the form of the locking script, the parameters of the UHF may be included in the unlocking script rather than the locking script. An example is given below.
The cryptographic hash function may be any suitable hash function. For example, the cryptographic hash function may be RIPEMD160, SHA256, SHA512, etc. In some examples, the cryptographic hash function may be a combination of more than one hash function. For instance, the cryptographic hash function may be HASH160 which comprises hashing first with 5HA256 and then with RIPEMD160.
As discussed above for the case of generating single address, Alice 103a may store the plurality of different addresses (intermediate and/or final) in a look-up table for ease of reference. The addresses may be associated with an index or with the public key from which the addresses are derived.
8. INDEX HASH This section provides further examples of the described embodiments.
8.1 Cryptographic Hash Cryptographic hash functions are one-way functions that produce an unpredictable and fixed length output from an arbitrary sized input. They are used frequently in Bitcoin transaction scripts to hide the pre-image input. One of the most common examples of this is to mask the public key in a P2PKH transaction. As highlighted, P2PKH transactions are larger than P2PK transactions and are therefore more costly to transact overall. P2PKH typically involves the following locking script: OP_DUP OP_HASH160 <HASH160(PK)> OP_EQUALVERIFY OP_CHECKSIG.
In this setup the person locking the funds must know the hashed value of the public key, referred to as the address, of the receiving party. The sending party will lock funds to this hash value. This has the effect of masking the public key. HASH160 is the algorithm used on chain to perform this and is composed of 8 steps: 1. SHA256(); 2. RIPEMD160(); 3. adding prefix to the output for network type; 4. SHA256(); 5. SHA256(); 6. taking the firsts bytes of the output of Step 5; 7. adding this to the output of Step 3; and 8. base58-encoding.
The output of HASH160 is unpredictable and deterministic, e.g. the same input will always produce the same output.
Public keys are typically not linked to an individual's identity and therefore masking is not necessary to maintain the privacy of an individual. However, it is possible for attackers to link commonalities between multiple transactions. For example, if an attacker Bob knew real world information about Alice it might be possible for Bob to link a public key to Alice.
This would not compromise the security of Alice's funds in any way but could allow Bob to track Alice's transactions related to this public key and therefore reduce her privacy.
The HASH160 algorithm provides a mask for a public key in a P2PKH transaction script locked in the above manner, it is computationally infeasible for a party to derive the public key from the hashed value available on chain. However, as the algorithm is deterministic, the same public key will always produce the same hashed value. This would therefore allow an attacker to simply match the same on-chain P2PKH hashed values together if used more than once.
Further, to unlock funds the receiving party must still provide their pre-image public key on-chain. Once accepted, the network can associate this public key with the P2PKH hash value and could connect any other on-chain P2PKH transaction associated with that public key. It is therefore strongly recommended that to increase privacy a party should always vary their public key for new transactions. This brings into question what functionality masking in this way provides, especially considering the additional cost incurred in utilising P2PKH over P2PK. If the public key should be altered for every transaction, it would be infeasible to link accounts to public keys, thus mitigating the need to mask them. Further, the security of ECDSA is currently considered computationally infeasible to break, so the additional layer of security provided by hashing seems unnecessary.
8.2 Universal Hash As discussed above, universal hashing refers to a form of hashing that typically takes the form: H ashu kip (x) = ((ax + b) mod p) mod n Where x is the input and a, b, p and n are predetermined and random integers that are typically kept secret. Universal Hash Functions (UHF) have two main properties: 1. Deterministic -HashuHF(x) = HashuHF(y) when x = y, 2. Uniform mapping distribution -PrtHushufw(x) = HashuliF(y)} -q for two randomly chosen inputs x, y.
This second condition defines that UHF evenly distribute outputs, so that the probability of two distinct inputs hashing to the same value is less than or equal to lover the output size 71.
As shown, UHF utilises only one multiplication, one addition and two modular operations. It is therefore extremely efficient to perform this style of hashing many times to create an index of outputs. It is much more efficient than HASH160 which, as shown above, utilises more steps with each of these more complicated.
Further, compared to cryptographic hash functions, UHFs allow a degree of choice for the parameters used from the party computing them. This flexibility can be used to provide functionality currently not available in HASH160.
8.3 Index Hash Public key hashing in P2PKH transactions ensures that the public keys are not disclosed to other users prior to that public key's owner spending funds. This creates an additional layer of security between the user's private key and the public network, providing a degree of increased privacy. However, as deriving a private key from the public key is currently considered computationally infeasible, this may be considered unnecessary. Further, as HASH160 is deterministic, an attacker can easily connect the same hashed values of public keys together and link them to a public key once funds are unlocked by the user. As a result, users are recommended to alter their public key for each transaction to increase privacy.
Thus, masking using HASH160 in a P2PKH transaction vs a P2PK transaction seems limited to reducing the size of a locking script by 13 bytes but increasing the unlocking script by 33 bytes.
UHF's allow a level of control over parameters that generates much more functionality than the cryptographic hash functions currently used in script. The present disclosure describes how this functionality may be used to produce multiple hashed addresses from a single public key, link multiple public keys to a common hashed address and be used in conjunction with a cryptographic hash to provide multiple secure addresses from a single address. UHF's are extremely efficient due to the simple arithmetic they utilise.
8.4 Universal Hash Function An example Universal Hash Function (UFH) that generates the hashed address Ai is defined herein as: Ai = HashunF(Pi) = [aPi + b mod n] mod n Where Pi represents the compressed version of public key for the ith user, which is the integer value for the x-coordinate with a positive or negative indicator for the 2 possible corresponding y values. We assume that xi E [0, p -a and we use -xi as the input to the universal hash function for (xi, -).
HASH160 always produces the same output address for the same public key. An attacker can simply associate the same hashed public key values together if the private-public key pair is reused. Once the unlocking public key is revealed during a transaction the attacker can link all those hashed value to the public key and the mask is redundant. It is therefore recommended that users create a new public key for each transaction. This can be laboursome and requires each new public key to be transmitted to the funding party for each new transaction.
Using the multiplicative hash function, one may generate indexed addresses from a single public key. Where a and b are randomly generated for each new address created (p and n may also be changed, depending on use case). This can be efficiently recorded in a look up table stored offline. Public keys may be associated with an index and corresponding addresses can be searched using the index or public key.
HashunF(Pi) = [cliPi + bi mod p] mod n.
Index cti, bi A = HashuHF(P) 1 al, hi A1 2 a2, b2 A2 3 a3, 1)3 A3 : : : The above table could be used to generate a maximum n number of different masked addresses for a single public key, where a, b1 are selected randomly. This would allow a funding party, with knowledge of a single public key for a receiving party, to generate many transactions to that party without having duplicate locking script addresses. Further, the receiving party would not need to have knowledge of this process and would only need to input their public key and signature. This is a more efficient solution than the recipient having to generate a new public key for each transaction and send this to the funding party.
Although unlikely, it may be prudent to check for collisions for separate ai, b producing the same address, modulo n. As will be discussed, the security of this mask system is related to value n. It is therefore likely that these would be selected for the desired level of security and fixed for the addressing scheme.
The probability of two randomly chosen public keys, Pi and Pi, collide to the same hashed address (e.g UHFamp,(Pi) = UHF",b,p,n(PJ)) is bounded by: Where p is set to the same value as in the input space to the UHF, which in this case is the p prime that comes with Secp256k1.
8.5 Parameter Selection Pi -this compressed public key value is considered random as the payee cannot select which public keys they wish to send funds to.
p -we may choose p to be the prime that comes with Secp256k1, the elliptic curve used in Bitcoin addressing. We may use this value as it maximises collision resistance for the first modulo. Any larger number would not be beneficial as it we would effectively be spreading a smaller input size (p) over a large output size. It has a fixed value of 2256 -232 -29 -1. Other values of p may be chosen.
71 -is selected to increase or decrease the collision probability. A smaller it value decreases the output size, leading to a higher number of collisions. Where all security is derived from bitcoins FCC key pair security, a larger n is considered more 'secure', as there would be fewer number of collisions, so there would be less unintended public keys that would resolve to the address to access the funds. We can also alter this n value to change the fixed length output size, e.g. set maximum n = 2160 so it has same fixed length output as Hash160, for example. One may typically fix 71 depending on the requirement.
a, b -The value a and the value b may be chosen randomly from;, by the user. However, a cannot equal zero, a ER ZpV0). We may select a, b from the range p such that: 1 < a < p -land 0 < b < p -1. This would provide the greatest amount of choice and variability for the hashing scheme. The range and size of a or b does not affect the collision probability.
8.6 Script The following highlights how the transactions may be locked and unlocked: Locking Script: OP_DUP < a > OP_MUL < b > OP_ADD <p > OP_MOD < q > OP_MOD < Ai > OP EQUALVERIFY OP CHECKSIGVERIFY Unlocking Script: <Sigi> <Pi> Where Pi represents the compressed form of the public address.
8.7 Transaction Size The above locking script contains 7 opcodes (OP_MUL, OP_ADD, OP_MOD, OP_MOD, OP_EQUAL and OP_CHECKSIGVERIFY), which are each 1 byte in size. The hashed address Ai would require a maximum 32 bytes on script, but this value is based on variable modulo n as discussed.
The locking script size depends mostly on the sizes of the four input parameters sizes a, b, p and re). As mentioned these can be determined by the users. The p value may be a maximum 32 bytes (as this is the maximum input space taken from the modulo 2256 from Secp256k1). From here a, b and it sizes can be selected dependent on requirement.
Locking Script Size(bytes) Unlocking Script Size (bytes) Overall Size (bytes) P2PK 35 74 109 P2PKH 25 108 133 UHF (a = 2' b= 121 109 230 232, n = 2256) As shown, transactions using the UHF transaction are larger than standard P2PK and P2PKH. For the above UHF locking script a, b,p and n values represent 80 bytes out of the total 121. We could considerably decrease the transaction size by selecting smaller parameters when appropriate. This would have security and variability implications as will be discussed in the next section.
Another method for reducing in script parameter size would be to represent values by directly pushing bits. For example, if it was selected as the value 2256 exactly, rather than some value within that range, we could represent 2256 as 1664. Using this we could simply push the value 1664 (which in hex is 1 followed by 640's) in script using the following op codes: OP 1 < 64 > OP LSHIFT Doing this would only use 4 bytes of memory, instead of 32 bytes that would be required to represent any number within the range 0 -2256. However, such methods would only be more efficient if exact powers of 16 are used for the parameters. For example, as we say our modulo p is fixed to 2256_232_ 977 (from Secp256k1). We can represent this more efficiently using the above method like so: OP 1 < 64 > OP LSHIFT OP 1 OP SOP LSHIFT OP SUB < 977 > OP SUB The above does the following: 1. Push 1 and left-shift this 64 places, forming the value 2256 2. Push 1 and left-shift this 8 places, forming the value 232, 3. Subtract 232 from 2256, 4. Push the value 977 and subtract this from the previous output.
This method forms the p value Secp256k1 in 12 bytes, rather than 32 bytes.
8.8 Security The UHF enables multiple distinct public keys to hash to the same unlocking address. This provides masking to the public keys prior to their being unlocked. Firstly, the hashed on-chain address is distinct from the public key for which it is intended. Secondly, if the attacker wished to do work to derive which public keys could unlock the scripts, they would need to calculate all possible public keys that could collide to that address.
For example, consider that we select a modulo n value that resulted in 1 billion possible public key collisions for our single on-chain hashed address. This would mean that an attacker would need to derive 1 billion public keys that could solve for the on-chain locking script. This would require that the attacker solve for the UHF and then derive all values that collide for this modulo n, from input space p. So the attacker could derive and store all pin number of values, but it would not greatly assist the attacker in identifying/tracking the activity of a single user's public key address. When considering that the attacker would have to keep track of many UHF locking scripts in this way, we can describe the UHF as a masking function at the expense of some security.
As stated, the security of the UHF is derived from ECC key pair security. It is computationally infeasible to work out the private key that corresponds to a public key that can unlock the script address. Even if in the case where there are 1 billion public keys that could solve to form the same address in our locking script, this would still give the attacker an approximately 22,6 chance of deriving a private key that forms the public key per attempt.
8.9 Hybrid Hash As described, the UHF provides additional functionality unavailable from cryptographic hashing. However, it would be somewhat trivial to derive potential public keys, Pi, that could solve for the on-chain UHF: Ai = [aPi + b mod p] mod n Provided a, b,p, n and A, which would all be visible on chain.
This vulnerability can be dealt with by passing the UHF output Ai, through a cryptographic hash function, such as HASH160. This would combine the pre-image resistance of cryptographic hashing with the flexibility of UHF's. We will refer to this as hybrid hashing as it involves both forms of hash function. This is illustrated schematically in Figure 15.
The pre-image resistance provided by HASH160, would make it computationally infeasible to derive Ai from the publicly visible address hash Ai, which in turn makes it infeasible to compute potential public keys, Pi, that solve for A1. Although requiring more operations, this hybrid hashing would provide all the functionality described above. Parties may create a hash index table that efficiently outputs multiple addresses from a single public key, by varying UHF parameters. These distinct address values, when passed through HASH160, would also have very distinct values A. However, now it would be infeasible to compute the pre-image value Ai from A" and therefore infeasible to compute the public key(s) that solve for this address. The hash index table may take the following form: Index ai, bi Ai A, = HashialF(P) = HASH160(113 1 a1, b1 A1 71-1 2 a2, b2 A2 A-2 3 a3, b3 A3 24-3 : * . Where, # 712 # The locking and unlocking script may take the following forms: Locking Script: OP_DUP OP_TOALTSTACK OP_MUL OP_ADD OP_MOD OP_MOD OP HASH160 <A1> OP_EQUALVERIFY OP_FROMALTSTACK OP_CHECKSIG Unlocking Script: <Sig i><n> < p> < bi > <ai> <Pi> Using pre-image resistance in hybrid hashing we may now choose to offset all UHF parameters to the unlocking script, to make the locking script more compact. This has the benefit of significantly reducing UTXO storage space, but also necessitates the unlocking party knows the hash index table. Further, the UHF values a,b,p and n may be enforced by concatenate them into the address and verifying this value.
The functionality of the UHF (indexed hashing) is now enhanced as it is computationally infeasible to compute public keys that could solve for the UHF on chain. Further, the locking script size is significantly smaller than those in multi-signature transactions, reducing the UTXO memory size used by nodes. As shown, it includes both cryptographic and universal hashing to best obscure the addresses.
Locking Script Size(bytes) Unlocking Script Size (bytes) Overall Size (bytes) P2PKH 25 108 133 Hybrid Hash (a = 2Bo b = 213, q = 31 188 219 2256)
9. EXAMPLE USE CASE
9.1 Single User This section describes an example use case for the described embodiments. Alice 103a runs an online game. Bob 103b is a regular player of Alice's game. Alice 103a regularly generates transactions to Bob 103b for his winnings. Bob 103b is lazy and uses a cold storage wallet, making it inconvenient to constantly generate new private-public key pairs each time he plays the game. To reduce communication costs, Bob 103b requests that Alice 103 use the same public key in all payment transactions to him. Bob 103b would like to ensure that the UTX0s assigned to him in these separate transactions cannot be linked by an external party until they have been spent. Alice 103a therefore uses the described index hash system for transmitting the regular payments to Bob 103b.
Bob 103b will generate a one-time-only public key P for Alice 103a. Alice 103a will then create a secure, off-chain lookup table for this single public key. Generating n number of maximum addresses A" in the following way: Index abbi Ai IT = [ay = HASH160(A1) + bt mod p] mod n 1 al, bi A1 Ai 2 a2, b2 A2 24-2 3 a3, b3 A3 A; : : : * q aq, bq A q q Alice 103a can now use these indexed hybrid hashes to generate a maximum n number of distinct addresses A. Alice 103a and Bob 103b can be secure in the knowledge that each of these transactions will have a different on-chain address, making it difficult for a bad actor to associate them together. Further, the cryptographic hash function ensures that this same bad actor cannot calculate the public key P used to derive these.
Bob 103b simply needs to use the same public key and relevant digital signature to unlock all these transactions, making the process far simpler on his part than constantly updating and transmitting his public key.
9.2 Open Puzzle Competition Similarly, to the above example, Alice 103a wishes to outsource the verification of some publicly available records. However, now she does not want to tie them to any specific public keys and simply wishes for anyone who can verify the records to be able to unlock the associated funds. This can be achieved through setting a sufficiently small n in the linked address scheme from: Ai = [aPi + b mod p] mod n For example, if q = 2 then half of all public keys and corresponding signatures could unlock the script. This would not be ideal as it would be extremely trivial for a Bitcoin node to simply replace the transaction solution with their own public key and signature to claim the funds that they did not work to do.
However, Alice could set the q value to be sufficiently high such that an unknown solving party could generate a private-public key pair that satisfied the address system off-line, on average, over the course of days for example. This would ensure that it would not be feasible for a rogue Bitcoin node to generate their own satisfactory private-public key pair in the average mining time for a block (10 minutes). Assuming that there are at least some good miners, the original transaction would be validated and published into the bitcoin network before a bad Bitcoin node could generate a replacement transaction to steal the associated funds.
10. CONCLUSION
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 implementing a hash function, HF, using blockchain transactions, wherein the method is performed by a first party and comprises: generating a first blockchain transaction; and submitting the first blockchain transaction to one or more nodes of a blockchain transaction, wherein the first blockchain transaction comprises a locking script configured to, when executed together with an unlocking script of a second blockchain transaction comprising a target data item, generate a hash result of the target data item, wherein the locking script comprises a HF script configured to generate the hash result by performing at least the steps of: generating a first intermediate result based on a multiplication of the target data item by a first parameter, generating a second intermediate result based on an addition of a second parameter to the first intermediate result, generating a third intermediate result based on a modulo of the second intermediate result by a third parameter; and generating the hash result based on a modulo of the third intermediate result by a fourth parameter.
Statement 2. The method of statement 1, wherein the first locking script is configured to output at least the hash result. For instance, the hash result may be output to memory, e.g. a stack.
Statement 3. The method of statement 1 or statement 2, wherein the locking script comprises an expected hash result, and wherein the locking script is configured to require the target hash result to match the expected hash result in order to be unlocked by the unlocking script.
Statement 4. The method of statement 3, wherein the expected hash result is generated by applying the hash function to an expected public key.
Statement 5. The method of statement 4, wherein the locking script is configured to require the target data item to be the expected public key, and to comprise a signature generated using a private key corresponding to the expected public key.
Statement 6. The method of statement 4 or statement 5, comprising: storing the expected hash result, or a shortened version thereof, in a look-up table mapped to at least one of: the expected public key, data associated with the first blockchain transaction, and/or data associated with a spending transaction that spends an output of the first blockchain transaction.
Statement 7. The method of statement 6, wherein:
the data associated with the first blockchain transaction comprises a transaction identifier of the first blockchain transaction and/or the first blockchain transaction itself; and/or the data associated with the spending transaction comprises a transaction identifier of the spending transaction and/or the spending transaction itself.
Statement 8. The method of statement 6 or statement 7, wherein the look-up table comprises a plurality of different hash results or shortened versions thereof, each generated by applying the universal hash function to a different public key, and wherein each different hash result is mapped to at least one of: the different public key, data associated with a respective blockchain transaction comprising the different hash result, and/or data associated with a respective spending transaction that spends an output of the respective blockchain transaction.
Statement 9. The method of statement 1 or statement 2, wherein the locking script comprises a public key derivation, PKD, script configured to generate a child public key of a parent public key, wherein the PKD script comprises the HF script, and wherein the unlocking script comprises the parent public key, and wherein the target data item comprises at least a chain code of a parent public key and the parent public key, and wherein the PKD script is configured to generate the child public key based on the parent public key and the hash result. The first locking script may be configured to output the child public key.
S
Statement 10. The method of statement 9, wherein the target data item comprises additional data.
Statement 11. The method of statement 10, wherein the additional data comprises at least one of: an index of the child public key, a timestamp, and/or a message.
Statement 12. The method of any of statement 9 to 11, wherein the PKD script comprises a binary conversion script, a point multiplication script and a point addition script, wherein the binary conversion script is configured to covert the hash result to a binary representation, wherein the point multiplication script is configured to perform point multiplication of the binary representation of the hash result with a generator point of an elliptic curve to generate an intermediate public key, and wherein the point addition script is configured to perform point addition of the intermediate public key and the parent public key to generate the child public key.
Statement 13. The method of statement 12, wherein the hash result is represented in a decimal or hexadecimal representation, and wherein the binary conversion script is configured to convert the decimal or hexadecimal representation of the hash result to the binary representation.
Statement 14. The method of any preceding statement, wherein the first parameter is any non-zero number, the second parameter is any number, the third parameter is a positive number, and the fourth parameter is 2AL, wherein L is chosen to define a length of the hash result.
Statement 15. The method of statement 14, wherein p is a prime number defining the sec9256k1 elliptic curve.
Statement 16. The method of statement 14 or statement 15, wherein L is one of: 32, 64, 128, 160, 256, or 512.
Statement 17. The method of any preceding statement, wherein the hash function is defined as HashuHF(P) = [aiP + b1 mod p] mod 11, where at is the first parameter, b1 is the second parameter, p is the third parameter, and n is the fourth parameter, and wherein the method comprises: generating a plurality of different respective expected hash results for the expected public key P by applying the hash function HashuHF(P) to the expected public key P for different respective values of one, some or all of: the first parameter, the second parameter, the third parameter, the fourth parameter.
Statement 18. The method of statement 17, wherein the first blockchain transaction comprises a plurality of respective outputs, each respective output comprising a respective locking script configured to, when executed together with a respective unlocking script of a different respective blockchain transaction comprising a respective target public key, generate a respective hash result of the respective target public key, wherein the respective locking script comprises a respective HF script configured to generate the respective hash result by performing at least the steps of: generating a respective first intermediate result based on a multiplication of the target data item by a respective first parameter, generating a respective second intermediate result based on an addition of a respective second parameter to the respective first intermediate result, generating a respective third intermediate result based on a modulo of the respective second intermediate result by a respective third parameter; and generating the respective hash result based on a modulo of the respective third intermediate result by a respective fourth parameter.
wherein each respective locking script comprises a respective one of the plurality of expected hash results, and wherein the respective locking script is configured to a) require the respective target hash result to match the respective expected hash result, and b) require the respective unlocking script to comprise a respective signature generated using the expected public key in order to be unlocked by the unlocking script.
Statement 19. The method of statement 17 or statement 18, comprising: generating one or more further blockchain transactions, wherein each further transaction comprises one or more respective outputs, each respective output comprising a respective locking script configured to, when executed together with a respective unlocking script of a different respective blockchain transaction comprising a respective target public key, generate a respective hash result of the respective target public key, wherein the respective locking script comprises a respective HF script configured to generate the respective hash result by performing at least the steps of: generating a respective first intermediate result based on a multiplication of the target data item by a respective first parameter, generating a respective second intermediate result based on an addition of a respective second parameter to the respective first intermediate result, generating a respective third intermediate result based on a modulo of the respective second intermediate result by a respective third parameter; and generating the respective hash result based on a modulo of the respective third intermediate result by a respective fourth parameter.
wherein each respective locking script comprises a respective one of the plurality of expected hash results, and wherein the respective locking script is configured to a) require the respective target hash result to match the respective expected hash result, and b) require the respective unlocking script to comprise a respective signature generated using the expected public key in order to be unlocked by the unlocking script.
Statement 20. The method of any of statements 17 to 19, wherein said generating of the plurality of different respective expected hash results for the expected public key P comprises i) generating a respective intermediate hash result by applying the hash function HashuFTE(P) to the expected public key P for different respective values of one, some or all of: the first parameter, the second parameter, the third parameter, the fourth parameter; and ii) hashing the respective intermediate hash result with a cryptographic hash function.
Statement 21. The method of statement 20 when dependent on statement 1801 statement 19, wherein the modulo of the respective third intermediate result by the respective fourth parameter generated by the respective HF script is a respective intermediate hash result, and wherein the respective HF script is configured to generate the respective expected hash result by hashing the respective intermediate hash result with the cryptographic hash function.
Statement 22. The method of statement 20 or statement 21, wherein the cryptographic hash function is one of: RIPEMD160, SHA256, or a combination of RIPEMD160 and SHA256.
Statement 23. The method of any of statements 17 to 22, comprising: storing the plurality of expected hash results, or a respective shortened version thereof, in a look-up table mapped to at least one of: the expected public key or an index thereof.
Statement 24. 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 preceding statement.
Statement 25. 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 statement 1 to 16.
According to another aspect disclosed herein, there may be provided a method comprising the actions of the first party and the second party.
According to another aspect disclosed herein, there may be provided a system comprising the computer equipment of the first party and the second party.

Claims (25)

  1. CLAIMS1. A computer-implemented method of implementing a hash function, HF, using blockchain transactions, wherein the method is performed by a first party and comprises: generating a first blockchain transaction; and submitting the first blockchain transaction to one or more nodes of a blockchain network, wherein the first blockchain transaction comprises a locking script configured to, when executed together with an unlocking script of a second blockchain transaction comprising a target data item, generate a hash result of the target data item, wherein the locking script comprises a HF script configured to generate the hash result by performing at least the steps of: generating a first intermediate result based on a multiplication of the target data item by a first parameter, generating a second intermediate result based on an addition of a second parameter to the first intermediate result, generating a third intermediate result based on a modulo of the second intermediate result by a third parameter; and generating the hash result based on a modulo of the third intermediate result by a fourth parameter.
  2. 2. The method of claim 1, wherein the first locking script is configured to output at least the hash result.
  3. 3. The method of claim 1 or claim 2, wherein the locking script comprises an expected hash result, and wherein the locking script is configured to require the target hash result to match the expected hash result in order to be unlocked by the unlocking script.
  4. 4. The method of claim 3, wherein the expected hash result is generated by applying the hash function to an expected public key.
  5. 5. The method of claim 4, wherein the locking script is configured to require the target data item to be the expected public key, and to comprise a signature generated using a private key corresponding to the expected public key.
  6. 6. The method of claim 4 or claim 5, comprising: storing the expected hash result, or a shortened version thereof, in a look-up table mapped to at least one of: the expected public key, data associated with the first blockchain transaction, and/or data associated with a spending transaction that spends an output of the first blockchain transaction.
  7. 7. The method of claim 6, wherein: the data associated with the first blockchain transaction comprises a transaction identifier of the first blockchain transaction and/or the first blockchain transaction itself; and/or the data associated with the spending transaction comprises a transaction identifier of the spending transaction and/or the spending transaction itself.
  8. 8. The method of claim 6 or claim 7, wherein the look-up table comprises a plurality of different hash results or shortened versions thereof, each generated by applying the universal hash function to a different public key, and wherein each different hash result is mapped to at least one of: the different public key, data associated with a respective blockchain transaction comprising the different hash result, and/or data associated with a respective spending transaction that spends an output of the respective blockchain transaction.
  9. 9. The method of claim 1 or claim 2, wherein the locking script comprises a public key derivation, PKD, script configured to generate a child public key of a parent public key, wherein the PKD script comprises the HF script, and wherein the unlocking script comprises the parent public key, and wherein the target data item comprises at least a chain code of a parent public key and the parent public key, and wherein the PKD script is configured to generate the child public key based on the parent public key and the hash result.
  10. 10. The method of claim 9, wherein the target data item comprises additional data.
  11. 11. The method of claim 10, wherein the additional data comprises at least one of: an index of the child public key, a timestamp, and/or a message.
  12. 12. The method of any of claims 9 to 11, wherein the PKD script comprises a binary conversion script, a point multiplication script and a point addition script, wherein the binary conversion script is configured to covert the hash result to a binary representation, wherein the point multiplication script is configured to perform point multiplication of the binary representation of the hash result with a generator point of an elliptic curve to generate an intermediate public key, and wherein the point addition script is configured to perform point addition of the intermediate public key and the parent public key to generate the child public key.
  13. 13. The method of claim 12, wherein the hash result is represented in a decimal or hexadecimal representation, and wherein the binary conversion script is configured to convert the decimal or hexadecimal representation of the hash result to the binary representation.
  14. 14. The method of any preceding claim, wherein the first parameter is any non-zero number, the second parameter is any number, the third parameter is a positive number, and the fourth parameter is 2^1_, wherein L is chosen to define a length of the hash result.
  15. 15. The method of claim 14, wherein p is a prime number defining the sec9256k1 elliptic curve.
  16. 16. The method of claim 14 or claim 15, wherein L is one of: 32, 64, 128, 160, 256, or 512.
  17. 17. The method of any preceding claim, wherein the hash function is defined as HashuHF(P) = [ay + bi mod p] mod n, where ai is the first parameter, bi is the second parameter, p is the third parameter, and n is the fourth parameter, and wherein the method comprises: generating a plurality of different respective expected hash results for the expected public key P by applying the hash function HashuHF(P) to the expected public key P for different respective values of one, some or all of: the first parameter, the second parameter, the third parameter, the fourth parameter.
  18. 18. The method of claim 17, wherein the first blockchain transaction comprises a plurality of respective outputs, each respective output comprising a respective locking script configured to, when executed together with a respective unlocking script of a different respective blockchain transaction comprising a respective target public key, generate a respective hash result of the respective target public key, wherein the respective locking script comprises a respective HF script configured to generate the respective hash result by performing at least the steps of: generating a respective first intermediate result based on a multiplication of the target data item by a respective first parameter, generating a respective second intermediate result based on an addition of a respective second parameter to the respective first intermediate result, generating a respective third intermediate result based on a modulo of the respective second intermediate result by a respective third parameter; and generating the respective hash result based on a modulo of the respective third intermediate result by a respective fourth parameter.wherein each respective locking script comprises a respective one of the plurality of expected hash results, and wherein the respective locking script is configured to a) require the respective target hash result to match the respective expected hash result, and b) require the respective unlocking script to comprise a respective signature generated using the expected public key in order to be unlocked by the unlocking script.
  19. 19. The method of claim 17 or claim 18, comprising: generating one or more further blockchain transactions, wherein each further transaction comprises one or more respective outputs, each respective output comprising a respective locking script configured to, when executed together with a respective unlocking script of a different respective blockchain transaction comprising a respective target public key, generate a respective hash result of the respective target public key, wherein the respective locking script comprises a respective HF script configured to generate the respective hash result by performing at least the steps of: generating a respective first intermediate result based on a multiplication of the target data item by a respective first parameter, generating a respective second intermediate result based on an addition of a respective second parameter to the respective first intermediate result, generating a respective third intermediate result based on a modulo of the respective second intermediate result by a respective third parameter; and generating the respective hash result based on a modulo of the respective third intermediate result by a respective fourth parameter.wherein each respective locking script comprises a respective one of the plurality of expected hash results, and wherein the respective locking script is configured to a) require the respective target hash result to match the respective expected hash result, and b) require the respective unlocking script to comprise a respective signature generated using the expected public key in order to be unlocked by the unlocking script.
  20. 20. The method of any of claims 17 to 19, wherein said generating of the plurality of different respective expected hash results for the expected public key P comprises i) generating a respective intermediate hash result by applying the hash function HashuHF(P) to the expected public key P for different respective values of one, some or all of: the first parameter, the second parameter, the third parameter, the fourth parameter; and ii) hashing the respective intermediate hash result with a cryptographic hash function.
  21. 21. The method of claim 20 when dependent on claim 18 or claim 19, wherein the modulo of the respective third intermediate result by the respective fourth parameter generated by the respective HF script is a respective intermediate hash result, and wherein the respective HF script is configured to generate the respective expected hash result by hashing the respective intermediate hash result with the cryptographic hash function.
  22. 22. The method of claim 20 or claim 21, wherein the cryptographic hash function is one of: RIPEMD160, SHA256, or a combination of RIPEMD160 and SHA256.
  23. 23. The method of any of claims 17 to 22, comprising: storing the plurality of expected hash results, or a respective shortened version thereof, in a look-up table mapped to at least one of: the expected public key or an index thereof.
  24. 24. 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 preceding claim.
  25. 25. 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 23.
GB2201957.4A 2021-04-07 2022-02-15 Blockchain-implemented hash function Pending GB2615596A (en)

Priority Applications (5)

Application Number Priority Date Filing Date Title
GB2201957.4A GB2615596A (en) 2022-02-15 2022-02-15 Blockchain-implemented hash function
PCT/EP2022/055704 WO2022214255A1 (en) 2021-04-07 2022-03-07 Blockchain-implemented hash function
JP2023561211A JP2024513084A (ja) 2021-04-07 2022-03-07 ブロックチェーン実装ハッシュ関数
EP22713576.1A EP4320804A1 (en) 2021-04-07 2022-03-07 Blockchain-implemented hash function
CN202280025794.XA CN117121434A (en) 2021-04-07 2022-03-07 Hash function for blockchain implementation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
GB2201957.4A GB2615596A (en) 2022-02-15 2022-02-15 Blockchain-implemented hash function

Publications (2)

Publication Number Publication Date
GB202201957D0 GB202201957D0 (en) 2022-03-30
GB2615596A true GB2615596A (en) 2023-08-16

Family

ID=80820927

Family Applications (1)

Application Number Title Priority Date Filing Date
GB2201957.4A Pending GB2615596A (en) 2021-04-07 2022-02-15 Blockchain-implemented hash function

Country Status (2)

Country Link
CN (1) CN117121434A (en)
GB (1) GB2615596A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060218176A1 (en) * 2005-03-24 2006-09-28 International Business Machines Corporation System, method, and service for organizing data for fast retrieval
WO2018050229A1 (en) * 2016-09-15 2018-03-22 Telefonaktiebolaget Lm Ericsson (Publ) Integrity protected capacity license counting
WO2018217788A1 (en) * 2017-05-23 2018-11-29 Materialytics, LLC Distributed ledger for physical material
US20190208422A1 (en) * 2018-01-03 2019-07-04 Helium Systems , Inc. Systems and methods for providing and using a decentralized wireless network
US20200139631A1 (en) * 2018-11-07 2020-05-07 Velo3D, Inc. Data assurance in three-dimensional forming
US20200265534A1 (en) * 2019-02-20 2020-08-20 Aon Risk Services, Inc. Of Maryland Digital Property Authentication and Management System
US20210036854A1 (en) * 2019-07-31 2021-02-04 The Toronto-Dominion Bank Dynamic implementation and management of hash-based consent and permissioning protocols

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060218176A1 (en) * 2005-03-24 2006-09-28 International Business Machines Corporation System, method, and service for organizing data for fast retrieval
WO2018050229A1 (en) * 2016-09-15 2018-03-22 Telefonaktiebolaget Lm Ericsson (Publ) Integrity protected capacity license counting
WO2018217788A1 (en) * 2017-05-23 2018-11-29 Materialytics, LLC Distributed ledger for physical material
US20190208422A1 (en) * 2018-01-03 2019-07-04 Helium Systems , Inc. Systems and methods for providing and using a decentralized wireless network
US20200139631A1 (en) * 2018-11-07 2020-05-07 Velo3D, Inc. Data assurance in three-dimensional forming
US20200265534A1 (en) * 2019-02-20 2020-08-20 Aon Risk Services, Inc. Of Maryland Digital Property Authentication and Management System
US20210036854A1 (en) * 2019-07-31 2021-02-04 The Toronto-Dominion Bank Dynamic implementation and management of hash-based consent and permissioning protocols

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"Universal hashing", BitcoinWiki [online], dated 6 November 2018, available from: https://en.bitcoinwiki.org/wiki/Universal_hashing [Accessed on 8/7/22] *
"Universal hashing", Wikipedia [online], available from https://en.wikipedia.org/wiki/Universal_hashing [Accessed on 8/7/22] *
Information Processing Letters, Vol. 37, No. 5, March 1991, IEE, J K Mullin, "A caution on universal classes of hash functions", pages 247 to 256. *

Also Published As

Publication number Publication date
GB202201957D0 (en) 2022-03-30
CN117121434A (en) 2023-11-24

Similar Documents

Publication Publication Date Title
US20230291585A1 (en) Method of generating a public key
US20230134619A1 (en) Method of generating a hash-based message authentication code
WO2022268430A1 (en) Tiered consensus
GB2615596A (en) Blockchain-implemented hash function
EP4320804A1 (en) Blockchain-implemented hash function
WO2023156099A1 (en) Identity-linked blockchain addresses
GB2605776A (en) Blockchain-implemented hash function
GB2606526A (en) Multi-party blockchain address scheme
GB2606528A (en) Multi-party blockchain address scheme
WO2022238066A1 (en) Multi-party blockchain address scheme
WO2023041270A1 (en) Generating blockchain transactions
WO2023036548A1 (en) Signature verification
WO2023117274A1 (en) Signature-based atomic swap
GB2615081A (en) Elliptic curve arithmetic in script
WO2023144068A1 (en) Elliptic curve arithmetic in script
KR20240034793A (en) Enforcement of conditions on blockchain transactions
GB2621858A (en) Blockchain transaction
WO2024017786A1 (en) Proving and verifying input data
GB2621857A (en) Blockchain transaction
WO2023174629A1 (en) Improved hill cipher encryption based on blockchain
KR20240037243A (en) Enforcement of conditions on blockchain transactions
EP4371271A1 (en) Blockchain blocks &amp; proof-of-existence
GB2616623A (en) Computer implemented methods &amp; systems
GB2606196A (en) Subtree-based storage and retrieval of merkle tree data