Table of Contents

Class Invoice

Namespace
NLightning.Bolts.BOLT11
Assembly
NLightning.Bolts.dll

Represents a BOLT11 Invoice

public class Invoice
Inheritance
Invoice
Derived
Inherited Members

Remarks

The invoice is a payment request that can be sent to a payer to request a payment.

Constructors

Invoice(ulong, uint256, uint256, uint256)

The base constructor for the invoice

public Invoice(ulong amountMilliSats, uint256 descriptionHash, uint256 paymentHash, uint256 paymentSecret)

Parameters

amountMilliSats ulong

The amount of millisatoshis the invoice is for

descriptionHash uint256

The description hash of the invoice

paymentHash uint256

The payment hash of the invoice

paymentSecret uint256

The payment secret of the invoice

Remarks

The invoice is created with the given amount of millisatoshis, a description hash, the payment hash and the payment secret.

See Also

Invoice(ulong, string, uint256, uint256)

The base constructor for the invoice

public Invoice(ulong amountMilliSats, string description, uint256 paymentHash, uint256 paymentSecret)

Parameters

amountMilliSats ulong

The amount of millisatoshis the invoice is for

description string

The description of the invoice

paymentHash uint256

The payment hash of the invoice

paymentSecret uint256

The payment secret of the invoice

Remarks

The invoice is created with the given amount of millisatoshis, a description, the payment hash and the payment secret.

See Also

Properties

AmountMilliSats

The amount of millisatoshis the invoice is for

public ulong AmountMilliSats { get; }

Property Value

ulong

AmountSats

The amount of satoshis the invoice is for

public ulong AmountSats { get; }

Property Value

ulong

Description

The description of the invoice

public string? Description { get; }

Property Value

string

Remarks

The description is a UTF-8 encoded string that describes, in short, the purpose of payment

DescriptionHash

The description hash of the invoice

public uint256? DescriptionHash { get; }

Property Value

uint256

Remarks

The description hash is a 32 byte hash of the description

See Also
uint256

ExpiryDate

The expiry date of the invoice

public DateTimeOffset ExpiryDate { get; set; }

Property Value

DateTimeOffset

Remarks

The expiry date is the date the invoice expires

See Also

FallbackAddresses

The fallback addresses of the invoice

public List<BitcoinAddress>? FallbackAddresses { get; set; }

Property Value

List<BitcoinAddress>

Remarks

The fallback addresses are used to specify the fallback addresses the payer can use

See Also
BitcoinAddress

Features

The features of the invoice

public Features? Features { get; set; }

Property Value

Features

Remarks

The features are used to specify the features the payer should support

See Also

HumanReadablePart

The human-readable part of the invoice

public string HumanReadablePart { get; }

Property Value

string

Metadata

The metadata of the invoice

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

Property Value

byte[]

Remarks

The metadata is used to add additional information to the invoice

MinFinalCltvExpiry

The min final cltv expiry of the invoice

public ushort? MinFinalCltvExpiry { get; set; }

Property Value

ushort?

Remarks

The min final cltv expiry is the minimum final cltv expiry the payer should use

Network

The network the invoice is created for

public Network Network { get; }

Property Value

Network

PayeePubKey

The payee pubkey of the invoice

public PubKey? PayeePubKey { get; set; }

Property Value

PubKey

Remarks

The payee pubkey is the pubkey of the payee

See Also
PubKey

PaymentHash

The payment hash of the invoice

public uint256 PaymentHash { get; }

Property Value

uint256

Remarks

The payment hash is a 32 byte hash that is used to identify a payment

See Also
uint256

PaymentSecret

The payment secret of the invoice

public uint256 PaymentSecret { get; }

Property Value

uint256

Remarks

The payment secret is a 32 byte secret that is used to identify a payment

See Also
uint256

RoutingInfos

The Routing Information of the invoice

public RoutingInfoCollection? RoutingInfos { get; set; }

Property Value

RoutingInfoCollection

Remarks

The routing information is used to hint about the route the payment could take

See Also

Signature

The signature of the invoice

public CompactSignature Signature { get; }

Property Value

CompactSignature

Timestamp

The timestamp of the invoice

public long Timestamp { get; }

Property Value

long

Remarks

The timestamp is the time the invoice was created in seconds since the Unix epoch.

Methods

Decode(string)

Decodes an invoice from a string

public static Invoice Decode(string invoiceString)

Parameters

invoiceString string

The invoice string

Returns

Invoice

The invoice

Exceptions

InvoiceSerializationException

If something goes wrong in the decoding process

Encode()

Encodes the invoice to a string

public string Encode()

Returns

string

A string representing the invoice

Exceptions

InvoiceSerializationException

If something goes wrong in the encoding process

InSatoshis(long, uint256, uint256, uint256)

Creates a new invoice with the given amount of satoshis

public static Invoice InSatoshis(long amountSats, uint256 descriptionHash, uint256 paymentHash, uint256 paymentSecret)

Parameters

amountSats long

The amount of satoshis the invoice is for

descriptionHash uint256

The description hash of the invoice

paymentHash uint256

The payment hash of the invoice

paymentSecret uint256

The payment secret of the invoice

Returns

Invoice

The invoice

Remarks

The invoice is created with the given amount of satoshis, a description hash, the payment hash and the payment secret.

InSatoshis(long, string, uint256, uint256)

Creates a new invoice with the given amount of satoshis

public static Invoice InSatoshis(long amountSats, string description, uint256 paymentHash, uint256 paymentSecret)

Parameters

amountSats long

The amount of satoshis the invoice is for

description string

The description of the invoice

paymentHash uint256

The payment hash of the invoice

paymentSecret uint256

The payment secret of the invoice

Returns

Invoice

The invoice

Remarks

The invoice is created with the given amount of satoshis, a description, the payment hash and the payment secret.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.