NBip32Fast 2.0.2
dotnet add package NBip32Fast --version 2.0.2
NuGet\Install-Package NBip32Fast -Version 2.0.2
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="NBip32Fast" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NBip32Fast --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NBip32Fast, 2.0.2"
#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.
// Install NBip32Fast as a Cake Addin #addin nuget:?package=NBip32Fast&version=2.0.2 // Install NBip32Fast as a Cake Tool #tool nuget:?package=NBip32Fast&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NBip32Fast
High perfomance and low allocation BIP-32 HD key derivation library for .NET 9+
Usage
Basic
var der = new Bip32Key();
Secp256K1HdKey.Instance.DerivePath("m/44'/0'/0'/0/0", seed, ref der);
NistP256HdKey.Instance.DerivePath("m/44'/0'/0'/0/0", seed, ref der);
Ed25519HdKey.Instance.DerivePath("m/44'/0'/0'/0'/0'", seed, ref der);
Extended (tree-like)
var master = new Bip32Key();
Ed25519HdKey.Instance.DerivePath("m/44'/888'/0'/0'", seed, ref master);
var accounts = new List<byte[]>();
var derResult = new Bip32Key();
for (var i = 0u; i < 5u; i++)
{
Ed25519HdKey.Instance.Derive(ref master, KeyPathElement.Hard(i), ref derResult);
accounts.Add(Ed25519HdKey.Instance.GetPublic(derResult.Key));
}
Benchmarks
Intel Core i9-14900K, 1 CPU, 32 logical and 24 physical cores (lower values is better)
SecP256K1
Method | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|---|
NBip32FastKey | 32.49 us | 0.088 us | 0.083 us | 1.00 | 0.00 | 120 B | 1.00 |
NBitcoinKey | 447.77 us | 1.211 us | 1.074 us | 13.78 | 0.05 | 9664 B | 80.53 |
NetezosKey | 635.40 us | 1.744 us | 1.546 us | 19.55 | 0.07 | 3185946 B | 26,549.55 |
Ed25519
Method | Mean | Error | StdDev | Ratio | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|
NBip32FastKey | 4.527 us | 0.0217 us | 0.0193 us | 1.00 | 672 B | 1.00 |
NetezosKey | 6.041 us | 0.0258 us | 0.0242 us | 1.33 | 6136 B | 9.13 |
P3HdKey | 6.415 us | 0.0626 us | 0.0555 us | 1.42 | 6480 B | 9.64 |
NistP256
Method | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|---|
NBip32FastKey | 167.2 us | 0.53 us | 0.49 us | 1.00 | 0.00 | 608 B | 1.00 |
NetezosKey | 1,483.8 us | 11.86 us | 10.51 us | 8.87 | 0.07 | 7029510 B | 11,561.69 |
Parse KeyPath
Method | Mean | Error | StdDev | Ratio | RatioSD | Allocated | Alloc Ratio |
---|---|---|---|---|---|---|---|
NBip32FastParse | 73.83 ns | 0.227 ns | 0.212 ns | 1.00 | 0.00 | 80 B | 1.00 |
NBitcoinParse | 243.23 ns | 1.687 ns | 1.317 ns | 3.29 | 0.02 | 1168 B | 14.60 |
NetezosParse | 278.73 ns | 0.836 ns | 0.782 ns | 3.78 | 0.01 | 1184 B | 14.80 |
TODOs
- Ed25519 soft derivation scheme (used in
Cardano
) -
KeyPathTree
for efficient computing (for multiple keypath merging and index depth) -
HDKey
refactoring with public key lazy addition - More testing
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on NBip32Fast:
Package | Downloads |
---|---|
NBip32Fast.Secp256K1
Blazing fast SecP256k1 bip-32 keypath derivation subpackage |
|
DotNut
A full C# native implementation of the Cashu protocol |
|
NBip32Fast.Ed25519
Blazing fast Ed25519 bip-32 keypath derivation subpackage |
|
NBip32Fast.NistP256
Blazing fast NistP256 (SecP256r1) bip-32 keypath derivation subpackage |
GitHub repositories
This package is not used by any popular GitHub repositories.