NLightning.Infrastructure
2.0.0
dotnet add package NLightning.Infrastructure --version 2.0.0
NuGet\Install-Package NLightning.Infrastructure -Version 2.0.0
<PackageReference Include="NLightning.Infrastructure" Version="2.0.0" />
<PackageVersion Include="NLightning.Infrastructure" Version="2.0.0" />
<PackageReference Include="NLightning.Infrastructure" />
paket add NLightning.Infrastructure --version 2.0.0
#r "nuget: NLightning.Infrastructure, 2.0.0"
#:package NLightning.Infrastructure@2.0.0
#addin nuget:?package=NLightning.Infrastructure&version=2.0.0
#tool nuget:?package=NLightning.Infrastructure&version=2.0.0
NLightning.Infrastructure
NLightning.Infrastructure is a core component of the NLightning ecosystem, providing essential infrastructure services for Lightning Network implementations in .NET. This library serves as a bridge between the application and domain layers and external dependencies.
Features
- Cross-platform cryptographic operations with support for:
- Native environments (AOT/Native) using BouncyCastle and Argon2
- Server/desktop environments using
libsodium - Blazor WebAssembly using JavaScript interop and
libsodium.js
- Bitcoin and Lightning Network integration via NBitcoin
- DNS resolution capabilities
- Comprehensive logging support
Available Packages
We've decided to have 2 packages, one for desktop/server development, and one for Blazor WebAssembly development.
The reason behind this is that for a Blazor app running fully on the browser we don't have access to native libsodium.
Installation
Install the package from NuGet:
# For the "standard" version of the package run
dotnet add package NLightning.Infrastructure
# For the Blazor WebAssembly version run
dotnet add package NLightning.Infrastructure.Blazor
Configuration
NLightning.Infrastructure automatically adapts to your build environment:
- For AOT/Native builds, it uses BouncyCastle and Argon2
- For standard .NET applications, it uses libsodium
- For Blazor WebAssembly, it provides JavaScript interoperability
Blazor WebAssembly Setup
When using in a Blazor WebAssembly project, you need to initialize the crypto provider:
using NLightning.Infrastructure.Crypto.Providers.JS;
// Initialize before starting the app
await BlazorCryptoProvider.InitializeBlazorCryptoProviderAsync();
await builder.Build().RunAsync();
Usage
NLightning.Infrastructure is primarily used by other NLightning components, but you can also use it directly for:
// Crypto operations, networking, and other infrastructure services
// Detailed documentation coming soon
Dependencies
- NBitcoin and NBitcoin.Secp256k1 for Bitcoin operations
- Cryptographic libraries (BouncyCastle, Argon2, or libsodium depending on environment)
- DnsClient for DNS resolution
- Microsoft.Extensions.Logging for logging infrastructure
Related Projects
- NLightning.Application
- NLightning.Common
- NLightning.Domain
- NLightning.Bolt11
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- DnsClient (>= 1.8.0)
- libsodium (>= 1.0.21)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- NLightning.Domain (>= 2.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on NLightning.Infrastructure:
| Package | Downloads |
|---|---|
|
NLightning.Bolt11
A Bitcoin Lightning Invoice Decoder/Encoder implemented in C# |
|
|
NLightning.Infrastructure.Bitcoin
Bitcoin Infrastructure Library for NLightning |
|
|
NLightning.Application
Application Library for NLightning |
GitHub repositories
This package is not used by any popular GitHub repositories.
Added warning message propagation on disconnect, temporary channel ID generation, and TCP service improvements. Contains breaking interface changes. See CHANGELOG.md for details.