Agent-based turing complete transaction integration feedback within a blockchain system

By combining parallel computing resources with blockchain and using a manager to monitor and execute loop processes, the problem of Turing completeness in blockchain technology, which is limited by scripting languages, is solved. This enables the execution of complex control flows and automated tasks, thus expanding the application scope of blockchain technology.

CN114723447BActive Publication Date: 2026-02-06NCHAIN HLDG LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210359568.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2016-02-23
Filing Date
2017-02-14
Publication Date
2026-02-06
Estimated Expiration
2037-02-14

AI Technical Summary

Technical Problem

Existing blockchain technology is limited by the constraints of scripting languages, which prevent it from achieving Turing complete functionality and thus hinders the execution of complex control flow mechanisms, limiting its application in areas such as automated tasks and device management.

Method used

By combining parallel computing resources with blockchain, using computing resources as a manager to monitor and execute loop processes, and influencing the execution of loops through blockchain state, Turing-complete functionality is achieved.

Benefits of technology

It achieves the expansion of the functionality of blockchain technology while maintaining the security of blockchain transactions, allowing the execution of complex control flow mechanisms and automated tasks, such as automated tasks, distributed data storage, drone control, and IoT device management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114723447B_ABST
    Figure CN114723447B_ABST
Patent Text Reader

Abstract

The invention provides a solution to control processes executing on computing resources using a blockchain. In a preferred embodiment, the operation of a loop-based cycle by a computing resource running concurrently and in parallel with the blockchain. The computing resource continuously monitors the blockchain state as well as any other off-chain input data or sources. The execution of the cycle is influenced by the blockchain state. Each iteration of the cycle executed by the computing resource is recorded in a transaction written to the blockchain. It is stored as a hash in the metadata of the transaction. If the computing resource finds a transaction containing a hash related to the cycle, the computing resource accesses the relevant code section. The cycle contains conditional statements that enable the computing resource to decide which action to take. The conditions can depend on the blockchain state or any other data source.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a continuation-in-part of Invention Patent Application No. 201780008967.6 (corresponding to PCT International Application No. PCT / IB2017 / 050821), filed February 14, 2017, entitled "Proxy-based Turing Complete Transactional Integration Feedback within a Blockchain System." TECHNICAL FIELD

[0002] The present invention relates generally to consensus-based electronic ledgers, and in particular to blockchain implementations and techniques. The invention is particularly suited, but not limited to, applications such as device / system control, process control, distributed computing and storage. BACKGROUND

[0003] In this document, the term "blockchain" is used to include all forms of consensus-based electronic, computer-based distributed ledgers. These include, but are not limited to, blockchain and transaction chain technologies, permissioned and un-permissioned ledgers, shared ledgers, and variations thereof. It should be noted that other blockchain implementations and protocols also fall within the scope of the invention.

[0004] A blockchain is a consensus-based electronic ledger that is implemented as a computer- based decentralized distributed system of blocks, which in turn are composed of transactions. Each transaction is a data structure that encodes the transfer of control of a digital asset between participants in the blockchain system, and includes at least one input and at least one output. Each block contains a hash of the previous block, such that the blocks are linked together to build a permanent, unalterable record of all transactions that have been written to the blockchain since its inception. Transactions contain small programs, called scripts, embedded in their inputs and outputs that specify how and by whom the outputs of the transactions can be accessed. These scripts are written using a stack-based scripting language.

[0005] In order to write a transaction to the blockchain, the transaction must be "validated". Network nodes perform work to ensure that each transaction is valid by rejecting invalid transactions from the network. The software client installed on the node performs this validation work on unspent transactions (UTXOs) by executing their locking and unlocking scripts. If the result of the calculation of the locking and unlocking scripts is TRUE, then the transaction is valid and the transaction is written to the blockchain. Thus, in order to write a transaction to the blockchain, it must be i) validated by the first node that receives the transaction - if the transaction is validated, the node relays the transaction to other nodes in the network; and ii) added to a new block; and iii) added to a public ledger of past transactions.

[0006] Although blockchain technology is most widely known for its use in implementing cryptocurrency implementations, digital entrepreneurs have begun to explore the use of cryptographic security systems and data capable of being stored on a blockchain to implement new systems. These systems include, but are not limited to:

[0007] • Storing metadata;

[0008] • Implementing digital tokens;

[0009] • Establishing contracts signed using digital signatures.

[0010] It would be highly advantageous if blockchain could be used for automated tasks and processes not limited to the field of cryptocurrency. These solutions would be able to take advantage of the benefits of blockchain (e.g. permanent, tamper-proof record of events, distributed processing, etc.) while being more versatile in their applications.

[0011] One area of interest in the blockchain community at present is Turing Completeness, and in particular, how to facilitate Turing Complete behaviour in blockchain technologies that have been designed to be limited in functionality for security reasons.

[0012] It is contentious whether some scripting languages are Turing Complete, as these scripting languages do not natively support complex flow control functionality such as looping. One advantage of this limitation is that programs have a predictable execution time. Another important advantage of limiting scripts to linear or tree-like decision tasks is that it avoids infinite loops, which can be used as a means to initiate exploits such as denial of service (DoS or DDoS) attacks. As a result of this limitation, scripts are generally limited to linear tasks, and are not used for more complex applications such as control of automated tasks, device management, etc.

