# US 11,307,835 B2 · Method for controlling the flow execution of a generated script of a blockchain transaction

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,307,835 B2
- Document ID: US11307835B2
- Status: Granted
- Kind: B2
- Application number: 16/629,291
- Filed: 2018-07-05
- Published: 2020-06-04
- Granted: 2022-04-19
- Earliest claimed: 2017-07-07
- Assignees: nChain Holdings Limited
- Applicants: nChain Holdings Limited
- Inventors: Craig Steven Wright; Stephane Savanah
- Web page: https://patentgrep.com/patent/US11307835B2

## CPC

- H04L 9/0618: {Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation}
- G06F 8/31: {Programming languages or programming paradigms}
- G06F 8/41: Compilation
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 8/443: {Optimisation}
- G06F 8/452: {Loops}
- G06F 8/51: Source to source
- H04L 9/0637: {Modes of operation, e.g. cipher block chaining [CBC], electronic codebook [ECB] or Galois/counter mode [GCM]}
- H04L 9/0643: {Hash functions, e.g. MD5, SHA, HMAC or f9 MAC}
- H04L 9/3247: {involving digital signatures}
- H04L 9/3297: {involving time stamps, e.g. generation of time stamps}
- H04L 9/50: {using hash chains, e.g. blockchains or hash trees}
- H04L 63/1458: {Denial of Service}
- H04L 2209/56: Financial cryptography, e.g. electronic payment or e-cash
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The invention provides a computer-implemented method (and corresponding system) for generating a blockchain transaction (Tx). This may be a transaction for the Bitcoin blockchain or another blockchain protocol. The method comprises the step of using a software resource to receive, generate or otherwise derive at least one data item; and then insert, at least once, at least one portion of code into a script associated the transaction. Upon execution of the script, the portion of code provides the functionality of a control flow mechanism, the behaviour of the control flow mechanism being controlled or influenced by the at least one data item. In one embodiment, the code is copied/inserted into the script more than once. The control flow mechanism can be a loop, such as a while or for loop, or a selection control mechanism such as a switch statement. Thus, the invention allows the generation of a more complex blockchain script and controls how the script will execute when implemented on the blockchain. This, in turns provides control over how or when the output of the blockchain transaction is unlocked.

## Claims

### Claim 1

A computer-implemented method, comprising the steps of:
receiving, generating, or otherwise deriving at least one data item;
inserting, at least once, at least one portion of code into a script associated with a blockchain transaction such that, upon execution of the script, the script provides a functionality of a control flow mechanism, wherein a behavior of the control flow mechanism is controlled or influenced by the at least one data item; and
inserting or copying the at least one portion of code into the script more than once and at more than one location within the script,
wherein the functionality of the control flow mechanism is enabled or emulated in the script at least by using the at least one data item to determine a number of times to insert or copy the at least one portion of the code into the script, and
wherein the script is written in a scripting language that is functionally restricted on a blockchain.

### Claim 2 (depends on 1)

The computer-implemented method according to claim 1, wherein:
the script is associated with an input or output of the blockchain transaction.

### Claim 3 (depends on 1)

The computer-implemented method according to claim 1, wherein:
the blockchain transaction is generated in accordance with, or for use with, a blockchain protocol.

### Claim 4 (depends on 3)

The computer-implemented method according to claim 3, wherein:
the blockchain protocol is a Bitcoin protocol or a variant of the Bitcoin protocol.

### Claim 5 (depends on 1)

The computer-implemented method according to claim 1, wherein:
the control flow mechanism is a loop or a selection control mechanism.

### Claim 6 (depends on 1)

The computer-implemented method according to claim 1, wherein:
the at least one data item is derived from a compiler which is arranged to translate code from a High Level Language (HLL) into a blockchain transaction script.

### Claim 7 (depends on 1)

The computer-implemented method according to claim 1, wherein:
the at least one portion of code includes a counter or index which is incremented at least once upon the execution of the script, the counter or index being used to control or influence the execution of the script.

### Claim 8 (depends on 7)

The computer-implemented method according to claim 7, wherein:
the counter or index is incremented or otherwise manipulated using values stored in or retrieved from two stack-based data structures.

### Claim 9 (depends on 1)

The computer-implemented method according to claim 1, wherein:
the scripting language is non-Turing complete.

### Claim 10 (depends on 1)

A computer-implemented system comprising:
an electronic device;
one or more processors coupled to the electronic device; and
a memory coupled to the one or more processors, the memory having stored thereon computer executable instructions that, when executed, cause the one or more processors to implement the computer-implemented method of claim 1.

### Claim 11 (depends on 1)

A non-transitory computer readable storage medium comprising computer-executable instructions that, when executed, cause a processor to perform the computer-implemented method of claim 1.

### Claim 12 (depends on 1)

An electronic device comprising:
an interface device;
a processor coupled to the interface device; and
a memory coupled to the processor, the memory having stored thereon computer executable instructions which, when executed, cause the processor to perform the computer-implemented method of claim 1.
