ppad-bolt4-0.0.1: BOLT4 (onion routing) for Lightning Network
Copyright(c) 2025 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Lightning.Protocol.BOLT4.Construct

Description

Onion packet construction for BOLT4.

Synopsis

Types

data Hop Source #

Route information for a single hop.

Constructors

Hop 

Fields

Instances

Instances details
Show Hop Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Construct

Methods

showsPrec :: Int -> Hop -> ShowS #

show :: Hop -> String #

showList :: [Hop] -> ShowS #

Eq Hop Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Construct

Methods

(==) :: Hop -> Hop -> Bool #

(/=) :: Hop -> Hop -> Bool #

data Error Source #

Errors during packet construction.

Instances

Instances details
Show Error Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Construct

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Lightning.Protocol.BOLT4.Construct

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Packet construction

construct Source #

Arguments

:: ByteString

32-byte session key (random)

-> [Hop]

route (first hop to final destination)

-> ByteString

associated data

-> Either Error (OnionPacket, [SharedSecret]) 

Construct an onion packet for a payment route.

Takes a session key (32 bytes random), list of hops, and associated data (typically payment_hash).

Returns the onion packet and list of shared secrets (for error attribution).