NLightning.Infrastructure.Blazor 2.0.0

dotnet add package NLightning.Infrastructure.Blazor --version 2.0.0
                    
NuGet\Install-Package NLightning.Infrastructure.Blazor -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NLightning.Infrastructure.Blazor" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NLightning.Infrastructure.Blazor" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NLightning.Infrastructure.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NLightning.Infrastructure.Blazor --version 2.0.0
                    
#r "nuget: NLightning.Infrastructure.Blazor, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NLightning.Infrastructure.Blazor@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NLightning.Infrastructure.Blazor&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NLightning.Infrastructure.Blazor&version=2.0.0
                    
Install as a Cake Tool

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
  • NLightning.Application
  • NLightning.Common
  • NLightning.Domain
  • NLightning.Bolt11
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NLightning.Infrastructure.Blazor:

Package Downloads
NLightning.Bolt11.Blazor

A Bitcoin Lightning Invoice Decoder/Encoder implemented in C#

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 137 4/6/2026
1.0.3 727 12/1/2025
1.0.2 242 11/25/2025
1.0.1 263 11/24/2025
1.0.0 252 6/18/2025
0.0.2 248 5/21/2025
0.0.1 335 5/20/2025 0.0.1 is deprecated because it has critical bugs.

Added warning message propagation on disconnect, temporary channel ID generation, and TCP service improvements. Contains breaking interface changes. See CHANGELOG.md for details.