DotNetLightning


Primitives Module

Types

Type Description

BlockHeight

Absolute block height

BlockHeightOffset16

Description

16bit relative block height used for OP_CSV locks, Since OP_CSV allow only block number of 0 ~ 65535, it is safe to restrict into the range smaller than BlockHeight

BlockHeightOffset32

Description

32bit relative block height. For OP_CSV locks, BlockHeightOffset16 should be used instead.

BlockId

a.k.a. Block Header Hash

ChannelFlags

ComparablePubKey

wrapper for NBitcoin.PubKey which supports IComparable. Used for only those which is not NodeId

ConnectionId

EncodingType

Some p2p messages (e.g. querying the gossip messages for syncing the routing info) Supports compressed message format, This enum is used to annotate which type of the message format is used.

FeeRatePerKw

feerate per kilo weight

HTLCId

serial id for each HTLC in the channel.

LNECDSASignature

Wrapper around NBitcoin's ECDSASignature type for convenience. It has following difference 1. It is equatable 2. Some Convenience methods for serialization 3. Custom ToString

LNOutPoint

Small wrapper for NBitcoin's OutPoint type So that it supports comparison and equality constraints

NodeId

PubKey for node master private key. Which is unique for each lightning network nodes. Used extensively in the protocol. e.g. to * distinguish each nodes. * ECDH key-exchange to encrypt all p2p messages.

PaymentHash

Simple wrapper type for NBitcoin.uint256.

PaymentPreimage

The preimage for HTLC which the LN payment recipient must reveal when receiving the payment. Thus it also works as proof of payment (receipt)

PeerId

RGB

Each lightning node can specify its own RGB color in node_announcement. Used for e.g. lightning node explorer.

ShortChannelId

Unique index for the tx output in the blockchain (as long as there is no competing fork). In LN, this is used for funding txo. which corresponds 1-by-1 to the channel. Thus works as a unique identifier for the specific channel. This is only used when the channel is confirmed enough (thus "opened"). Before it gets open, ChannelId is used instead, which is a xor of the tx hash and the output index.

ShutdownScriptPubKey

destination script pubkey when closing channel in a cooperative way. typesafe wrapper for the raw scriptpubkey.

TxIndexInBlock

index number for the tx in the specific block.

TxOutIndex

a.k.a. vout, index number for the txo in the specific tx.

Type extensions

Type extension Description

Utils.ToBytes(d, lendian)

Full Usage: Utils.ToBytes(d, lendian)

Parameters:
    d : uint16
    lendian : bool

Returns: byte array

Extended Type: Utils

d : uint16
lendian : bool
Returns: byte array

Utils.ToUInt16(b, lendian)

Full Usage: Utils.ToUInt16(b, lendian)

Parameters:
    b : byte array
    lendian : bool

Returns: uint16

Extended Type: Utils

b : byte array
lendian : bool
Returns: uint16

Active patterns

Active pattern Description

(|PaymentPreimage|) x

Full Usage: (|PaymentPreimage|) x

Parameters:
Returns: seq<byte>
x : PaymentPreimage
Returns: seq<byte>