[0013] The Ethereum blockchain platform addresses this issue by incorporating a "built-in" Turing complete language called Solidity. This language is the native language of the Ethereum platform, enabling scripts written in Solidity to include control flow mechanisms such as loops. However, Ethereum has already suffered from multiple attacks and exploits.

[0014] Due to the above security issues and due to the widespread use and popularity of some scripting languages, an important part of the blockchain community still wishes to preserve the use of restricted scripting languages in relation to blockchain technology. SUMMARY

[0015] Therefore, it is desirable to provide a solution that facilitates Turing complete functionality, such as loop mechanisms and other complex control structures integrated or incorporated with blockchain scripts, while avoiding potential security flaws such as the disruptive effects of infinite loops. Such a solution would provide many benefits, including:

[0016] • enabling automation of complex blockchain-related transactions;

[0017] • controlling metadata flows recorded on a blockchain;

[0018] • extending the functionality and applications of blockchain platforms that do not rely on or purposefully incorporate Turing complete languages.

[0019] Such an improved solution has now been devised. The present invention provides a solution that includes a novel combination of a blockchain coupled with parallel computing resources that enable the emulation, simulation and / or incorporation of loops and other Turing complete functionality outside of typical blockchain scripts. This in turn facilitates many applications for automated tasks, for example, in relation to distributed data storage, distributed computing and drone control, or any IoT (Internet of Things) device. These applications can include the use of blockchain for metadata storage, managing digital tokens and establishing contracts.

[0020] Accordingly, in accordance with the present invention, there is provided a solution as defined in the appended claims. In accordance with the present invention, a (process) control method and corresponding system can be provided. The invention can be referred to as a blockchain-implemented control method / system. It is capable of controlling automated tasks or processes.

[0021] The invention can be arranged to use a blockchain to emulate / simulate Turing completeness. Additionally or alternatively, the invention can enable applications involving Turing complete control mechanisms to be executed on a blockchain platform.

[0022] Additionally or alternatively, the invention can be described as a method or system arranged to use a blockchain and / or one or more blockchain transactions to control execution of a process on an off-chain computing resource. Thus, the invention comprises an apparatus in which independent computing components, functionally and structurally distinct from one another, are arranged to interact to provide a new technical result. The interaction of the different computing systems (computing resource and blockchain) results in a powerful control solution.

[0023] From the perspective of the computing resource, the invention provides the advantage of a tamper-proof record of the execution of the program that is permanent. From the perspective of the blockchain, the invention provides an improved blockchain implementation because it enables Turing-complete behaviour to be at least partially simulated using the blockchain, which in turn enables more functionally complex blockchain-based applications to be deployed. This is all achieved while maintaining the use of a limited scripting language for blockchain transactions. The scripting language can be a limited (constrained) in its design or implementation in the specific limitation that the design or implementation of the scripting language prevents or at least does not natively support the incorporation of complex control flow mechanisms such as loops into code written in the language. The instruction set of the language, i.e. the "commands" or "opcodes" that a programmer can use, can be arranged such that it does not include commands for complex flow control mechanisms.

[0024] The blockchain can be associated with or used with a blockchain protocol that includes a limited language. This can be a scripting language. The invention can use the blockchain to extend the functionality of the limited scripting language to perform tasks.

[0025] The invention can use the state of the blockchain to execute a loop-based process. The loop-based process can be executed on a computing resource that operates in parallel to the blockchain network. The computing resource can be distinct from (not part of) the blockchain network. The computing resource can be referred to as an "oracle" or a "bot".

[0026] This enables the blockchain protocol to make use of a functionally limited scripting language while allowing control flow mechanisms such as looping mechanisms to be implemented off-chain. This novel combination enhances the versatility of blockchain technology while ensuring security.

[0027] The method can comprise the steps of:

[0028] executing a loop on the computing resource; and

[0029] using the state of the blockchain to influence the execution of the loop.

[0030] Additionally or alternatively, the invention can comprise the step of using the blockchain to implement a Turing machine, the blockchain having a code reference provided in one or more transactions and / or blocks (blocks of transactions).

[0031] The computing resource can be any processor-based device or system. For example, the computing resource can be one server or multiple servers. The computing resource can be a standalone resource or a distributed resource. The blockchain can be any blockchain-related platform. The blockchain can be a consensus-based distributed ledger.

[0032] Information relating to at least one iteration of a loop can be stored in a transaction on the blockchain. The information can be stored as metadata in the transaction. The loop can comprise an “If condition then action” (ICTA) instruction.

[0033] The method can further comprise the step of generating a cryptographic hash of the code relating to the loop, and preferably storing the cryptographic hash in a transaction on the blockchain. The code can be a block of code comprising a control flow statement, such as an “If condition then action” statement. The block of code can be a portion of code, such as an entire or partial subroutine (e.g. function, method, procedure). The control flow statement can control or influence how the loop is executed, for example the number of iterations.

[0034] The computing resource can be arranged to monitor a blockchain state for a transaction, wherein the transaction comprises a cryptographic hash of the code relating to the loop.

[0035] The method can further comprise the steps of:

[0036] For each iteration of the loop:

[0037] Evaluating the condition and performing at least one action based on the result of the evaluation, wherein the at least one action comprises:

[0038] Causing at least one transaction to be written to the blockchain; and / or

[0039] Causing an action outside of the blockchain to be performed.

