Modifiable blockchain transaction
Non-final previous transaction signing in blockchain transactions allows selected fields of the previous transaction to be signed, enabling modifications after signing, thus addressing the inflexibility of existing mechanisms.
Patent Information
- Application Number
- PCT/EP2024/076250
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-26
- Filing Date
- 2024-09-19
- Publication Date
- 2025-04-03
AI Technical Summary
Existing blockchain transaction mechanisms require a signature to be generated over a complete previous transaction, making it impossible to modify the transaction after the signature is generated, as the message signed includes the transaction identifier, which is a hash of the transaction.
The implementation of non-final previous transaction signing, which allows users to sign only selected fields of the previous transaction, enabling modifications to the transaction after signing. This is achieved through a computer-implemented method that provides a first locking script configured to reconstruct the non-final blockchain transaction based on the modifiable transaction.
This solution allows for the generation of modifiable blockchain transactions, enabling modifications to the transaction after signing without invalidating the signature, thus providing flexibility in transaction signing requirements.
Smart Images

Figure EP2024076250_03042025_PF_FP_ABST
Abstract
Description
[0001]BLOCKCHAIN TRANSACTION TECHNICAL FIELD The present disclosure relates to a computer implemented method for generating a modifiable blockchain transaction, and computer equipment and a computer program for implementing the method. BACKGROUND To generate a signature over a previous blockchain transaction, a private key is used to sign a message. The message comprises a set of fields of the previous transaction, including for example a transaction identifier, a hash sequence, and at least a portion of the locking script being spent. Based on the signature and the previous blockchain transaction, it can be verified that the previous transaction has not been modified since the signature was generated. SUMMARY In some instances, it is desirable to provide a mechanism in which a signer can sign a blockchain transaction before it is complete, i.e. the transaction is modified after the signature is generated. However, since the message signed comprises the blockchain transaction identifier, which is a hash of the transaction, it is not possible to modify the transaction after the signature has been generated. Other components of the message may also change if the transaction is modified. The signature verification opcodes in blockchain traditionally require signing the complete previous transaction. Non-final previous transaction signing is provided here, which can be fully implemented in script to lock a blockchain transaction output to a signature where the signed previous transaction is non-final. Non-final means that the previous transaction hasn’t been included in the blockchain yet and may be modified without invalidating the signature. This works by requiring the signature to only sign selected fields of the previous transaction. In the methods provided herein, users can exclude signing some selected fields of the previous transaction. This enables many applications where users would like to omit signing some fields of the previous transaction, either because they allow these fields to change after they sign, or because the complete previous transaction is not known yet. According to one aspect disclosed herein, there is provided a computer-implemented method for generating a non-final blockchain transaction comprising a first portion, wherein the non-final blockchain transaction is for signing by a signer, wherein the non-final blockchain transaction is for modifying after signing to generate a modifiable blockchain transaction, the method comprising: providing a first locking script, wherein the first locking script is configured, when executed together with a first unlocking script of a signature blockchain transaction, to reconstruct the non-final blockchain transaction based on the modifiable blockchain transaction; and making the non-final blockchain transaction available to the signer. According to a second aspect disclosed herein, there is provided a computer-implemented method for generating a modifiable blockchain transaction comprising a first portion and a second portion, wherein a non-final blockchain transaction is a blockchain transaction comprising the first portion and not the second portion, the method comprising: obtaining the non-final blockchain transaction, wherein the non-final blockchain transaction comprises a first locking script which is configured, when executed together with a first unlocking script of a signature blockchain transaction, to reconstruct the non-final blockchain transaction based on the modifiable blockchain transaction; determining that a signature has been generated based on the non-final blockchain transaction; and in response to determining that the signature has been generated, modifying the non-final blockchain transaction to include the second portion to generate the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS To assist understanding of embodiments of the present disclosure and to show how such embodiments may be put into effect, reference is made, by way of example only, to the accompanying drawings in which: Figure 1 is a schematic block diagram of a system for implementing a blockchain; Figure 2 schematically illustrates some examples of transactions which may be recorded in a blockchain; Figure 3 shows a structure of a spending transaction and a SIGHASH preimage; Figure 4 illustrates generating a non-final SIGHASH preimage from a current SIGHASH preimage; Figure 5 shows a previous transaction and a corresponding non-final transaction, where a locking script of the previous transaction is partially signed; Figure 6 provides an example method for generating a modifiable transaction; Figure 7 illustrates different document signing options; Figure 8A illustrates sequential signing using chained transactions; Figure 8B provides a multisignature signing scheme; Figure 9 illustrates sequential signing using scripted code separator; and Figure 10 provides an example method for sequential signing. DETAILED DESCRIPTION OF EMBODIMENTS 1. BLOCKCHAIN SIGNATURES A blockchain signature is the concatenation of an ECDSA signature with a SIGHASH flag. The SIGHASH flag determines which part of a current (spending) transaction is signed by the signature. The message signed is known as the SIGHASH preimage and contains the following fields: 1. nVersion of the transaction (4-byte little endian). 2. hashPrevouts (32 bytes): double SHA256 hash of the serialization of all input outpoints (=concatenation of hash and n). 3. hashSequence (32 bytes): double SHA256 hash of the serialization of nSequence of all inputs. 4. hash (32 bytes): TXID of the previous transaction. 5. n (4-byte little endian): index of the spent output in the list of outputs of the previous transaction. 6. scriptCode: serialised script where everything up to and including the last executed OP_CODESEPARATOR is removed. 7. nValue (8-byte little endian): amount of bitcoin spent by this input. 8. nSequence of the input (4-byte little endian). 9. hashOutputs (32 bytes): double SHA256 of the serialization of all output amount and their corresponding scriptPubKey. 10. nLocktime of the transaction (4-byte little endian). 11. nHashType (4-byte little endian): SIGHASH flag. Figure 3 shows the structure of a spending transaction 302 whose input ^^ ^^ ^^[ ^^] spends the output ^^ ^^ ^^ ^^[ ^^] of the previous transaction 304. It also shows the structure of the SIGHASH preimage 306 whose signature is included in scriptSig in ^^ ^^ ^^[ ^^]. 1.1.1 ECDSA Signature Generation In Bitcoin, an ECDSA signature is a pair of 256-bit numbers ( ^^, ^^) encoded in DER format that is generated as follows: 1. Calculate ^^ = ^^ ⋅ ^^. a. ^^ is an Elliptic Curve Point with coordinates ( ^^, ^^). b. ^^ is a randomly generated 256-bit ephemeral key. c. ^^ is the generator of the secp256k1 Elliptic Curve. 2. Calculate ^^ = ^^ mod ^^. a. ^^ is one of the 256-bit numbers in the signature. b. ^^ is the order of the secp256k1 Elliptic Curve. 3. Calculate ^^ = ^^ି^( ^^ + ^^ × ^^) mod ^^. a. ^^ is one of the 256-bit numbers in the signature. b. ^^ି^is the modular multiplicative inverse of ^^. c. ^^ is the hash digest of the message signed. In Bitcoin, the hash function used is double SHA256 (SHA256 applied twice). d. ^^ is the 256-bit private key. 4. Encode ( ^^, ^^) in DER format. 1.1.2 ECDSA signature verification Given a message ^^, an ECDSA signature ( ^^, ^^) on that message that was created with the private key ^^ corresponding to the public key ^^, the signature is verified in the following way. 1. Check that ^^ is not the identity element of the EC. 2. Verify that ( ^^, ^^) are integers in the range [1, ^^ − 1]. 3. Calculate ^^ = ℎ ^^ ^^ℎ( ^^). 4. Calculate ^^ = ^^ × ^^ି^mod ^^, ^^ = ^^ × ^^ି^mod ^^. 5. Calculate(^^, ^^)= ^^ ⋅ ^^ + ^^ ⋅ ^^.6. If ( ^^, ^^) is the identity element, then reject. 7. If ^^ = ^^ mod ^^, accept. Otherwise, reject. 1.2 Computing a Blockchain Signature in Script The ECDSA signature generation can be implemented in script. This can then be extended to a signature generation script segment GENSIG by appending the SIGHASH flag to the end of the signature: Locking script: [GENSIG] : = OP_HASH256 < ^^ି^> OP_MUL < ^^ି^^^ ^^> OP_ADD < ^^> OP_MOD < ^^> OP_SWAP [toDER] <SIGHASH flag> OP_CAT Unlocking script: < ^^> The script segment toDER encodes the signature using DER encoding, as required by OP_CHECKSIG. As GENSIG is not used for authenticity, a private key ^^ and an ephemeral key ^^ can be chosen at wish and shown publicly. 1.3 Verifying a Blockchain Signature The ECDSA signature verification can be implemented in script as follows. Locking script: [VERSIG] : = / / 0. Push ^^, ^^, ^^, and then ^^ to the altstack OP_3DUP OP_ROT OP_TUCK OP_TOALTSTACK OP_TOALTSTACK OP_TOALTSTACK OP_TOALTSTACK / / 1. ^^ is not ^^ < ^^> OP_EQUAL OP_NOT OP_VERIFY / / 2. ^^ and ^^ are in the range [1, ^^ − 1] OP_DUP OP_0 OP_GREATERTHAN OP_VERIFY < ^^> OP_LESSTHAN OP_VERIFY OP_DUP OP_0 OP_GREATERTHAN OP_VERIFY < ^^> OP_LESSTHAN OP_VERIFY / / 3. Compute ^^ = ℎ ^^ ^^ℎ( ^^) OP_HASH256 / / 4.a. Compute ^^ି^OP_FROMALTSTACK < ^^> [MODINV] OP_DUP OP_TOALTSTACK / / 4.b. Compute ^^ = ^^ × ^^ି^mod ^^ OP_MUL < ^^> OP_MOD / / 4.c. Compute ^^ = ^^ × ^^ି^mod ^^ OP_FROMALTSTACK OP_FROMALTSTACK OP_MUL < ^^> OP_MOD / / 5. Compute ( ^^, ^^) = ^^ ⋅ ^^ + ^^ ⋅ ^^ OP_FROMALTSTACK [ECPMULT] OP_SWAP < ^^> [ECPMULT] [ECPADD] / / 6. Check ( ^^, ^^) is not ^^ OP_DUP OP_TOALTSTACK < ^^> OP_EQUAL OP_NOT OP_VERIFY / / 7. Check ^^ == ^^ mod ^^ OP_FROMALTSTACK [ECPX] < ^^> OP_MOD OP_FROMALTSTACK OP_EQUAL Unlocking script: < ^^> < ^^> < ^^> < ^^> where: • MODINV does modular inverse computation, • ECPMULT does elliptic curve point multiplication, • ECPADD does elliptic curve point addition, • ECPX extracts the ^^ value of an elliptic curve point. 1.4 Push Transaction and its Derivatives PUSHTX PUSHTX verifies that the SIGHASH preimage of the current input is on the stack. PUSHTX takes as input a SIGHASH preimage and works as follows: 1. signs the SIGHASH preimage using GENSIG, 2. verifies the signature using OP_CHECKSIG. If the check passes, it implies that the SIGHASH preimage given as input is equal to the message constructed by OP_CHECKSIG. In other words, the SIGHASH preimage given as input is the SIGHASH preimage of the current input, valid for the SIGHASH flag used in GENSIG. PUSHTX can be constructed as follows: Locking script: [PUSHTX] : = OP_DUP [GENSIG] < ^^> OP_CHECKSIGVERIFY Unlocking script: <SIGHASH preimage> The public key ^^ corresponds to the private key ^^ used in GENSIG. PUSHTXPARENT The PUSHTX technique can be extended to verify that the previous transaction is on the stack. This technique is referred to as PUSHTXPARENT. PUSHTXPARENT takes as input a serialised transaction and a SIGHASH preimage. It works as follows: 1. extracts the TXID of the previous transaction from the SIGHASH preimage (hash field), 2. signs the SIGHASH preimage using GENSIG and verifies the signature using OP_CHECKSIG. This ensures that the SIGHASH preimage is the SIGHASH preimage of the current input, valid for the SIGHASH flag used in GENSIG, 3. computes the double SHA256 hash of the serialised transaction, 4. verifies that the hash is equal to the extracted TXID. If the check passes, it implies that the serialised transaction on the stack is the serialised previous transaction. Moreover, it implies that the SIGHASH preimage on the stack is the SIGHASH preimage of the current input, valid for the SIGHASH flag used in GENSIG. PUSHTXPARENT can be constructed as follows: Locking script: [PUSHTXPARENT] : = [extractTXID] OP_TOALTSTACK [GENSIG] < ^^> OP_CHECKSIGVERIFY OP_DUP OP_HASH256 OP_FROMALTSTACK OP_EQUALVERIFY Unlocking script: <Serialised previous transaction> <SIGHASH preimage> The script segment extractTXID extracts the TXID (hash field) from the SIGHASH preimage. 1.5 OP_CODESEPERATOR OP_CODESEPARATOR is an opcode that specifies which part of the locking script is included in the scriptCode field of the SIGHASH preimage. When the transaction validation engine reaches a signature verification opcode (OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG, or OP_CHECKMULTISIGVERIFY), the scriptCode field of the SIGHASH preimage signed only contains the script that comes after the most recently executed OP_CODESEPARATOR. OP_CODESEPARATOR is only effective if it is read by a signature verification opcode contained in the same locking script. OP_CODESEPARATOR can be used to build scripts where users can omit part of the locking script being signed, such as in contracts with signature witness statements. For instance, we can construct the following locking script: Locking script: <Contract> OP_DROP < ^^ௌ^^^^௧^^௬> OP_CHECKSIGVERIFY OP_CODESEPARATOR <Witness statement> OP_DROP < ^^^^௧^^^^> OP_CHECKSIG The corresponding unlocking script would be the following: Unlocking script: In this case, OP_CHECKSIGVERIFY verifies < ^^ ^^ ^^ௌ^^^^௧^^௬> < ^^ௌ^^^^௧^^௬> on the full locking script while OP_CHECKSIG verifies < ^^ ^^ ^^^^௧^^^^> < ^^^^௧^^^^> only on the locking script that comes after OP_CODESEPARATOR, i.e.: <Witness statement> OP_DROP < ^^^^௧^^^^> OP_CHECKSIG. In this case, OP_CODESEPARATOR allows the signatory to hide the contract from the witness. Even though OP_CODESEPARATOR allows users to omit signing some parts of the locking script, they still have to sign the TXID of the previous transaction containing the full locking script. Since the TXID of the previous transaction is a hash of the transaction, this means that the signature is bound to the full locking script, even though they may not have had access to it. Thus, the previous transaction cannot be changed after the signature is generated. 2. NON-FINAL PREVIOUS TRANSACTION SIGNING Herein is provided non-final previous transaction signing, or non-final prev TX signing, a new technique to lock a transaction output to a signature that only signs selected fields of the previous transaction. The previous transaction that is signed is referred to as a non-final previous transaction. The non-final previous transaction can then be modified to generate the previous transaction, which is ultimately recorded to the blockchain. Non-final previous TX signing is similar to SIGHASH flags in the sense that it allows some fields of the transaction to change after the signature is generated. The difference is that this technique applies to the previous transaction whereas SIGHASH flags apply on the spending transaction. The non-final prev TX signing mechanism provided herein provides flexibility to signature requirements enforced on chain. 2.1 Specification CHECKSIG_NONFINALTX is used herein to refer to a script segment implementation of the non-final previous TX signing technique. CHECKSIG_NONFINALTX takes as input a signature and verifies that it correctly signs the spending transaction and non-final previous transaction. More specifically, the message that is signed must be the SIGHASH preimage of the current input at the time when the signature was generated, i.e. when the previous transaction was not final yet. This SIGHASH preimage is referred to as a non-final SIGHASH preimage. The unlocking scripts of the previous transaction inputs are not signed since they are added last when finalising the previous transaction. Figure 4 shows the CHECKSIG_NONFINALTX construction. It works as follows: 1. Push the previous transaction 402 and the current SIGHASH preimage 404 on the stack using PUSHTXPARENT. 2. Reconstruct the non-final previous transaction 406 from the previous transaction 402. Remove the unlocking scripts of the inputs of the previous transaction 402. CONSTRUCT_NONFINALTX refers to the corresponding script segment. 3. Reconstruct the non-final SIGHASH preimage 408 from the current SIGHASH preimage 404 and the non-final previous transaction 406. 4. Verify that the signature correctly signs the reconstructed non-final SIGHASH preimage 408 using VERSIG. Optionally, CHECKSIG_NONFINALTX may bind the signature to a specific public key, like in P2PKH scripts. The fields that can differ between the non-final SIGHASH preimage and the current SIGHASH preimage pushed on the stack are hashPrevouts, hash, and scriptCode. They are described below: 1. hashPrevouts: the hash of the concatenation of all the outpoints referenced in the spending transaction. There are two distinct cases, depending on whether the signature uses the ANYONECANPAY SIGHASH flag or not. A signature whose ANYONECANPAY flag is set doesn’t sign any of the outpoints of the inputs in the spending transaction. In this case, the hashPrevouts field of the SIGHASH preimage is zeroed out and is the same between the non-final SIGHASH preimage and current SIGHASH preimage. A signature whose ANYONECANPAY flag is not set signs the outpoints of all the inputs in the spending transaction. However, the full previous transaction is not known when the signature is generated. This implies that the hashPrevouts field of the non-final SIGHASH preimage differs from that of the current SIGHASH preimage. In particular, the hashPrevouts field of the current SIGHASH preimage must be modified to include the outpoint referencing the non-final previous transaction instead of the final previous transaction. 2. hash field: the TXID of the previous transaction. The hash field of the current SIGHASH preimage must be replaced by the TXID of the non-final previous transaction. 3. scriptCode: the serialised script where everything up to and including the last executed OP_CODESEPARATOR is removed. CHECKSIG_NONFINALTX may allow the locking script in the non-final transaction to change after the signature is generated. In this case, the scriptCode field of the non-final SIGHASH preimage must be reconstructed from the scriptCode field of the current SIGHASH preimage, e.g. by removing opcodes that were added after the signature is generated. The corresponding script segment is labelled CONSTRUCT_NONFINALSCRIPT. In the following, the implementation of CHECKSIG_NONFINALTX is detailed. Two cases are distinguished: firstly, when the signature omits signing the outpoints of the inputs in the spending transaction (ANYONECANPAY set), and secondly, when it signs them (ANYONECANPAY not set). While reconstruction is the main example of generating the non-final transaction described herein, a skilled person would appreciate that variations of the specific reconstruction steps set out herein and other methods could be used to generate the locking script. 2.1.1 ANYONECANPAY Set When the signature does not sign the outpoints referenced by the other inputs in the spending transaction, CHECKSIG_NONFINALTX can be constructed as follows: 1. Call PUSHTXPARENT using the ANYONECANPAY flag. The serialised previous transaction and the SIGHASH preimage of the current input are on the stack. The value of the hashPrevouts field of the SIGHASH preimage is zero. 2. Call CONSTRUCT_NONFINALTX to reconstruct the non-final previous transaction from the serialised previous transaction. 3. Calculate hash’, the double SHA-256 hash of the non-final previous transaction. 4. Replace the hash field of the SIGHASH preimage with hash’. 5. Call CONSTRUCT_NONFINALSCRIPT to reconstruct the scriptCode field of the non-final SIGHASH preimage from the scriptCode field of the current SIGHASH preimage. At this stage, the non-final SIGHASH preimage is on the stack. 6. Call VERSIG to verify that the signature provided in the unlocking script correctly signs the reconstructed non-final SIGHASH preimage. A possible implementation of CHECKSIG_NONFINALTX when ANYONECANPAY is set is shown below. Locking script: [CHECKSIG_NONFINALTX] : = / * Push the previous transaction and SIGHASH preimage on the stack with the ANYONECANPAY flag set* / OP_TUCK [PUSHTXPARENT] / / Construct the non-final previous tx and push its TXID (hash’) on the alt stack [CONSTRUCT_NONFINALTX] OP_HASH256 OP_TOALTSTACK / / Replace the hash field of the SIGHASH preimage with hash’ <68> OP_SPLIT <32> OP_SPLIT OP_NIP OP_FROMALTSTACK OP_SWAP OP_CAT OP_CAT / * Reconstruct the scriptCode field of the non-final SIGHASH preimage from the scriptCode field of the current SIGHASH preimage* / <104> OP_SPLIT OP_SIZE <52> OP_SUB OP_SPLIT OP_SWAP [CONSTRUCT_NONFINALSCRIPT] OP_SWAP OP_CAT OP_CAT / / Verify the signature OP_SWAP OP_2SWAP OP_ROT [VERSIG] This can be unlocked as follows. Unlocking script: < ^^> < ^^> < ^^> <Serialised previous transaction> <SIGHASH preimage> The value ( ^^, ^^) is an ECDSA signature, valid for the public key ^^, that signs the non-final SIGHASH preimage with the ANYONECANPAY flag set. The serialised previous transaction and the SIGHASH preimage provided in the unlocking script are that of the final previous transaction, that were recorded on chain. 2.1.2 ANYONECANPAY Not Set In the following, it is shown how CHECKSIG_NONFINALTX can be constructed when the signature signs the outpoints of all the inputs in the spending transaction, i.e. when the ANYONECANPAY flag is not set. hashPrevouts’ refers to the hash of the concatenation of all outpoints referenced in the spending transaction where the outpoint spent by the current input includes the TXID of the non-final transaction. CHECKSIG_NONFINALTX must calculate hashPrevouts’ to reconstruct the non-final SIGHASH preimage. To achieve this, the list of individual outpoints referenced by the inputs in the spending transaction is required as input. This list is provided in the unlocking script. When the signature signs the outpoints referenced by the inputs in the spending transaction, CHECKSIG_NONFINALTX can be constructed as follows: 1. Calculate hashPrevout from the ordered list of outpoints given as input. 2. Reconstruct the current SIGHASH preimage from hashPrevout and the other SIGHASH preimage fields given as input. 3. Call PUSHTXPARENT without the ANYONECANPAY flag set. The serialised previous transaction and the SIGHASH preimage of the current input are on the stack. 4. Call CONSTRUCT_NONFINALTX to reconstruct the non-final previous transaction from the serialised previous transaction. 5. Calculate hash’, the double SHA-256 hash of the non-final previous transaction. 6. Calculate hashPrevouts’ from the ordered list of outpoints given as input by replacing the TXID of the outpoint spent by the current input with hash’. The corresponding script segment is labelled REPLACE_OUTPOINT. 7. Replace the hash field of the SIGHASH preimage with hash’. 8. Replace the hashPrevout field of the SIGHASH preimage with hashPrevouts’. 9. Call CONSTRUCT_NONFINALSCRIPT to reconstruct the scriptCode field of the non-final SIGHASH preimage from the scriptCode field of the current SIGHASH preimage. At this stage, the non-final SIGHASH preimage is on the stack. 10. Call VERSIG to verify that the signature provided in the unlocking script correctly signs the reconstructed non-final SIGHASH preimage. A possible implementation of CHECKSIG_NONFINALTX when ANYONECANPAY is not set is shown below. Locking script: [CHECKSIG_NONFINALTX] : = / * Push the list of outpoints and the index ^^ ^^ ^^ of the current input in the ordered list of inputs of the spending transaction on the alt stack* / OP_TUCK OP_TOALTSTACK OP_TOALTSTACK / / Construct the current SIGHASH preimage OP_HASH256 OP_SWAP OP_CAT OP_CAT / * Push the previous transaction and SIGHASH preimage on the stack with the ANYONECANPAY flag not set* / OP_TUCK [PUSHTXPARENT] / / Construct the non-final tx and calculate its TXID (hash’) [CONSTRUCT_NONFINALTX] OP_HASH256 / * Calculate hashPrevouts’ and push hashPrevouts’ and hash’ on the alt stack. The script segment REPLACE_OUTPOINT takes as input an outpoint ^^ ^^ ^^ identifying the output of the non-final blockchain transaction being spent, an index ^^ ^^ ^^, and an ordered list of outpoints, and replaces the outpoint at index ^^ ^^ ^^ in the list of outpoints by the outpoint ^^ ^^ ^^.* / OP_DUP OP_FROMALTSTACK OP_FROMALTSTACK [REPLACE_OUTPOINT] OP_HASH256 OP_TOALTSTACK OP_TOALTSTACK / / Replace the hash field of the SIGHASH preimage with hash’ <68> OP_SPLIT <32> OP_SPLIT OP_NIP OP_FROMALTSTACK OP_SWAP OP_CAT OP_CAT / / Replace the hashPrevouts field of the SIGHASH preimage with hashPrevouts’ <4> OP_SPLIT <32> OP_SPLIT OP_NIP OP_FROMALTSTACK OP_SWAP OP_CAT OP_CAT / * Reconstruct the scriptCode field of the non-final SIGHASH preimage from the scriptCode field of the current SIGHASH preimage* / <104> OP_SPLIT OP_SIZE <52> OP_SUB OP_SPLIT OP_SWAP [CONSTRUCT_NONFINALSCRIPT] OP_SWAP OP_CAT OP_CAT / / Verify the signature OP_SWAP OP_2SWAP OP_ROT [VERSIG] This can be unlocked as follows. Unlocking script: < ^^> < ^^> < ^^> <Serialised previous transaction> <SIGHASH preimage[: 4] ≔ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^> <SIGHASH preimage[36: ] ≔ (ℎ ^^ ^^ℎ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ℎ ^^ ^^ℎ, ^^, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ^^ ^^ ^^ ^^ ^^ ^^, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ℎ ^^ ^^ℎ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ^^ ^^ ^^ ^^ℎ ^^ ^^ ^^ ^^) > < ^^ ^^ ^^> <( ^^ ^^ ^^^, … , ^^ ^^ ^^ே)> The list ( ^^ ^^ ^^^, … , ^^ ^^ ^^ே) is the ordered list of the outpoints referenced by the inputs in the spending transaction, ^^ ^^ ^^ is the index of the current input in the ordered list of inputs of the spending transaction, and ( ^^, ^^) is an ECDSA signature, valid for the public key ^^, that signs the non-final SIGHASH preimage with the ANYONECANPAY flag not set. 2.1.3 Modifiable Transaction The previous transaction provided herein may be referred to as a modifiable blockchain transaction. As described above, the transaction is made modifiable by including the CHECKSIG_NONFINALTX script segment, i.e. by providing a mechanism for the signed, non- final, previous transaction to be reconstructed. The modifiable transaction comprises two parts – a first portion and a second portion. The non-final transaction comprises the first portion and not the second portion. The signature, generated using the non-final transaction, is therefore related to the first portion and not the second portion of the modifiable transaction. The modifiable transaction is generated by providing the locking script which reconstructs the non-final blockchain transaction, and verifies a signature provided in an unlocking script of a next transaction based on the reconstructed non-final blockchain transaction. The next transaction may be referred to as a signature transaction. Specific examples of this locking script are provided above. It will be appreciated that variations may be implemented, as will be apparent to the skilled person. For example, the serialised previous transaction and / or the SIGHASH preimage may not be provided in the unlocking script. 2.2 Non-Final Previous Transaction Signing Options The previous subsection describes the generic implementation of CHECKSIG_NONFINALTX. The full CHECKSIG_NONFINALTX implementation varies depending on which fields of the previous transaction are required to be signed. The different options are obtained by tuning the exact implementations of the script segments CONSTRUCT_NONFINALTX and CONSTRUCT_NONFINALSCRIPT used in CHECKSIG_NONFINALTX. One option consists of signing only part of the locking script, similarly to OP_CODESEPARATOR. The exact CHECKSIG_NONFINALTX implementation for this case is described in the next section. Other options for CHECKSIG_NONFINALTX include: • Not signing any of the inputs of the previous transaction. • Not signing specific inputs of the previous transaction. • Not signing specific outputs of the previous transaction. • Not signing the nVersion field. • Not signing the nLocktime field. • … 2.3 Example Method Figure 6 provides an example method for allowing Bob 103b to sign a non-final Tx 406 generated by Alice 103b. In this implementation, the previous, or modifiable, transaction 402 comprises a first and second portion. After the signature has been generated, the second portion is added to the non-final previous transaction 406, thereby generating the previous Tx 402. At step 1, Alice 103a generates the non-final transaction 406. The non-final Tx 406 comprises first portion and not the second portion. Alice 103a then makes the non-final transaction 406 available to Bob 103b, step 2. Bob 103b generates a signature based on the non-final Tx 406 and using his private key, step 3. Once signed, Bob 103b indicates to Alice 103a that he has signed the non-final transaction 406, step 4. This indication may be in the form of a message sent from Bob 103b to Alice 103b, or may be a notification generated by a third-party system automatically on detecting that Bob 103b has generated a signature. The indication may comprise the signature generated by Bob 103b. On receiving the indication, Alice 103a determines that the signature has been generated. At step 5, Alice 103a completes the previous Tx 402 by including the second portion, and updating other fields which are dependent on the second portion. Alice 103a then makes the completed previous Tx 402 available to one or more nodes of the blockchain 150, where it is stored, step 6. At step 7, Bob 103b generates a signature blockchain transaction comprising an unlocking script comprising his signature generated in step 3. Example unlocking scripts are provided in section 2.1. Bob 103b then makes the signature blockchain transaction available to one or more nodes of the blockchain 150 for storing on chain. As an alternative, Alice 103a, or another party (not shown) could generate the signature blockchain transaction (step 7) and make it available for storing on the blockchain 150 (step 8). In these embodiments, Bob 103b provides his signature generated in step 3 to the party who will generate the signature transactions for including in the transaction. 3. SCRIPTED CODE SEPERATOR In this section, scripted code separator is presented, a new technique that uses non-final prev TX signing to require only a subpart of the locking script of the previous transaction to be signed. Compared to OP_CODESEPARATOR, scripted code separator provides better flexibility on which parts of the locking script are required to be signed. While OP_CODESEPARATOR removes all opcodes before it, scripted code separator can be used to select any parts of the locking script to be signed. Moreover, with OP_CODESEPARATOR the locking script must be final before the signature is generated. This is because the signature signs the TXID of the final previous transaction. That is, the transaction cannot be modified after the signature is generated. Conversely, scripted code separator requires the signature to sign only the TXID of the non-final transaction. This enables the locking script to change after the signature is generated e.g. by adding additional opcodes or data pushes. The following shows how to implement the scripted code separator technique. It details the exact implementation of the CONSTRUCT_NONFINALTX and CONSTRUCT_NONFINALSCRIPT segments employed in CHECKSIG_NONFINALTX. Figure 5 shows how these script segments work. Without loss of generality, the case where opcodes are allowed to be appended to the signed locking script portion, after the signature is generated, is described below. The implementation can easily be adapted to the case where opcodes are allowed to be added before the signed locking script portion or in the middle of it. CONSTRUCT_NONFINALTX: reconstructing the non-final previous TX 504 CONSTRUCT_NONFINALTX takes as input the previous transaction 502 and reconstructs the non-final previous transaction 504 that was signed. ^^ is the number of bytes in the non-final previous transaction 504 that come before the end of the locking script (included), and ^^ is the number of bytes after the end of the locking script (excluded). The values ^^ and ^^ sum up to the size of the non-final previous transaction 504 and are known when CHECKSIG_NONFINALTX is constructed, and are hardcoded in the locking script. CONSTRUCT_NONFINALTX also removes the unlocking scripts of the previous transaction inputs. The script can be constructed to iterate all inputs because the number of inputs # ^^ ^^ ^^ is known when CHECKSIG_NONFINALTX is constructed. The CONSTRUCT_NONFINALTX segment works as follows: 1. For each input in the previous transaction, read the size of the unlocking script and remove the unlocking script from the transaction. 2. Compute ^^, the size of the serialised previous transaction given as input. 3. Calculate ^^ = ^^ − ^^ − ^^, the number of bytes that were added in the locking script after the signature is generated. 4. Subtract ^^ from the scriptPubKeyLen field of the spent output in the previous transaction 502. 5. Split the previous transaction 502 at position ^^. Extract the left part. This part may be referred to as a leading part of the previous transaction 502. 6. Split the previous transaction at position ^^ − ^^. Extract the right part. This part may be referred to as a trailing part of the previous transaction 502. 7. Merge the two parts. The result is the non-final previous transaction 504 that was signed. CONSTRUCT_NONFINALSCRIPT: reconstructing the scriptCode field CONSTRUCT_NONFINALSCRIPT takes as input the scriptCode field of the current SIGHASH preimage and reconstruct the scriptCode field of the non-final SIGHASH preimage that was signed. ^^ is the length of the scriptCode field of the non-final SIGHASH preimage. This value is known when CHECKSIG_NONFINALTX is constructed , and is hardcoded in the locking script. The script segment CONSTRUCT_NONFINALSCRIPT works by splitting the scriptCode field of the SIGHASH preimage at position ^^ and extracting the left part. The result is the scriptCode field of the non-final SIGHASH preimage. A user might try to modify the non-final previous transaction by adding extra outputs after the ^^-th byte of the non-final previous transaction 504 (after the end of the locking script). However, adding an output to the non-final previous transaction implies incrementing the #vout field of the transaction, which would immediately invalidate the signature. Therefore, the modifications are constrained to happen only on the locking script of the spent output. In the example of Figure 5, the fields that change between the previous Tx 502 and the non- final previous Tx 504 are scriptPubKeyLen and scriptCode. In this case, the data push <C> was added after the signature is generated. The scriptCode field signed is: [CHECKSIG_NONFINALTX]. The scripted code separator implementation above allows opcodes to be added after the signed locking script. The implementation where opcodes can be added before the script is very similar. In this case, the definition of the positions ^^ and ^^ are modified accordingly. However, this case must be taken with special care as a malicious user intercepting the non- final previous transaction could add e.g. OP_TRUE OP_RETURN before the signed script. This would have the effect of spending the funds without checking the signature. Therefore, the output of the spending transaction could be malleated. This issue also arises with OP_CODESEPARATOR where a signatory is only given the TXID of the final transaction and asked to produce a signature on the partial locking script without knowing the full locking script. In both cases, the user who finalises the previous transaction must be trusted. Referring to Figure 6, the steps set out in section 2.3 are implemented for generating the modifiable Tx 502 from the non-final transaction 504. In this implementation, the previous, or modifiable, transaction 502 comprises a signed portion and an unsigned portion. After the signature has been generated, the unsigned portion is added to the locking script of the non-final Tx 504, thereby generating the modifiable Tx 502. At step 1, Alice 103a generates the non-final transaction 504. The non-final Tx 504 comprises a locking script which includes the signed portion and not the unsigned portion. Alice 103a then makes the non-final transaction 504 available to Bob 103b, step 2. Bob 103b generates a signature based on the non-final Tx 504 and using his private key, step 3. Once signed, Bob 103b indicates to Alice 103a that he has signed the non-final transaction, step 4. This indication may be in the form of a message sent from Bob 103b to Alice 103b, or may be a notification generated by a third-party system automatically on detecting that Bob 103b has generated a signature. The indication may comprise the signature generated by Bob 103b. On receiving the indication, Alice 103a determines that the signature has been generated. At step 5, Alice 103a completes the modifiable Tx 1502 by including the unsigned portion in the locking script of the modifiable Tx 502, and updating other fields which are dependent on the locking script, such as the scriptPubKeyLen field. Alice 103a then makes the completed modifiable Tx 504 available to one or more nodes of the blockchain 150, where it is stored, step 6. At step 7, Bob 103b generates a signature blockchain transaction comprising an unlocking script comprising his signature generated in step 3. Example unlocking scripts are provided in section 2. Bob 103b then makes the signature blockchain transaction available to one or more nodes of the blockchain 150 for storing on chain. As set out in section 2.3, any party may generate the signature blockchain transaction. Bob 103b need only provide his signature, generated in step 3, to the party generating the signature transaction. 4. SEQUENTIAL SIGNING USING SCRIPTED CODE SEPERATOR An example use case is provided, in which the scripted code separator technique is used to enforce sequential signing of documents where the signatures of all parties are included within a single transaction input. There exist several ways of signing a document, as depicted in Figure 7. Figure 7 shows five different signing options. In concurrent signing 702, the documents are sent to the recipients for signing in any order. Each recipient will sign the same copy of the document. In sequential signing 704, the documents are sent to recipients following a defined order of signing. Each recipient will sign the same copy of the document and will be notified when it is their turn. In group send signing 706, a copy of each document is sent to a group of recipients at once. Each signer gets their own version of the document to sign. In a video signing room mechanism 708, an online meeting is schedules with one or more signers in which the signing session can be shared and recorded via video conferencing. In person signing 710 allows participants to maintain ownership of the documents while securing single user signatures from signers in a shared screen environment. Signers will not receive a link to the document, but will instead be sent a link to a signature pad during the screen share session. In the method provided below, the sequential signing option 704 is used. Sequential signing 704 allows a requestor to send a document to multiple recipients following a defined order of signing. Each recipient signs the same copy of the document in order, therefore signing the signature of the previous recipient in the order of signing. Sequential signing is relevant in witness statements. A witness wants to attest the fact that a signatory signed a document by providing his signature on the signed document. The protocol should ensure that the witness can only provide his signature after the signatory signs the document. One way to achieve this effect using the blockchain is by using two chained transactions, as shown in Figure 8A. The first transaction TxID0stores the document to be signed in its data payload. The signatory with public key ^^ௌsigns the transaction and locks one of its outputs to the witness’ public key ^^^. The witness is then able to spend the transaction by providing their signature in a new transaction TxID1, thereby signing the signatory’s signature and the document. Because the witness signs the signatory’s signature, the witness can only sign after the signatory did. In the method shown in Figure 8B, the same effect is sought to be achieved by having both signatures ^^ ^^ ^^( ^^^) and ^^ ^^ ^^( ^^ௌ) in the same input of the same transaction. In this example, a transaction stores the document and has an output with two signature checks, as depicted in Figure 6. The output can be unlocked by providing signatures ^^ ^^ ^^( ^^^) and ^^ ^^ ^^( ^^ௌ) in the same input of another transaction. However, in the example of Figure 8B, there is no guarantee that ^^ ^^ ^^( ^^ௌ) was produced before ^^ ^^ ^^( ^^^), i.e. that the witness has checked the signature of the signatory before providing his signature. To enforce sequential signing, the signature of the witness is required to sign that of the signatory. In other words, the signature ^^ ^^ ^^( ^^ௌ) is included in the message signed by ^^ ^^ ^^( ^^^). Looking at the example in Figure 8B, the signature ^^ ^^ ^^( ^^ௌ) could be included in the output spent by the signatory and the witness. By doing this, the signature ^^ ^^ ^^( ^^ௌ) is required to sign itself. To solve this, the scripted code separator technique is leveraged to allow the signature ^^ ^^ ^^( ^^ௌ) to be added to the output after the signature is generated. The signature of the witness ^^ ^^ ^^( ^^^) could then sign the full output containing the signatory’s signature ^^ ^^ ^^( ^^ௌ), thereby ensuring sequentially of the signing. Figure 9 describes a sequential signing scheme using the scripted code separator technique. Both signatures ^^ ^^ ^^( ^^^) and ^^ ^^ ^^( ^^ௌ) appear in the same input in the same transaction. By using CHECKSIG_NONFINALTX to verify ^^ ^^ ^^( ^^ௌ), ^^ ^^ ^^( ^^ௌ) is constrained to sign only a portion of the locking script. This allows the witness to later add the signatory’s signature ^^ ^^ ^^( ^^ௌ) in the locking script without invalidating ^^ ^^ ^^( ^^ௌ) and sign it to finalise the transaction. The interaction between the signatory and the witness could be as follows: 1. The signatory creates a non-final transaction ^^ ^^ ^^ ^^^that contains the document to be signed and an output locked to CHECKSIG_NONFINALTX and the public key of the witness. In this case, CHECKSIG_NONFINALTX allows opcodes to be appended to the locking script. 2. The signatory creates a transaction ^^ ^^ ^^ ^^^that contains his signature and spends the previously created output. 3. The witness receives the non-final transactions ^^ ^^ ^^ ^^^, ^^ ^^ ^^ ^^^, and finalises transaction ^^ ^^ ^^ ^^^by adding the signature of the signatory to the spent output. By including the signature of the signatory in the locking script of ^^ ^^ ^^ ^^^, the witness signs the signatory’s signature and therefore proves the order of signing. 4. The witness finalises transaction ^^ ^^ ^^ ^^^by adding his signature, his public key, the serialized previous transaction, and the SIGHASH preimage to unlock the spent output. 5. The signatory then finalises transaction ^^ ^^ ^^ ^^^by completing its unlocking scripts and broadcasts the two transactions ^^ ^^ ^^ ^^^and ^^ ^^ ^^ ^^^to the blockchain network. It is the responsibility of the witness to add the right opcodes to finalise transactions ^^ ^^ ^^ ^^^and ^^ ^^ ^^ ^^^. After they are added to the blockchain, these two transactions provide immutable evidence that the document was signed sequentially – first by the signatory, and then by the witness. The previously described technique can be extended to allow sequential signing involving more than two parties. Assuming there are ^^ parties ordered by index ^^ = 1,2,3, … , ^^. In this case, party ^^ signs the document and the signature of all parties ^^ with ^^ < ^^. This means that all parties with index ^^ < ^^ use the scripted code separator technique to allow the next party to add its signature to the output. Finally, party ^^ signs the document and all ^^ − 1 signatures of the previous parties using a regular P2PKH script. Figure 10 provides an example method for sequentially signing a document using the script code separator mechanism. In this example, Alice 103a is a party requesting the document be signed, Bob 103b is the signatory, and Charlie 103c is the witness. Alice 103a generates the non-final Tx 902 comprising a locking script comprising the signed portion, that is the portion to be signed by the witness (bob 103b), step 1. Alice then makes the non-final Tx 902 available to Bob 103b for signing, step 2. Alice 103a may send the non- final Tx 902 directly to Bob 103b, store the non-final Tx 902 to a shared platform, or make the non-final Tx 902 available in any other known manner. Bob 103b obtains the non-final Tx 902 and generates his signature using his private key, step 3. Bob 103b also generates the non-final signature Tx 904, providing his signature in the unlocking script, step 4. At step 5, Bob 103b makes the non-final Tx 902, the non-final signature Tx 904, and his signature available to the witness, Charlie 103c. Charlie 103c completes the modifiable Tx 906 by including the unsigned portion, Bob’s signature, in the locking script, step 6, and making the now complete modifiable Tx 906 available to one or more nodes of the blockchain 150 for storing, step 7. Charlie 103c also completes the signature Tx 908 by signing the modifiable Tx 906, and thus proving the order of signing, and providing his signature in the unlocking script of the signature Tx 908, step 8. Charlie 103c also includes the serialised modifiable Tx and the modifiable Tx SIGHASH preimage in the unlocking script. Once complete, the signature Tx 908 is made available to one or more node of the blockchain 150 for storing, step 9. The method of Figure 10 is provided by way of example only. In another example, Alice 103a provides the non-final Tx 902 to Charlie 103c, rather than Bob 103c, once Bob 103b has notified Alice 103a that he has generates his signature. Bob 103b may provide his signature to Alice 103a in the notification, such that Alice 103a completes the modifiable Tx 906 and makes the modifiable Tx 906 available to nodes of the blockchain 150. In some embodiments, Bob 103b may not generates a non-final signature Tx 904. Instead, Charlie 103c receives Bob’s signature and generates the signature Tx 908. In some embodiments, the signatory, Bob 103b, may generate the non-final transaction 902. In this instance, Alice 103a, the signature requestor, does not participate in the method. Other variations of the method provided in Figure 10 will be apparent to the skilled person. 5. EXAMPLE SYSTEM OVERVIEW A blockchain refers to a form of distributed data structure, wherein a duplicate copy of the blockchain is maintained at each of a plurality of nodes in a distributed peer-to-peer (P2P) network (referred to below as a “blockchain network”) and widely publicised. The blockchain comprises a chain of blocks of data, wherein each block comprises one or more transactions. Each transaction, other than so-called “coinbase transactions”, points back to a preceding transaction in a sequence which may span one or more blocks going back to one or more coinbase transactions. Coinbase transactions are discussed further below. Transactions that are submitted to the blockchain network are included in new blocks. New blocks are created by a process often referred to as “mining”, which involves each of a plurality of the nodes competing to perform “proof-of-work”, i.e. solving a cryptographic puzzle based on a representation of a defined set of ordered and validated pending transactions waiting to be included in a new block of the blockchain. It should be noted that the blockchain may be pruned at some nodes, and the publication of blocks can be achieved through the publication of mere block headers. The transactions in the blockchain may be used for one or more of the following purposes: to convey a digital asset (i.e. a number of digital tokens), to order a set of entries in a virtualised ledger or registry, to receive and process timestamp entries, and / or to 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. In an “output-based” model (sometimes referred to as a UTXO-based model), the data structure of a given transaction comprises one or more inputs and one or more outputs. Any spendable output comprises an element specifying an amount of the digital asset that is derivable from the proceeding sequence of transactions. The spendable output is sometimes referred to as a UTXO (“unspent transaction output”). The output may further comprise a locking script specifying a condition for the future redemption of the output. A locking script is a predicate defining the conditions necessary to validate and transfer digital tokens or assets. Each input of a transaction (other than a coinbase transaction) comprises a pointer (i.e. a reference) to such an output in a preceding transaction, and may further comprise an unlocking script for unlocking the locking script of the pointed-to output. So consider a pair of transactions, call them a first and a second transaction (or “target” transaction). The first transaction comprises at least one output specifying an amount of the digital asset, and comprising a locking script defining one or more conditions of unlocking the output. The second, target transaction comprises at least one input, comprising a pointer to the output of the first transaction, and an unlocking script for unlocking the output of the first transaction. In such a model, when the second, target transaction is sent to the blockchain network to be propagated and recorded in the blockchain, one of the criteria for validity applied at each node will be that the unlocking script meets all of the one or more conditions defined in the locking script of the first transaction. Another will be that the output of the first transaction has not already been redeemed by another, earlier valid transaction. Any node that finds the target transaction invalid according to any of these conditions will not propagate it (as a valid transaction, but possibly to register an invalid transaction) nor include it in a new block to be recorded in the blockchain. An alternative type of transaction model is an account-based model. In this case each transaction does not define the amount to be transferred by referring back to the UTXO of a preceding transaction in a sequence of past transactions, but rather by reference to an absolute account balance. The current state of all accounts is stored by the nodes separate to the blockchain and is updated constantly. Figure 1 shows an example system 100 for implementing a blockchain 150. The system 100 may comprise a packet-switched network 101, typically a wide-area internetwork such as the Internet. The packet-switched network 101 comprises a plurality of blockchain nodes 104 (often referred to as “miners”) that may be arranged to form a peer-to-peer (P2P) network 106 within the packet-switched network 101. Whilst not illustrated, the blockchain nodes 104 may be arranged as a near-complete graph. Each blockchain node 104 is therefore highly connected to other blockchain nodes 104. Each blockchain node 104 comprises computer equipment of a peer, with different ones of the nodes 104 belonging to different peers. Each blockchain node 104 comprises processing apparatus comprising one or more processors, e.g. one or more central processing units (CPUs), accelerator processors, application specific processors and / or field programmable gate arrays (FPGAs), and other equipment such as application specific integrated circuits (ASICs). Each node also comprises memory, i.e. computer-readable storage in the form of a non-transitory computer-readable medium or media. The memory may comprise one or more memory units employing one or more memory media, e.g. a magnetic medium such as a hard disk; an electronic medium such as a solid-state drive (SSD), flash memory or EEPROM; and / or an optical medium such as an optical disk drive. The blockchain 150 comprises a chain of blocks of data 151, wherein a respective copy of the blockchain 150 is maintained at each of a plurality of blockchain nodes 104 in the distributed or blockchain network 106. As mentioned above, maintaining a copy of the blockchain 150 does not necessarily mean storing the blockchain 150 in full. Instead, the blockchain 150 may be pruned of data so long as each blockchain node 150 stores the block header (discussed below) of each block 151. Each block 151 in the chain comprises one or more transactions 152, wherein a transaction in this context refers to a kind of data structure. The nature of the data structure will depend on the type of transaction protocol used as part of a transaction model or scheme. A given blockchain will use one particular transaction protocol throughout. A blockchain node 104 may be configured to forward transactions 152 to other blockchain nodes 104, and thereby cause transactions 152 to be propagated throughout the network 106. A blockchain node 104 may be configured to create blocks 151 and to store a respective copy of the same blockchain 150 in their respective memory. A blockchain node 104 may also maintain an ordered set (or “pool”) 154 of transactions 152 waiting to be incorporated into blocks 151. The ordered pool 154 is often referred to as a “mempool”. This term herein is not intended to limit to any particular blockchain, protocol or model. It refers to the ordered set of transactions which a node 104 has accepted as valid and for which the node 104 is obliged not to accept any other transactions attempting to spend the same output. In a given present transaction 152j, the (or each) input comprises a pointer referencing the output of a preceding transaction 152i in the sequence of transactions, specifying that this output is to be redeemed or “spent” in the present transaction 152j. Spending or redeeming does not necessarily imply transfer of a financial asset, though that is certainly one common application. More generally spending could be described as consuming the output, or assigning it to one or more outputs in another, onward transaction. In general, the preceding transaction could be any transaction in the ordered set 154 or any block 151. The preceding transaction 152i need not necessarily exist at the time the present transaction 152j is created or even sent to the network 106, though the preceding transaction 152i will need to exist and be validated in order for the present transaction to be valid. Hence “preceding” herein refers to a predecessor in a logical sequence linked by pointers, not necessarily the time of creation or sending in a temporal sequence, and hence it does not necessarily exclude that the transactions 152i, 152j be created or sent out-of-order (see discussion below on orphan transactions). The preceding transaction 152i could equally be called the antecedent or predecessor transaction. Due to the resources involved in transaction validation and publication, typically at least each of the blockchain nodes 104 takes the form of a server comprising one or more physical server units, or even whole a data centre. However in principle any given blockchain node 104 could take the form of a user terminal or a group of user terminals networked together. The memory of each blockchain node 104 stores software configured to run on the processing apparatus of the blockchain node 104 in order to perform its respective role or roles and handle transactions 152 in accordance with the blockchain node protocol. It will be understood that any action attributed herein to a blockchain node 104 may be performed by the software run on the processing apparatus of the respective computer equipment. The node software may be implemented in one or more applications at the application layer, or a lower layer such as the operating system layer or a protocol layer, or any combination of these. Any given blockchain node may be configured to perform one or more of the following operations: validating transactions, storing transactions, propagating transactions to other peers, performing consensus (e.g. proof-of-work) / mining operations. In some examples, each type of operation is performed by a different node 104. That is, nodes may specialise in particular operation. For example, a nodes 104 may focus on transaction validation and propagation, or on block mining. In some examples, a blockchain node 104 may perform more than one of these operations in parallel. Any reference to a blockchain node 104 may refer to an entity that is configured to perform at least one of these operations. Also connected to the network 101 is the computer equipment 102 of each of a plurality of parties 103 in the role of consuming users. These users may interact with the blockchain network 106 but do not participate in validating transactions or constructing blocks. Some of these users or agents 103 may act as senders and recipients in transactions. Other users may interact with the blockchain 150 without necessarily acting as senders or recipients. For instance, some parties may act as storage entities that store a copy of the blockchain 150 (e.g. having obtained a copy of the blockchain from a blockchain node 104). Some or all of the parties 103 may be connected as part of a different network, e.g. a network overlaid on top of the blockchain network 106. Users of the blockchain network (often referred to as “clients”) may be said to be part of a system that includes the blockchain network 106; however, these users are not blockchain nodes 104 as they do not perform the roles required of the blockchain nodes. Instead, each party 103 may interact with the blockchain network 106 and thereby utilize the blockchain 150 by connecting to (i.e. communicating with) a blockchain node 106. Two parties 103 and their respective equipment 102 are shown for illustrative purposes: a first party 103a and his / her respective computer equipment 102a, and a second party 103b and his / her respective computer equipment 102b. It will be understood that many more such parties 103 and their respective computer equipment 102 may be present and participating in the system 100, but for convenience they are not illustrated. Each party 103 may be an individual or an organization. Purely by way of illustration the first party 103a is referred to herein as Alice and the second party 103b is referred to as Bob, but it will be appreciated that this is not limiting and any reference herein to Alice or Bob may be replaced with “first party” and “second “party” respectively. The computer equipment 102 of each party 103 comprises respective processing apparatus comprising one or more processors, e.g. one or more CPUs, GPUs, other accelerator processors, application specific processors, and / or FPGAs. The computer equipment 102 of each party 103 further comprises memory, i.e. computer-readable storage in the form of a non-transitory computer-readable medium or media. This memory may comprise one or more memory units employing one or more memory media, e.g. a magnetic medium such as hard disk; an electronic medium such as an SSD, flash memory or EEPROM; and / or an optical medium such as an optical disc drive. The memory on the computer equipment 102 of each party 103 stores software comprising a respective instance of at least one client application 105 arranged to run on the processing apparatus. It will be understood that any action attributed herein to a given party 103 may be performed using the software run on the processing apparatus of the respective computer equipment 102. The computer equipment 102 of each party 103 comprises at least one user terminal, e.g. a desktop or laptop computer, a tablet, a smartphone, or a wearable device such as a smartwatch. The computer equipment 102 of a given party 103 may also comprise one or more other networked resources, such as cloud computing resources accessed via the user terminal. The client application 105 may be initially provided to the computer equipment 102 of any given party 103 on suitable computer-readable storage medium or media, e.g. downloaded from a server, or provided on a removable storage device such as a removable SSD, flash memory key, removable EEPROM, removable magnetic disk drive, magnetic floppy disk or tape, optical disk such as a CD or DVD ROM, or a removable optical drive, etc. The client application 105 comprises at least a “wallet” function. This has two main functionalities. One of these is to enable the respective party 103 to create, authorise (for example sign) and send transactions 152 to one or more bitcoin nodes 104 to then be propagated throughout the network of blockchain nodes 104 and thereby included in the blockchain 150. The other is to report back to the respective party the amount of the digital asset that he or she currently owns. In an output-based system, this second functionality comprises collating the amounts defined in the outputs of the various 152 transactions scattered throughout the blockchain 150 that belong to the party in question. Note: whilst the various client functionality may be described as being integrated into a given client application 105, this is not necessarily limiting and instead any client functionality described herein may instead be implemented in a suite of two or more distinct applications, e.g. interfacing via an API, or one being a plug-in to the other. More generally the client functionality could be implemented at the application layer or a lower layer such as the operating system, or any combination of these. The following will be described in terms of a client application 105 but it will be appreciated that this is not limiting. The instance of the client application or software 105 on each computer equipment 102 is operatively coupled to at least one of the blockchain nodes 104 of the network 106. This enables the wallet function of the client 105 to send transactions 152 to the network 106. The client 105 is also able to contact blockchain nodes 104 in order to query the blockchain 150 for any transactions of which the respective party 103 is the recipient (or indeed inspect other parties’ transactions in the blockchain 150, since in embodiments the blockchain 150 is a public facility which provides trust in transactions in part through its public visibility). The wallet function on each computer equipment 102 is configured to formulate and send transactions 152 according to a transaction protocol. As set out above, each blockchain node 104 runs software configured to validate transactions 152 according to the blockchain node protocol, and to forward transactions 152 in order to propagate them throughout the blockchain network 106. The transaction protocol and the node protocol correspond to one another, and a given transaction protocol goes with a given node protocol, together implementing a given transaction model. The same transaction protocol is used for all transactions 152 in the blockchain 150. The same node protocol is used by all the nodes 104 in the network 106. An alternative type of transaction protocol operated by some blockchain networks may be referred to as an “account-based” protocol, as part of an account-based transaction model. In the account-based case, each transaction does not define the amount to be transferred by referring back to the UTXO of a preceding transaction in a sequence of past transactions, but rather by reference to an absolute account balance. The current state of all accounts is stored, by the nodes of that network, separate to the blockchain and is updated constantly. In such a system, transactions are ordered using a running transaction tally of the account (also called the “position” or “nonce”). This value is signed by the sender as part of their cryptographic signature and is hashed as part of the transaction reference calculation. In addition, an optional data field may also be signed the transaction. This data field may point back to a previous transaction, for example if the previous transaction ID is included in the data field. Some account-based transaction models share several similarities with the output-based transaction model described herein. For example, as mentioned above, the data field of an account-based transaction may point back to a previous transaction, which is equivalent to the input of an output-based transaction which references an outpoint a previous transaction. Thus both models enable linking between transactions. As another example, an account-based transaction contains a “recipient” field (in which a receiving address of an account is specified) and a “value” field (in which an amount of digital asset may be specified). Together the recipient and value fields are equivalent to the output of an output- based transaction which may be used to assign an amount of digital asset to a blockchain address. Similarly, an account-based transaction has a “signature” field which includes a signature for the transaction. The signature is generated using the sender's private key and confirms the sender has authorized this transaction. This is equivalent to an input / unlocking script of an output-based transaction which, typically, includes a signature for the transaction. When both types of transaction are submitted to their respective blockchain networks, the signatures are checked to determine whether the transaction is valid and can be recorded on the blockchain. On an account-based blockchain, a “smart contact” refers to a transaction that contains a script configured to perform one or more actions (e.g. send or “release” a digital asset to a recipient address) in response to one or more inputs (provided by a transaction) meeting one or more conditions defined by the smart contact’s script. The smart contract exists as a transaction on the blockchain, and can be called (or triggered) by subsequent transactions. Thus, in some examples, a smart contract may be considered equivalent to a locking script of an output-based transaction, which can be triggered by a subsequent transaction, and checks whether one or more conditions defined by the locking script are met by the input of the subsequent transaction. 6. 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 “Tx1”. 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 “Tx0” in Figure 2. Tx0 and Tx1 are just arbitrary labels. They do not necessarily mean that Tx0 is the first transaction in the blockchain 151, nor that Tx1 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 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 Tx0comprises a particular UTXO, labelled here UTXO0. Each UTXO comprises a value specifying an amount of the digital asset represented by the UTXO, and a locking script which defines a condition which must be met by an unlocking script in the input 202 of a subsequent transaction in order for the subsequent transaction to be validated, and therefore for the UTXO to be successfully redeemed. The locking script (aka scriptPubKey) is a piece of code written in the domain specific language recognized by the node protocol. A particular example of such a language is called “Script” (capital S) which is used by the blockchain network. The locking script specifies what information is required to spend a transaction output 203, for example the requirement of Alice’s signature. Locking scripts appear in the outputs of transactions. The unlocking script (aka scriptSig) is a piece of code written the domain specific language that provides the information required to satisfy the locking script criteria. For example, it may contain Bob’s signature. Unlocking scripts appear in the input 202 of transactions. So in the example illustrated, UTXO0 in the output 203 of Tx0 comprises a locking script [Checksig PA] which requires a signature Sig PA of Alice in order for UTXO0to be redeemed (strictly, in order for a subsequent transaction attempting to redeem UTXO0to 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 Tx1 comprises a pointer pointing back to Tx1 (e.g. by means of its transaction ID, TxID0, which in embodiments is the hash of the whole transaction Tx0). The input 202 of Tx1 comprises an index identifying UTXO0 within Tx0, to identify it amongst any other possible outputs of Tx0. The input 202 of Tx1 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 Tx1arrives at a blockchain node 104, the node applies the node protocol. This comprises running the locking script and unlocking script together to check whether the unlocking script meets the condition defined in the locking script (where this condition may comprise one or more criteria). Note that the script code is often represented schematically (i.e. not using the exact language). For example, one may use operation codes (opcodes) to represent a particular function. “OP_...” refers to a particular opcode of the Script language. As an example, OP_RETURN is an opcode of the Script language that when preceded by OP_FALSE at the beginning of a locking script creates an unspendable output of a transaction that can store data within the transaction, and thereby record the data immutably in the blockchain 150. E.g. the data could comprise a document which it is desired to store in the blockchain. Typically an input of a transaction contains a digital signature corresponding to a public key PA. In embodiments this is based on the ECDSA using the elliptic curve 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. 7. FURTHER REMARKS Other variants or use cases of the disclosed techniques may become apparent to the person skilled in the art once given the disclosure herein. The scope of the disclosure is not limited by the described embodiments but only by the accompanying claims. For instance, some embodiments above have been described in terms of a bitcoin network 106, bitcoin blockchain 150 and bitcoin nodes 104. However it will be appreciated that the bitcoin blockchain is one particular example of a blockchain 150 and the above description may apply generally to any blockchain. That is, the present invention is in by no way limited to the bitcoin blockchain. More generally, any reference above to bitcoin network 106, bitcoin blockchain 150 and bitcoin nodes 104 may be replaced with reference to a blockchain network 106, blockchain 150 and blockchain node 104 respectively. The blockchain, blockchain network and / or blockchain nodes may share some or all of the described properties of the bitcoin blockchain 150, bitcoin network 106 and bitcoin nodes 104 as described above. In preferred embodiments of the invention, the blockchain network 106 is the bitcoin network and bitcoin nodes 104 perform at least all of the described functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150. It is not excluded that there may be other network entities (or network elements) that only perform one or some but not all of these functions. That is, a network entity may perform the function of propagating and / or storing blocks without creating and publishing blocks (recall that these entities are not considered nodes of the preferred bitcoin network 106). In other embodiments of the invention, the blockchain network 106 may not be the bitcoin network. In these embodiments, it is not excluded that a node may perform at least one or some but not all of the functions of creating, publishing, propagating and storing blocks 151 of the blockchain 150. For instance, on those other blockchain networks a “node” may be used to refer to a network entity that is configured to create and publish blocks 151 but not store and / or propagate those blocks 151 to other nodes. Even more generally, any reference to the term “bitcoin node” 104 above may be replaced with the term “network entity” or “network element”, wherein such an entity / element is configured to perform some or all of the roles of creating, publishing, propagating and storing blocks. The functions of such a network entity / element may be implemented in hardware in the same way described above with reference to a blockchain node 104. Some embodiments have been described in terms of the blockchain network implementing a proof-of-work consensus mechanism to secure the underlying blockchain. However, proof- of-work is just one type of consensus mechanism and in general embodiments may use any type of suitable consensus mechanism such as, for example, proof-of-stake, delegated proof-of-stake, proof-of-capacity, or proof-of-elapsed time. As a particular example, proof- of-stake uses a randomized process to determine which blockchain node 104 is given the opportunity to produce the next block 151. The chosen node is often referred to as a validator. Blockchain nodes can lock up their tokens for a certain time in order to have the chance of becoming a validator. Generally, the node who locks the biggest stake for the longest period of time has the best chance of becoming the next validator. It will be appreciated that the above embodiments have been described by way of example only. More generally there may be provided a method, apparatus or program in accordance with any one or more of the following Statements. Statement 1. A computer-implemented method for generating a modifiable blockchain transaction comprising a first portion and a second portion, wherein a non-final blockchain transaction is a blockchain transaction comprising the first portion and not the second portion, wherein the non-final blockchain transaction is to be signed, the method comprising: providing a first locking script which, when executed together with a first unlocking script of a signature blockchain transaction, is configured to: generate the non- final blockchain transaction based on the modifiable blockchain transaction; and verify a signature provided in the first unlocking script of the signature blockchain transaction based on the non-final blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network. Statement 2. A computer-implemented method for generating a non-final blockchain transaction comprising a first portion, wherein the non-final blockchain transaction is for signing by a signer, wherein the non-final blockchain transaction is for modifying after signing to generate a modifiable blockchain transaction, the method comprising: providing a first locking script, wherein the first locking script is configured, when executed together with a first unlocking script of a signature blockchain transaction, to reconstruct the non-final blockchain transaction based on the modifiable blockchain transaction; and making the non- final blockchain transaction available to the signer. Statement 3. The method of statement 2, wherein the method further comprises: determining that a signature has been generated based on the non-final blockchain transaction; and in response to determining that the signature has been generated, modifying the non-final blockchain transaction to include a second portion to generate the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network. Statement 4. A computer-implemented method for generating a modifiable blockchain transaction comprising a first portion and a second portion, wherein a non-final blockchain transaction is a blockchain transaction comprising the first portion and not the second portion, the method comprising: obtaining the non-final blockchain transaction, wherein the non- final blockchain transaction comprises a first locking script which is configured, when executed together with a first unlocking script of a signature blockchain transaction, to reconstruct the non-final blockchain transaction based on the modifiable blockchain transaction; determining that a signature has been generated based on the non-final blockchain transaction; and in response to determining that the signature has been generated, modifying the non-final blockchain transaction to include the second portion to generate the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network. Statement 5. The method of statement 4, wherein the method further comprises: generating the non-final blockchain transaction by providing the first locking script, thereby obtaining the non-final blockchain transaction; and making the non-final blockchain transaction available to a signer for generating the signature. Statement 6. The method of any of statements 2 to 5, wherein the first locking script is further configured, when executed together with a first unlocking script of a signature blockchain transaction, to verify the signature provided in the first unlocking script based on the non-final blockchain transaction. Statement 7. The method of statement 1 or statement 6, wherein the first locking script is further configured to: generate a non-final signature hash preimage derived from the non- final blockchain transaction, wherein the non-final signature hash preimage is a message signed by the signature; wherein the signature is verified if it is derivable from the generated non-final signature hash preimage. Statement 8. The method of any preceding statement, wherein the first locking script is further configured to: obtain a copy of the modifiable blockchain transaction; wherein the non-final blockchain transaction is generated by removing, from the copy of the modifiable blockchain transaction, the second portion to generate the non-final blockchain transaction. Statement 9. The method of statement 8, wherein the non-final blockchain transaction is generated by further modifying one or more fields of the modifiable blockchain transaction after the second portion has been removed, the further modifications being based on the removal of the second portion. Statement 10. The method of statement 8 or statement 9, wherein the first locking script is configured to obtain the copy of the modifiable blockchain transaction by extracting, from the first unlocking script a serialised copy of the modifiable blockchain transaction. Statement 11. The method of any of statements 7 to 10, wherein the non-final signature hash preimage is generated by: hashing the non-final blockchain transaction to compute a transaction identifier of the non-final blockchain transaction; and providing the transaction identifier of the non-final blockchain transaction in a transaction identifier field of the non- final signature hash preimage. Statement 12. The method of statement 11, wherein the first locking script is further configured to: obtain a copy of a signature hash preimage corresponding to the modifiable blockchain transaction; wherein the non-final signature hash preimage is generated by replacing a hash field of the signature hash preimage of the modifiable blockchain transaction with the transaction identifier of the non-final blockchain transaction. Statement 13. The method of statement 11, wherein the non-final signature hash preimage is generated by further: modifying a script code field of the signature hash preimage of the modifiable blockchain transaction to remove a script segment associated with the second portion to generate a non-final script code field. Statement 14. The method of statement 11, wherein the second portion is defined in-script by a delimiter, wherein the script code is modified by parsing the script code field of the signature hash preimage of the modifiable blockchain transaction and removing a portion of the script code field provided after the delimiter. Statement 15. The method of any of statements 11 to 14, wherein the signature signs at least one output of the modifiable blockchain transaction, wherein the non-final signature hash preimage is generated by further: obtaining an ordered set of outpoints provided as inputs to the signature blockchain transaction from the first unlocking script; determining a current outpoint associated with the first unlocking script; replacing a transaction identified portion of the current outpoint with the transaction identifier of the non-final blockchain transaction to generate a non-final current outpoint; replacing the current outpoint with the non-final current outpoint in the ordered set of outpoints to generate a non-final ordered set of outpoints; and computing a non-final previous outpoints hash value based on the non-final ordered set of outpoints. Statement 16. The method of statement 15, wherein the non-final signature hash preimage is generated by further: replacing a previous outpoints hash value of the signature hash preimage of the modifiable blockchain transaction with the non-final previous outpoints hash value. Statement 17. The method of any of statements 15 to 16, wherein the signature signs at least one output of the modifiable blockchain transaction, wherein the first locking script is further configured to: obtain an ordered set of outpoints provided as inputs to the signature blockchain transaction from the first unlocking script; calculate , based on the ordered set of outpoints, a previous outpoints hash value; and obtain a set of signature hash preimage fields from the first unlocking script; wherein obtaining the copy of the signature hash preimage corresponding to the modifiable blockchain transaction comprises generating the copy of the signature hash preimage using the previous outpoints hash value and the set of signature hash preimage fields. Statement 18. The method of any of statements 11 to 14, wherein the first locking script is further configured to: obtain the copy of the signature hash preimage of the modifiable blockchain transaction by extracting the copy of the signature hash preimage of the modifiable blockchain transaction from the first unlocking script. Statement 19. The method of any preceding statement, wherein the second portion comprises at least one of: an input of the modifiable blockchain transaction; an output of the modifiable blockchain transaction; a version field of the modifiable blockchain transaction; and a locktime field of the modifiable blockchain transaction. Statement 20. The method of statement 8 or any statement dependent thereon, wherein the modifiable blockchain transaction comprises one or more unlocking scripts, wherein the non- final blockchain transaction is reconstructed by further removing, from the modifiable blockchain transaction, the one or more unlocking scripts. Statement 21. Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of statements 1 to 20. Statement 22. A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of statements 1 to 20. Statement 23. A computer-implemented method for generating a non-final blockchain transaction, wherein the non-final blockchain transaction is for signing by a signer, wherein the non-final blockchain transaction is for modifying after signing to generate a modifiable blockchain transaction, the method comprising: providing a first locking script comprising a signed portion, wherein the first locking script is configured, when executed together with a first unlocking script of a signature blockchain transaction, is configured to generate the non-final blockchain transaction based on the modifiable blockchain transaction; and making the non-final blockchain transaction available to the signer. Statement 24. The method of statement 23, wherein the method further comprises: determining that a signature has been generated based on the non-final blockchain transaction; and in response to determining that the signature has been generated, modifying the first locking script to include an unsigned portion to generate the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network. Statement 25. A computer-implemented method for generating a modifiable blockchain transaction comprising a signed portion and an unsigned portion, wherein a non-final blockchain transaction is a blockchain transaction comprising the signed portion and not the unsigned portion, the method comprising: obtaining the non-final blockchain transaction, wherein the non-final blockchain transaction comprises a first locking script comprising the signed portion; determining that a signature has been generated based on the non-final blockchain transaction; and in response to determining that the signature has been generated, modifying the first locking script to include the unsigned portion to generate the modifiable blockchain transaction, wherein the first locking script is configured, when executed, to generate the non-final blockchain transaction based on the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network. Statement 26. The method of statement 25, wherein the method further comprises: generating the non-final blockchain transaction by providing the first locking script comprising the signed portion, thereby obtaining the non-final blockchain transaction; and making the non-final blockchain transaction available to a signer for generating the signature. Statement 27. The method of any of statements 23 to 26, wherein the first locking script is further configured, when executed together with a first unlocking script of a signature blockchain transaction, to verify the signature provided in the first unlocking script based on the non-final blockchain transaction. Statement 28. The method of any of statements 23 to 27, wherein the first locking comprises a first size defining a size of a first portion of the non-final blockchain transaction, the first portion being a portion of the non-final blockchain transaction before an end of the first locking script. Statement 29. The method of statement 28, wherein the first locking script is further configured to: extract, from the modifiable blockchain transaction, the first portion based on the first size; wherein the extracted first portion is used to generate the non-final blockchain transaction. Statement 30. The method of statement 29, wherein the first portion is contained in a leading portion of the modifiable blockchain transaction of size equal to the first size. Statement 31. The method of any of statements 23 to 30, wherein the first locking script is further configured to: obtain a second size defining a size of a second portion of the non- final blockchain transaction, the second portion being a portion of the non-final blockchain transaction after an end of the first locking script; and extract, from the modifiable blockchain transaction, the second portion based on the second size; wherein the extracted second portion is used to generate the non-final blockchain transaction. Statement 32. The method of statement 31, wherein the second portion is contained in a trailing portion of the modifiable blockchain transaction of size equal to the second size. Statement 33. The method of statement 31 or statement 32, wherein the second size is provided in the first locking script, wherein the second size is obtained from the first locking script. Statement 34. The method of statement 28 and statement 31, or any statement dependent thereon, wherein the first locking script is configured to generate the non-final blockchain transaction by merging the extracted first portion and the extracted second portion. Statement 35. The method of statement 34, wherein the first locking script is further configured to: obtain a third size defining a size of the modifiable blockchain transaction; compute, based on the first size, second size, and third size, a size of the unsigned portion; compute a non-final locking script size based on a locking script size of the modifiable blockchain transaction and the size of the unsigned portion; and provide, at a locking script size field of the non-final blockchain transaction, the non-final locking script size. Statement 36. The method of any of statements 23 to 35, wherein the first locking script is further configured to generate a non-final signature hash preimage derived from the non- final blockchain transaction, wherein the non-final signature hash preimage is a message signed by the signature, wherein the signature is verified if it is derivable from the non-final signature hash preimage. Statement 37. The method of statement 36 when dependent on statements 28 and 31, wherein the first locking script is configured to generate the non-final signature hash preimage by: computing a non-final transaction identifier based on the extracted included portion and the extracted excluded portion; and providing the non-final transaction identifier at a transaction identifier field of the non-final signature hash preimage. Statement 38. The method of statement 37, wherein the signature signs at least one output of the modifiable blockchain transaction, wherein the first locking script is configured to generate the non-final signature hash preimage by: obtaining an ordered set of outpoints provided as inputs to the signature blockchain transaction from the first unlocking script; determining a current outpoint associated with the first unlocking script; replacing a transaction identified portion of the current outpoint with the transaction identifier of the non-final blockchain transaction to generate a non-final current outpoint; replacing the current outpoint with the non-final current outpoint in the ordered set of outpoints to generate a non-final ordered set of outpoints; computing a non-final previous outpoints hash value based on the non-final ordered set of outpoints; and providing the non-final previous outpoints hash value at a previous outpoints hash field of the non-final signature hash preimage. Statement 39. The method of any of statements 24 to 38, wherein determining that the signature has been generated comprises receiving the signature, wherein the unsigned portion comprises the signature. Statement 40. Computer equipment comprising: memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of statements 23 to 39. Statement 41. A computer program embodied on computer-readable storage and configured so as, when run on one or more processors, to perform the method of any of statements 1 to 40.
Claims
CLAIMS 1. A computer-implemented method for generating a non-final blockchain transaction comprising a first portion, wherein the non-final blockchain transaction is for signing by a signer, wherein the non-final blockchain transaction is for modifying after signing to generate a modifiable blockchain transaction, the method comprising: providing a first locking script, wherein the first locking script is configured, when executed together with a first unlocking script of a signature blockchain transaction, to reconstruct the non-final blockchain transaction based on the modifiable blockchain transaction; and making the non-final blockchain transaction available to the signer.
2. The method of claim 1, wherein the method further comprises: determining that a signature has been generated based on the non-final blockchain transaction; and in response to determining that the signature has been generated, modifying the non-final blockchain transaction to include a second portion to generate the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network.
3. A computer-implemented method for generating a modifiable blockchain transaction comprising a first portion and a second portion, wherein a non-final blockchain transaction is a blockchain transaction comprising the first portion and not the second portion, the method comprising: obtaining the non-final blockchain transaction, wherein the non-final blockchain transaction comprises a first locking script which is configured, when executed together with a first unlocking script of a signature blockchain transaction, to reconstruct the non- final blockchain transaction based on the modifiable blockchain transaction; determining that a signature has been generated based on the non-final blockchain transaction; andin response to determining that the signature has been generated, modifying the non-final blockchain transaction to include the second portion to generate the modifiable blockchain transaction; and making the modifiable blockchain transaction available to one or more nodes of a blockchain network.
4. The method of claim 3, wherein the method further comprises: generating the non-final blockchain transaction by providing the first locking script, thereby obtaining the non-final blockchain transaction; and making the non-final blockchain transaction available to a signer for generating the signature.
5. The method of any preceding claim, wherein the first locking script is further configured, when executed together with a first unlocking script of a signature blockchain transaction, to verify the signature provided in the first unlocking script based on the non- final blockchain transaction.
6. The method of claim 5, wherein the first locking script is further configured to: generate a non-final signature hash preimage derived from the non-final blockchain transaction, wherein the non-final signature hash preimage is a message signed by the signature; wherein the signature is verified if it is derivable from the generated non-final signature hash preimage.
7. The method of any preceding claim, wherein the first locking script is further configured to: obtain a copy of the modifiable blockchain transaction; wherein the non-final blockchain transaction is reconstructed by removing, from the copy of the modifiable blockchain transaction, the second portion to reconstruct the non- final blockchain transaction.
8. The method of claim 7, wherein the modifiable blockchain transaction comprises one or more unlocking scripts, wherein the non-final blockchain transaction is reconstructed by further removing, from the modifiable blockchain transaction, the one or more unlocking scripts.
9. The method of claim 7 or claim 8, wherein the first locking script is configured to obtain the copy of the modifiable blockchain transaction by extracting, from the first unlocking script a serialised copy of the modifiable blockchain transaction, wherein the serialised copy of the modifiable blockchain transaction is the copy of the modifiable blockchain transaction.
10. The method of any of claims 6 to 9, wherein the non-final signature hash preimage is generated by: hashing the non-final blockchain transaction to compute a transaction identifier of the non- final blockchain transaction; and providing the transaction identifier of the non-final blockchain transaction in a transaction identifier field of the non-final signature hash preimage.
11. The method of claim 10, wherein the first locking script is further configured to: obtain a copy of a signature hash preimage corresponding to the modifiable blockchain transaction; wherein the non-final signature hash preimage is generated by replacing a hash field of the signature hash preimage of the modifiable blockchain transaction with the transaction identifier of the non-final blockchain transaction.
12. The method of claim 11, wherein the non-final signature hash preimage is generated by further: modifying a script code field of the signature hash preimage of the modifiable blockchain transaction to remove a script segment associated with the second portion to generate a non-final script code field.
13. Computer equipment comprising:memory comprising one or more memory units; and processing apparatus comprising one or more processing units, wherein the memory stores code arranged to run on the processing apparatus, the code being configured so as when on the processing apparatus to perform the method of any of claims 1 to 12.
14. 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 12.
15. A blockchain-based data structure, comprising: a modifiable blockchain transaction comprising an instruction reconstruct a non-final transaction, and a signature blockchain transaction comprising: a reference to the first transaction; and data used to reconstruct the non-final transaction.
Citation Information
Patent Citations
Streaming portions of data over a side channel
WO2020240292A1
Blockchain transaction double spend proof
WO2021181177A1
Methods and systems for recipient-facilitated blockchain transactions
WO2023117471A1