sigil-bitcoin-tx

sigil bitcoin tx

(sigil bitcoin tx) — Bitcoin transaction structs and serialization

88 public exports

sighash-default

variable

Standard Taproot `SIGHASH_DEFAULT` flag.

sighash-all

variable

Standard Bitcoin `SIGHASH_ALL` flag.

outpoint

procedure

Transaction outpoint identifying a previous output by txid and index.

outpoint?

procedure

Test if a value is a `outpoint` struct.

outpoint-txid

procedure

Get the `txid` field of a `outpoint` struct.

outpoint-index

procedure

Get the `index` field of a `outpoint` struct.

txin

procedure

Transaction input with previous output, scriptSig, sequence, and witness.

txin?

procedure

Test if a value is a `txin` struct.

txin-previous-output

procedure

Get the `previous-output` field of a `txin` struct.

txin-script-sig

procedure

Get the `script-sig` field of a `txin` struct.

txin-sequence

procedure

Get the `sequence` field of a `txin` struct.

txin-witness

procedure

Get the `witness` field of a `txin` struct.

txout

procedure

Transaction output with satoshi value and scriptPubKey.

txout?

procedure

Test if a value is a `txout` struct.

txout-value

procedure

Get the `value` field of a `txout` struct.

txout-script-pubkey

procedure

Get the `script-pubkey` field of a `txout` struct.

transaction

procedure

Bitcoin transaction record.

transaction?

procedure

Test if a value is a `transaction` struct.

transaction-version

procedure

Get the `version` field of a `transaction` struct.

transaction-inputs

procedure

Get the `inputs` field of a `transaction` struct.

transaction-outputs

procedure

Get the `outputs` field of a `transaction` struct.

transaction-lock-time

procedure

Get the `lock-time` field of a `transaction` struct.

psbt-taproot-leaf-script

procedure

BIP371 Taproot leaf script record for PSBT input maps.

psbt-taproot-leaf-script?

procedure

Test if a value is a `psbt-taproot-leaf-script` struct.

psbt-taproot-leaf-script-control-block

procedure

Get the `control-block` field of a `psbt-taproot-leaf-script` struct.

psbt-taproot-leaf-script-script

procedure

Get the `script` field of a `psbt-taproot-leaf-script` struct.

psbt-taproot-leaf-script-leaf-version

procedure

Get the `leaf-version` field of a `psbt-taproot-leaf-script` struct.

psbt-input

procedure

PSBT input map subset supported by this package.

psbt-input?

procedure

Test if a value is a `psbt-input` struct.

psbt-input-non-witness-utxo

procedure

Get the `non-witness-utxo` field of a `psbt-input` struct.

psbt-input-witness-utxo

procedure

Get the `witness-utxo` field of a `psbt-input` struct.

psbt-input-partial-sigs

procedure

Get the `partial-sigs` field of a `psbt-input` struct.

psbt-input-sighash-type

procedure

Get the `sighash-type` field of a `psbt-input` struct.

psbt-input-final-script-sig

procedure

Get the `final-script-sig` field of a `psbt-input` struct.

psbt-input-final-script-witness

procedure

Get the `final-script-witness` field of a `psbt-input` struct.

psbt-input-taproot-key-sig

procedure

Get the `taproot-key-sig` field of a `psbt-input` struct.

psbt-input-taproot-script-sigs

procedure

Get the `taproot-script-sigs` field of a `psbt-input` struct.

psbt-input-taproot-leaf-scripts

procedure

Get the `taproot-leaf-scripts` field of a `psbt-input` struct.

psbt-input-redeem-script

procedure

Get the `redeem-script` field of a `psbt-input` struct.

psbt-input-witness-script

procedure

Get the `witness-script` field of a `psbt-input` struct.

psbt-input-bip32-derivations

procedure

Get the `bip32-derivations` field of a `psbt-input` struct.

psbt-input-taproot-bip32-derivations

procedure

Get the `taproot-bip32-derivations` field of a `psbt-input` struct.

psbt-input-unknowns

procedure

Get the `unknowns` field of a `psbt-input` struct.

psbt-output

procedure

PSBT output map subset supported by this package.

psbt-output?

procedure

Test if a value is a `psbt-output` struct.

psbt-output-bip32-derivations

procedure

Get the `bip32-derivations` field of a `psbt-output` struct.

psbt-output-taproot-bip32-derivations

procedure

Get the `taproot-bip32-derivations` field of a `psbt-output` struct.

psbt-output-unknowns

procedure

Get the `unknowns` field of a `psbt-output` struct.