[0040] The condition can be used to monitor any value, signal or input, regardless of where, how or by whom the value, signal or input is generated, whether on or outside of the blockchain. The condition can relate to data received, detected or generated by the computing resource; and / or the blockchain state. The condition can be described as a “trigger”. The condition can be or relate to a particular state of the blockchain, or an event detected outside of the blockchain (e.g. a date or temperature reading etc.), or a combination of both.

[0041] The action can comprise sending a signal to cause an event to close a clock, or to broadcast a new transaction, or a combination of both. The index can be held (i) off-chain, in a computing resource ("Manager"), or can be (ii) a value stored in a transaction that is subsequently broadcast.

[0042] (i) and (ii) represent two alternative ways of holding control data.

[0043] The computing resource can be arranged to monitor:

[0044] the blockchain state; values generated or received by the computing resource; and / or data or signal sources provided from off-chain.

[0045] The method can comprise the steps of:

[0046] i) using the blockchain as a storage component for data, instructions, or pointers to data and / or instructions; and

[0047] ii) using the computing resource as a control flow management component for a Turing complete process, the computing resource being arranged to implement a looping mechanism.

[0048] Thus, the blockchain can be used as a non-erasable tape for a Turing machine. The computing resource can be used to control the flow of execution of the process, implement a loop and extend the functionality of a scripting language.

[0049] The method can further comprise the step of restarting (re-generating) the loop in a specified iteration. The loop can be restarted if the computing resource finds a predetermined hash of a portion of code in a transaction in the blockchain. The portion of code can relate to the body of the loop. The portion of code can comprise an ICTA statement.

[0050] The computing resource can re-generate the loop at each iteration. This can be performed in various ways. For example, the block of code for the loop can be:

[0051] hard-coded into the computing resource itself;

[0052] stored in a private or publicly available file;

[0053] stored as an entry in a private or public hash table file;

[0054] or a combination of the above.

[0055] The code block can be a static code block with hard-coded variables, or the code block can be a static code block but contain parameters that can be filled in. The parameters can be single values in any data format, or can be small blocks of code, or a combination of the above. The parameters can be filled in by retrieving the parameters directly from metadata in the transaction, or from an external source such as an internal database or a private / public file or hash table or any combination of the above. A pointer to the external source of the parameter values can be stored in the metadata in the transaction.

[0056] Information relating to the iteration can be specified using metadata provided within or associated with the transaction.

[0057] The computing resource can comprise or be in communication with a registry, database, repository or other storage facility, enabling the computing resource to access pre-stored versions of subroutines. The registry can store:

[0058] i) a cryptographic hash of the code relating to the loop; and

[0059] ii) information indicating a location at which a copy of the code can be accessed.

[0060] The method can further comprise the step of using a blockchain transaction to update the code for the loop to replace the existing code with new code. Preferably, the transaction is a multi-signature P2SH transaction. The hash of the existing code and the hash of the new code can be stored.

[0061] The invention also provides a system for implementing any of the embodiments of the above method.

[0062] The invention can provide a computer-based system. The system can be arranged to use a blockchain to control processes executed on a computing resource. Additionally or alternatively, the system can be arranged to use a blockchain (interact with a blockchain) to simulate or emulate Turing completeness, and / or to enable execution of tasks (applications) involving control flow structures such as loops via the blockchain.

[0063] The system can comprise:

[0064] a blockchain; and

[0065] a computing resource arranged to execute a loop, and such that execution of the loop is affected by the state of the blockchain.

[0066] Information relating to at least one iteration of the loop is stored in a transaction on the blockchain. Preferably, the information is stored as metadata in the transaction.

[0067] Preferably, the computing resource is arranged to generate a cryptographic hash of the code relating to the loop. Preferably, the cryptographic hash is stored in a transaction on the blockchain. Additionally or alternatively, the computing resource is arranged to monitor a blockchain state for a transaction, wherein the transaction comprises the cryptographic hash of the code relating to the loop.

[0068] Preferably, for each iteration of the loop: a condition is evaluated and at least one action is performed based on the result of the evaluation; the at least one action comprises:

[0069] causing at least one transaction to be written to the blockchain; and / or

[0070] causing an action to be performed off-chain.

[0071] The condition can relate to data received, detected or generated by the computing resource; or the blockchain state.

[0072] The computing resource can be arranged to monitor:

[0073] the blockchain state;

[0074] a value generated or received by the computing resource; and / or

[0075] a data or signal source provided from off-chain.

[0076] The blockchain can be used as a storage component for data, instructions or pointers to data and / or instructions. The computing resource can be used as a control flow management component for a Turing complete process, the computing resource being arranged to execute the loop mechanism. The blockchain can be arranged to operate in a restricted language.

[0077] If the computing resource finds a predetermined hash of a portion of code in a transaction in the blockchain, the loop can be restarted at a specified iteration. Information relating to the iteration can be specified using metadata provided in or associated with the transaction.

[0078] The computing resource can comprise or be in communication with a registry, enabling the computing resource to access pre-stored versions of subroutines. The registry can store:

[0079] i) a cryptographic hash of the code relating to the loop; and

[0080] ii) information indicating a location at which a copy of the code can be accessed.

[0081] The system can be configured to update the code for the loop using a blockchain transaction to replace existing code with new code. Preferably, the transaction is a multi-signature P2SH transaction. Preferably, the system is arranged to store a hash of the existing code and a hash of the new code.

