Table of Contents

Class HtlcEntity

Namespace
NLightning.Infrastructure.Persistence.Entities.Channel
Assembly
NLightning.Infrastructure.Persistence.dll
public class HtlcEntity
Inheritance
HtlcEntity
Inherited Members

Properties

AddMessageBytes

Stores the serialized byte representation of the HTLC's "Add" message. This property is used for persisting and reconstructing the HTLC's initial state for communication purposes.

public required byte[] AddMessageBytes { get; set; }

Property Value

byte[]

Remarks

This property facilitates the serialization and deserialization of the UpdateAddHtlcMessage to ensure accurate data storage and retrieval in the repository layers.

AmountMsat

Represents the amount associated with the HTLC in milli-satoshis (msat). This property is used to define the precise value of the HTLC for transactions and operations within the Lightning Network.

public required ulong AmountMsat { get; set; }

Property Value

ulong

ChannelId

Represents the unique identifier for a channel associated with the HTLC entity. This property is used to establish a relationship between HTLCs and their respective channels.

public required ChannelId ChannelId { get; set; }

Property Value

ChannelId

Remarks

This is part of the composite-key identifier

CltvExpiry

Represents the expiration time of the HTLC (Hashed Timelock Contract). This property indicates the deadline by which the HTLC must be resolved, or it becomes invalid.

public required uint CltvExpiry { get; set; }

Property Value

uint

Remarks

This property is critical in ensuring the timely processing of payment channels to avoid stale or unresolved contracts.

Direction

Specifies the direction of the HTLC in relation to the channel, indicating whether it is incoming or outgoing. This property aids in identifying the flow of funds and the associated logic within the channel operations.

public required byte Direction { get; set; }

Property Value

byte

Remarks

This is part of the composite-key identifier

HtlcId

Represents the unique identifier for a specific HTLC (Hashed Time-Locked Contract) instance. This property helps to distinguish and track individual HTLCs associated with a channel.

public required ulong HtlcId { get; set; }

Property Value

ulong

Remarks

This is part of the composite-key identifier

ObscuredCommitmentNumber

Represents the obscured commitment number associated with the HTLC entity. This property is used in creating a commitment transaction's unique identifier and ensures privacy and obfuscation in Lightning Network transactions.

public required ulong ObscuredCommitmentNumber { get; set; }

Property Value

ulong

Remarks

The obscured commitment number is derived using the negotiated channel information and serves as a mechanism to mitigate channel state leakage.

PaymentHash

Represents the hash identifier used for payment routing in Lightning Network. This property ensures that payments are routed securely without exposing the preimage.

public required byte[] PaymentHash { get; set; }

Property Value

byte[]

Remarks

The PaymentHash is a fundamental part of HTLC (Hashed Time Lock Contract) mechanics, allowing validation of payment claims through hash preimage revelation.

PaymentPreimage

Represents the raw preimage of a cryptographic hash used in the context of HTLC (Hashed Time Lock Contract) payments. This property is utilized to verify payment authenticity by reconstructing the hash associated with the HTLC.

public byte[]? PaymentPreimage { get; set; }

Property Value

byte[]

Remarks

This property may be null if the preimage is not available at the given state of the HTLC lifecycle.

Signature

Represents the cryptographic signature associated with the HTLC entity. This property is used to validate and ensure the authenticity of messages or transactions within the HTLC protocol, using the corresponding cryptographic keys.

public byte[]? Signature { get; set; }

Property Value

byte[]

Remarks

This property is optional, as it may not be present in all scenarios.

State

Represents the current state of the HTLC (Hashed Time-Locked Contract). This property captures the lifecycle stage of the HTLC, such as being offered, settled, failed, fulfilled, or revoked.

public required byte State { get; set; }

Property Value

byte

Remarks

The state is stored as an enumeration of type HtlcState.