Skip to content

Script

Also see:

scriptPubKey()

Get the scriptPubKey to be used in a transaction output.

Also accessible using the script_pubkey field.

Errors: When called with a Descriptor<Indefinite>.

explicitScript()

explicitScript(Descriptor<Definite>|WshInfo) -> Script

Get the underlying Script, before any hashing is done.

  • For Wpkh, Pkh and Bare descriptors, this is the scriptPubkey
  • For Wsh and ShWsh descriptors, this is the witnessScript
  • For Sh and ShWpkh descriptors, this is the redeemScript
  • For WshInfo, this is the witnessScript

Also accessible using the explicit_script field.

Errors:

Script

Construction Examples:

Underlying type: bitcoin::ScriptBuf

script()

script(Bytes|Miniscript<Ctx>|Script) -> Script

instructions Array<Script|Int|Bytes> opt

Only available for parsable scripts.

minimal_instructions Array<Script|Int|Bytes> opt

Only available for parsable scripts that are minimally encoded.

is_parsable Bool

Whether this script can be parsed into valid instructions.

parse_error String opt

is_minimal Bool

Whether this script uses minimally encoded pushes.

is_witness_program Bool

witness_version Int opt

Only available for scripts representing the scriptPubKey of a witness program.

is_p2pk Bool

is_p2pkh Bool

is_p2sh Bool

is_p2wpkh Bool

is_p2wsh Bool

is_p2tr Bool

is_multisig Bool

is_op_return Bool

is_push_only Bool

count_sigops Int

count_sigops_legacy Int

dust_value Int

Aliased as: minimal_non_dust

script::instructions()

script::instructions(Script, enforce_minimal: Bool = false, include_errors: Bool = false) -> Array<Script|Int|Bytes|String>

ScriptPubKey