Keysmith.Net
1.2.0
See the version list below for details.
dotnet add package Keysmith.Net --version 1.2.0
NuGet\Install-Package Keysmith.Net -Version 1.2.0
<PackageReference Include="Keysmith.Net" Version="1.2.0" />
paket add Keysmith.Net --version 1.2.0
#r "nuget: Keysmith.Net, 1.2.0"
// Install Keysmith.Net as a Cake Addin #addin nuget:?package=Keysmith.Net&version=1.2.0 // Install Keysmith.Net as a Cake Tool #tool nuget:?package=Keysmith.Net&version=1.2.0
Keysmith.Net
Modern .NET9 library implementing common cryptographic standards used by various cryptocurrencies like BIP32/SLIP10, BIP39 and BIP44.
The intention of this library is to provide minimal no boilerplate implemenations of these cryptographic primitives while maintaining the best possible performance using the latest language features.
Installation
Base Package: Keysmith.Net
The base package is always required.
Optional curve packages:
Installing a curve package will provide a singleton instance of that specific curve to be used in SLIP10 derivations.
Keysmith.Net.Secp256k1
Requires the secp256k1 c library in the same directory as your binary to work.
Consider building it from source or installing the Secp256k1.Native
package which bundles it for you.
Keysmith.Net.ED25519
Uses NSec behind the scenes for curve math which is also MIT licensed.
Features
BIP39
Converts mnemonic words to the seed used for deriving private keys.
[!NOTE]
Only supports the english wordlist.
Usage
byte[] seed = BIP39.MnemonicToSeed("[mnemonics]");
//Or using spans
Span<byte> seed = stackalloc byte[256];
BIP39.TryMnemonicToSeed(seed, "[mnemonics]")
Performance
<img src="./img/bip39_bench.png" />
BIP32/SLIP10
Takes the seed calculated using BIP39 and derives the master private key and child keys using BIP44 derivation paths.
Usage
(byte[] key, byte[] chainCode) = Slip10.DerivePath(
Secp256k1.Instance,
seed,
"m/44'/60'/0'/0/0"
);
//Or using spans
Span<byte> key = stackalloc byte[32];
Span<byte> chainCode = stackalloc byte[32];
Span<uint> path = stackalloc uint[5];
BIP44.Ethereum(path);
Slip10.TryDerivePath(
Secp256k1.Instance,
seed,
key,
chainCode,
path
);
Performance
<img src="./img/slip10_bench.png" />
BIP44
Defines the format for derivation paths used for Bitcoin and a lot of other chains following the same spec.
This library defines helper methods to construct these paths to be used for BIP32 derivation.
Usage
string path = BIP44.Ethereum(5);
// ^ "m/44'/60'/0'/0/5"
// Or using spans
Span<uint> path = stackalloc uint[5];
BIP44.Ethereum(path, 5);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Keysmith.Net:
Package | Downloads |
---|---|
Keysmith.Net.Secp256k1
Secp256k1 implementation for Keysmith.Net |
|
Keysmith.Net.ED25519
ED25519 implementation for Keysmith.Net |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.2 | 39 | 11/21/2024 |
1.2.1 | 40 | 11/21/2024 |
1.2.0 | 34 | 11/21/2024 |
1.1.2 | 36 | 11/21/2024 |
1.1.1 | 35 | 11/21/2024 |
1.1.0 | 37 | 11/21/2024 |
1.0.1 | 61 | 11/18/2024 |
1.0.0 | 56 | 11/18/2024 |
0.5.0 | 59 | 11/18/2024 |
0.4.0 | 62 | 11/18/2024 |
0.3.0 | 57 | 11/18/2024 |
0.2.1 | 63 | 11/17/2024 |
0.2.0 | 64 | 11/17/2024 |
0.1.0 | 57 | 11/17/2024 |