[0082] Any feature described with respect to one aspect or embodiment of the invention can also be applicable to any other aspect or embodiment. For example, any feature described with respect to the method can also be used in relation to the system, and any feature described with respect to the system can also be used in relation to the method. BRIEF DESCRIPTION OF DRAWINGS

[0083] These and other aspects of the present invention will become apparent from the embodiments described herein. Embodiments of the present invention will now be described, by way of example only, with reference to the attached drawings in which:

[0084] Figure 1 An illustrative use of a blockchain as an unerasable tape of a Turing machine is shown.

[0085] Figure 2 Subroutines that can be used by a manager to implement a repeat loop in conjunction with a blockchain are illustrated.

[0086] Figure 3 An example of an ICTA (If condition then action) code block that can be used in accordance with embodiments of the present invention is shown.

[0087] Figure 4 Commands that allow a user to move data into and out of an optional stack in accordance with embodiments of the present invention are shown.

[0088] Figure 5 A code registry for a manager in accordance with embodiments of the present invention is shown.

[0089] Figure 6 Metadata associated with a code block of a manager in accordance with embodiments of the present invention is shown.

[0090] Figure 7 Metadata associated with an output at a particular iteration of a manager loop in accordance with embodiments of the present invention is shown.

[0091] Figure 8 A transaction script and metadata in accordance with embodiments of the present invention is shown.

[0092] Figure 9 An illustrative manager software patch validation and audit trail is shown.

[0093] Figure 10 An illustrative use of the present invention is shown, and an embodiment of a vote counting robot repeat loop in pseudo code is shown. DETAILED DESCRIPTION

[0094] The following describes illustrative embodiments using a specific blockchain. However, other blockchain protocols and implementations can be used. The invention is not limited in this regard.

[0095] The invention addresses the problem of how to improve the Turing completeness of a restricted blockchain platform (i.e., a blockchain platform that uses a scripting language that does not support complex control mechanisms), and thus extends the uses or applications that can be implemented by a blockchain. Computation: Finite and Infinite Machines by Marvin Minsky et al., published by Prentice-Hall, Inc. in 1967, describes how an unerasable tape can be used to implement a Turing complete machine and how it can execute any algorithm that can also be executed on a universal Turing machine.

[0096] The invention includes a computing resource that operates with a blockchain using the blockchain as an unerasable tape in an implementation of a Turing machine. The computing resource runs in parallel with the blockchain network, supervising and processing the execution of a loop process. The loop process is designed to perform a given task, such as the automation of a process, or the control of a device or system (e.g., the control of an IoT device). The parallel resource monitors the blockchain state and can cause transactions to be written to the blockchain. Thus, for ease of reference, the parallel resource can be referred to herein as a "Manager".

[0097] Features and advantages of the invention include:

[0098] • enabling a blockchain to act as an unerasable tape for a Turing machine;

[0099] • functions and implementations of a computer-based monitoring and management component (Manager) that operates with a blockchain;

[0100] • using the Manager as an instruction table for a Turing machine;

[0101] • managing the Manager using a code registry;

[0102] • transaction metadata related to the regeneration of Manager code and loops;

[0103] • using digital signatures for software updates for the Manager;

[0104] • specific implementations of the Manager using optional blockchains.

[0105] Blockchain as a non-erasable tape for a Turing machine

[0106] With reference to Figure 1 the invention uses a blockchain as an unerasable tape for a Turing machine, with the following definitions and features:

[0107] 1. The blockchain is the tape of a Turing machine. Each transaction in the blockchain represents a cell on the tape. The cell can contain a symbol from a finite alphabet.

[0108] 2. The tape head can read information from blocks that have already been written to the blockchain.

[0109] 3. The tape head can write new blocks containing many transactions to the end of the blockchain. However, these blocks cannot write to existing blocks. Thus, the blockchain tape is non-erasable.

[0110] 4. Metadata for each transaction can be stored as part of a multi-signature pay-to-script-hash (P2SH) transaction.

[0111] An important function of the manager is to act as an agent that monitors the current state of the blockchain. The manager can also receive signals or inputs from any off-block source. Based on the state of the blockchain and / or the received inputs, the manager can perform certain actions. The manager decides which action(s) to perform. These actions can or can not involve actions in the "real world" (i.e., off-block) and / or actions on the blockchain (such as creating and broadcasting new transactions). The actions taken by the manager can be triggered by the state of the blockchain or certain off-block inputs. The manager can also decide on the next set of transactions to broadcast to the network and then be written to the blockchain.

[0112] The actions of the manager run in parallel and concurrently with the network. In a sense, this extends the functionality of a script with limited behavior. This continuous monitoring implements a "loop" control flow construct, making the manager and the blockchain combined system Turing complete.

[0113] Instruction table for a manager as a Turing machine

[0114] According to embodiments of the invention, the Turing machine comprises two stacks:

[0115] • Data stack: The data stack is represented by the blockchain as described above.

[0116] • Control stack: The control stack is represented by the manager function. The control stack stores information related to the repeat control flow function.

[0117] The separation of the control stack from the data stack provides the advantage of preventing infinite loops from occurring in the core of the blockchain. This in turn mitigates denial-of-service attacks on the system.

[0118] The manager manages and runs subroutines that can be looped by any type of looping construct, such as FOR-NEXT; WHILE, REPEAT UNTIL; etc. The illustrative embodiments described herein include a process using one example of a "repeat" construct (see Figure 2 ). The user specifies an index (i) and a limit (J). They represent the current iteration number (usually counted from 0) and the total number of iterations for the repeat loop, respectively.