psbt

procedure

Partially Signed Bitcoin Transaction record.

psbt?

procedure

Test if a value is a `psbt` struct.

psbt-unsigned-tx

procedure

Get the `unsigned-tx` field of a `psbt` struct.

psbt-inputs

procedure

Get the `inputs` field of a `psbt` struct.

psbt-outputs

procedure

Get the `outputs` field of a `psbt` struct.

psbt-unknowns

procedure

Get the `unknowns` field of a `psbt` struct.

compact-size-encode

procedure

Encode a Bitcoin CompactSize unsigned integer.

compact-size-decode

procedure

Decode a CompactSize integer from a bytevector. Returns `(value . next-offset)`.

transaction-has-witness?

procedure

Return true when any transaction input has witness stack items.

transaction-serialize

procedure

Serialize a transaction to Bitcoin wire bytes. Includes witness data by default when present. Pass `#f` to omit witnesses for txid/base serialization.

transaction-parse

procedure

Parse Bitcoin wire bytes into a transaction record.

transaction-base-serialize

procedure

Serialize a transaction without SegWit marker, flag, or witnesses.

transaction-txid

procedure

Return the transaction ID bytevector for a transaction.

transaction-wtxid

procedure

Return the witness transaction ID bytevector for a transaction.

transaction-sighash-legacy

procedure

Compute a legacy pre-SegWit signature hash for one input. Currently supports `SIGHASH_ALL`.

transaction-sighash-segwit-v0

procedure

Compute a BIP143 SegWit v0 signature hash for one input. Currently supports `SIGHASH_ALL`.

transaction-sighash-taproot-keypath

procedure

Compute a BIP341 Taproot key-path signature hash. Supports key-path spends without annex or script-path extension for `SIGHASH_DEFAULT` and `SIGHASH_ALL`.

transaction-sighash-taproot-scriptpath

procedure

Compute a BIP341/BIP342 Taproot script-path signature hash. Supports script-path spends without annex or non-default code separator for `SIGHASH_DEFAULT` and `SIGHASH_ALL`.

transaction-sign-p2pkh-input

procedure

Sign one legacy P2PKH input and return a transaction with scriptSig data.

transaction-sign-p2wpkh-input

procedure

Sign one P2WPKH input and return a transaction with witness data.

transaction-sign-p2tr-keypath-input

procedure

Sign one Taproot key-path input and return a transaction with witness data. This signs BIP86-style key-path spends without script tree commitments.

psbt-create

procedure

Create an empty PSBT from an unsigned transaction.

psbt-serialize

procedure

Serialize a PSBT v0 record.

psbt-parse

procedure

Parse PSBT v0 bytes into a PSBT record.

psbt-annotate-input

procedure

Attach BIP32 derivation metadata to a PSBT input after script matching.

psbt-annotate-input-scripts

procedure

Attach redeem or witness scripts to a PSBT input map.

psbt-annotate-output

procedure

Attach BIP32 derivation metadata to a PSBT output after script matching.

psbt-sign-p2pkh-input

procedure

Add a legacy P2PKH partial signature to a PSBT input. The input must contain the previous transaction as a non-witness UTXO.

psbt-sign-p2wpkh-input

procedure

Add a P2WPKH partial signature to a PSBT input. The input must contain a witness UTXO.

psbt-sign-p2wsh-input

procedure

Add a P2WSH partial signature for a single-key checksig witness script.

psbt-sign-p2tr-keypath-input

procedure

Add a Taproot key-path signature to a PSBT input.

psbt-sign-p2tr-scriptpath-input

procedure

Add a Taproot script-path signature for a single-key checksig leaf.

psbt-sign-standard-input

procedure

Sign a standard P2PKH, P2WPKH, or key-path P2TR PSBT input.

psbt-finalize-p2pkh-input

procedure

Finalize a signed P2PKH PSBT input.

psbt-finalize-p2wpkh-input

procedure

Finalize a signed P2WPKH PSBT input.

psbt-finalize-p2wsh-input

procedure

Finalize a signed P2WSH single-key checksig PSBT input.

psbt-finalize-p2tr-keypath-input

procedure

Finalize a signed Taproot key-path PSBT input.

psbt-finalize-p2tr-scriptpath-input

procedure

Finalize a signed Taproot script-path PSBT input.

psbt-finalize-standard-input

procedure

Finalize a standard P2PKH, P2WPKH, or key-path P2TR PSBT input.

psbt-extract-transaction

procedure

Extract the final transaction from a fully-finalized PSBT.