![]() |
VOOZH | about |
dotnet add package NuvTools.Blockchain.Azure --version 10.1.0
NuGet\Install-Package NuvTools.Blockchain.Azure -Version 10.1.0
<PackageReference Include="NuvTools.Blockchain.Azure" Version="10.1.0" />
<PackageVersion Include="NuvTools.Blockchain.Azure" Version="10.1.0" />Directory.Packages.props
<PackageReference Include="NuvTools.Blockchain.Azure" />Project file
paket add NuvTools.Blockchain.Azure --version 10.1.0
#r "nuget: NuvTools.Blockchain.Azure, 10.1.0"
#:package NuvTools.Blockchain.Azure@10.1.0
#addin nuget:?package=NuvTools.Blockchain.Azure&version=10.1.0Install as a Cake Addin
#tool nuget:?package=NuvTools.Blockchain.Azure&version=10.1.0Install as a Cake Tool
A suite of .NET libraries for abstracting tamper-evident, append-only blockchain ledger operations, with comprehensive support for Microsoft Azure Confidential Ledger.
NuvTools.Blockchain provides a clean, intuitive abstraction layer for writing and reading typed records to a blockchain ledger. The library follows a provider pattern, allowing you to implement custom ledger backends while maintaining a consistent API.
The core library defines the foundational abstractions:
ILedgerService - Interface for writing entries to and reading entries from a ledgerLedgerEntry<T> - Typed entry returned from the ledger, including TransactionId and optional CollectionIdLedgerEntryBase<T> - Base wrapper carrying the original Content and CommitTimeUtcAzure Confidential Ledger implementation:
AzureConfidentialLedgerService - Full ILedgerService implementation backed by Azure.Security.ConfidentialLedgerBlockchainSection - Strongly-typed configuration POCO bound to the NuvTools.Blockchain configuration sectionBlockchainExtensions.AddBlockchain() - Dependency injection registration extensionDefaultAzureCredential (managed identity, environment, Visual Studio, Azure CLI, etc.)Loading state (eventual consistency)✅ Provider Pattern - Easy to implement custom ledger backends
✅ Async/Await - Fully asynchronous API with CancellationToken support
✅ Generic Type Support - Write and read any serializable type
✅ Azure Integration - Production-ready Azure Confidential Ledger implementation
✅ Collection / Sub-Ledger Support - Organize entries by collectionId
✅ Eventual-Consistency Retry - Configurable retry while the ledger commits the entry
✅ Automatic Serialization - Records are serialized to JSON transparently
✅ Comprehensive Documentation - Full XML documentation for IntelliSense
✅ Multi-Targeting - Supports .NET 8, 9, and 10
Install via NuGet Package Manager:
# Core library
dotnet add package NuvTools.Blockchain
# Azure Confidential Ledger implementation
dotnet add package NuvTools.Blockchain.Azure
Or via Package Manager Console:
Install-Package NuvTools.Blockchain
Install-Package NuvTools.Blockchain.Azure
1. Configure appsettings.json:
{
"NuvTools.Blockchain": {
"LedgerEndpoint": "https://your-ledger-name.confidential-ledger.azure.com"
}
}
2. Register services in Program.cs:
using NuvTools.Blockchain.Azure;
builder.Services.AddBlockchain(builder.Configuration);
3. Inject ILedgerService and use it:
using NuvTools.Blockchain;
public class AuditService(ILedgerService ledgerService)
{
public async Task RecordAsync(AuditRecord record, CancellationToken ct)
{
var transactionId = await ledgerService.WriteAsync(record, cancellationToken: ct);
var entry = await ledgerService.ReadAsync<AuditRecord>(transactionId, cancellationToken: ct);
Console.WriteLine($"Committed at: {entry?.CommitTimeUtc}");
}
}
public record AuditRecord(string UserId, string Action, DateTime Timestamp);
var record = new AuditRecord("user-42", "DocumentSigned", DateTime.UtcNow);
// Write to the default ledger
var transactionId = await ledgerService.WriteAsync(record);
// Read with default retry settings (10 attempts, 500ms base delay)
var entry = await ledgerService.ReadAsync<AuditRecord>(transactionId);
if (entry is not null)
{
Console.WriteLine($"Transaction: {entry.TransactionId}");
Console.WriteLine($"Committed at: {entry.CommitTimeUtc}");
Console.WriteLine($"User: {entry.Content.UserId}");
Console.WriteLine($"Action: {entry.Content.Action}");
}
const string CollectionId = "audit-2026";
// Write to a specific collection
var transactionId = await ledgerService.WriteAsync(record, CollectionId);
// Read from the same collection
var entry = await ledgerService.ReadAsync<AuditRecord>(
transactionId,
collectionId: CollectionId);
Entries can briefly be in a Loading state while the ledger commits and seals them. The reader retries with linear backoff (delayMilliseconds * attempt) until the entry is available or maxRetries is exceeded.
var entry = await ledgerService.ReadAsync<AuditRecord>(
transactionId,
collectionId: null,
maxRetries: 20,
delayMilliseconds: 250,
cancellationToken: ct);
If the ledger does not finish loading within the retry budget, a TimeoutException is thrown.
// Bind to a non-default section name
builder.Services.AddBlockchain(builder.Configuration, "MyApp:Ledger");
{
"MyApp": {
"Ledger": {
"LedgerEndpoint": "https://my-ledger.confidential-ledger.azure.com"
}
}
}
| Setting | Type | Required | Description |
|---|---|---|---|
LedgerEndpoint |
string |
Yes | The Azure Confidential Ledger endpoint URL. |
AzureConfidentialLedgerService uses DefaultAzureCredential, which transparently tries the following credential sources in order:
Ensure the identity running the application has the appropriate role on the ledger resource (typically Confidential Ledger Contributor).
All libraries enable nullable reference types and implicit usings.
This solution uses the modern .slnx (XML-based) solution format.
# Clone the repository
git clone https://github.com/nuvtools/nuvtools-blockchain.git
cd nuvtools-blockchain
# Build the solution
dotnet build NuvTools.Blockchain.slnx
# Run tests
dotnet test NuvTools.Blockchain.slnx
# Create NuGet packages
dotnet pack NuvTools.Blockchain.slnx -c Release
The solution structure:
nuvtools-blockchain/
├── src/
│ ├── NuvTools.Blockchain/ # Core abstractions
│ └── NuvTools.Blockchain.Azure/ # Azure Confidential Ledger implementation
├── tests/
│ └── NuvTools.Blockchain.Azure.Test/ # NUnit tests
└── NuvTools.Blockchain.slnx # Solution file
All public APIs include comprehensive XML documentation comments. IntelliSense in Visual Studio, Visual Studio Code, and Rider will display:
XML documentation files are included in the NuGet packages for seamless integration.
Licensed under the .
Copyright © 2026 Nuv Tools
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. 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 is compatible. 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. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.