[0119] For each iteration:

[0120] 1. The index is incremented by 1. For the exit condition, the iteration will stop when the index reaches the limit.

[0121] 2. A code block containing "if condition then action" (ICTA) statements is executed; where the action can be any action on or off the blockchain;

[0122] 3. The cryptographic hash of the subroutine is computed. The cryptographic hash can be stored in the blockchain as part of a transaction (Tx). Since the hash is unique for each code block, it will be possible to verify which code has been used.

[0123] Thus, the loop body includes code blocks. Each code block contains an "if condition then action" (ICTA) statement (see Figure 3 ). This monitors the current blockchain state for matching each of the following transactions:

[0124] • A start or trigger condition.

[0125] • A repeat condition (i.e. metadata or hash associated with the previous iteration).

[0126] • A stop condition (i.e. last iteration of the loop).

[0127] The ICTA statement enables the manager to decide the next transaction to be made based on the current state of the blockchain. Making the next transaction involves broadcasting the transaction to the network and writing the new transaction to the blockchain. This serves as a record that this iteration has been executed. Once the transaction is written to the blockchain, the manager will subsequently find that the last iteration has been executed and written to the blockchain and will execute the next iteration. The next iteration continues until the repeat loop exits when the index (i) reaches the limit (J) specified in the code block.

[0128] Each transaction is saved in the blockchain in a reusable manner. In some embodiments, each signature in a transaction is appended with a SIGHASH flag. This flag can take different values, each indicating whether other parts of the transaction can be modified without the owner of that signature being involved. The reusable transaction has the SIGHASH flag "SigHash_AnyoneCanPay" in one of the transaction inputs. This allows anyone to contribute to the input of the transaction. This parameter enables the ICTA functionality of the manager to be executed and repeated multiple times with different inputs. The use of this functionality can be limited to authorised parties, for example, through a copyright of the reusable transaction.

[0129] The "If condition" part of the ICTA code block can monitor any type of condition. This is similar to other programming languages, such as C, C++, Java, and is not limited to information stored on the blockchain. Some example conditions are listed below:

[0130] • Monitor a date and time (i.e. when a certain date and time is reached).

[0131] • Monitor the weather (i.e. when the temperature is below 10°C and it is raining).

[0132] • Monitor social media (i.e. when I receive a message from a friend).

[0133] • Monitor conditions of a contract or trust (i.e. when company A acquires company B).

[0134] • Monitor news and events (i.e. when football team A wins a game).

[0135] • Monitor information from the Internet of Things (i.e. when a light bulb needs to be replaced).

[0136] • Monitor data from mobile / wearable devices (i.e. when a wearable step tracking device counts reach 10,000 steps).

[0137] • Monitor results of cloud computing (i.e. when a computation is completed and a result is received).

[0138] • Monitor remote data storage (i.e. whether a file still exists remotely).

[0139] The "Then action" part of the ICTA code block can perform many actions. The invention does not limit the number or type of actions that can be taken. While a transaction containing metadata related to the action can be written to the blockchain, the action is not limited to transactions on the blockchain.

[0140] The metadata can be in any form specified by the manager. However, according to one embodiment of the invention, the metadata can store a hyperlink to a file containing more data or instructions related to the action. The metadata can store a hyperlink to a hash table containing more data or instructions related to the action and a hash of the action to be used as a loop-up key for the hash table. Embodiments can use links in a format similar to the BitTorrent's magnet URL format.

[0141] A list of example operations is listed below.

[0142] • Social media (i.e. send a message to a friend).

[0143] • Trading (i.e. sell X shares).

[0144] • Internet of Things (i.e. turn off a light bulb).

[0145] • Commerce (i.e. buy an item online).

[0146] As the invention does not limit the nature, type or number of actions performed, the invention provides a highly versatile solution that can have great advantages in a wide range of applications.

[0147] The manager's control stack can be implemented in a number of ways tailored to the needs of each user. For example, the repetitive looping of the control stack can be based on any Turing complete language. One possible language choice is a Forth-style stack-based language. The advantage of using such a language is that it keeps the control stack consistent in programming style with the use of scripts that are already known and widely used.

[0148] Using a script's reserve stack as a data storage space

[0149] The scripts contain commands, also known as op codes, that enable the user to move data to an alternative stack, known as the "alt stack".

[0150] The op codes are:

[0151] • OP_TOALTSTACK - moves data from the top of the main stack to the top of the alt stack.

[0152] • OP_FROMALTSTACK - moves data from the top of the alt stack to the top of the main stack (see Figure 4 ).

[0153] This enables data from intermediate calculation steps to be stored in the alt stack, similar to the "memory" function that allows data to be stored on a calculator. According to illustrative embodiments of the present invention, the alt stack is used to configure scripts to solve small computational tasks and return the results to the calculation.

[0154] Using code registers to manage a manager

[0155] The manager also manages a registry of all code it owns and runs. This registry is structured like a lookup table or dictionary that maps specific keys to specific values (see Figure 5 ). The key-value pairs are represented by the hash of the code block (H1) and the Internet Protocol version 6 (IPv6) address where the code is stored, respectively. To retrieve a code block using the key H1, the lookup table is used to retrieve the associated value (which is the location where the source code is stored) and retrieve the source code accordingly.

