Computer-implemented systems and methods to enable complex functionality on a blockchain while preserving security-based restrictions on script size and opcode limits
The invention relates to blockchain technologies such as the Bitcoin blockchain. The invention uses a novel technique to decompose the functionality of a blockchain transaction script into several chunks or functional parts, and to use the output of a chunk as the input of the next chunk. Advantageously, this allows the blockchain to be used for ever complex tasks and computations while minimising script size, and also provides a novel architecture for the distributed execution of computational processes. The invention comprises a method of using a plurality of blockchain transactions to execute a computer-implemented task, comprising the steps: using an unlocking script (ULS 1 ) associated with a first input (In 1 ) in a blockchain transaction (Tx 2 ) to present at least one data item to a locking script (LS 1 ) of another transaction (Tx 1 ) so as to provide a result on a stack; amending the blockchain transaction (Tx 2 ) to include a second input (In 2 ); generating a further unlocking script (ULS 2 ) associated with the second input (In 2 ), the further unlocking script (ULS 2 ) comprising the result from the stack; and presenting the further unlocking script (ULS 2 ) to a further locking script (LS 2 ) such that the result from the stack is provided as input to the further locking script (LS 2 ). Preferably, the locking script (LS 1 ) and the further locking script (LS 2 ) are provided in association with different outputs within the same blockchain transaction (Tx 1 ).
1. A method of using a plurality of blockchain transactions to execute a computer-implemented task, comprising the steps:
using an unlocking script (ULS 1 ) associated with a first input (In 1 ) in a blockchain transaction (Tx 2 ) to present at least one data item to a locking script (LS 1 ) of another transaction (Tx 1 ) so as to provide a result on a stack;
amending the blockchain transaction (Tx 2 ) to include a second input (In 2 );
generating a further unlocking script (ULS 2 ) associated with the second input (In 2 ), the further unlocking script (ULS 2 ) comprising the result from the stack, wherein the unlocking script (ULS 1 ) and the further unlocking script (ULS 2 ) are provided in association with different inputs (In 1 In 2 ) within the same blockchain transaction (Tx 2 ) and wherein the result is provided as metadata within the further unlocking script (ULS 2 ); and
presenting the further unlocking script (ULS 2 ) to a further locking script (LS 2 ) such that the result from the stack is provided as input to the further locking script (LS 2 ), wherein the locking script (LS 1 ) and the further locking script (LS 2 ) are provided in association with different outputs within the same blockchain transaction (Tx 1 ) and wherein:
the plurality of blockchain transactions are for a blockchain, the blockchain being a consensus-based, distributed, electronic ledger; and/or
the blockchain is the Bitcoin blockchain; and/or
one, some or all of the transactions are Bitcoin transactions; and/or
the method is arranged for execution on the Bitcoin blockchain.
2. A method according to claim 1 , and further comprising amending the blockchain transaction (Tx 2 ) to include a third input (In 3 ).
3. A method according to claim 1 , and further comprising the step of:
using the at least one data item in the execution of a calculation or sequence of instructions provided within the locking script (LS 1 ).
4. A method according to claim 1 , and further comprising the step of:
using the result provided on the stack in the execution of a calculation or sequence of instructions provided within the further locking script (LS 2 ).
5. A method according to claim 1 , and further comprising the step of:
obtaining the result from the stack.
6. A method according to claim 1 , and further comprising the step of:
validating the blockchain transaction (Tx 2 ) and/or the other transaction (Tx 1 ) to generate the result on the stack.
7. A method according to claim 1 , wherein:
the step of presenting the further unlocking script (ULS 2 ) to a further locking script (LS 2 ) provides a further result on the stack, or on a different stack.
8. A method according to claim 1 , and further comprising the step of:
using a blockchain client to obtain the result from the stack.
9. A method according to claim 8 , wherein:
the blockchain client is a Bitcoin client.
10. A method according to claim 1 , and further comprising the step of:
submitting the blockchain transaction (Tx 2 ) and/or other blockchain transaction (Tx 1 ) to a blockchain network.
11. A method according to claim 1 , wherein:
the at least one data item is provided as metadata within the unlocking script (ULS 1 ).
12. A method according to claim 1 , wherein:
the plurality of blockchain transactions are for a blockchain, the blockchain being a consensus-based, distributed, electronic ledger; and/or
the blockchain is the Bitcoin blockchain; and/or
one, some or all of the transactions are Bitcoin transactions; and/or
the method is arranged for execution on the Bitcoin blockchain.
13. A method according to claim 1 , and further comprising the step of:
using the method to compute a final result, and using the final result to control a process performed off the blockchain.
14. A computer-implemented system arranged and configured to perform at least the following operations:
using an unlocking script (ULS 1 ) associated with a first input (In 1 ) in a blockchain transaction (Tx 2 ) to present at least one data item to a locking script (LS 1 ) of another transaction (Tx 1 ) so as to provide a result on a stack;
amending the blockchain transaction (Tx 2 ) to include a second input (In 2 );
generating a further unlocking script (ULS 2 ) associated with the second input (In 2 ), the further unlocking script (ULS 2 ) comprising the result from the stack, wherein the unlocking script (ULS 1 ) and the further unlocking script (ULS 2 ) are provided in association with different inputs (In 1 In 2 ) within the same blockchain transaction (Tx 2 ) and wherein the result is provided as metadata within the further unlocking script (ULS 2 ); and
presenting the further unlocking script (ULS 2 ) to a further locking script (LS 2 ) such that the result from the stack is provided as input to the further locking script (LS 2 ), wherein the locking script (LS 1 ) and the further locking script (LS 2 ) are provided in association with different outputs within the same blockchain transaction (Tx 1 ) and wherein:
the plurality of blockchain transactions are for a blockchain, the blockchain being a consensus-based, distributed, electronic ledger; and/or
the blockchain is the Bitcoin blockchain; and/or
one, some or all of the transactions are Bitcoin transactions; and/or
the method is arranged for execution on the Bitcoin blockchain.
15. The computer-implemented system of claim 14 , wherein the operations further comprise amending the blockchain transaction (Tx 2 ) to include a third input (In 3 ).
16. The computer-implemented system of claim 14 , wherein the operations further comprise:
using the at least one data item in the execution of a calculation or sequence of instructions provided within the locking script (LS 1 ).
17. The computer-implemented system of claim 14 , wherein the operations further comprise using the result provided on the stack in the execution of a calculation or sequence of instructions provided within the further locking script (LS 2 ).
18. The computer-implemented system of claim 14 , wherein the operations further comprise obtaining the result from the stack.
19. The computer-implemented system of claim 14 , wherein the operations further comprise validating the blockchain transaction (Tx 2 ) and/or the other transaction (Tx 1 ) to generate the result on the stack.
20. The computer-implemented system of claim 14 , wherein presenting the further unlocking script (ULS 2 ) to a further locking script (LS 2 ) provides a further result on the stack, or on a different stack.