| Copyright | (c) 2025 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | None |
| Language | Haskell2010 |
Lightning.Protocol.BOLT3
Description
Bitcoin transaction formats for the Lightning Network, per BOLT #3.
Overview
This library implements the transaction and script formats defined in BOLT #3, including:
- Commitment transactions with to_local, to_remote, anchor, and HTLC outputs
- HTLC-timeout and HTLC-success second-stage transactions
- Closing transactions (legacy and option_simple_close)
- Per-commitment key derivation and secret storage
- Transaction serialization and parsing
- Stateless validation
Quick Start
import Lightning.Protocol.BOLT3
-- Build a commitment transaction
let ctx = CommitmentContext { ... }
tx = build_commitment_tx ctx
-- Serialize for signing
let bytes = encode_tx tx
-- Validate the transaction
case validate_commitment_tx dustLimit features tx of
Right () -> putStrLn Valid
Left err -> print err
Modules
- Lightning.Protocol.BOLT3.Types - Core types (Satoshi, Pubkey, HTLC, etc.)
- Lightning.Protocol.BOLT3.Keys - Per-commitment key derivation and secret storage
- Lightning.Protocol.BOLT3.Scripts - Witness script templates (funding, to_local, HTLC, anchor)
- Lightning.Protocol.BOLT3.Tx - Transaction assembly
- Lightning.Protocol.BOLT3.Encode - Transaction serialization
- Lightning.Protocol.BOLT3.Decode - Transaction parsing
- Lightning.Protocol.BOLT3.Validate - Stateless validation
Synopsis
- newtype Satoshi = Satoshi {}
- newtype MilliSatoshi = MilliSatoshi {}
- msatToSat :: MilliSatoshi -> Satoshi
- satToMsat :: Satoshi -> MilliSatoshi
- newtype Pubkey = Pubkey {}
- pubkey :: ByteString -> Maybe Pubkey
- newtype Seckey = Seckey {}
- seckey :: ByteString -> Maybe Seckey
- newtype Point = Point ByteString
- point :: ByteString -> Maybe Point
- newtype PaymentHash = PaymentHash ByteString
- paymentHash :: ByteString -> Maybe PaymentHash
- newtype PaymentPreimage = PaymentPreimage ByteString
- paymentPreimage :: ByteString -> Maybe PaymentPreimage
- newtype TxId = TxId ByteString
- mkTxId :: ByteString -> Maybe TxId
- data OutPoint = OutPoint {}
- newtype Sequence = Sequence {
- unSequence :: Word32
- newtype Locktime = Locktime {
- unLocktime :: Word32
- newtype CommitmentNumber = CommitmentNumber {}
- commitment_number :: Word64 -> Maybe CommitmentNumber
- newtype ToSelfDelay = ToSelfDelay {}
- newtype CltvExpiry = CltvExpiry {}
- newtype DustLimit = DustLimit {}
- newtype FeeratePerKw = FeeratePerKw {}
- data HTLC = HTLC {}
- data HTLCDirection
- data Basepoints = Basepoints {}
- newtype PerCommitmentPoint = PerCommitmentPoint {}
- newtype PerCommitmentSecret = PerCommitmentSecret ByteString
- perCommitmentSecret :: ByteString -> Maybe PerCommitmentSecret
- newtype RevocationBasepoint = RevocationBasepoint {}
- newtype PaymentBasepoint = PaymentBasepoint {}
- newtype DelayedPaymentBasepoint = DelayedPaymentBasepoint {}
- newtype HtlcBasepoint = HtlcBasepoint {}
- newtype LocalPubkey = LocalPubkey {}
- newtype RemotePubkey = RemotePubkey {}
- newtype LocalDelayedPubkey = LocalDelayedPubkey {}
- newtype RemoteDelayedPubkey = RemoteDelayedPubkey {}
- newtype LocalHtlcPubkey = LocalHtlcPubkey {}
- newtype RemoteHtlcPubkey = RemoteHtlcPubkey {}
- newtype RevocationPubkey = RevocationPubkey {}
- newtype FundingPubkey = FundingPubkey {}
- newtype Script = Script {}
- newtype Witness = Witness [ByteString]
- data ChannelFeatures = ChannelFeatures {}
- has_anchors :: ChannelFeatures -> Bool
- commitment_weight_no_anchors :: Word64
- commitment_weight_anchors :: Word64
- htlc_timeout_weight_no_anchors :: Word64
- htlc_timeout_weight_anchors :: Word64
- htlc_success_weight_no_anchors :: Word64
- htlc_success_weight_anchors :: Word64
- htlc_output_weight :: Word64
- dust_p2pkh :: Satoshi
- dust_p2sh :: Satoshi
- dust_p2wpkh :: Satoshi
- dust_p2wsh :: Satoshi
- anchor_output_value :: Satoshi
- derive_per_commitment_point :: PerCommitmentSecret -> Maybe PerCommitmentPoint
- derive_pubkey :: Point -> PerCommitmentPoint -> Maybe Pubkey
- derive_localpubkey :: PaymentBasepoint -> PerCommitmentPoint -> Maybe LocalPubkey
- derive_local_htlcpubkey :: HtlcBasepoint -> PerCommitmentPoint -> Maybe LocalHtlcPubkey
- derive_remote_htlcpubkey :: HtlcBasepoint -> PerCommitmentPoint -> Maybe RemoteHtlcPubkey
- derive_local_delayedpubkey :: DelayedPaymentBasepoint -> PerCommitmentPoint -> Maybe LocalDelayedPubkey
- derive_remote_delayedpubkey :: DelayedPaymentBasepoint -> PerCommitmentPoint -> Maybe RemoteDelayedPubkey
- derive_revocationpubkey :: RevocationBasepoint -> PerCommitmentPoint -> Maybe RevocationPubkey
- generate_from_seed :: ByteString -> Word64 -> ByteString
- derive_secret :: ByteString -> Int -> Word64 -> ByteString
- data SecretStore
- empty_store :: SecretStore
- insert_secret :: ByteString -> Word64 -> SecretStore -> Maybe SecretStore
- derive_old_secret :: Word64 -> SecretStore -> Maybe ByteString
- obscured_commitment_number :: PaymentBasepoint -> PaymentBasepoint -> CommitmentNumber -> Word64
- funding_script :: FundingPubkey -> FundingPubkey -> Script
- funding_witness :: ByteString -> ByteString -> Witness
- to_local_script :: RevocationPubkey -> ToSelfDelay -> LocalDelayedPubkey -> Script
- to_local_witness_spend :: ByteString -> Witness
- to_local_witness_revoke :: ByteString -> Witness
- to_remote_script :: RemotePubkey -> ChannelFeatures -> Script
- to_remote_witness :: ByteString -> RemotePubkey -> ChannelFeatures -> Witness
- anchor_script :: FundingPubkey -> Script
- anchor_witness_owner :: ByteString -> Witness
- anchor_witness_anyone :: Witness
- offered_htlc_script :: RevocationPubkey -> RemoteHtlcPubkey -> LocalHtlcPubkey -> PaymentHash -> ChannelFeatures -> Script
- offered_htlc_witness_preimage :: ByteString -> PaymentPreimage -> Witness
- offered_htlc_witness_revoke :: ByteString -> Pubkey -> Witness
- received_htlc_script :: RevocationPubkey -> RemoteHtlcPubkey -> LocalHtlcPubkey -> PaymentHash -> CltvExpiry -> ChannelFeatures -> Script
- received_htlc_witness_timeout :: ByteString -> Witness
- received_htlc_witness_revoke :: ByteString -> Pubkey -> Witness
- htlc_output_script :: RevocationPubkey -> ToSelfDelay -> LocalDelayedPubkey -> Script
- htlc_output_witness_spend :: ByteString -> Witness
- htlc_output_witness_revoke :: ByteString -> Witness
- to_p2wsh :: Script -> Script
- witness_script_hash :: Script -> ByteString
- data CommitmentTx = CommitmentTx {}
- data CommitmentContext = CommitmentContext {
- cc_funding_outpoint :: !OutPoint
- cc_commitment_number :: !CommitmentNumber
- cc_local_payment_bp :: !PaymentBasepoint
- cc_remote_payment_bp :: !PaymentBasepoint
- cc_to_self_delay :: !ToSelfDelay
- cc_dust_limit :: !DustLimit
- cc_feerate :: !FeeratePerKw
- cc_features :: !ChannelFeatures
- cc_is_funder :: !Bool
- cc_to_local_msat :: !MilliSatoshi
- cc_to_remote_msat :: !MilliSatoshi
- cc_htlcs :: ![HTLC]
- cc_keys :: !CommitmentKeys
- data CommitmentKeys = CommitmentKeys {}
- build_commitment_tx :: CommitmentContext -> CommitmentTx
- data HTLCTx = HTLCTx {}
- data HTLCContext = HTLCContext {}
- build_htlc_timeout_tx :: HTLCContext -> HTLCTx
- build_htlc_success_tx :: HTLCContext -> HTLCTx
- data ClosingTx = ClosingTx {}
- data ClosingContext = ClosingContext {
- clc_funding_outpoint :: !OutPoint
- clc_local_amount :: !Satoshi
- clc_remote_amount :: !Satoshi
- clc_local_script :: !Script
- clc_remote_script :: !Script
- clc_local_dust_limit :: !DustLimit
- clc_remote_dust_limit :: !DustLimit
- clc_fee :: !Satoshi
- clc_is_funder :: !Bool
- clc_locktime :: !Locktime
- clc_funding_script :: !Script
- build_closing_tx :: ClosingContext -> ClosingTx
- build_legacy_closing_tx :: ClosingContext -> ClosingTx
- data TxOutput = TxOutput {
- txout_value :: !Satoshi
- txout_script :: !Script
- txout_type :: !OutputType
- data OutputType
- commitment_fee :: FeeratePerKw -> ChannelFeatures -> Word64 -> Satoshi
- commitment_weight :: ChannelFeatures -> Word64 -> Word64
- htlc_timeout_fee :: FeeratePerKw -> ChannelFeatures -> Satoshi
- htlc_success_fee :: FeeratePerKw -> ChannelFeatures -> Satoshi
- htlc_trim_threshold :: DustLimit -> FeeratePerKw -> ChannelFeatures -> HTLCDirection -> Satoshi
- is_trimmed :: DustLimit -> FeeratePerKw -> ChannelFeatures -> HTLC -> Bool
- trimmed_htlcs :: DustLimit -> FeeratePerKw -> ChannelFeatures -> [HTLC] -> [HTLC]
- untrimmed_htlcs :: DustLimit -> FeeratePerKw -> ChannelFeatures -> [HTLC] -> [HTLC]
- sort_outputs :: [TxOutput] -> [TxOutput]
- commitment_to_tx :: CommitmentTx -> Maybe Tx
- htlc_to_tx :: HTLCTx -> Tx
- closing_to_tx :: ClosingTx -> Maybe Tx
- 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
- data Tx = Tx {
- tx_version :: !Word32
- tx_inputs :: !(NonEmpty TxIn)
- tx_outputs :: !(NonEmpty TxOut)
- tx_witnesses :: ![Witness]
- tx_locktime :: !Word32
- data TxIn = TxIn {}
- data TxOut = TxOut !Word64 !ByteString
- from_bytes :: ByteString -> Maybe Tx
- decode_tx :: ByteString -> Maybe Tx
- data ValidationError
- = InvalidVersion !Word32 !Word32
- | InvalidLocktime !Word32
- | InvalidSequence !Word32
- | InvalidOutputOrdering
- | DustLimitViolation !Int !Satoshi !Satoshi
- | MissingAnchorOutput
- | InvalidAnchorValue !Satoshi
- | InvalidFee !Satoshi !Satoshi
- | InvalidHTLCLocktime !Word32 !Word32
- | InvalidHTLCSequence !Word32 !Word32
- | NoOutputs
- | TooManyOutputs !Int
- validate_commitment_tx :: DustLimit -> ChannelFeatures -> CommitmentTx -> Either ValidationError ()
- validate_commitment_locktime :: Locktime -> Either ValidationError ()
- validate_commitment_sequence :: Sequence -> Either ValidationError ()
- validate_htlc_tx :: HTLCTx -> Either ValidationError ()
- validate_htlc_timeout_tx :: ChannelFeatures -> CltvExpiry -> HTLCTx -> Either ValidationError ()
- validate_htlc_success_tx :: ChannelFeatures -> HTLCTx -> Either ValidationError ()
- validate_closing_tx :: ClosingTx -> Either ValidationError ()
- validate_legacy_closing_tx :: ClosingTx -> Either ValidationError ()
- validate_output_ordering :: [TxOutput] -> Either ValidationError ()
- validate_dust_limits :: DustLimit -> [TxOutput] -> Either ValidationError ()
- validate_anchor_outputs :: [TxOutput] -> Either ValidationError ()
- validate_commitment_fee :: FeeratePerKw -> ChannelFeatures -> Word64 -> Satoshi -> Either ValidationError ()
- validate_htlc_fee :: FeeratePerKw -> ChannelFeatures -> HTLCDirection -> Satoshi -> Either ValidationError ()
Types
Monetary amounts
Amount in satoshis.
Instances
| NFData Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Enum Satoshi | |||||
| Generic Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Num Satoshi | |||||
| Integral Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Real Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods toRational :: Satoshi -> Rational # | |||||
| Show Satoshi | |||||
| Eq Satoshi | |||||
| Ord Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| type Rep Satoshi | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
newtype MilliSatoshi Source #
Amount in millisatoshis.
Constructors
| MilliSatoshi | |
Fields | |
Instances
msatToSat :: MilliSatoshi -> Satoshi Source #
Convert MilliSatoshi to Satoshi (rounds down).
satToMsat :: Satoshi -> MilliSatoshi Source #
Convert Satoshi to MilliSatoshi.
Keys and points
Compressed public key (33 bytes).
Constructors
| Pubkey | |
Fields | |
Instances
| Generic Pubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show Pubkey Source # | |||||
| Eq Pubkey Source # | |||||
| Ord Pubkey Source # | |||||
| type Rep Pubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep Pubkey = D1 ('MetaData "Pubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "Pubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
pubkey :: ByteString -> Maybe Pubkey Source #
Parse a 33-byte compressed public key.
Returns Nothing if the input is not exactly 33 bytes.
>>>pubkey (BS.replicate 33 0x02)Just (Pubkey ...)>>>pubkey (BS.replicate 32 0x02)Nothing
Secret key (32 bytes).
Constructors
| Seckey | |
Fields | |
Instances
| Generic Seckey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show Seckey Source # | |||||
| Eq Seckey Source # | |||||
| type Rep Seckey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep Seckey = D1 ('MetaData "Seckey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "Seckey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSeckey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
seckey :: ByteString -> Maybe Seckey Source #
Parse a 32-byte secret key.
Returns Nothing if the input is not exactly 32 bytes.
A 33-byte compressed secp256k1 public key.
Constructors
| Point ByteString |
Instances
| NFData Point | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Generic Point | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show Point | |||||
| Eq Point | |||||
| Ord Point | |||||
| type Rep Point | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep Point = D1 ('MetaData "Point" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-9kk6j4MaRHW2ecFq1ls24D" 'True) (C1 ('MetaCons "Point" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
point :: ByteString -> Maybe Point Source #
Construct a Point from a 33-byte ByteString.
Returns Nothing if the input is not exactly 33 bytes.
Hashes
newtype PaymentHash Source #
A 32-byte SHA256 payment hash.
Constructors
| PaymentHash ByteString |
Instances
| NFData PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: PaymentHash -> () # | |||||
| Generic PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
| |||||
| Show PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> PaymentHash -> ShowS # show :: PaymentHash -> String # showList :: [PaymentHash] -> ShowS # | |||||
| Eq PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim | |||||
| Ord PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods compare :: PaymentHash -> PaymentHash -> Ordering # (<) :: PaymentHash -> PaymentHash -> Bool # (<=) :: PaymentHash -> PaymentHash -> Bool # (>) :: PaymentHash -> PaymentHash -> Bool # (>=) :: PaymentHash -> PaymentHash -> Bool # max :: PaymentHash -> PaymentHash -> PaymentHash # min :: PaymentHash -> PaymentHash -> PaymentHash # | |||||
| type Rep PaymentHash | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep PaymentHash = D1 ('MetaData "PaymentHash" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-9kk6j4MaRHW2ecFq1ls24D" 'True) (C1 ('MetaCons "PaymentHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
paymentHash :: ByteString -> Maybe PaymentHash Source #
Construct a PaymentHash from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
newtype PaymentPreimage Source #
A 32-byte payment preimage.
Constructors
| PaymentPreimage ByteString |
Instances
| NFData PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: PaymentPreimage -> () # | |||||
| Generic PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
Methods from :: PaymentPreimage -> Rep PaymentPreimage x # to :: Rep PaymentPreimage x -> PaymentPreimage # | |||||
| Show PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> PaymentPreimage -> ShowS # show :: PaymentPreimage -> String # showList :: [PaymentPreimage] -> ShowS # | |||||
| Eq PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods (==) :: PaymentPreimage -> PaymentPreimage -> Bool # (/=) :: PaymentPreimage -> PaymentPreimage -> Bool # | |||||
| Ord PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods compare :: PaymentPreimage -> PaymentPreimage -> Ordering # (<) :: PaymentPreimage -> PaymentPreimage -> Bool # (<=) :: PaymentPreimage -> PaymentPreimage -> Bool # (>) :: PaymentPreimage -> PaymentPreimage -> Bool # (>=) :: PaymentPreimage -> PaymentPreimage -> Bool # max :: PaymentPreimage -> PaymentPreimage -> PaymentPreimage # min :: PaymentPreimage -> PaymentPreimage -> PaymentPreimage # | |||||
| type Rep PaymentPreimage | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep PaymentPreimage = D1 ('MetaData "PaymentPreimage" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-9kk6j4MaRHW2ecFq1ls24D" 'True) (C1 ('MetaCons "PaymentPreimage" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
paymentPreimage :: ByteString -> Maybe PaymentPreimage Source #
Construct a PaymentPreimage from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
Transaction primitives
Transaction ID (32 bytes, little-endian double-SHA256).
Constructors
| TxId ByteString |
Instances
| NFData TxId | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic TxId | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show TxId | |||||
| Eq TxId | |||||
| type Rep TxId | |||||
Defined in Bitcoin.Prim.Tx type Rep TxId = D1 ('MetaData "TxId" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-DYNxnVCbwvIAo5p2lB5jg7" 'True) (C1 ('MetaCons "TxId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
mkTxId :: ByteString -> Maybe TxId Source #
Construct a TxId from a 32-byte ByteString.
Returns Nothing if the input is not exactly 32 bytes.
mkTxId (BS.replicate 32 0x00) == Just (TxId ...) mkTxId (BS.replicate 31 0x00) == Nothing
Transaction outpoint (txid + output index).
Instances
| NFData OutPoint | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic OutPoint | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show OutPoint | |||||
| Eq OutPoint | |||||
| type Rep OutPoint | |||||
Defined in Bitcoin.Prim.Tx type Rep OutPoint = D1 ('MetaData "OutPoint" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-DYNxnVCbwvIAo5p2lB5jg7" 'False) (C1 ('MetaCons "OutPoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "op_txid") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 TxId) :*: S1 ('MetaSel ('Just "op_vout") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word32))) | |||||
Transaction input sequence number.
Constructors
| Sequence | |
Fields
| |
Instances
| Generic Sequence Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Num Sequence Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Show Sequence Source # | |||||
| Eq Sequence Source # | |||||
| Ord Sequence Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| type Rep Sequence Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
Transaction locktime.
Constructors
| Locktime | |
Fields
| |
Instances
| Generic Locktime Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Num Locktime Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Show Locktime Source # | |||||
| Eq Locktime Source # | |||||
| Ord Locktime Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| type Rep Locktime Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
Channel parameters
newtype CommitmentNumber Source #
48-bit commitment number.
Constructors
| CommitmentNumber | |
Fields | |
Instances
| Generic CommitmentNumber Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: CommitmentNumber -> Rep CommitmentNumber x # to :: Rep CommitmentNumber x -> CommitmentNumber # | |||||
| Num CommitmentNumber Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (+) :: CommitmentNumber -> CommitmentNumber -> CommitmentNumber # (-) :: CommitmentNumber -> CommitmentNumber -> CommitmentNumber # (*) :: CommitmentNumber -> CommitmentNumber -> CommitmentNumber # negate :: CommitmentNumber -> CommitmentNumber # abs :: CommitmentNumber -> CommitmentNumber # signum :: CommitmentNumber -> CommitmentNumber # fromInteger :: Integer -> CommitmentNumber # | |||||
| Show CommitmentNumber Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> CommitmentNumber -> ShowS # show :: CommitmentNumber -> String # showList :: [CommitmentNumber] -> ShowS # | |||||
| Eq CommitmentNumber Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: CommitmentNumber -> CommitmentNumber -> Bool # (/=) :: CommitmentNumber -> CommitmentNumber -> Bool # | |||||
| Ord CommitmentNumber Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: CommitmentNumber -> CommitmentNumber -> Ordering # (<) :: CommitmentNumber -> CommitmentNumber -> Bool # (<=) :: CommitmentNumber -> CommitmentNumber -> Bool # (>) :: CommitmentNumber -> CommitmentNumber -> Bool # (>=) :: CommitmentNumber -> CommitmentNumber -> Bool # max :: CommitmentNumber -> CommitmentNumber -> CommitmentNumber # min :: CommitmentNumber -> CommitmentNumber -> CommitmentNumber # | |||||
| type Rep CommitmentNumber Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep CommitmentNumber = D1 ('MetaData "CommitmentNumber" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "CommitmentNumber" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCommitmentNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64))) | |||||
commitment_number :: Word64 -> Maybe CommitmentNumber Source #
Parse a 48-bit commitment number.
Returns Nothing if the value exceeds 2^48 - 1.
newtype ToSelfDelay Source #
CSV delay for to_local outputs.
Constructors
| ToSelfDelay | |
Fields | |
Instances
| Generic ToSelfDelay Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Num ToSelfDelay Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (+) :: ToSelfDelay -> ToSelfDelay -> ToSelfDelay # (-) :: ToSelfDelay -> ToSelfDelay -> ToSelfDelay # (*) :: ToSelfDelay -> ToSelfDelay -> ToSelfDelay # negate :: ToSelfDelay -> ToSelfDelay # abs :: ToSelfDelay -> ToSelfDelay # signum :: ToSelfDelay -> ToSelfDelay # fromInteger :: Integer -> ToSelfDelay # | |||||
| Show ToSelfDelay Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> ToSelfDelay -> ShowS # show :: ToSelfDelay -> String # showList :: [ToSelfDelay] -> ShowS # | |||||
| Eq ToSelfDelay Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Ord ToSelfDelay Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: ToSelfDelay -> ToSelfDelay -> Ordering # (<) :: ToSelfDelay -> ToSelfDelay -> Bool # (<=) :: ToSelfDelay -> ToSelfDelay -> Bool # (>) :: ToSelfDelay -> ToSelfDelay -> Bool # (>=) :: ToSelfDelay -> ToSelfDelay -> Bool # max :: ToSelfDelay -> ToSelfDelay -> ToSelfDelay # min :: ToSelfDelay -> ToSelfDelay -> ToSelfDelay # | |||||
| type Rep ToSelfDelay Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep ToSelfDelay = D1 ('MetaData "ToSelfDelay" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "ToSelfDelay" 'PrefixI 'True) (S1 ('MetaSel ('Just "unToSelfDelay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16))) | |||||
newtype CltvExpiry Source #
CLTV expiry for HTLCs.
Constructors
| CltvExpiry | |
Fields | |
Instances
| Generic CltvExpiry Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Num CltvExpiry Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (+) :: CltvExpiry -> CltvExpiry -> CltvExpiry # (-) :: CltvExpiry -> CltvExpiry -> CltvExpiry # (*) :: CltvExpiry -> CltvExpiry -> CltvExpiry # negate :: CltvExpiry -> CltvExpiry # abs :: CltvExpiry -> CltvExpiry # signum :: CltvExpiry -> CltvExpiry # fromInteger :: Integer -> CltvExpiry # | |||||
| Show CltvExpiry Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> CltvExpiry -> ShowS # show :: CltvExpiry -> String # showList :: [CltvExpiry] -> ShowS # | |||||
| Eq CltvExpiry Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Ord CltvExpiry Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: CltvExpiry -> CltvExpiry -> Ordering # (<) :: CltvExpiry -> CltvExpiry -> Bool # (<=) :: CltvExpiry -> CltvExpiry -> Bool # (>) :: CltvExpiry -> CltvExpiry -> Bool # (>=) :: CltvExpiry -> CltvExpiry -> Bool # max :: CltvExpiry -> CltvExpiry -> CltvExpiry # min :: CltvExpiry -> CltvExpiry -> CltvExpiry # | |||||
| type Rep CltvExpiry Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep CltvExpiry = D1 ('MetaData "CltvExpiry" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "CltvExpiry" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCltvExpiry") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))) | |||||
Dust limit threshold.
Constructors
| DustLimit | |
Fields | |
Instances
| Generic DustLimit Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show DustLimit Source # | |||||
| Eq DustLimit Source # | |||||
| Ord DustLimit Source # | |||||
| type Rep DustLimit Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
newtype FeeratePerKw Source #
Fee rate in satoshis per 1000 weight units.
Constructors
| FeeratePerKw | |
Fields | |
Instances
| Generic FeeratePerKw Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Num FeeratePerKw Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (+) :: FeeratePerKw -> FeeratePerKw -> FeeratePerKw # (-) :: FeeratePerKw -> FeeratePerKw -> FeeratePerKw # (*) :: FeeratePerKw -> FeeratePerKw -> FeeratePerKw # negate :: FeeratePerKw -> FeeratePerKw # abs :: FeeratePerKw -> FeeratePerKw # signum :: FeeratePerKw -> FeeratePerKw # fromInteger :: Integer -> FeeratePerKw # | |||||
| Show FeeratePerKw Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> FeeratePerKw -> ShowS # show :: FeeratePerKw -> String # showList :: [FeeratePerKw] -> ShowS # | |||||
| Eq FeeratePerKw Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Ord FeeratePerKw Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: FeeratePerKw -> FeeratePerKw -> Ordering # (<) :: FeeratePerKw -> FeeratePerKw -> Bool # (<=) :: FeeratePerKw -> FeeratePerKw -> Bool # (>) :: FeeratePerKw -> FeeratePerKw -> Bool # (>=) :: FeeratePerKw -> FeeratePerKw -> Bool # max :: FeeratePerKw -> FeeratePerKw -> FeeratePerKw # min :: FeeratePerKw -> FeeratePerKw -> FeeratePerKw # | |||||
| type Rep FeeratePerKw Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep FeeratePerKw = D1 ('MetaData "FeeratePerKw" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "FeeratePerKw" 'PrefixI 'True) (S1 ('MetaSel ('Just "unFeeratePerKw") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32))) | |||||
HTLC types
HTLC output details.
Constructors
| HTLC | |
Fields | |
Instances
| Generic HTLC Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show HTLC Source # | |||||
| Eq HTLC Source # | |||||
| type Rep HTLC Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep HTLC = D1 ('MetaData "HTLC" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "HTLC" 'PrefixI 'True) ((S1 ('MetaSel ('Just "htlc_direction") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 HTLCDirection) :*: S1 ('MetaSel ('Just "htlc_amount_msat") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 MilliSatoshi)) :*: (S1 ('MetaSel ('Just "htlc_payment_hash") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 PaymentHash) :*: S1 ('MetaSel ('Just "htlc_cltv_expiry") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 CltvExpiry)))) | |||||
data HTLCDirection Source #
Direction of an HTLC from the commitment tx owner's perspective.
Constructors
| HTLCOffered | We offered this HTLC (outgoing) |
| HTLCReceived | We received this HTLC (incoming) |
Instances
| Generic HTLCDirection Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show HTLCDirection Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> HTLCDirection -> ShowS # show :: HTLCDirection -> String # showList :: [HTLCDirection] -> ShowS # | |||||
| Eq HTLCDirection Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: HTLCDirection -> HTLCDirection -> Bool # (/=) :: HTLCDirection -> HTLCDirection -> Bool # | |||||
| Ord HTLCDirection Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: HTLCDirection -> HTLCDirection -> Ordering # (<) :: HTLCDirection -> HTLCDirection -> Bool # (<=) :: HTLCDirection -> HTLCDirection -> Bool # (>) :: HTLCDirection -> HTLCDirection -> Bool # (>=) :: HTLCDirection -> HTLCDirection -> Bool # max :: HTLCDirection -> HTLCDirection -> HTLCDirection # min :: HTLCDirection -> HTLCDirection -> HTLCDirection # | |||||
| type Rep HTLCDirection Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
Basepoints
data Basepoints Source #
Collection of all basepoints for one party.
Constructors
| Basepoints | |
Instances
| Generic Basepoints Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show Basepoints Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> Basepoints -> ShowS # show :: Basepoints -> String # showList :: [Basepoints] -> ShowS # | |||||
| Eq Basepoints Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| type Rep Basepoints Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep Basepoints = D1 ('MetaData "Basepoints" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "Basepoints" 'PrefixI 'True) ((S1 ('MetaSel ('Just "bp_revocation") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RevocationBasepoint) :*: S1 ('MetaSel ('Just "bp_payment") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PaymentBasepoint)) :*: (S1 ('MetaSel ('Just "bp_delayed_payment") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DelayedPaymentBasepoint) :*: S1 ('MetaSel ('Just "bp_htlc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 HtlcBasepoint)))) | |||||
newtype PerCommitmentPoint Source #
Per-commitment point (used to derive keys).
Constructors
| PerCommitmentPoint | |
Fields | |
Instances
| Generic PerCommitmentPoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: PerCommitmentPoint -> Rep PerCommitmentPoint x # to :: Rep PerCommitmentPoint x -> PerCommitmentPoint # | |||||
| Show PerCommitmentPoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> PerCommitmentPoint -> ShowS # show :: PerCommitmentPoint -> String # showList :: [PerCommitmentPoint] -> ShowS # | |||||
| Eq PerCommitmentPoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: PerCommitmentPoint -> PerCommitmentPoint -> Bool # (/=) :: PerCommitmentPoint -> PerCommitmentPoint -> Bool # | |||||
| Ord PerCommitmentPoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: PerCommitmentPoint -> PerCommitmentPoint -> Ordering # (<) :: PerCommitmentPoint -> PerCommitmentPoint -> Bool # (<=) :: PerCommitmentPoint -> PerCommitmentPoint -> Bool # (>) :: PerCommitmentPoint -> PerCommitmentPoint -> Bool # (>=) :: PerCommitmentPoint -> PerCommitmentPoint -> Bool # max :: PerCommitmentPoint -> PerCommitmentPoint -> PerCommitmentPoint # min :: PerCommitmentPoint -> PerCommitmentPoint -> PerCommitmentPoint # | |||||
| type Rep PerCommitmentPoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep PerCommitmentPoint = D1 ('MetaData "PerCommitmentPoint" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "PerCommitmentPoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPerCommitmentPoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Point))) | |||||
newtype PerCommitmentSecret Source #
A 32-byte per-commitment secret.
Constructors
| PerCommitmentSecret ByteString |
Instances
| NFData PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods rnf :: PerCommitmentSecret -> () # | |||||
| Generic PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Associated Types
Methods from :: PerCommitmentSecret -> Rep PerCommitmentSecret x # to :: Rep PerCommitmentSecret x -> PerCommitmentSecret # | |||||
| Show PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods showsPrec :: Int -> PerCommitmentSecret -> ShowS # show :: PerCommitmentSecret -> String # showList :: [PerCommitmentSecret] -> ShowS # | |||||
| Eq PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods (==) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (/=) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # | |||||
| Ord PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim Methods compare :: PerCommitmentSecret -> PerCommitmentSecret -> Ordering # (<) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (<=) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (>) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # (>=) :: PerCommitmentSecret -> PerCommitmentSecret -> Bool # max :: PerCommitmentSecret -> PerCommitmentSecret -> PerCommitmentSecret # min :: PerCommitmentSecret -> PerCommitmentSecret -> PerCommitmentSecret # | |||||
| type Rep PerCommitmentSecret | |||||
Defined in Lightning.Protocol.BOLT1.Prim type Rep PerCommitmentSecret = D1 ('MetaData "PerCommitmentSecret" "Lightning.Protocol.BOLT1.Prim" "ppad-bolt1-0.0.1-9kk6j4MaRHW2ecFq1ls24D" 'True) (C1 ('MetaCons "PerCommitmentSecret" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
perCommitmentSecret :: ByteString -> Maybe PerCommitmentSecret Source #
Construct a PerCommitmentSecret from a 32-byte
ByteString.
Returns Nothing if the input is not exactly 32 bytes.
newtype RevocationBasepoint Source #
Revocation basepoint.
Constructors
| RevocationBasepoint | |
Fields | |
Instances
| Generic RevocationBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: RevocationBasepoint -> Rep RevocationBasepoint x # to :: Rep RevocationBasepoint x -> RevocationBasepoint # | |||||
| Show RevocationBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> RevocationBasepoint -> ShowS # show :: RevocationBasepoint -> String # showList :: [RevocationBasepoint] -> ShowS # | |||||
| Eq RevocationBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: RevocationBasepoint -> RevocationBasepoint -> Bool # (/=) :: RevocationBasepoint -> RevocationBasepoint -> Bool # | |||||
| Ord RevocationBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: RevocationBasepoint -> RevocationBasepoint -> Ordering # (<) :: RevocationBasepoint -> RevocationBasepoint -> Bool # (<=) :: RevocationBasepoint -> RevocationBasepoint -> Bool # (>) :: RevocationBasepoint -> RevocationBasepoint -> Bool # (>=) :: RevocationBasepoint -> RevocationBasepoint -> Bool # max :: RevocationBasepoint -> RevocationBasepoint -> RevocationBasepoint # min :: RevocationBasepoint -> RevocationBasepoint -> RevocationBasepoint # | |||||
| type Rep RevocationBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep RevocationBasepoint = D1 ('MetaData "RevocationBasepoint" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "RevocationBasepoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "unRevocationBasepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Point))) | |||||
newtype PaymentBasepoint Source #
Payment basepoint.
Constructors
| PaymentBasepoint | |
Fields | |
Instances
| Generic PaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: PaymentBasepoint -> Rep PaymentBasepoint x # to :: Rep PaymentBasepoint x -> PaymentBasepoint # | |||||
| Show PaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> PaymentBasepoint -> ShowS # show :: PaymentBasepoint -> String # showList :: [PaymentBasepoint] -> ShowS # | |||||
| Eq PaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: PaymentBasepoint -> PaymentBasepoint -> Bool # (/=) :: PaymentBasepoint -> PaymentBasepoint -> Bool # | |||||
| Ord PaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: PaymentBasepoint -> PaymentBasepoint -> Ordering # (<) :: PaymentBasepoint -> PaymentBasepoint -> Bool # (<=) :: PaymentBasepoint -> PaymentBasepoint -> Bool # (>) :: PaymentBasepoint -> PaymentBasepoint -> Bool # (>=) :: PaymentBasepoint -> PaymentBasepoint -> Bool # max :: PaymentBasepoint -> PaymentBasepoint -> PaymentBasepoint # min :: PaymentBasepoint -> PaymentBasepoint -> PaymentBasepoint # | |||||
| type Rep PaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep PaymentBasepoint = D1 ('MetaData "PaymentBasepoint" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "PaymentBasepoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPaymentBasepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Point))) | |||||
newtype DelayedPaymentBasepoint Source #
Delayed payment basepoint.
Constructors
| DelayedPaymentBasepoint | |
Fields | |
Instances
| Generic DelayedPaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: DelayedPaymentBasepoint -> Rep DelayedPaymentBasepoint x # to :: Rep DelayedPaymentBasepoint x -> DelayedPaymentBasepoint # | |||||
| Show DelayedPaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> DelayedPaymentBasepoint -> ShowS # show :: DelayedPaymentBasepoint -> String # showList :: [DelayedPaymentBasepoint] -> ShowS # | |||||
| Eq DelayedPaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Bool # (/=) :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Bool # | |||||
| Ord DelayedPaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Ordering # (<) :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Bool # (<=) :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Bool # (>) :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Bool # (>=) :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> Bool # max :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> DelayedPaymentBasepoint # min :: DelayedPaymentBasepoint -> DelayedPaymentBasepoint -> DelayedPaymentBasepoint # | |||||
| type Rep DelayedPaymentBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep DelayedPaymentBasepoint = D1 ('MetaData "DelayedPaymentBasepoint" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "DelayedPaymentBasepoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "unDelayedPaymentBasepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Point))) | |||||
newtype HtlcBasepoint Source #
HTLC basepoint.
Constructors
| HtlcBasepoint | |
Fields | |
Instances
| Generic HtlcBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show HtlcBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> HtlcBasepoint -> ShowS # show :: HtlcBasepoint -> String # showList :: [HtlcBasepoint] -> ShowS # | |||||
| Eq HtlcBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: HtlcBasepoint -> HtlcBasepoint -> Bool # (/=) :: HtlcBasepoint -> HtlcBasepoint -> Bool # | |||||
| Ord HtlcBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: HtlcBasepoint -> HtlcBasepoint -> Ordering # (<) :: HtlcBasepoint -> HtlcBasepoint -> Bool # (<=) :: HtlcBasepoint -> HtlcBasepoint -> Bool # (>) :: HtlcBasepoint -> HtlcBasepoint -> Bool # (>=) :: HtlcBasepoint -> HtlcBasepoint -> Bool # max :: HtlcBasepoint -> HtlcBasepoint -> HtlcBasepoint # min :: HtlcBasepoint -> HtlcBasepoint -> HtlcBasepoint # | |||||
| type Rep HtlcBasepoint Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep HtlcBasepoint = D1 ('MetaData "HtlcBasepoint" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "HtlcBasepoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "unHtlcBasepoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Point))) | |||||
Derived keys
newtype LocalPubkey Source #
Local pubkey.
Constructors
| LocalPubkey | |
Fields | |
Instances
| Generic LocalPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show LocalPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> LocalPubkey -> ShowS # show :: LocalPubkey -> String # showList :: [LocalPubkey] -> ShowS # | |||||
| Eq LocalPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Ord LocalPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: LocalPubkey -> LocalPubkey -> Ordering # (<) :: LocalPubkey -> LocalPubkey -> Bool # (<=) :: LocalPubkey -> LocalPubkey -> Bool # (>) :: LocalPubkey -> LocalPubkey -> Bool # (>=) :: LocalPubkey -> LocalPubkey -> Bool # max :: LocalPubkey -> LocalPubkey -> LocalPubkey # min :: LocalPubkey -> LocalPubkey -> LocalPubkey # | |||||
| type Rep LocalPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep LocalPubkey = D1 ('MetaData "LocalPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "LocalPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLocalPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype RemotePubkey Source #
Remote pubkey.
Constructors
| RemotePubkey | |
Fields | |
Instances
| Generic RemotePubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show RemotePubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> RemotePubkey -> ShowS # show :: RemotePubkey -> String # showList :: [RemotePubkey] -> ShowS # | |||||
| Eq RemotePubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types | |||||
| Ord RemotePubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: RemotePubkey -> RemotePubkey -> Ordering # (<) :: RemotePubkey -> RemotePubkey -> Bool # (<=) :: RemotePubkey -> RemotePubkey -> Bool # (>) :: RemotePubkey -> RemotePubkey -> Bool # (>=) :: RemotePubkey -> RemotePubkey -> Bool # max :: RemotePubkey -> RemotePubkey -> RemotePubkey # min :: RemotePubkey -> RemotePubkey -> RemotePubkey # | |||||
| type Rep RemotePubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep RemotePubkey = D1 ('MetaData "RemotePubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "RemotePubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unRemotePubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype LocalDelayedPubkey Source #
Local delayed pubkey.
Constructors
| LocalDelayedPubkey | |
Fields | |
Instances
| Generic LocalDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: LocalDelayedPubkey -> Rep LocalDelayedPubkey x # to :: Rep LocalDelayedPubkey x -> LocalDelayedPubkey # | |||||
| Show LocalDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> LocalDelayedPubkey -> ShowS # show :: LocalDelayedPubkey -> String # showList :: [LocalDelayedPubkey] -> ShowS # | |||||
| Eq LocalDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: LocalDelayedPubkey -> LocalDelayedPubkey -> Bool # (/=) :: LocalDelayedPubkey -> LocalDelayedPubkey -> Bool # | |||||
| Ord LocalDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: LocalDelayedPubkey -> LocalDelayedPubkey -> Ordering # (<) :: LocalDelayedPubkey -> LocalDelayedPubkey -> Bool # (<=) :: LocalDelayedPubkey -> LocalDelayedPubkey -> Bool # (>) :: LocalDelayedPubkey -> LocalDelayedPubkey -> Bool # (>=) :: LocalDelayedPubkey -> LocalDelayedPubkey -> Bool # max :: LocalDelayedPubkey -> LocalDelayedPubkey -> LocalDelayedPubkey # min :: LocalDelayedPubkey -> LocalDelayedPubkey -> LocalDelayedPubkey # | |||||
| type Rep LocalDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep LocalDelayedPubkey = D1 ('MetaData "LocalDelayedPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "LocalDelayedPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLocalDelayedPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype RemoteDelayedPubkey Source #
Remote delayed pubkey.
Constructors
| RemoteDelayedPubkey | |
Fields | |
Instances
| Generic RemoteDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: RemoteDelayedPubkey -> Rep RemoteDelayedPubkey x # to :: Rep RemoteDelayedPubkey x -> RemoteDelayedPubkey # | |||||
| Show RemoteDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> RemoteDelayedPubkey -> ShowS # show :: RemoteDelayedPubkey -> String # showList :: [RemoteDelayedPubkey] -> ShowS # | |||||
| Eq RemoteDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Bool # (/=) :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Bool # | |||||
| Ord RemoteDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Ordering # (<) :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Bool # (<=) :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Bool # (>) :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Bool # (>=) :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> Bool # max :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> RemoteDelayedPubkey # min :: RemoteDelayedPubkey -> RemoteDelayedPubkey -> RemoteDelayedPubkey # | |||||
| type Rep RemoteDelayedPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep RemoteDelayedPubkey = D1 ('MetaData "RemoteDelayedPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "RemoteDelayedPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unRemoteDelayedPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype LocalHtlcPubkey Source #
Local HTLC pubkey.
Constructors
| LocalHtlcPubkey | |
Fields | |
Instances
| Generic LocalHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: LocalHtlcPubkey -> Rep LocalHtlcPubkey x # to :: Rep LocalHtlcPubkey x -> LocalHtlcPubkey # | |||||
| Show LocalHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> LocalHtlcPubkey -> ShowS # show :: LocalHtlcPubkey -> String # showList :: [LocalHtlcPubkey] -> ShowS # | |||||
| Eq LocalHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: LocalHtlcPubkey -> LocalHtlcPubkey -> Bool # (/=) :: LocalHtlcPubkey -> LocalHtlcPubkey -> Bool # | |||||
| Ord LocalHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: LocalHtlcPubkey -> LocalHtlcPubkey -> Ordering # (<) :: LocalHtlcPubkey -> LocalHtlcPubkey -> Bool # (<=) :: LocalHtlcPubkey -> LocalHtlcPubkey -> Bool # (>) :: LocalHtlcPubkey -> LocalHtlcPubkey -> Bool # (>=) :: LocalHtlcPubkey -> LocalHtlcPubkey -> Bool # max :: LocalHtlcPubkey -> LocalHtlcPubkey -> LocalHtlcPubkey # min :: LocalHtlcPubkey -> LocalHtlcPubkey -> LocalHtlcPubkey # | |||||
| type Rep LocalHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep LocalHtlcPubkey = D1 ('MetaData "LocalHtlcPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "LocalHtlcPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLocalHtlcPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype RemoteHtlcPubkey Source #
Remote HTLC pubkey.
Constructors
| RemoteHtlcPubkey | |
Fields | |
Instances
| Generic RemoteHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: RemoteHtlcPubkey -> Rep RemoteHtlcPubkey x # to :: Rep RemoteHtlcPubkey x -> RemoteHtlcPubkey # | |||||
| Show RemoteHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> RemoteHtlcPubkey -> ShowS # show :: RemoteHtlcPubkey -> String # showList :: [RemoteHtlcPubkey] -> ShowS # | |||||
| Eq RemoteHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Bool # (/=) :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Bool # | |||||
| Ord RemoteHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Ordering # (<) :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Bool # (<=) :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Bool # (>) :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Bool # (>=) :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> Bool # max :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> RemoteHtlcPubkey # min :: RemoteHtlcPubkey -> RemoteHtlcPubkey -> RemoteHtlcPubkey # | |||||
| type Rep RemoteHtlcPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep RemoteHtlcPubkey = D1 ('MetaData "RemoteHtlcPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "RemoteHtlcPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unRemoteHtlcPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype RevocationPubkey Source #
Revocation pubkey.
Constructors
| RevocationPubkey | |
Fields | |
Instances
| Generic RevocationPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: RevocationPubkey -> Rep RevocationPubkey x # to :: Rep RevocationPubkey x -> RevocationPubkey # | |||||
| Show RevocationPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> RevocationPubkey -> ShowS # show :: RevocationPubkey -> String # showList :: [RevocationPubkey] -> ShowS # | |||||
| Eq RevocationPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: RevocationPubkey -> RevocationPubkey -> Bool # (/=) :: RevocationPubkey -> RevocationPubkey -> Bool # | |||||
| Ord RevocationPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: RevocationPubkey -> RevocationPubkey -> Ordering # (<) :: RevocationPubkey -> RevocationPubkey -> Bool # (<=) :: RevocationPubkey -> RevocationPubkey -> Bool # (>) :: RevocationPubkey -> RevocationPubkey -> Bool # (>=) :: RevocationPubkey -> RevocationPubkey -> Bool # max :: RevocationPubkey -> RevocationPubkey -> RevocationPubkey # min :: RevocationPubkey -> RevocationPubkey -> RevocationPubkey # | |||||
| type Rep RevocationPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep RevocationPubkey = D1 ('MetaData "RevocationPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "RevocationPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unRevocationPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
newtype FundingPubkey Source #
Funding pubkey (used in 2-of-2 multisig).
Constructors
| FundingPubkey | |
Fields | |
Instances
| Generic FundingPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show FundingPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> FundingPubkey -> ShowS # show :: FundingPubkey -> String # showList :: [FundingPubkey] -> ShowS # | |||||
| Eq FundingPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: FundingPubkey -> FundingPubkey -> Bool # (/=) :: FundingPubkey -> FundingPubkey -> Bool # | |||||
| Ord FundingPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods compare :: FundingPubkey -> FundingPubkey -> Ordering # (<) :: FundingPubkey -> FundingPubkey -> Bool # (<=) :: FundingPubkey -> FundingPubkey -> Bool # (>) :: FundingPubkey -> FundingPubkey -> Bool # (>=) :: FundingPubkey -> FundingPubkey -> Bool # max :: FundingPubkey -> FundingPubkey -> FundingPubkey # min :: FundingPubkey -> FundingPubkey -> FundingPubkey # | |||||
| type Rep FundingPubkey Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep FundingPubkey = D1 ('MetaData "FundingPubkey" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "FundingPubkey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unFundingPubkey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Pubkey))) | |||||
Script and witness
Bitcoin script (serialized).
Constructors
| Script | |
Fields | |
Instances
| Generic Script Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
| |||||
| Show Script Source # | |||||
| Eq Script Source # | |||||
| Ord Script Source # | |||||
| type Rep Script Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep Script = D1 ('MetaData "Script" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'True) (C1 ('MetaCons "Script" 'PrefixI 'True) (S1 ('MetaSel ('Just "unScript") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |||||
Witness stack for a single input.
Constructors
| Witness [ByteString] |
Instances
| NFData Witness | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic Witness | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show Witness | |||||
| Eq Witness | |||||
| type Rep Witness | |||||
Defined in Bitcoin.Prim.Tx type Rep Witness = D1 ('MetaData "Witness" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-DYNxnVCbwvIAo5p2lB5jg7" 'True) (C1 ('MetaCons "Witness" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ByteString]))) | |||||
Channel features
data ChannelFeatures Source #
Channel feature flags relevant to BOLT #3.
Constructors
| ChannelFeatures | |
Fields | |
Instances
| Generic ChannelFeatures Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Associated Types
Methods from :: ChannelFeatures -> Rep ChannelFeatures x # to :: Rep ChannelFeatures x -> ChannelFeatures # | |||||
| Show ChannelFeatures Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods showsPrec :: Int -> ChannelFeatures -> ShowS # show :: ChannelFeatures -> String # showList :: [ChannelFeatures] -> ShowS # | |||||
| Eq ChannelFeatures Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types Methods (==) :: ChannelFeatures -> ChannelFeatures -> Bool # (/=) :: ChannelFeatures -> ChannelFeatures -> Bool # | |||||
| type Rep ChannelFeatures Source # | |||||
Defined in Lightning.Protocol.BOLT3.Types type Rep ChannelFeatures = D1 ('MetaData "ChannelFeatures" "Lightning.Protocol.BOLT3.Types" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "ChannelFeatures" 'PrefixI 'True) (S1 ('MetaSel ('Just "cf_option_anchors") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) | |||||
has_anchors :: ChannelFeatures -> Bool Source #
Check if option_anchors is enabled.
Constants
commitment_weight_no_anchors :: Word64 Source #
Base commitment tx weight without option_anchors.
commitment_weight_anchors :: Word64 Source #
Base commitment tx weight with option_anchors.
htlc_timeout_weight_no_anchors :: Word64 Source #
HTLC-timeout tx weight without option_anchors.
htlc_timeout_weight_anchors :: Word64 Source #
HTLC-timeout tx weight with option_anchors.
htlc_success_weight_no_anchors :: Word64 Source #
HTLC-success tx weight without option_anchors.
htlc_success_weight_anchors :: Word64 Source #
HTLC-success tx weight with option_anchors.
htlc_output_weight :: Word64 Source #
Weight added per HTLC output in commitment tx.
dust_p2pkh :: Satoshi Source #
P2PKH dust threshold (546 satoshis).
dust_p2wpkh :: Satoshi Source #
P2WPKH dust threshold (294 satoshis).
dust_p2wsh :: Satoshi Source #
P2WSH dust threshold (330 satoshis).
anchor_output_value :: Satoshi Source #
Fixed anchor output value (330 satoshis).
Key derivation
derive_per_commitment_point :: PerCommitmentSecret -> Maybe PerCommitmentPoint Source #
Derive the per-commitment point from a per-commitment secret.
per_commitment_point = per_commitment_secret * G
>>>let secret = PerCommitmentSecret (BS.replicate 32 0x01)>>>derive_per_commitment_point secretJust (PerCommitmentPoint ...)
Arguments
| :: Point | basepoint |
| -> PerCommitmentPoint | per_commitment_point |
| -> Maybe Pubkey |
Derive a pubkey from a basepoint and per-commitment point.
pubkey = basepoint + SHA256(per_commitment_point || basepoint) * G
This is the general derivation formula used for localpubkey, local_htlcpubkey, remote_htlcpubkey, local_delayedpubkey, and remote_delayedpubkey.
>>>derive_pubkey basepoint per_commitment_pointJust (Pubkey ...)
derive_localpubkey :: PaymentBasepoint -> PerCommitmentPoint -> Maybe LocalPubkey Source #
Derive localpubkey from payment_basepoint and per_commitment_point.
>>>derive_localpubkey payment_basepoint per_commitment_pointJust (LocalPubkey ...)
derive_local_htlcpubkey :: HtlcBasepoint -> PerCommitmentPoint -> Maybe LocalHtlcPubkey Source #
Derive local_htlcpubkey from htlc_basepoint and per_commitment_point.
>>>derive_local_htlcpubkey htlc_basepoint per_commitment_pointJust (LocalHtlcPubkey ...)
derive_remote_htlcpubkey :: HtlcBasepoint -> PerCommitmentPoint -> Maybe RemoteHtlcPubkey Source #
Derive remote_htlcpubkey from htlc_basepoint and per_commitment_point.
>>>derive_remote_htlcpubkey htlc_basepoint per_commitment_pointJust (RemoteHtlcPubkey ...)
derive_local_delayedpubkey :: DelayedPaymentBasepoint -> PerCommitmentPoint -> Maybe LocalDelayedPubkey Source #
Derive local_delayedpubkey from delayed_payment_basepoint and per_commitment_point.
>>>derive_local_delayedpubkey delayed_payment_basepoint per_commitment_pointJust (LocalDelayedPubkey ...)
derive_remote_delayedpubkey :: DelayedPaymentBasepoint -> PerCommitmentPoint -> Maybe RemoteDelayedPubkey Source #
Derive remote_delayedpubkey from delayed_payment_basepoint and per_commitment_point.
>>>derive_remote_delayedpubkey delayed_payment_basepoint pcpJust (RemoteDelayedPubkey ...)
derive_revocationpubkey :: RevocationBasepoint -> PerCommitmentPoint -> Maybe RevocationPubkey Source #
Derive revocationpubkey from revocation_basepoint and per_commitment_point.
revocationpubkey = revocation_basepoint
* SHA256(revocation_basepoint || per_commitment_point)
+ per_commitment_point
* SHA256(per_commitment_point || revocation_basepoint)
>>>derive_revocationpubkey revocation_basepoint per_commitment_pointJust (RevocationPubkey ...)
Secret generation
Arguments
| :: ByteString | seed (32 bytes) |
| -> Word64 | index I (max 2^48 - 1) |
| -> ByteString | per-commitment secret (32 bytes) |
Generate the I'th per-commitment secret from a seed.
Implements the generate_from_seed algorithm from BOLT #3:
generate_from_seed(seed, I):
P = seed
for B in 47 down to 0:
if B set in I:
flip(B) in P
P = SHA256(P)
return P
>>>generate_from_seed seed 281474976710655<32-byte secret>
Arguments
| :: ByteString | base secret |
| -> Int | bits (number of trailing bits to process) |
| -> Word64 | target index I |
| -> ByteString | derived secret |
Derive a secret from a base secret.
This is a generalization of generate_from_seed used for efficient secret storage. Given a base secret whose index has bits..47 the same as target index I, derive the I'th secret.
derive_secret(base, bits, I):
P = base
for B in bits - 1 down to 0:
if B set in I:
flip(B) in P
P = SHA256(P)
return P
Secret storage
data SecretStore Source #
Compact storage for per-commitment secrets.
Stores up to 49 (value, index) pairs, allowing efficient derivation of any previously-received secret. This is possible because for a given secret on a 2^X boundary, all secrets up to the next 2^X boundary can be derived from it.
Instances
| Generic SecretStore Source # | |||||
Defined in Lightning.Protocol.BOLT3.Keys Associated Types
| |||||
| Show SecretStore Source # | |||||
Defined in Lightning.Protocol.BOLT3.Keys Methods showsPrec :: Int -> SecretStore -> ShowS # show :: SecretStore -> String # showList :: [SecretStore] -> ShowS # | |||||
| Eq SecretStore Source # | |||||
Defined in Lightning.Protocol.BOLT3.Keys | |||||
| type Rep SecretStore Source # | |||||
Defined in Lightning.Protocol.BOLT3.Keys | |||||
empty_store :: SecretStore Source #
Empty secret store.
Arguments
| :: ByteString | secret (32 bytes) |
| -> Word64 | index |
| -> SecretStore | current store |
| -> Maybe SecretStore |
Insert a secret into the store, validating against existing secrets.
Returns Nothing if the secret doesn't derive correctly from known secrets (indicating the secrets weren't generated from the same seed).
>>>insert_secret secret 281474976710655 empty_storeJust (SecretStore ...)
Arguments
| :: Word64 | target index |
| -> SecretStore | store |
| -> Maybe ByteString |
Derive a previously-received secret from the store.
Iterates over known secrets to find one whose index is a prefix of the target index, then derives the target secret from it.
>>>derive_old_secret 281474976710654 storeJust <32-byte secret>
Commitment number
obscured_commitment_number Source #
Arguments
| :: PaymentBasepoint | opener's payment_basepoint |
| -> PaymentBasepoint | accepter's payment_basepoint |
| -> CommitmentNumber | commitment number (48-bit) |
| -> Word64 | obscured commitment number |
Calculate the obscured commitment number.
The 48-bit commitment number is obscured by XOR with the lower 48 bits of SHA256(payment_basepoint from open_channel || payment_basepoint from accept_channel).
>>>obscured_commitment_number local_payment_bp remote_payment_bp cn<obscured value>
Scripts
Funding output
funding_script :: FundingPubkey -> FundingPubkey -> Script Source #
funding_witness :: ByteString -> ByteString -> Witness Source #
to_local output
to_local_script :: RevocationPubkey -> ToSelfDelay -> LocalDelayedPubkey -> Script Source #
to_local witness script (revocable with CSV delay).
Script:
OP_IF
revocationpubkey
OP_ELSE
to_self_delay
OP_CHECKSEQUENCEVERIFY
OP_DROP
local_delayedpubkey
OP_ENDIF
OP_CHECKSIG
>>>to_local_script revpk delay localpkScript "c!<revpk>g<delay>\xb2u!<localpk>h\xac"
to_local_witness_spend :: ByteString -> Witness Source #
Witness for delayed spend of to_local output.
Input nSequence must be set to to_self_delay.
Witness: local_delayedsig <>
>>>to_local_witness_spend sigWitness [sig, ""]
to_local_witness_revoke :: ByteString -> Witness Source #
Witness for revocation spend of to_local output.
Witness: revocation_sig 1
>>>to_local_witness_revoke sigWitness [sig, "\x01"]
to_remote output
to_remote_script :: RemotePubkey -> ChannelFeatures -> Script Source #
to_remote witness script.
With option_anchors:
remotepubkey OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY
Without option_anchors: P2WPKH (just the pubkey hash).
>>>to_remote_script pk (ChannelFeatures True)Script "!<pk>\xadQ\xb2"
to_remote_witness :: ByteString -> RemotePubkey -> ChannelFeatures -> Witness Source #
Witness for spending to_remote output.
With option_anchors (P2WSH), input nSequence must be 1.
Witness: remote_sig (witness script appended by caller)
Without option_anchors (P2WPKH):
Witness: remote_sig remotepubkey
>>>to_remote_witness sig pk (ChannelFeatures False)Witness [sig, pk]
Anchor outputs
anchor_script :: FundingPubkey -> Script Source #
Anchor output witness script.
Script:
funding_pubkey OP_CHECKSIG OP_IFDUP OP_NOTIF OP_16 OP_CHECKSEQUENCEVERIFY OP_ENDIF
>>>anchor_script fundpkScript "!<fundpk>\xac\x73d`\xb2h"
anchor_witness_anyone :: Witness Source #
Witness for anyone to sweep anchor output after 16 blocks.
Witness: <>
>>>anchor_witness_anyoneWitness [""]
Offered HTLC
offered_htlc_script :: RevocationPubkey -> RemoteHtlcPubkey -> LocalHtlcPubkey -> PaymentHash -> ChannelFeatures -> Script Source #
Offered HTLC witness script.
Without option_anchors:
OP_DUP OP_HASH160 RIPEMD160(SHA256(revocationpubkey)) OP_EQUAL OP_IF OP_CHECKSIG OP_ELSE remote_htlcpubkey OP_SWAP OP_SIZE 32 OP_EQUAL OP_NOTIF OP_DROP 2 OP_SWAP local_htlcpubkey 2 OP_CHECKMULTISIG OP_ELSE OP_HASH160 RIPEMD160(payment_hash) OP_EQUALVERIFY OP_CHECKSIG OP_ENDIF OP_ENDIF
With option_anchors, adds 1 OP_CHECKSEQUENCEVERIFY OP_DROP before
final OP_ENDIF.
offered_htlc_witness_preimage :: ByteString -> PaymentPreimage -> Witness Source #
Witness for remote node to claim offered HTLC with preimage.
With option_anchors, input nSequence must be 1.
Witness: remotehtlcsig payment_preimage
>>>offered_htlc_witness_preimage sig preimageWitness [sig, preimage]
offered_htlc_witness_revoke :: ByteString -> Pubkey -> Witness Source #
Witness for revocation spend of offered HTLC.
Witness: revocation_sig revocationpubkey
>>>offered_htlc_witness_revoke sig revpkWitness [sig, revpk]
Received HTLC
received_htlc_script :: RevocationPubkey -> RemoteHtlcPubkey -> LocalHtlcPubkey -> PaymentHash -> CltvExpiry -> ChannelFeatures -> Script Source #
Received HTLC witness script.
Without option_anchors:
OP_DUP OP_HASH160 RIPEMD160(SHA256(revocationpubkey)) OP_EQUAL OP_IF OP_CHECKSIG OP_ELSE remote_htlcpubkey OP_SWAP OP_SIZE 32 OP_EQUAL OP_IF OP_HASH160 RIPEMD160(payment_hash) OP_EQUALVERIFY 2 OP_SWAP local_htlcpubkey 2 OP_CHECKMULTISIG OP_ELSE OP_DROP cltv_expiry OP_CHECKLOCKTIMEVERIFY OP_DROP OP_CHECKSIG OP_ENDIF OP_ENDIF
With option_anchors, adds 1 OP_CHECKSEQUENCEVERIFY OP_DROP before
final OP_ENDIF.
received_htlc_witness_timeout :: ByteString -> Witness Source #
Witness for remote node to timeout received HTLC.
With option_anchors, input nSequence must be 1.
Witness: remotehtlcsig <>
>>>received_htlc_witness_timeout sigWitness [sig, ""]
received_htlc_witness_revoke :: ByteString -> Pubkey -> Witness Source #
Witness for revocation spend of received HTLC.
Witness: revocation_sig revocationpubkey
>>>received_htlc_witness_revoke sig revpkWitness [sig, revpk]
HTLC output (same as to_local)
htlc_output_script :: RevocationPubkey -> ToSelfDelay -> LocalDelayedPubkey -> Script Source #
HTLC output witness script (same structure as to_local).
Used for HTLC-timeout and HTLC-success transaction outputs.
Script:
OP_IF
revocationpubkey
OP_ELSE
to_self_delay
OP_CHECKSEQUENCEVERIFY
OP_DROP
local_delayedpubkey
OP_ENDIF
OP_CHECKSIG
htlc_output_witness_spend :: ByteString -> Witness Source #
Witness for delayed spend of HTLC output.
Input nSequence must be set to to_self_delay.
Witness: local_delayedsig 0
htlc_output_witness_revoke :: ByteString -> Witness Source #
Witness for revocation spend of HTLC output.
Witness: revocationsig 1
P2WSH helpers
to_p2wsh :: Script -> Script Source #
Convert a witness script to P2WSH scriptPubKey.
P2WSH format: OP_0 32-byte-hash
>>>to_p2wsh some_witness_scriptScript "\x00\x20<32-byte-hash>"
witness_script_hash :: Script -> ByteString Source #
Compute SHA256 hash of a witness script.
>>>witness_script_hash (Script "some_script")<32-byte SHA256 hash>
Transaction assembly
Commitment transactions
data CommitmentTx Source #
A commitment transaction.
Constructors
| CommitmentTx | |
Fields
| |
Instances
| Generic CommitmentTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
| |||||
| Show CommitmentTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods showsPrec :: Int -> CommitmentTx -> ShowS # show :: CommitmentTx -> String # showList :: [CommitmentTx] -> ShowS # | |||||
| Eq CommitmentTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx | |||||
| type Rep CommitmentTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep CommitmentTx = D1 ('MetaData "CommitmentTx" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "CommitmentTx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "ctx_version") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "ctx_locktime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Locktime) :*: S1 ('MetaSel ('Just "ctx_input_outpoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OutPoint))) :*: (S1 ('MetaSel ('Just "ctx_input_sequence") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Sequence) :*: (S1 ('MetaSel ('Just "ctx_outputs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [TxOutput]) :*: S1 ('MetaSel ('Just "ctx_funding_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script))))) | |||||
data CommitmentContext Source #
Context for building a commitment transaction.
Constructors
| CommitmentContext | |
Fields
| |
Instances
| Generic CommitmentContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
Methods from :: CommitmentContext -> Rep CommitmentContext x # to :: Rep CommitmentContext x -> CommitmentContext # | |||||
| Show CommitmentContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods showsPrec :: Int -> CommitmentContext -> ShowS # show :: CommitmentContext -> String # showList :: [CommitmentContext] -> ShowS # | |||||
| Eq CommitmentContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods (==) :: CommitmentContext -> CommitmentContext -> Bool # (/=) :: CommitmentContext -> CommitmentContext -> Bool # | |||||
| type Rep CommitmentContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep CommitmentContext = D1 ('MetaData "CommitmentContext" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "CommitmentContext" 'PrefixI 'True) (((S1 ('MetaSel ('Just "cc_funding_outpoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OutPoint) :*: (S1 ('MetaSel ('Just "cc_commitment_number") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CommitmentNumber) :*: S1 ('MetaSel ('Just "cc_local_payment_bp") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PaymentBasepoint))) :*: (S1 ('MetaSel ('Just "cc_remote_payment_bp") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PaymentBasepoint) :*: (S1 ('MetaSel ('Just "cc_to_self_delay") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ToSelfDelay) :*: S1 ('MetaSel ('Just "cc_dust_limit") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DustLimit)))) :*: ((S1 ('MetaSel ('Just "cc_feerate") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FeeratePerKw) :*: (S1 ('MetaSel ('Just "cc_features") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChannelFeatures) :*: S1 ('MetaSel ('Just "cc_is_funder") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "cc_to_local_msat") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MilliSatoshi) :*: S1 ('MetaSel ('Just "cc_to_remote_msat") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MilliSatoshi)) :*: (S1 ('MetaSel ('Just "cc_htlcs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [HTLC]) :*: S1 ('MetaSel ('Just "cc_keys") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CommitmentKeys)))))) | |||||
data CommitmentKeys Source #
Derived keys needed for commitment transaction outputs.
Constructors
| CommitmentKeys | |
Instances
| Generic CommitmentKeys Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
Methods from :: CommitmentKeys -> Rep CommitmentKeys x # to :: Rep CommitmentKeys x -> CommitmentKeys # | |||||
| Show CommitmentKeys Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods showsPrec :: Int -> CommitmentKeys -> ShowS # show :: CommitmentKeys -> String # showList :: [CommitmentKeys] -> ShowS # | |||||
| Eq CommitmentKeys Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods (==) :: CommitmentKeys -> CommitmentKeys -> Bool # (/=) :: CommitmentKeys -> CommitmentKeys -> Bool # | |||||
| type Rep CommitmentKeys Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep CommitmentKeys = D1 ('MetaData "CommitmentKeys" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "CommitmentKeys" 'PrefixI 'True) (((S1 ('MetaSel ('Just "ck_revocation_pubkey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RevocationPubkey) :*: S1 ('MetaSel ('Just "ck_local_delayed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LocalDelayedPubkey)) :*: (S1 ('MetaSel ('Just "ck_local_htlc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LocalHtlcPubkey) :*: S1 ('MetaSel ('Just "ck_remote_htlc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RemoteHtlcPubkey))) :*: ((S1 ('MetaSel ('Just "ck_local_payment") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LocalPubkey) :*: S1 ('MetaSel ('Just "ck_remote_payment") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RemotePubkey)) :*: (S1 ('MetaSel ('Just "ck_local_funding") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FundingPubkey) :*: S1 ('MetaSel ('Just "ck_remote_funding") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FundingPubkey))))) | |||||
build_commitment_tx :: CommitmentContext -> CommitmentTx Source #
Build a commitment transaction.
Follows the algorithm from BOLT #3:
- Initialize input and locktime with obscured commitment number
- Calculate which HTLCs are trimmed
- Calculate base fee and subtract from funder
- Add untrimmed HTLC outputs
- Add to_local output if above dust
- Add to_remote output if above dust
- Add anchor outputs if option_anchors
- Sort outputs per BIP69+CLTV
HTLC transactions
An HTLC transaction (timeout or success).
Constructors
| HTLCTx | |
Fields
| |
Instances
| Generic HTLCTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
| |||||
| Show HTLCTx Source # | |||||
| Eq HTLCTx Source # | |||||
| type Rep HTLCTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep HTLCTx = D1 ('MetaData "HTLCTx" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "HTLCTx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "htx_version") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "htx_locktime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Locktime) :*: S1 ('MetaSel ('Just "htx_input_outpoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OutPoint))) :*: (S1 ('MetaSel ('Just "htx_input_sequence") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Sequence) :*: (S1 ('MetaSel ('Just "htx_output_value") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Satoshi) :*: S1 ('MetaSel ('Just "htx_output_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script))))) | |||||
data HTLCContext Source #
Context for building HTLC transactions.
Constructors
| HTLCContext | |
Fields | |
Instances
| Generic HTLCContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
| |||||
| Show HTLCContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods showsPrec :: Int -> HTLCContext -> ShowS # show :: HTLCContext -> String # showList :: [HTLCContext] -> ShowS # | |||||
| Eq HTLCContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx | |||||
| type Rep HTLCContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep HTLCContext = D1 ('MetaData "HTLCContext" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "HTLCContext" 'PrefixI 'True) (((S1 ('MetaSel ('Just "hc_commitment_txid") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TxId) :*: S1 ('MetaSel ('Just "hc_output_index") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :*: (S1 ('MetaSel ('Just "hc_htlc") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 HTLC) :*: S1 ('MetaSel ('Just "hc_to_self_delay") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ToSelfDelay))) :*: ((S1 ('MetaSel ('Just "hc_feerate") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FeeratePerKw) :*: S1 ('MetaSel ('Just "hc_features") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ChannelFeatures)) :*: (S1 ('MetaSel ('Just "hc_revocation_pubkey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RevocationPubkey) :*: S1 ('MetaSel ('Just "hc_local_delayed") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LocalDelayedPubkey))))) | |||||
build_htlc_timeout_tx :: HTLCContext -> HTLCTx Source #
Build an HTLC-timeout transaction.
- locktime: cltv_expiry
- sequence: 0 (or 1 with option_anchors)
- output: to_local style script with revocation and delayed paths
build_htlc_success_tx :: HTLCContext -> HTLCTx Source #
Build an HTLC-success transaction.
- locktime: 0
- sequence: 0 (or 1 with option_anchors)
- output: to_local style script with revocation and delayed paths
Closing transactions
A closing transaction.
Constructors
| ClosingTx | |
Fields
| |
Instances
| Generic ClosingTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
| |||||
| Show ClosingTx Source # | |||||
| Eq ClosingTx Source # | |||||
| type Rep ClosingTx Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep ClosingTx = D1 ('MetaData "ClosingTx" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "ClosingTx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "cltx_version") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "cltx_locktime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Locktime) :*: S1 ('MetaSel ('Just "cltx_input_outpoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OutPoint))) :*: (S1 ('MetaSel ('Just "cltx_input_sequence") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Sequence) :*: (S1 ('MetaSel ('Just "cltx_outputs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [TxOutput]) :*: S1 ('MetaSel ('Just "cltx_funding_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script))))) | |||||
data ClosingContext Source #
Context for building closing transactions.
Constructors
| ClosingContext | |
Fields
| |
Instances
| Generic ClosingContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
Methods from :: ClosingContext -> Rep ClosingContext x # to :: Rep ClosingContext x -> ClosingContext # | |||||
| Show ClosingContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods showsPrec :: Int -> ClosingContext -> ShowS # show :: ClosingContext -> String # showList :: [ClosingContext] -> ShowS # | |||||
| Eq ClosingContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods (==) :: ClosingContext -> ClosingContext -> Bool # (/=) :: ClosingContext -> ClosingContext -> Bool # | |||||
| type Rep ClosingContext Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep ClosingContext = D1 ('MetaData "ClosingContext" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "ClosingContext" 'PrefixI 'True) (((S1 ('MetaSel ('Just "clc_funding_outpoint") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OutPoint) :*: S1 ('MetaSel ('Just "clc_local_amount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Satoshi)) :*: (S1 ('MetaSel ('Just "clc_remote_amount") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Satoshi) :*: (S1 ('MetaSel ('Just "clc_local_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script) :*: S1 ('MetaSel ('Just "clc_remote_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script)))) :*: ((S1 ('MetaSel ('Just "clc_local_dust_limit") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DustLimit) :*: (S1 ('MetaSel ('Just "clc_remote_dust_limit") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DustLimit) :*: S1 ('MetaSel ('Just "clc_fee") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Satoshi))) :*: (S1 ('MetaSel ('Just "clc_is_funder") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "clc_locktime") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Locktime) :*: S1 ('MetaSel ('Just "clc_funding_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script)))))) | |||||
build_closing_tx :: ClosingContext -> ClosingTx Source #
Build a closing transaction (option_simple_close).
- locktime: from closing_complete message
- sequence: 0xFFFFFFFD
- outputs: sorted per BIP69
build_legacy_closing_tx :: ClosingContext -> ClosingTx Source #
Build a legacy closing transaction (closing_signed).
- locktime: 0
- sequence: 0xFFFFFFFF
- outputs: sorted per BIP69
Transaction outputs
A transaction output with value, script, and type information.
Constructors
| TxOutput | |
Fields
| |
Instances
| Generic TxOutput Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
| |||||
| Show TxOutput Source # | |||||
| Eq TxOutput Source # | |||||
| type Rep TxOutput Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep TxOutput = D1 ('MetaData "TxOutput" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (C1 ('MetaCons "TxOutput" 'PrefixI 'True) (S1 ('MetaSel ('Just "txout_value") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Satoshi) :*: (S1 ('MetaSel ('Just "txout_script") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Script) :*: S1 ('MetaSel ('Just "txout_type") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 OutputType)))) | |||||
data OutputType Source #
Type of output in a commitment transaction.
Constructors
| OutputToLocal | |
| OutputToRemote | |
| OutputLocalAnchor | |
| OutputRemoteAnchor | |
| OutputOfferedHTLC !CltvExpiry | |
| OutputReceivedHTLC !CltvExpiry |
Instances
| Generic OutputType Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Associated Types
| |||||
| Show OutputType Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx Methods showsPrec :: Int -> OutputType -> ShowS # show :: OutputType -> String # showList :: [OutputType] -> ShowS # | |||||
| Eq OutputType Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx | |||||
| type Rep OutputType Source # | |||||
Defined in Lightning.Protocol.BOLT3.Tx type Rep OutputType = D1 ('MetaData "OutputType" "Lightning.Protocol.BOLT3.Tx" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) ((C1 ('MetaCons "OutputToLocal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "OutputToRemote" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OutputLocalAnchor" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "OutputRemoteAnchor" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "OutputOfferedHTLC" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 CltvExpiry)) :+: C1 ('MetaCons "OutputReceivedHTLC" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 CltvExpiry))))) | |||||
Fee calculation
commitment_fee :: FeeratePerKw -> ChannelFeatures -> Word64 -> Satoshi Source #
Calculate the base commitment transaction fee.
fee = feerate_per_kw * weight / 1000
where weight = base_weight + 172 * num_htlcs
commitment_weight :: ChannelFeatures -> Word64 -> Word64 Source #
Calculate commitment transaction weight.
weight = base + 172 * num_htlcs
htlc_timeout_fee :: FeeratePerKw -> ChannelFeatures -> Satoshi Source #
Calculate HTLC-timeout transaction fee.
With option_anchors, fee is 0 (CPFP).
Otherwise, fee = feerate_per_kw * 663 / 1000
htlc_success_fee :: FeeratePerKw -> ChannelFeatures -> Satoshi Source #
Calculate HTLC-success transaction fee.
With option_anchors, fee is 0 (CPFP).
Otherwise, fee = feerate_per_kw * 703 / 1000
Trimming
htlc_trim_threshold :: DustLimit -> FeeratePerKw -> ChannelFeatures -> HTLCDirection -> Satoshi Source #
Calculate the trim threshold for an HTLC.
An HTLC is trimmed if:
amount < dust_limit + htlc_tx_fee
is_trimmed :: DustLimit -> FeeratePerKw -> ChannelFeatures -> HTLC -> Bool Source #
Check if an HTLC should be trimmed.
An HTLC is trimmed if its amount minus the HTLC tx fee is below the dust limit.
trimmed_htlcs :: DustLimit -> FeeratePerKw -> ChannelFeatures -> [HTLC] -> [HTLC] Source #
Filter HTLCs that are trimmed.
untrimmed_htlcs :: DustLimit -> FeeratePerKw -> ChannelFeatures -> [HTLC] -> [HTLC] Source #
Filter HTLCs that are not trimmed.
Output ordering
sort_outputs :: [TxOutput] -> [TxOutput] Source #
Sort outputs per BOLT #3 ordering.
Outputs are sorted by: 1. Value (smallest first) 2. ScriptPubKey (lexicographic) 3. CLTV expiry (for HTLCs)
Conversion to ppad-tx
commitment_to_tx :: CommitmentTx -> Maybe Tx Source #
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.
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.
Parsing
Complete transaction.
Bitcoin requires at least one input and one output, enforced here
via NonEmpty lists.
Constructors
| Tx | |
Fields
| |
Instances
| NFData Tx | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic Tx | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show Tx | |||||
| Eq Tx | |||||
| type Rep Tx | |||||
Defined in Bitcoin.Prim.Tx type Rep Tx = D1 ('MetaData "Tx" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-DYNxnVCbwvIAo5p2lB5jg7" 'False) (C1 ('MetaCons "Tx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tx_version") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word32) :*: S1 ('MetaSel ('Just "tx_inputs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (NonEmpty TxIn))) :*: (S1 ('MetaSel ('Just "tx_outputs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (NonEmpty TxOut)) :*: (S1 ('MetaSel ('Just "tx_witnesses") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Witness]) :*: S1 ('MetaSel ('Just "tx_locktime") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word32))))) | |||||
Transaction input.
Constructors
| TxIn | |
Fields
| |
Instances
| NFData TxIn | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic TxIn | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show TxIn | |||||
| Eq TxIn | |||||
| type Rep TxIn | |||||
Defined in Bitcoin.Prim.Tx type Rep TxIn = D1 ('MetaData "TxIn" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-DYNxnVCbwvIAo5p2lB5jg7" 'False) (C1 ('MetaCons "TxIn" 'PrefixI 'True) (S1 ('MetaSel ('Just "txin_prevout") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 OutPoint) :*: (S1 ('MetaSel ('Just "txin_script_sig") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "txin_sequence") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word32)))) | |||||
Transaction output.
Constructors
| TxOut !Word64 !ByteString |
Instances
| NFData TxOut | |||||
Defined in Bitcoin.Prim.Tx | |||||
| Generic TxOut | |||||
Defined in Bitcoin.Prim.Tx Associated Types
| |||||
| Show TxOut | |||||
| Eq TxOut | |||||
| type Rep TxOut | |||||
Defined in Bitcoin.Prim.Tx type Rep TxOut = D1 ('MetaData "TxOut" "Bitcoin.Prim.Tx" "ppad-tx-0.1.0-DYNxnVCbwvIAo5p2lB5jg7" 'False) (C1 ('MetaCons "TxOut" 'PrefixI 'True) (S1 ('MetaSel ('Just "txout_value") 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word64) :*: S1 ('MetaSel ('Just "txout_script_pubkey") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))) | |||||
from_bytes :: ByteString -> Maybe Tx Source #
Parse a transaction from bytes.
Automatically detects segwit vs legacy format by checking for marker byte 0x00 followed by flag 0x01 after the version field.
Returns Nothing on invalid or truncated input.
-- round-trip from_bytes (to_bytes tx) == Just tx
decode_tx :: ByteString -> Maybe Tx Source #
Decode a raw Bitcoin transaction from bytes.
Handles both legacy and SegWit transaction formats.
>>>decode_tx rawTxBytesJust (Tx {...})
Validation
data ValidationError Source #
Errors that can occur during validation.
Constructors
| InvalidVersion !Word32 !Word32 | Expected version, actual version |
| InvalidLocktime !Word32 | Invalid locktime format |
| InvalidSequence !Word32 | Invalid sequence format |
| InvalidOutputOrdering | Outputs not in BIP69+CLTV order |
| DustLimitViolation !Int !Satoshi !Satoshi | Output index, actual value, dust limit |
| MissingAnchorOutput | Expected anchor output not present |
| InvalidAnchorValue !Satoshi | Anchor value not 330 satoshis |
| InvalidFee !Satoshi !Satoshi | Expected fee, actual fee |
| InvalidHTLCLocktime !Word32 !Word32 | Expected locktime, actual locktime |
| InvalidHTLCSequence !Word32 !Word32 | Expected sequence, actual sequence |
| NoOutputs | Transaction has no outputs |
| TooManyOutputs !Int | More outputs than expected |
Instances
| Generic ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT3.Validate Associated Types
Methods from :: ValidationError -> Rep ValidationError x # to :: Rep ValidationError x -> ValidationError # | |||||
| Show ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT3.Validate Methods showsPrec :: Int -> ValidationError -> ShowS # show :: ValidationError -> String # showList :: [ValidationError] -> ShowS # | |||||
| Eq ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT3.Validate Methods (==) :: ValidationError -> ValidationError -> Bool # (/=) :: ValidationError -> ValidationError -> Bool # | |||||
| type Rep ValidationError Source # | |||||
Defined in Lightning.Protocol.BOLT3.Validate type Rep ValidationError = D1 ('MetaData "ValidationError" "Lightning.Protocol.BOLT3.Validate" "ppad-bolt3-0.0.1-ivFIs7KqKGMlCfHgSU6Y" 'False) (((C1 ('MetaCons "InvalidVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :+: (C1 ('MetaCons "InvalidLocktime" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :+: C1 ('MetaCons "InvalidSequence" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)))) :+: (C1 ('MetaCons "InvalidOutputOrdering" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DustLimitViolation" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Satoshi) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Satoshi))) :+: C1 ('MetaCons "MissingAnchorOutput" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "InvalidAnchorValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Satoshi)) :+: (C1 ('MetaCons "InvalidFee" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Satoshi) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Satoshi)) :+: C1 ('MetaCons "InvalidHTLCLocktime" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)))) :+: (C1 ('MetaCons "InvalidHTLCSequence" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)) :+: (C1 ('MetaCons "NoOutputs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TooManyOutputs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)))))) | |||||
validate_commitment_tx :: DustLimit -> ChannelFeatures -> CommitmentTx -> Either ValidationError () Source #
Validate a commitment transaction.
Checks:
- Version is 2
- Locktime format (upper 8 bits = 0x20)
- Sequence format (upper 8 bits = 0x80)
- Output ordering per BIP69+CLTV
- Dust limit compliance
- Anchor outputs if option_anchors
validate_commitment_locktime :: Locktime -> Either ValidationError () Source #
Validate commitment transaction locktime format.
Upper 8 bits must be 0x20.
validate_commitment_sequence :: Sequence -> Either ValidationError () Source #
Validate commitment transaction sequence format.
Upper 8 bits must be 0x80.
validate_htlc_tx :: HTLCTx -> Either ValidationError () Source #
Validate an HTLC transaction (timeout or success).
Checks:
- Version is 2
- Single output
validate_htlc_timeout_tx :: ChannelFeatures -> CltvExpiry -> HTLCTx -> Either ValidationError () Source #
Validate an HTLC-timeout transaction.
Checks:
- Base HTLC validation
- Locktime equals HTLC cltv_expiry
- Sequence is 0 (or 1 with option_anchors)
validate_htlc_success_tx :: ChannelFeatures -> HTLCTx -> Either ValidationError () Source #
Validate an HTLC-success transaction.
Checks:
- Base HTLC validation
- Locktime is 0
- Sequence is 0 (or 1 with option_anchors)
validate_closing_tx :: ClosingTx -> Either ValidationError () Source #
Validate a closing transaction (option_simple_close).
Checks:
- Version is 2
- Sequence is 0xFFFFFFFD
- At least one output
- Output ordering per BIP69
validate_legacy_closing_tx :: ClosingTx -> Either ValidationError () Source #
Validate a legacy closing transaction (closing_signed).
Checks:
- Version is 2
- Locktime is 0
- Sequence is 0xFFFFFFFF
- At least one output
- Output ordering per BIP69
validate_output_ordering :: [TxOutput] -> Either ValidationError () Source #
Validate output ordering per BIP69+CLTV.
Outputs must be sorted by: 1. Value (smallest first) 2. ScriptPubKey (lexicographic) 3. CLTV expiry (for HTLC outputs)
validate_dust_limits :: DustLimit -> [TxOutput] -> Either ValidationError () Source #
Validate that no output violates dust limits.
validate_anchor_outputs :: [TxOutput] -> Either ValidationError () Source #
Validate anchor outputs are present and correctly valued.
validate_commitment_fee Source #
Arguments
| :: FeeratePerKw | |
| -> ChannelFeatures | |
| -> Word64 | Number of untrimmed HTLCs |
| -> Satoshi | Actual fee |
| -> Either ValidationError () |
Validate commitment transaction fee.
Checks that the fee matches the expected calculation.
Arguments
| :: FeeratePerKw | |
| -> ChannelFeatures | |
| -> HTLCDirection | |
| -> Satoshi | Actual fee |
| -> Either ValidationError () |
Validate HTLC transaction fee.