| Copyright | (c) 2025 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | None |
| Language | Haskell2010 |
Lightning.Protocol.BOLT3.Encode
Description
Serialization for BOLT #3 transactions and scripts.
Delegates to ppad-tx for transaction encoding.
Synopsis
- encode_tx :: CommitmentTx -> Maybe ByteString
- encode_htlc_tx :: HTLCTx -> ByteString
- encode_closing_tx :: ClosingTx -> Maybe ByteString
- encode_tx_for_signing :: CommitmentTx -> Maybe ByteString
- encode_witness :: Witness -> ByteString
- encode_funding_witness :: ByteString -> ByteString -> Script -> ByteString
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.