Method and system for providing high-level operations on a blockchain
By emulating high-level operations like multiplication and division within blockchain scripts using combined low-level opcodes, the limitations of scripting languages are overcome, enabling more complex and diverse blockchain applications with improved efficiency and reduced errors.
Patent Information
- Application Number
- JP2025182164
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2017-07-07
- Filing Date
- 2025-10-29
- Publication Date
- 2026-02-10
AI Technical Summary
Existing blockchain scripting languages, such as Bitcoin's Script, lack support for certain arithmetic operations like multiplication and division, limiting the functionality and versatility of blockchain applications.
Implement high-level scripting language primitives that emulate operations like multiplication and division by combining existing low-level opcodes, allowing these operations to be performed without modifying the scripting language or blockchain protocol, and inserting these primitives into blockchain transactions.
Enables more complex and diverse applications on the blockchain by providing efficient and error-reduced execution of transactions, enhancing the functionality and versatility of blockchain systems.
Smart Images

Figure 2026021421000015 
Figure 2026021421000016 
Figure 2026021421000017
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 blockchain transactions (Tx) are configured for execution, and therefore 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 encompass all forms of electronic, computer-based, distributed ledger technology. These include consensus-based blockchain and transaction chain technologies, permissioned and permissionless ledgers, shared ledgers, sidechains, and variations thereof. The most widely known application of blockchain technology is the Bitcoin ledger, although other blockchain implementations have been proposed and developed. While 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 decentralized, distributed, computer-based system composed of blocks. Blocks, in turn, are 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 chain 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 transaction's outputs 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 each transaction is valid; invalid transactions are rejected by the network. A software client installed on a node performs this validation work on unspent transactions (UTXOs) by running its locking and unlocking scripts. If the execution of the locking and unlocking scripts evaluates to true, 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; 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] While 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 upon 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 not limited to the cryptocurrency realm, thus broadening the applicability of blockchain-implemented technologies. 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, decentralized processes, etc.).
[0006] However, to improve the functionality of such technologies, several currently existing technical limitations must be addressed. In one or more Bitcoin protocols, for example, certain operators may not be available to programmers when their programs are written in Script. Security 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. Therefore, currently, some protocols lack an inherent mechanism for performing such operations in Script, which limits what script code can currently achieve. Scripts containing invalid opcodes will fail and terminate abnormally. This limits the functionality of technologies implemented in underlying blockchain protocols, etc. Technical challenges arise when a desired implementation requires the use of 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 provides greater programming capabilities to script programmers 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. Many benefits may be derived from this, including, but not limited to:
[0008] Enabling the automation of complex blockchain-related transfers; Controlling the metadata streams recorded on the blockchain; Expanding 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] Embodiments of the present invention may provide a blockchain-implemented method / system, which may be a control method / system configured to control the execution of scripts embedded in blockchain transactions (Tx) and / or whether outputs are unlocked, and / or to control the transfer of resources from one entity to another by a transaction.
[0012] A 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 it 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] Embodiments of the present invention may provide a mechanism for emulating or implementing the functionality of an operation within a blockchain script. The operation may be an operation not natively supported by the scripting language associated with the blockchain protocol. It may be an invalid operation. This 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 language's native opcodes. A high-level operation may be an arithmetic operation such as multiplication and division. An advantage of this is that the present invention can be used to write scripts that incorporate this functionality in a convenient manner, without requiring changes to the scripting language or the blockchain protocol. Thus, the present invention provides an improved blockchain system, enabling more functionally complex and diverse applications to be run on the blockchain, and making application programming easier and faster to achieve with fewer errors. This results in a more diverse, functionally powerful, and useful blockchain. Meanwhile, the present invention enables the construction of more blockchain-implemented technologies.
[0014] Additionally or alternatively, the method may include configuring a plurality of (blockchain) scripting language primitives to provide functionality of high-level scripting language primitives when executed, the scripting language being 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 within 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 the word or instruction set of the scripting language. They may be specific to the scripting language.
[0019] High-level scripting language primitives may be a group or selection of composed opcodes, which may be purposefully composed to provide a desired abstracted functionality, which may be referred to as "high-level primitives" for ease of reference. High-level primitives may perform arithmetic operations or data copies, logic, or program (flow) control operations, which may produce results that reside in memory on the computer's stack. High-level primitives may emulate or provide functionality of opcodes that are not included in or disabled in the language's native word set. High-level primitives may be "high-level" in the sense that they are native to the language and / or can be decomposed into more basic or building blocks that perform functionally simpler operations. High-level primitives are a level of abstraction more than opcodes, but may be composed 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 with the term "functionally constrained" herein. 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 plurality of scripting language primitives in a computer-based storage resource, which may be a non-volatile computer memory, and retrieving the plurality of scripting language primitives from the computer-based storage resource prior to inserting the plurality of 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 blockchain transactions (Tx) by being associated with the inputs or outputs 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 the 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), which may be an incomplete version of the script / transaction.
[0028] The present invention also provides a computer-implemented system, which may be configured to perform any of the above-described method embodiments. Any feature described in relation to one or more aspects of the present invention may be applicable to any other aspect. Any feature described in relation to a 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 stored thereon executable instructions that, when executed by a processor of a computer system, cause the computer system to perform at least one 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 herein, which are described hereinafter, by way of example only, with reference to the accompanying drawings, in which: [Brief explanation of the drawings]
[0032] [Figure 1] It shows how transactions can be chained together on a blockchain to transfer control of ownership of any cryptocurrency, as it is conventionally known. [Figure 2] 1 illustrates control transactions suitable for use with an embodiment of the present invention and associated with an illustrative use case. [Figure 3] 1 illustrates an exemplary network associated with a blockchain. DETAILED DESCRIPTION OF THE INVENTION
[0033] The present invention provides an improved mechanism for implementing high-level operation functionality within a blockchain script, 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 the language's existing low-level opcodes 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. 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 labels or identifiers for ease of reference, use, or invocation.
[0034] The code portions that make up the high-level operators may be predetermined or preselected. "In advance" 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 runtime. The code portions (or "chucks") are stored in a computer-based resource, such as 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 runtime. The script with the inserted high-level operators may be a template accessed from storage. Thus, functionally complex blockchain transactions can be conveniently and instantly generated, saving programming time and effort and reducing the likelihood of coding errors. By reducing the likelihood 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 script (and therefore transaction) failures upon execution. In this sense, the present invention provides a more efficient and less error prone solution for executing transactions on a blockchain and transferring funds 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 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] Hereinafter, we present a solution according to embodiments of the present invention that enables 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 operators. The operators provide a mechanism for controlling how 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 for influencing and controlling how transactions are executed and, therefore, how control of ownership of cryptocurrency is transferred 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:
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, 2 x 3 becomes 3 x 2 so that fewer additions are required. 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 whether the addition has been performed a sufficient number of times.
[0044] The code shown in the double-lined box performs the role 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 is 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, duplication is 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 three items to the left.
number
[0049] <Example: division> In this second example, we perform division instead of multiplication, using the knowledge that division can be performed by repeated subtraction. 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 Script language syntax, the division operator is:
number
[0050] The output above is shown on the left of 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. Division by zero can be a source of coding errors in computational implementations due to the inability of finite machines to represent infinity. In this example, we proceed 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 within blockchain scripts even when the protocol's language does not contain the desired low-level opcodes, which provides a wide variety of configurations for implementing solutions on blockchain platforms.
[0055] To illustrate this, we now present 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 pier (state 1), (ii) The 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 Figure 3, Figure 3 illustrates in block diagram form an exemplary network associated with a blockchain. The network may be referred to herein as blockchain network 100 and may be utilized to implement the present invention. Blockchain network 100 is a peer-to-peer, open membership network that anyone may join without invitation or approval from other members. Blockchain network 100 operates under a blockchain protocol, and distributed electronic devices running instances of the blockchain protocol may participate in 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. Often, the blockchain network 100 is implemented at least in part over 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, and each block contains 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, thereby maintaining the validity of the global ledger. The implementation and operation details of blockchain networks, 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 (spend or not) 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 that are responsible for verifying transactions on the blockchain and generating new blocks. "Wallet nodes" are typically lightweight nodes that 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 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 claim. The word "comprising" or "comprises", and the like, does not exclude the presence of elements or steps other than those listed in any claim or 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 can be embodied 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 method implemented on a blockchain, comprising: configuring a plurality of scripting language primitives to provide functionality of high-level scripting language primitives when executed, the scripting language being associated with a blockchain protocol; receiving one or more inputs or signals from a source and using said one or more inputs or signals to influence or control the number of times said plurality of scripting language primitives are inserted into a script; inserting the plurality of scripting language primitives into a script at least once; Inserting the script into a blockchain transaction (Tx); A method comprising:
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 the Script language and / or the blockchain protocol is the 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 saving 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 plurality of scripting language primitives from a computer-based storage resource prior to inserting the plurality of 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. 10. 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. 10. The method of claim 1, further comprising submitting the blockchain transaction to a blockchain network.
10. The method of claim 1 , wherein the plurality of scripting language primitives are inserted into a template script and / or a template transaction (Tx).
11. The method of claim 1 , wherein the plurality of scripting language primitives are associated with a label or identifier.
12. The method of claim 1 , wherein the scripting language is functionally constrained.
13. A computer-implemented system configured to perform the method according to any of claims 1 to 12.
14. 13. A computer readable storage medium comprising computer executable instructions that, when executed, configure a processor to perform the method of any one of claims 1 to 12.
15. 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 method of any one of claims 1 to 12; An electronic device comprising: