Satoshi Script
A script the can be run in Nexa or BCH transaction validation virtual machine
Inheritors
Constructors
Construct a script from a hex string, which is a serialized script
Construct a script from a list of raw bytes
Construct a script from raw bytes
Construct a script from individual instructions
Create this script object from serialized data
Types
The result of attempting to match a script to well known script forms, pulling out the variable parts, such as public keys.
Script type
Properties
Functions
Append new instructions to this script
Append a raw instruction to this script
Append raw script bytes to this script. Note! Use add(OP.push(...)) to push data into a script
Wraps this script into a serialized byte array. That is, a byte array of script bytes. This is different than toByteArray which just returns the script bytes.
Clear any current script bytes, and replace them with the passed serialized script
Serialize this script
Compare whether 2 scripts are the same.
Make a copy of this script
Take a copy of stack element at offset as it would appear on the stack, returning the copy and the range copied from. Offset MUST point to a PUSH operation.
Turn a byte array (from the script stack) into a group amount
Replace any data currently in this script with the passed hex-encoded binary script. Note that this function does NOT check to ensure that the passed hex-encoded binary data is a valid script.
If this is a P2SH satisfier script, get its redeem script. Warning, this just returns the last script data push as a script, so if this is NOT a P2SH satisfier script, you will get weird results.
If this script is a script template output, put a token group and token amount into the script template output
Parse common script forms, P2PKH and P2PKT, and P2SH (in BCH only) and return useful data
Attempt to match this script (or just the beginning of it) to a script form.
Attempt to match this script (or just the beginning of it) to a script form
Return the P2SH constraint (output) script corresponding to this redeem script
Return the P2SH part of the satisfier (input) script corresponding to this redeem script. You must subsequently append a push-only script that provides the arguments required by the redeem script.
Returns true if this script has replacable marker parameters in it (its not a valid executable script yet).
Parse is the opposite of flatten in the sense that each element in data will be 1 instruction
Given an output script in script template format, parse its data items
Append raw script bytes to this script, returning a new script. Note! Use '+ OP.push(...)' to push data into a script")
Append an opcode to this script, returning a new script.
concatenate a script to the end of this one, returning the joined script
iterate through the script, looking for replaceable marker opcodes. If a marker is found, call the callback with the marker.
The single SHA256 hash of this script. Used by some services as a global pointer identifying the script
The RIPEMD160 of the SHA256 hash of this script. Used by P2SH scripts
Convert this script to a serialized byte array (suitable for network, execution or hashing)
This script with native group annotation