ppad-bolt3-0.0.1: Bitcoin transaction formats per BOLT #3
Copyright(c) 2025 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Lightning.Protocol.BOLT3.Encode

Description

Serialization for BOLT #3 transactions and scripts.

Delegates to ppad-tx for transaction encoding.

Synopsis

Transaction serialization

encode_tx :: CommitmentTx -> Maybe ByteString Source #

Encode a commitment transaction (SegWit format).

Returns Nothing if the transaction has no outputs.

encode_htlc_tx :: HTLCTx -> ByteString Source #

Encode an HTLC transaction (SegWit format).

encode_closing_tx :: ClosingTx -> Maybe ByteString Source #

Encode a closing transaction (SegWit format).

Returns Nothing if the transaction has no outputs.

encode_tx_for_signing :: CommitmentTx -> Maybe ByteString Source #

Encode a commitment transaction for signing (stripped format, no witness).

Returns Nothing if the transaction has no outputs.

Witness serialization

encode_witness :: Witness -> ByteString Source #

Encode a witness stack.

Format: varint item count, then for each item: varint length followed by item data.

encode_funding_witness Source #

Arguments

:: ByteString

Signature for lesser pubkey

-> ByteString

Signature for greater pubkey

-> Script

The funding witness script

-> ByteString 

Encode a funding witness (2-of-2 multisig).

The witness stack is: 0 sig1 sig2 witnessScript

Signatures must be ordered to match pubkey order in the funding script.