AddData pushes the passed data to the end of the script. It automatically chooses canonical opcodes depending on the length of the data.
A zero length buffer will lead to a push of empty data onto the stack (Op0 = OpFalse)
and any push of data greater than MAX_SCRIPT_ELEMENT_SIZE
will not modify
the script since that is not allowed by the script engine.
Also, the script will not be modified if pushing the data would cause the script to
exceed the maximum allowed script engine size MAX_SCRIPTS_SIZE
.
Pushes the passed opcode to the end of the script. The script will not be modified if pushing the opcode would cause the script to exceed the maximum allowed script engine size.
Adds the passed opcodes to the end of the script.
Supplied opcodes can be represented as an Uint8Array
or a HexString
.
Creates an equivalent pay-to-script-hash script. Can be used to create an P2SH address.
Optional
args: IHexViewConfigStatic
canonicalStatic
fromCreates a new ScriptBuilder over an existing script.
Supplied script can be represented as an Uint8Array
or a HexString
.
Generated using TypeDoc
ScriptBuilder provides a facility for building custom scripts. It allows you to push opcodes, ints, and data while respecting canonical encoding. In general it does not ensure the script will execute correctly, however any data pushes which would exceed the maximum allowed script engine limits and are therefore guaranteed not to execute will not be pushed and will result in the Script function returning an error.