Expand description

Simple types for Bitcoin Script Witness stack datastructures, each of which are treated as opaque, wrapped Vec<u8> instance.

We do not handle assembly, disassembly, or Script execution in bitcoins. Scripts are treated as opaque bytes vectors with no semantics.

Scripts can be freely converted between eachother using From and Into. This merely rewraps the underlying Vec<u8> in the new type.

For a complete Script builder solution see rust-bitcoin’s builder.

For a macro version for in-line scripts, see mappum’s rust-bitcoin-script. This crate uses the builder under the hood.

In order to convert a bitcoin::Script to any variation of bitcoins::types::Script, use

let script = bitcoin::Script::new(/* your script info */);
let script = bitcoins::types::Script::from(script.into_bytes());

Structs

A Script is marked Vec for use as an opaque Script in SighashArgs structs.

A ScriptPubkey is a marked Vec for use as a RecipientIdentifier in Bitcoin TxOuts.

A ScriptSig is a marked Vec for use in the script_sig.

A WitnessStackItem is a marked Vec<u8> intended for use in witnesses. Each Witness is a PrefixVec<WitnessStackItem>. The Transactions witnesses is a non-prefixed Vec<Witness>.

Enums

Standard script types, and a non-standard type for all other scripts.

Traits

A wrapped script.

Type Definitions

A TxWitness is the UNPREFIXED vector of witnesses

A Witness is a PrefixVec of WitnessStackItems. This witness corresponds to a single input.