Crate cat_envelope

Crate cat_envelope 

Source

Re-exports§

pub use bitcoin;

Structs§

Envelope
TaptreeElement

Constants§

NUMS
Hash of G per BIP-341: https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#constructing-and-spending-taproot-outputs
PROTOCOL_ID
Protocol ID for the envelope

Functions§

get_unwrapped_script
has_annex
Checks if the input has a taproot annex in its witness.
sign_tx_input
Signs the transaction input and adds the signature as the first element of the witness. This function assumes the input is a taproot script spend and uses sig hash default.
unwrap_tx_input
Changes the script to the unwrapped script Returns the previous wrapped script of the input
wrap_script
Wraps the script in an envelope with the protocol id “cat”. Adds [num_witness_elements] OP_DROPs so the witness can be provided with the transaction still being valid. The script is then locked to a OP_CHECKSIG with the [signer_pk].
wrap_taptree
Takes every script and wraps it, then builds a taptree out of it
wrap_tx_input
Changes the script to the wrapped script and modifies the control block accordingly Returns the newly created wrapped script