SVScript class
Bitcoin has a built-in scripting language. This class allows one to easily move between human-readable instructions and internal hexadecimal representations of bitcoin script.
Constructors
- SVScript()
- Default constructor. Processing in this constructor is used by subclasses to bootstrap their internals.
- SVScript.fromASM(String str)
- SVScript.fromBitcoindString(String str)
- This constructor is only used by the Script Interpreter test vectors at the moment. Bitcoind test vectors are rather special snowflakes so we made a special constructor just for them.
-
SVScript.fromBuffer(List<
int> buffer) - Constructs a Script instance by parsing a byte buffer representing a script.
-
SVScript.fromByteArray(List<
int> buffer) - Constructs a Script instance by parsing a byte buffer representing a script.
-
SVScript.fromChunks(List<
ScriptChunk> chunks) - Constructs a Script instance from a list of ScriptChunks.
- SVScript.fromHex(String script)
- Constructs a Script instance by parsing a hexadecimal form of Script.
- SVScript.fromString(String script)
- Constructs a Script instance by parsing the human-readable form of Script OP_CODES.
Properties
-
buffer
→ List<
int> -
Return this script in it's hexadecimal form as a bytearray
no setter
-
chunks
→ List<
ScriptChunk> -
Returns this script's internal representation as a list of
ScriptChunk
sno setter - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
dynamic obj) → SVScript - Appends an item to the Script. Used by the Interpreter. Should not be useful for everyday wallet development.
-
findAndDelete(
SVScript tmpScript) → SVScript - Searches for a subscript within the current script and deletes it.
-
isPushOnly(
) → bool - Returns true if this script only performs PUSHDATA operations
-
isScriptHashOut(
) → bool - Returns true if this script matches the Pay-To-Public-Key-Hash template
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeCodeseparators(
) → SVScript - Strips all OP_CODESEPARATOR instructions from the script.
-
splice(
int index, int howMany, {List< ScriptChunk> ? values}) → List<ScriptChunk> - Removes ScriptChunks from the script and optionally inserts ScriptChunks.
-
toBitcoindString(
) → String -
toHex(
) → String - Renders this script in it's hexadecimal form as a String
-
toString(
{dynamic type = 'hex'}) → String -
Render this script in it's human-readable form
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
decodeFromOpN(
int opcode) → int -
encodeToOpN(
int value) → int -
getSigOpCount(
List< ScriptChunk> chunks, bool accurate) → int -
removeAllInstancesOf(
List< int> inputScript, List<int> chunkToRemove) → List<int> - Returns the script bytes of inputScript with all instances of the specified script object removed
-
removeAllInstancesOfOp(
List< int> inputScript, int opCode) → List<int> - Returns the script bytes of inputScript with all instances of the given op code removed
-
writeBytes(
ByteDataWriter os, List< int> buf) → void