System and method for providing high-level operation on blockchain
By emulating high-level operations within blockchain scripts using combined low-level opcodes, the limitations of scripting languages like Bitcoin's Script are overcome, enabling more complex and versatile blockchain applications with improved efficiency and reduced errors.
Patent Information
- Application Number
- JP2024093389
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2017-07-07
- Filing Date
- 2024-06-10
- Publication Date
- 2024-08-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Current blockchain scripting languages, such as Bitcoin's Script, lack support for complex control flow mechanisms and operations like multiplication and division, limiting the functionality and versatility of blockchain applications.
Implement high-level scripting language primitives, such as arithmetic operations, within blockchain transactions by combining existing low-level opcodes to emulate functionalities not natively supported by the scripting language, allowing for more complex and diverse applications without modifying the scripting language or protocol.
Enables the creation of functionally complex and diverse blockchain applications with reduced programming errors and increased efficiency, while maintaining the security and integrity of the blockchain system.
Smart Images

Figure 2024116281000015 
Figure 2024116281000016 
Figure 2024116281000017
Abstract
Description
[Technical field]
[0001] The present invention relates generally to distributed ledger technology, and in particular to blockchain technology, such as the Bitcoin blockchain or any other blockchain / cryptocurrency protocol variant. The present invention is suitable for use, but not limited to, in controlling how scripts within a blockchain transaction (Tx) are configured for execution, and thus how control or ownership of digital resources is transferred across a blockchain network. [Background technology]
[0002] As used herein, the term "blockchain" is used to include all forms of electronic, computer-based, distributed ledger technologies. These include consensus-based blockchain and transaction chain technologies, permissioned and unpermissioned ledgers, shared ledgers, side chains, and variations thereof. The most widely known application of blockchain technology is the Bitcoin ledger, although other blockchain implementations have been proposed and developed. Although Bitcoin is referred to herein for convenience and illustrative purposes, it should be noted that the present invention is not limited to use with variations of Bitcoin's blockchain, and alternative blockchain implementations and protocols are within the scope of the present invention.
[0003] A blockchain is a peer-to-peer electronic ledger implemented as a computer-based decentralized distributed system composed of blocks. Blocks are in turn composed of transactions. Each transaction is a data structure that encodes the transfer of control of digital assets between participants in the blockchain system and contains at least one input and at least one output. Each block contains a hash of the previous block, and blocks are chained together to create a permanent, immutable record of all transactions written to the blockchain since its inception. Transactions contain small programs, known as scripts, embedded in their inputs and outputs. Scripts specify how and by whom the output of a transaction can be accessed. On the Bitcoin platform, these scripts are written using a stack-based scripting language called Script.
[0004] In order for a transaction to be written to the blockchain, it must be "verified." Network nodes (miners) perform work to ensure that each transaction is valid, and invalid transactions are rejected from the network. A software client installed on the node performs this validation work on unspent transactions (UTXOs) by executing its locking and unlocking scripts. If the execution of the locking and unlocking scripts evaluates to true, then the transaction is valid and the transaction is written to the blockchain. Thus, for a transaction to be written to the blockchain, it must i) be verified by the first node that receives the transaction, and if the transaction is verified, the node relays the transaction to other nodes in the network, ii) be added to a new block constructed by miners, and iii) be mined, i.e., added to the public ledger of past transactions.
[0005] Although blockchain technology is most widely known for its use in implementing cryptocurrencies, digital entrepreneurs are beginning to explore the use of both the cryptocurrency security system on which Bitcoin is based, and the data that can be stored on the blockchain, to implement new systems. It would be highly advantageous if blockchain could be used for automated tasks and processes that are not limited to the cryptocurrency realm, thus broadening the applicability of the technologies implemented in blockchain. Such solutions would be more diverse in their applications, while still being able to take advantage of the benefits of blockchain (e.g., permanent, tamper-resistant record of events, distributed process, etc.).
[0006] However, in order to improve the functionality of such technologies, some currently existing technical limitations need to be resolved. In one or more Bitcoin protocols, for example, certain operators may not be available to a programmer when their program is written in Script. Security-related concerns have led the Bitcoin community to disable some of the Script opcodes provided in the original version of the protocol. These include operators for performing certain arithmetic operations, such as multiplication and division. Thus, currently, in some protocols, there is no inherent mechanism to perform such operations in Script, which limits what the script code can currently accomplish. Scripts that contain invalid opcodes will fail and abort. This limits the functionality of the technology as implemented in the underlying blockchain protocol, etc. Technical challenges exist when a desired implementation needs to use functionality not provided in the underlying protocol. Protocol modifications may not always be desirable or feasible. Meanwhile, such blockchain platforms remain functionally constrained.
[0007] Therefore, there is also a need to provide a solution that gives script programmers greater programming power and increases the versatility, availability and applicability of the language, while still maintaining the desire to maintain the security and integrity of the blockchain scripting language. Such a solution may provide an improved blockchain network. A number of benefits may be derived from this, including, but not limited to:
[0008] Enabling the automation of complex blockchain-related transfers; Controlling the metadata stream that is recorded on the blockchain; · Expand the capabilities and uses of technologies implemented in blockchain.
[0009] An example of such a solution is provided here. Summary of the Invention
[0010] According to the present invention there is provided a system and / or method as defined in the accompanying claims.
[0011] An embodiment of the present invention may provide a blockchain implemented method / system, which may be a control method / system, which may be configured to control the execution of scripts embedded in a blockchain transaction (Tx) and / or whether outputs are unlocked and / or to control the transfer of resources from one entity to another by a transaction.
[0012] The blockchain may be associated with a protocol and a scripting language. The scripting language may be a stack-based language. The scripting language may be functionally constrained in the sense that the scripting language does not allow complex control flow mechanisms such as loops and / or jump iterations. This may be the Bitcoin scripting language, Script, or an alternative.
[0013] An embodiment of the present invention may provide a mechanism to emulate or implement the functionality of an operation in a blockchain script. The operation may be an operation that is not natively supported by the scripting language associated with the blockchain protocol. It may be an invalid operation. It may be referred to as a high-level operation. It may be high-level relative to the word set (opcodes, commands, instructions, or functions) of the blockchain scripting language. A high-level operation may be an inherent primitive operation or an operation that operates at a level of abstraction removed from the native opcodes of the language. A high-level operation may be an arithmetic operation such as multiplication and division. The advantage of this is that the present invention can be used to write scripts that incorporate this functionality in a convenient way, without the need to change the scripting language or the blockchain protocol. Thus, the present invention provides an improved blockchain system, making more functionally complex and more functionally diverse applications possible to run on the blockchain, and making application programming easier and faster to accomplish with reduced errors. Thus, the result is a more diverse, functionally powerful and useful blockchain. Meanwhile, the present invention makes it possible to build more blockchain-implemented technologies.
[0014] Additionally or alternatively, the method may include configuring a plurality of (blockchain) scripting language primitives that, when executed, provide functionality of high-level scripting language primitives, the scripting language may be associated with a blockchain protocol; inserting the plurality of scripting language primitives at least once into a script; and / or inserting the script into a blockchain transaction (Tx).
[0015] Additionally or alternatively, a method according to the present invention may include storing a plurality of blockchain opcodes (primitives) configured and / or selected to perform functions of high-level scripting language operators, retrieving the plurality of opcodes from storage, and inserting the plurality of opcodes into a script in a blockchain transaction.
[0016] The multiple opcodes may be described as a "chunk."
[0017] The method may include evaluating the transaction and / or submitting the transaction to a blockchain network. The method may include executing the transaction.
[0018] Each of the scripting language primitives may also be known as a word, a command, or a function. These may be referred to as "high-level primitives." For convenience, the term "opcode" is used for "scripting language primitive." One, some, or all of the opcodes may be selected from a word or instruction set of the scripting language. They may be specific to the scripting language.
[0019] A high-level scripting language primitive may be a group or selection of configured opcodes. They may be purposefully configured to provide a desired abstracted functionality. This may be referred to as a "high-level primitive" for ease of reference. A high-level primitive may perform an arithmetic operation or a data copy, logic or program (flow) control operation. This may produce a result that is left in memory on the computer's stack. A high-level primitive may emulate or provide functionality of an opcode that is not included in the language's native word set or is disabled. A high-level primitive may be "high-level" in the sense that it can be decomposed into more basic or building blocks that perform operations that are native to the language and / or functionally simpler. A high-level primitive is a level of abstraction more than an opcode, but may be configured to perform a single operation or produce a result.
[0020] The scripting language may be the Script language. The blockchain protocol may be the Bitcoin protocol. However, other languages and protocols may be encompassed within the scope of the present invention. The scripting language may be functionally constrained. The term "non-Turing complete" may be used synonymously herein with the term "functionally constrained." A language may be functionally constrained in the sense that the language does not natively support one or more control flow mechanisms such as loops and / or jump iterations.
[0021] The method may further include selecting one, some or all of the plurality of scripting language primitives from a word set or instruction set of the scripting language.
[0022] The method may further include saving and / or storing the scripting language primitives in a computer-based storage resource, which may be a non-volatile computer memory, and may further include retrieving the scripting language primitives from a computer-based storage resource prior to inserting the scripting language primitives into the script.
[0023] The script may be an unlock script, a lock script, or a redeem script.
[0024] Scripts are inserted into a blockchain transaction (Tx) by being associated with the input or output of the blockchain transaction.
[0025] The method may further include receiving an input or signal from a source and using the input or signal to control a number of times the plurality of scripting language primitives are inserted into the script.
[0026] The method may further include submitting the transaction to a blockchain network.
[0027] The scripting language primitives are inserted into a template script and / or a template transaction (Tx), the template may be an incomplete version of the script / transaction.
[0028] The present invention also provides a computer-implemented system. The system may be configured to perform any embodiment of the method described above. Any feature described in relation to one or more aspects of the invention may be applicable to any other aspect. Any feature described in relation to the method may also be applicable to the corresponding system and vice versa.
[0029] The present invention also provides a system comprising a processor and a memory containing executable instructions that, upon execution by the processor, cause the system to perform any embodiment of the computer-implemented method described herein.
[0030] The present invention also provides a non-transitory computer-readable storage medium having executable instructions stored thereon that, when executed by a processor of a computer system, cause the computer system to perform at least an embodiment of a computer-implemented method described herein.
[0031] These and other aspects of the invention will be apparent from and will be taught with reference to the embodiments described hereinafter, by way of example only, and with reference to the accompanying drawings, in which: [Brief description of the drawings]
[0032] [Figure 1] It shows how transactions can be chained together on a blockchain to transfer control of ownership of some cryptocurrency, as it is conventionally known. [Diagram 2] 1 illustrates control transactions suitable for use with an embodiment of the present invention and associated with an illustrative use case. [Diagram 3] 1 illustrates an exemplary network associated with a blockchain. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0033] The present invention provides an improved mechanism for implementing high-level operation functionality in blockchain scripts, even when the scripting language of the blockchain's associated protocol does not provide native opcodes for such operations or they are disabled. The present invention utilizes a selection of existing low-level opcodes of the language and combines them in novel ways to achieve the desired functionality. Selected combinations of primitive opcodes are selected and / or configured to provide the desired high-level functionality. The selected combinations of native opcodes may be referred to as "high-level operators" for convenience and ease of reference. Thus, the term "high-level" may be used to mean that an operation can be decomposed into more basic or fundamental operations that are preferably native to the scripting language. Multiple opcodes or chunks of opcodes may be associated with a label or identifier for ease of reference, use, or incorporation.
[0034] The code portions that make up the high-level operators may be pre-determined or pre-selected. "Pre-" in this context may mean before the end use or application to which the code portions will ultimately be put. Additionally or alternatively, it may mean before execution or run-time. The code portions (or "chucks") are stored in a computer-based resource such as a non-volatile memory. When a script is needed for a given purpose, the stored opcodes can be accessed, copied, and inserted into the script at one or more selected locations to provide the desired control and functionality at run-time. The script with the high-level operators inserted may be a template that is accessed from the storage device. Thus, functionally complex blockchain transactions can be conveniently and instantly generated, saving programming time, effort, and reducing the possibility of coding errors. By reducing the possibility of errors, the present invention provides a mechanism to ensure the quality of the code used for blockchain transactions. This also reduces the number of failures of the script (and therefore the transaction) at run-time. In this sense, the present invention provides a more efficient and less error prone solution to performing transactions on a blockchain and transfers from one party to another, via the output of one transaction to the input of a second transaction.
[0035] Upon execution, one or more signals or inputs can be received from a source, which can be used to influence or control the number of times that high level operators are used within the script. In certain embodiments, inputs are received from sensors. Thus, a script can be generated such that a result is calculated in response to some external or environmental factor.
[0036] Another advantage is that the design, implementation, or deployment of existing scripting languages does not need to be amended or changed in any way: the functionality of invalid or unimplemented primitive operators can be easily and undisruptively provided to the blockchain protocol in its current form.
[0037] Hereafter, we present a solution according to embodiments of the present invention that allows for the emulation of high-level multiplication and division operators. These embodiments include a Script-based sequence of operations that provides the desired functionality and behavior of the operator. The operator provides a mechanism to control how the programs implemented by the blockchain execute. When these programs are embedded into the inputs and outputs of blockchain transactions (Tx), they therefore provide a mechanism to influence and control how the transaction is executed and thus transfers control of ownership of cryptocurrency from party to party.
[0038] <Example: Multiplication> In this embodiment, we provide a mechanism for multiplication in blockchain scripts. This takes advantage of the knowledge that multiplication takes X and Y as the values you want to multiply. Written in Script language syntax, the multiplication operator is as follows:
number
[0039] The result of doing the above is that the product is left on the Alt stack.
number
[0040] In the code above, the purpose of the begin segment is to swap operands as necessary to ensure that fewer additions need to be performed. For example, 3x2 so that 2x3 requires fewer additions. This reduces effort and makes the overall code more efficient in terms of time and computation. The "swap" segment is as follows:
number
[0041] The purpose of the code below is to provide a counter mechanism.
number
[0042] The value of the counter can be used to control the number of times the addition is performed.
[0043] In the above example, the code shown in the dotted box is the code to perform the addition. The addition is repeated as shown in the subsequent dotted box. For simplicity and readability, the content is not repeated. The OP_EQUAL operation at the end of the addition code is used to check if the addition has been performed a sufficient number of times.
[0044] The code shown in the double-lined box performs the functions of "cleaning up" the stack and returning the results.
[0045] <Example: Multiplication> To further illustrate the present technique, we provide below a working example using two operands, 2 and 3. In the example below, the state of the main stack and the Alt stack are shown. The left column is the main stack and the right column is the Alt stack.
number
[0046] This leaves the stack in the following state (note: for simplicity and clarity, duplicates are not shown here):
number
[0047] Next, if the top stack item is false, execute the "body" of code with:
number
[0048] Using the OP_ROT operation rotates the top 3 items to the left.
number
[0049] <Example: Division> In this second example, we use the knowledge that division can be performed by repeated subtraction to perform division instead of multiplication. We provide a Script-based operation sequence that emulates the behavior of the division operator. Let X and Y be the values you want to divide. Written in the Script language syntax, the division operator is as follows:
number
[0050] The output above is shown on the left in the Alt stack.
number
[0051] <Example: Division> In this working example, we divide 11 by 3.
number
[0052] <Second operation example: division> In this second working example, we show how the solution handles division by zero, which can be a source of coding errors in computational implementations due to the inability of finite machines to represent infinity. In this example, we step through the division of 3 by 0.
number
[0053] <Third operation example: division> In the third working example, we proceed through the division of 0 by 3.
number
[0054] <Illustrative use case: Control system implemented by blockchain> The present invention provides techniques for implementing high-level operations in blockchain scripts even when the protocol's language does not contain the desired low-level opcodes. This provides a wide variety of configurations for implementing solutions on blockchain platforms.
[0055] To illustrate this, we present here a system that combines multiple inputs to coordinate the operation of other devices. As an example, we consider two sensors that provide the following inputs: (i) the number of tank containers on board, n; (ii) Assume that the weights of the containers, w, and w, are exactly the same.
[0056] The device, in this simple example a cargo ship, can have two states: (i) A cargo ship is at the wharf (state 1), (ii) A cargo ship leaves the port (state 2). Initially, the system is in state 1.
[0057] We consider the threshold condition W t The total weight W carried by the cargo ship controls its motion.
[0058] ·W>W t If so, the system is in state2.
[0059] Figure 2 shows a control transaction (Tx) submitted to the blockchain. The opcode Pro_MULT represents the high-level arithmetic operation (X) described above. The sensor provides the values n and w to the unlock script. The corresponding unlock script that needs to be presented to the lock script is therefore:
number
[0060] <Blockchain network> Referring to FIG. 3, FIG. 3 illustrates in block diagram form an exemplary network associated with a blockchain. The network may be referred to herein as a blockchain network 100 and may be utilized for implementing the present invention. The blockchain network 100 is a peer-to-peer open membership network that anyone may join without invitation or approval from other members. The blockchain network 100 operates under a blockchain protocol, and distributed electronic devices running instances of the blockchain protocol may participate in the blockchain network 100. Such distributed electronic devices may be referred to as nodes 102. The blockchain protocol may be, for example, the Bitcoin protocol, or other cryptocurrency.
[0061] The electronic devices that execute the blockchain protocol and form the nodes 102 of the blockchain network 100 may be of various types, including, for example, computers such as desktop computers, laptop computers, tablet computers, servers, mobile devices such as smartphones, wearable computers such as smart watches, or other electronic devices.
[0062] The nodes 102 of the blockchain network 100 are coupled to one another using suitable communication technologies, which may include wired and wireless communication technologies. In many cases, the blockchain network 100 is implemented at least in part on the Internet, and some of the nodes 102 may be located in geographically dispersed locations.
[0063] Nodes 102 maintain a global ledger of all transactions on the blockchain. The transactions are grouped into blocks, with each block containing a hash of the previous block in the chain. The global ledger is a distributed ledger, and each node 102 may store a full or partial copy of the global ledger. Transactions by nodes 102 that affect the global ledger are verified by other nodes 102. As a result, the validity of the global ledger is maintained. The implementation and operation details of a blockchain network, such as using the Bitcoin protocol, are understood by those skilled in the art.
[0064] Each transaction typically has one or more inputs and one or more outputs. Script embedded in the inputs and outputs specifies how and by whom the transaction's outputs can be accessed. A transaction's output may be an address to which value is transferred as a result of the transaction. The value is then associated with that output address as an unspent transaction output (UTXO). Subsequent transactions may then reference that address as an input to use or disperse the value.
[0065] Nodes 102 can fulfill many different functions, from network routing to wallet services, and maintain a robust and secure distributed public ledger. "Full nodes" have a complete up-to-date copy of the blockchain and can therefore verify any transaction (spent or unspent) on the public ledger. "Lightweight nodes" (or SPVs) maintain a subset of the blockchain and can verify transactions using "simple payment verification" techniques. Lightweight nodes download only block headers, not the transactions within each block. These nodes therefore rely on peers to verify their transactions. "Mining nodes" are full or lightweight nodes, and are responsible for verifying transactions on the blockchain and generating new blocks. "Wallet nodes" are typically lightweight nodes, and handle wallet services for users. Nodes 102 communicate with each other using a connection-oriented protocol such as TCP / IP (Transmission Control Protocol).
[0066] It should be noted that the above-described embodiments do not limit the present invention, and that those skilled in the art can devise numerous alternative embodiments without departing from the scope of the present invention, which is defined by the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" or "comprises" and the like does not exclude the presence of elements or steps other than those listed in any claim and the specification as a whole. In this specification, "comprises" means "includes" or "consists of", and "comprising" means "including" or "including of". The singular reference of an element does not exclude the presence of a plurality of such elements and vice versa. The invention can be implemented by means of hardware comprising several distinct elements, or by means of a suitably programmed computer. In a device claim enumerating several means, these several means may be implemented by one and the same hardware element. The fact that certain quantities are recited in mutually different dependent claims does not indicate that a combination of these quantities cannot be used to advantage. [Explanation of symbols]
[0067] 100 Blockchain Networks 102 nodes
Claims
1. A control method implemented by a blockchain, comprising: Configuring a plurality of scripting language primitives such that, when executed, the scripting language provides functionality of a high-level scripting language primitive, the scripting language being associated with a blockchain protocol; inserting said plurality of scripting language primitives at least once into a script; Inserting the script into a blockchain transaction (Tx), where a number of scripting language primitives are used to control the device; The method includes:
2. The method of claim 1 , wherein the high-level scripting language primitives perform arithmetic operations.
3. The method of claim 1 , wherein the scripting language is a Script language and / or the blockchain protocol is a Bitcoin protocol.
4. The method of claim 1 , further comprising the step of selecting the plurality of scripting language primitives from a word set or an instruction set of the scripting language.
5. The method of claim 1 , further comprising the step of preserving and / or storing the plurality of scripting language primitives in a computer-based storage resource.
6. 2. The method of claim 1, further comprising retrieving the scripting language primitives from a computer-based storage resource prior to inserting the scripting language primitives into the script.
7. The method of claim 1 , wherein the script is an unlock script, a lock script, or a redeem script.
8. 2. The method of claim 1, wherein the script is inserted into the blockchain transaction in association with an input or output of the blockchain transaction.
9. 2. The method of claim 1, further comprising the step of receiving an input or signal from a source and using the input or signal to control a number of times the plurality of scripting language primitives are inserted into a script.
10. 10. The method of claim 1, further comprising submitting the blockchain transaction to a blockchain network.
11. The method of claim 1 , wherein the plurality of scripting language primitives are inserted into a template script and / or a template transaction (Tx).
12. The method of claim 1 , wherein the plurality of scripting language primitives are associated with a label or identifier.
13. The method of claim 1 , wherein the scripting language is functionally constrained.
14. 13. A computer-implemented system configured to perform the control method of claim 1.
15. A computer-readable storage medium containing computer-executable instructions that, when executed, configure a processor to perform the control method of claim 1.
16. 1. An electronic device comprising: An interface device; a processor coupled to the interface device; a memory coupled to the processor, the memory storing computer executable instructions that, when executed, configure the processor to perform the control method of claim 1; An electronic device comprising:
Citation Information
Patent Citations
System and Method for a Distributed Autonomous Medical Economy Platform
JP2018533103A
System and method for decentralized autonomous healthcare economy platform
WO2017024071A1