[0156] Embodiments of the code registry can vary. For example, a local management list or a peer-to-peer (P2P) distributed hash table can be used to implement the lookup table. The source code can be stored locally, remotely, or using a decentralized file storage system. This can be implemented through a magnet link (URI) format or any link format using shared zero knowledge encryption.

[0157] Transaction metadata for a manager code, and regeneration of loops

[0158] The information needed to regenerate the manager loop in a particular iteration is stored as metadata in a transaction recorded on the blockchain (see Figure 6 and Figure 7 ).

[0159] In this way, the transaction on the blockchain stores or provides access to information related to a given iteration of the loop being executed on the manager. This information can include the value of any variables associated with the loop, such as the index i, as well as any other necessary information, such as the value of parameters used in the code block or location-related data that specifies where other required information can be accessed.

[0160] The metadata itself is stored as part of a multi-signature pay-to-script-hash script (P2SH) in the transaction. For the format of the script, see Figure 8 . With the metadata recorded in the transaction, it is also possible to record an audit trail of how the code was executed in the past.

[0161] The manager can regenerate the repetitive loop code block at each iteration in a number of ways. The code block can be hard coded into the manager itself, or can be stored in a private or publically available file, or stored as an entry in a private or public hash table file, or a combination of the above. The code block can be static code with hard coded variables, or the code block can be a static code block but contain parameters that can be filled in. The parameters can be a single value in any data format, or can be a small piece of code, or a combination of the above. The parameters can be filled in by retrieving the parameters directly from the metadata in the transaction, or from an external source such as an internal database or a private / public file or hash table or any combination of the above. A pointer to the external source of the parameter value can be stored in the metadata in the transaction.

[0162] The following steps provide one example of how the manager regenerates the repetitive loop code block at the i-th iteration. In this example, the code registry is a hash table where the hash value is used as the lookup key for the table and is stored in the metadata of the transaction.

[0163] 1. The manager monitors the blockchain for transactions containing a hash that matches an entry in the code registry.

[0164] 2. The manager looks up the transaction containing the corresponding hash (H1).

[0165] 3. The manager reads the "Metadata-CodeHash" to get the CodeHash field to get H1 and uses H1 to retrieve the code (C1). If RIPEMD-160(SHA256(C1)) equals H1, then the code has not changed and it is safe to proceed to the next step.

[0166] 4. The manager reads the "Metadata-CodeHash" to store the index I and regenerates the code at the i-th iteration. In other words, the loop is "reloaded" at the appropriate iteration.

[0167] 5. The user's signature is included in the P2SH command to verify the origin of the metadata.

[0168] 6. If this iteration of the loop requires "Metadata-OutputHash" and "Metadata-OutputPointer", the manager reads these data (see Figure 6 ) to retrieve the output of the previous step.

[0169] Multiple signatures can be required to unlock the transaction (e.g. user, operating system, software developer and software vendor). This enables a DRM system to be used to manage the rights of all parties involved in the operation of the code in the P2SH transaction.

[0170] Updating a manager code

[0171] Software updates and patches related to the code blocks of the manager are securely authorised and managed using the multi-signature P2SH transaction (see Figure 8 ). The multi-signature transaction records the metadata of the new and old code blocks as shown in Figure 8 and Figure 9 . This records the transition from the old code to the new code, providing an audit trail of the software update. The manager needs to store all the hash values of the new and old source code blocks. The hashes of the new and old source code blocks can be used to verify the integrity of the code files.

[0172] According to embodiments of the present application, multiple signatures are required to unlock the transaction (e.g. user, operating system, software developer and software vendor). This provides a DRM system for managing the patching and software updates of the code used by the manager.

[0173] Unlike most software which does not allow software to be updated at runtime, an advantage of the present application is that software updates can occur in the middle of an execution loop. This provides a dynamic response solution which can be reconfigured in real-time and with minimal disruption to the processes controlled by the present application.

[0174] The information captured on the blockchain (see Figure 8 and Figure 9 ) can be used to update to new code in the middle of a loop and start the next iteration step using the output metadata from the previous iteration in the old code.

[0175] Example uses

[0176] Some current scripting languages do not allow loops to occur. However, when the manager of the present application continuously monitors the information on the blockchain, this allows complex automated actions to be performed in a secure manner based on the latest information from the blockchain.

[0177] The following illustrates how the control stack of the manager can be used for an automated process involving an automated and online voting robot. It should be noted that this is not limited to "voting" in the sense of elections or political voting, but can be used for any application involving selection or choice. The term "vote" can simply be used to mean "option" or "choice" or "indication".

[0178] The vote counting robot is designed to facilitate a fair and pseudo-anonymous vote, where a blockchain records an unalterable permanent audit trail of the vote counting process. The vote counting robot uses the control stack of the manager and a repeat loop to automatically count the votes (see Figure 10 ). The following scheme illustrates how the vote counting robot operates.

[0179] There are 100 voters. If 57 votes are received that only select "Yes" before January 1, 2016, then the payout will be issued to the chairman Jason. The voting process is divided into two parts:

[0180] • Token distribution

[0181] • Counting

