Tricksfor.DistributedNonce 9.0.0

dotnet add package Tricksfor.DistributedNonce --version 9.0.0
                    
NuGet\Install-Package Tricksfor.DistributedNonce -Version 9.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="Tricksfor.DistributedNonce" Version="9.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tricksfor.DistributedNonce" Version="9.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Tricksfor.DistributedNonce" />
                    
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 Tricksfor.DistributedNonce --version 9.0.0
                    
#r "nuget: Tricksfor.DistributedNonce, 9.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 Tricksfor.DistributedNonce@9.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=Tricksfor.DistributedNonce&version=9.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Tricksfor.DistributedNonce&version=9.0.0
                    
Install as a Cake Tool

DistributedNonce

Redis-backed, distributed nonce service for Ethereum-like blockchains. Ensures concurrent calls across processes/instances never return duplicate nonces.

Features

  • Distributed locking via Redis (Tricksfor.DistributedLockManager)
  • Safe concurrent GetNextNonceAsync with no duplicates
  • Nethereum integration (IClient)
  • DI-friendly with AddDistributedNonce extension

Quick Start

using DistributedLockManager;
using DistributedNonce;
using DistributedNonce.Services;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;

var services = new ServiceCollection();

// Register lock manager, Redis, and nonce service
services.AddDistributedLockManager();
services.AddSingleton<IConnectionMultiplexer>(
    await ConnectionMultiplexer.ConnectAsync("localhost:6379,abortConnect=false"));
services.AddDistributedNonce();

var provider = services.BuildServiceProvider();
var nonceFactory = provider.GetRequiredService<DistributedNonceService>();

// Create per-account nonce service
var nonceService = nonceFactory.GetInstance("0xYourAddress", yourRpcClient);
var next = await nonceService.GetNextNonceAsync();

Requirements

  • .NET 9+
  • Redis server/cluster

Scalable Environments

Use a shared Redis instance across all app instances. The distributed lock is keyed by account address, ensuring nonce uniqueness even under high concurrency.

For more details, see the GitHub repository.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 Tricksfor.DistributedNonce:

Package Downloads
Tricksfor.BlockChainTools

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.0 68 11/2/2025