![]() |
VOOZH | about |
dotnet add package BTCPayServer.Lightning.All --version 1.7.1
NuGet\Install-Package BTCPayServer.Lightning.All -Version 1.7.1
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.7.1" />
<PackageVersion Include="BTCPayServer.Lightning.All" Version="1.7.1" />Directory.Packages.props
<PackageReference Include="BTCPayServer.Lightning.All" />Project file
paket add BTCPayServer.Lightning.All --version 1.7.1
#r "nuget: BTCPayServer.Lightning.All, 1.7.1"
#:package BTCPayServer.Lightning.All@1.7.1
#addin nuget:?package=BTCPayServer.Lightning.All&version=1.7.1Install as a Cake Addin
#tool nuget:?package=BTCPayServer.Lightning.All&version=1.7.1Install as a Cake Tool
This library is meant to facilitate the development of Lightning Network based apps written in C#. Its main goal isn't to perfectly implement client API of all lightning node implementation, but to provide a common abstraction that can be used to support many implementations at once.
The most important packages are:
BTCPayServer.Lightning.Common contains the common abstractions shared between those implementation.BTCPayServer.Lightning.All contains LightningClientFactory which can convert a connection string to an instance of ILightningClient.If your app depends on ILightningClient directly, you will be able to support those different lightning implementations out of the box.
Here is a description of all packages:
BTCPayServer.Lightning.All super package which reference all the others 👁 NuGetBTCPayServer.Lightning.Common exposes common classes and ILightningClient 👁 NuGetBTCPayServer.Lightning.LND exposes easy to use LND clients 👁 NuGetBTCPayServer.Lightning.CLightning exposes easy to use clightning clients 👁 NuGetBTCPayServer.Lightning.Eclair exposes easy to use Eclair clients 👁 NuGetIf you develop an app, we advise you to reference BTCPayServer.Lightning.All 👁 NuGet
.
If you develop a library, we advise you to reference BTCPayServer.Lightning.Common 👁 NuGet
.
You can also use our BOLT11PaymentRequest to parse BOLT11 invoices. (See example).
Click on the nuget button of the package interesting you, and follow the instruction to add it to your project. For .NET Core Apps, you need to enter this in your project's folder:
dotnet add package BTCPayServer.Lightning.All
You have two ways to use this library:
This is done by using LightningClientFactory and the common interface ILightningClient.
string connectionString = "...";
ILightningClientFactory factory = new LightningClientFactory(Network.Main);
ILightningClient client = factory.Create(connectionString);
LightningInvoice invoice = await client.CreateInvoice(10000, "CanCreateInvoice", TimeSpan.FromMinutes(5));
ILightningClient is an interface which abstract the underlying implementation with a common interface.
The connectionString encapsulates the necessary information BTCPay needs to connect to your Lightning node, we currently support:
clightning via TCP or unix domain socket connectionLND via the REST proxyEclair via their new REST APItype=clightning;server=unix://root/.lightning/lightning-rpctype=clightning;server=tcp://1.1.1.1:27743/type=lnd-rest;server=http://mylnd:8080/;macaroonfilepath=/root/.lnd/invoice.macaroon;allowinsecure=truetype=lnd-rest;server=https://mylnd:8080/;macaroon=abef263adfe...type=lnd-rest;server=https://mylnd:8080/;macaroon=abef263adfe...;certthumbprint=abef263adfe...type=lnd-rest;server=https://mylnd:8080/;macaroonfilepath=/root/.lnd/invoice.macaroon;certfilepath=/var/lib/lnd/tls.certtype=eclair;server=http://127.0.0.1:4570;password=eclairpasstype=eclair;server=http://127.0.0.1:4570;password=eclairpass;bitcoin-host=bitcoin.host;bitcoin-auth=btcpassNote that bitcoin-host and bitcoin-auth are optional, only useful if you want to call ILightningClient.GetDepositAddress on Eclair.
We expect this won't be needed in the future.
Unless the LND certificate is trusted by your machine you need to set the server authentication scheme for LND by specifying one of: certthumbprint, certfilepath, allowinsecure=true.
certfilepath and certthumbprint are equivalent in terms of security but differ in their practical usage.
certfilepath reads a file on your file system so unless you set up some kind of file syncing you can not use it for remote connections.
The advantage is that if the certificate is updated (and synced in case of a remote machine) no more reconfiguration is required for RPC connections to continue to work.
It is therefore the recommended option if you can use it.
The certthumbprint to connect to your LND node can be obtained through this command line:
openssl x509 -noout -fingerprint -sha256 -in /root/.lnd/tls.cert | sed -e 's/.*=//;s/://g'
allowinsecure=true just blindly accepts any server connection and is therefore not secure unless used in tightly controlled environments.
E.g. host is the same machine or is accessed over an encrypted tunnel, assuming no untrusted entities can bind the specified port.
If you want to leverage specific lightning network implementation, either instanciate directly LndClient, CLightningClient, or EclairLightningClient, or cast the ILightningClient object returned by LightningClientFactory.
You first need to run all the dependencies with docker-compose:
cd tests
docker-compose up
Then you can run and debug the tests with Visual Studio or Visual Studio Code.
If you want to use command line:
cd tests
dotnet test
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on BTCPayServer.Lightning.All:
| Package | Downloads |
|---|---|
|
LNTestFramework
Testing Framework for Bitcoin Lightning Network |
|
|
NostrSharp
A library that provide a set of tools for Nostr developement |
Showing the top 1 popular GitHub repositories that depend on BTCPayServer.Lightning.All:
| Repository | Stars |
|---|---|
|
btcpayserver/btcpayserver
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.7.1 | 0 | 6/19/2026 |
| 1.7.0 | 432 | 6/9/2026 |
| 1.6.15 | 3,140 | 4/20/2026 |
| 1.6.14 | 1,897 | 3/23/2026 |
| 1.6.13 | 3,652 | 2/10/2026 |
| 1.6.12 | 134 | 2/10/2026 |
| 1.6.11 | 10,586 | 6/15/2025 |
| 1.6.10 | 2,124 | 5/20/2025 |
| 1.6.9 | 7,792 | 11/30/2024 |
| 1.6.7 | 1,379 | 11/13/2024 |
| 1.6.6 | 2,324 | 10/25/2024 |
| 1.6.5 | 388 | 10/22/2024 |
| 1.6.3 | 397 | 10/20/2024 |
| 1.6.2 | 329 | 10/20/2024 |
| 1.6.1 | 431 | 10/18/2024 |
| 1.6.0 | 9,071 | 4/10/2024 |
| 1.5.5 | 512 | 2/23/2024 |
| 1.5.4 | 4,541 | 2/1/2024 |
| 1.5.3 | 2,781 | 12/20/2023 |