[0182] For the token distribution, 100 voting tokens are distributed to each authorized voter. Each token is represented by a public key and a private key pair. The tokens are distributed to each voter using a secret exchange protocol. Each public key and address is loaded with a small amount of cryptocurrency representing one vote. The robot saves a list of public keys associated with each authorized token and publishes this list before the voting starts. To ensure that the vote cannot be manipulated and that the vote is anonymous, the list of private keys and the mapping between the voter identity and their token is destroyed (i.e. never stored).

[0183] Having a list of anonymous and pre-authorized addresses provides other important benefits. This ensures that only the authorized people can cast a valid vote. This can also facilitate the exclusion of any unwanted votes originating from specific addresses (e.g. spammers, unqualified voters) without compromising the identity of the voters. To implement the counting process, the manager runs a repeat loop. The list of addresses is saved in a script and transferred to the backup stack to store the data. Once the addresses are calculated, the addresses are removed from the backup stack and not added to the next transaction. When the list of addresses is empty, the repeat loop stops.

[0184] Instead of using an integer index i to keep track of where the loop currently is, the vote robot manager uses an integer index i to store the intermediate value of the vote count. This ensures that the intermediate value of the vote count is stored in the blockchain. This provides an audit trail and indicates that the vote counting process is fair.

[0185] If 57 votes are received that only select "Yes", then the agreed amount is paid to Jason's account. The cryptographic hash of the vote counting script and the IPv6 address where this script is stored will be published to the public. This means that the public has enough information to perform a recalculation and ensure that the vote counting process is fair and correct.

[0186] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design many alternative embodiments without departing from the scope of the application as defined by the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word 'comprising' and 'comprises', and the like, does not exclude the presence of elements or steps other than those listed in any claim. In the present application 'comprising' means 'including' or 'encompassing' and 'comprises' means 'including' or 'encompassing'. The singular forms 'a', 'an' and 'the' include plural references unless the context clearly dictates otherwise. The application can be implemented by means of both hardware and software, and any combination thereof. In a device claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measures cannot be used to advantage.

Claims

1. A method of using a blockchain to control a process executing on a computing device, the method comprising the steps of: executing a loop on the computing device; and using a state of the blockchain to influence execution of the loop by, for each iteration of the loop: if the computing device finds a predetermined hash of a portion of code within a transaction in the blockchain, restarting the loop at a specified iteration; wherein information relating to the iteration is specified using metadata provided within or associated with the transaction. information relating to at least one iteration of the loop is stored in a transaction on the blockchain; wherein the information is stored as metadata in the transaction.

2. The method of claim 1, wherein, generating a cryptographic hash of code relating to the loop and storing the cryptographic hash in a transaction on the blockchain.

3. The method of claim 1 or 2, further comprising the step of:

4. The method of claim 1, the method further comprising the step of: for each iteration of the loop, evaluating a condition and performing at least one action based on the result of the evaluation, wherein the at least one action comprises: causing at least one transaction to be written to the blockchain; and / or causing an action outside of the blockchain to be performed. the condition relates to:

5. The method of claim 4, wherein, data received, detected or generated by the computing device; or a state of the blockchain. the computing device is:

6. The method of claim 1, wherein, i) a device outside of the blockchain separate from the blockchain; and / or ii) arranged to implement a control stack of a Turing machine; and / or iii) arranged to use the blockchain as a non-erasable tape of a Turing machine; and / or iv) arranged to monitor: the state of the blockchain, and / or a value generated or received by the computing device, and / or a data or signal source provided from outside of the blockchain.

7. The method of claim 1, further comprising the steps of: i) using the blockchain as a storage component for storing data, instructions or pointers to data and / or instructions; and ii) using a computing device as a control flow management component of a Turing complete process, the computing device arranged to execute a loop mechanism. code for the loop is:

8. The method of claim 1, wherein, hard-coded into or on the computing device; stored in a private or publicly available file; and / or stored as an entry in a private or public hash table file; and / or a static block of code with a hard-coded variable or at least one parameter; and / or associated with or comprising at least one parameter: filled in, initialised or instantiated with a single value using any data format; a portion of code; obtained from metadata in a blockchain transaction or from a source external to the computing device; obtained from a database, or a private or public file or hash table; and / or filled in using a value accessed using at least one pointer to a data source, the at least one pointer stored as metadata in a transaction on the blockchain. the computing device comprises or is in communication with a registry that enables the computing device to access pre-stored versions of subroutines; 9. The method of claim 1, wherein, wherein the registry stores: i) a cryptographic hash of code relating to the loop; and ii) a cryptographic hash of a portion of code relating to the loop; and iii) a cryptographic hash of a portion of code relating to the loop; and iv) a cryptographic hash of a portion of code relating to the loop; and v) a cryptographic hash of a portion of code relating to the loop; and vi) a cryptographic hash of a portion of code relating to the loop; and vii) a cryptographic hash of a portion of code relating to the loop; and viii) a cryptographic hash of a portion of code relating to the loop; and ix) a cryptographic hash of a portion of code relating to the loop; and x) a cryptographic hash of a portion of code relating to the loop; and xi) a cryptographic hash of a portion of code relating to the loop; and xii) a cryptographic hash of a portion of code relating to the loop; and xiii) a cryptographic hash of a portion of code relating to the loop; and xiv) a cryptographic hash of a portion of code relating to the loop; and xv) a cryptographic hash of a portion of code relating to the loop; and xvi) a cryptographic hash of a portion of code relating to the loop; and xvii) a cryptographic hash of a portion of code relating to the loop; and xviii) a cryptographic hash of a portion of code relating to the loop; and xix) a cryptographic hash of a portion of code relating to the loop; and xx) a cryptographic hash of a portion of code relating to the loop; and xxi) a cryptographic hash of a portion of code relating to the loop; and xxii) a cryptographic hash of a portion of code relating to the loop; and xxiii) a cryptographic hash of a portion of code relating to the loop; and xxiv) a cryptographic hash of a portion of code relating to the loop; and xxv) a cryptographic hash of a portion of code relating to the loop; and xxvi) a cryptographic hash of a portion of code relating to the loop; and xxvii) a cryptographic hash of a portion of code relating to the loop; and xxviii) a cryptographic hash of a portion of code relating to the loop; and xxix) a cryptographic hash of a portion of code relating to the loop; and xxx) a cryptographic hash of a portion of code relating to the loop; and xxxi) a cryptographic hash of a portion of code relating to the loop; and xxxii) a cryptographic hash of a portion of code relating to the loop; and xxxiii) a cryptographic hash of a portion of code relating to the loop; and xxxiv) a cryptographic hash of a portion of code relating to the loop; and xxxv) a cryptographic hash of a portion of code relating to the loop; and xxxvi) a cryptographic hash of a portion of code relating to the loop; and xxxvii) a cryptographic hash of a portion of code relating to the loop; and xxxviii) a cryptographic hash of a portion of code relating to the loop; and xxxix) a cryptographic hash of a portion of code relating to the loop; and xl) a cryptographic hash of a portion of code relating to the loop; and xli) a cryptographic hash of a portion of code relating to the loop; and xlii) a cryptographic hash of a portion of code relating to the loop; and xliii) a cryptographic hash of a portion of code relating to the loop; and xliv) a cryptographic hash of a portion of code relating to the loop; and xlv) a cryptographic hash of a portion of code relating to the loop; and xlvi) a cryptographic hash of a portion of code relating to the loop; and xlvii) a cryptographic hash of a portion of code relating to the loop; and xlviii) a cryptographic hash of a portion of code relating to the loop; and xlx) a cryptographic hash of a portion of code relating to the loop; and l) a cryptographic hash of a portion of code relating to the loop; and li) a cryptographic hash of a portion of code relating to the loop; and lii) a cryptographic hash of a portion of code relating to the loop; and liii) a cryptographic hash of a portion of code relating to the loop; and liv) a cryptographic hash of a portion of code relating to the loop; and lv) a cryptographic hash of a portion of code relating to the loop; and lvi) a cryptographic hash of a portion of code relating to the loop; and lvii) a cryptographic hash of a portion of code relating to the loop; and lviii) a cryptographic hash of a portion of code relating to the loop; and lix) a cryptographic hash of a portion of code relating to the loop; and lx) a cryptographic hash of a portion of code relating to the loop; and lxi) a cryptographic hash of a portion of code relating to the loop; and lxii) a cryptographic hash of a portion of code relating to the loop; and lxiii) a cryptographic hash of a portion of code relating to the loop; and lxiv) a cryptographic hash of a portion of code relating to the loop; and lxv) a cryptographic hash of a portion of code relating to the loop; and lxvi) a cryptographic hash of a portion of code relating to the loop; and lxvii) a cryptographic hash of a portion of code relating to the loop; and lxviii) a cryptographic hash of a portion of code relating to the loop; and lxix) a cryptographic hash of a portion of code relating to the loop; and lxx) a cryptographic hash of a portion of code relating to the loop; and lxxi) a cryptographic hash of a portion of code relating to the loop; and lxxii) a cryptographic hash of a portion of code relating to the loop; and lxxiii) a cryptographic hash of a portion of code relating to the loop; and lxxiv) a cryptographic hash of a portion of code relating to the loop; and lxxv) a cryptographic hash of a portion of code relating to the loop; and lxxvi) a cryptographic hash of a portion of code relating to the loop; and lxxvii) a cryptographic hash of a portion of code relating to the loop; and lxxviii) a cryptographic hash of a portion of code relating to the loop; and lxxix) a cryptographic hash of a portion of code relating to the loop; and lxxx) a cryptographic hash of a portion ii) information indicative of a location from which a copy of the code can be accessed.

10. The method of claim 1, further comprising the step of: using a blockchain transaction to update the code for the loop such that existing code is replaced with new code; wherein, i) the transaction is a multi-signature P2SH transaction; or ii) the method further comprises the step of storing a hash of the existing code and a hash of the new code.

11. The method of claim 1, comprising the step of: using the state of the blockchain to influence execution of the loop by monitoring the current state of the blockchain for transactions that match a start or trigger condition, a repeat condition, or a stop condition.

12. The method of claim 1, wherein, the process: i) is an automated voting process; and / or ii) comprises distributing or allocating tokens to voters, wherein each token is associated with an amount of cryptocurrency.

13. The method of claim 1, wherein: the loop executed on the computing device is based on a Turing complete language; and the blockchain is associated with a blockchain protocol or a functionally restricted scripting language that does not itself support incorporating complex control structures into code written in the scripting language.

14. A computer-based system arranged to implement the method of any preceding claim and to use a blockchain to control a process executed on a computing device, the system comprising: a blockchain; and a computing device arranged to execute a loop such that execution of the loop is influenced by the state of the blockchain.

Citation Information

Patent Citations

  • System and method for securely receiving and counting votes in an election

    US20160027229A1