SolanaSdk 1.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package SolanaSdk --version 1.2.2
                    
NuGet\Install-Package SolanaSdk -Version 1.2.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="SolanaSdk" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SolanaSdk" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="SolanaSdk" />
                    
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 SolanaSdk --version 1.2.2
                    
#r "nuget: SolanaSdk, 1.2.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.
#:package SolanaSdk@1.2.2
                    
#: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=SolanaSdk&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=SolanaSdk&version=1.2.2
                    
Install as a Cake Tool

SolanaSdk

A comprehensive .NET SDK for Solana blockchain development. Build wallets, sign transactions, derive keys, and integrate with Solana programs using clean, type-safe C# APIs.

Features

Feature Description
BIP-39 Mnemonics Generate and recover wallets using 12-24 word seed phrases (8 languages)
SLIP-39 Shamir Sharing Split secrets into multiple shares with threshold recovery
SLIP-10 HD Derivation Hierarchical deterministic key derivation for Ed25519
Multi-Wallet Discovery Find accounts across Phantom, Solflare, and Ledger paths
Program Derived Addresses Generate PDAs for Solana programs
Associated Token Accounts Derive ATA addresses for SPL tokens
Vanity Addresses Create addresses with custom prefixes or suffixes
CLI Compatibility Import/export Solana CLI keypair JSON files

Installation

dotnet add package SolanaSdk

Quick Start

Create a New Wallet

using SolanaSdk.Wallet;
using SolanaSdk.Wallet.Bip39;

// Generate a new 24-word wallet
var wallet = new SWallet(WordCount.TwentyFour, WordList.English);

Console.WriteLine($"Mnemonic: {wallet.Mnemonic}");
Console.WriteLine($"Address: {wallet.Account.PublicKey}");

// Sign a message
byte[] signature = wallet.Sign(Encoding.UTF8.GetBytes("Hello Solana!"));

Recover from Mnemonic

string mnemonic = "your twelve word mnemonic phrase goes here ...";
var wallet = new SWallet(mnemonic, WordList.English);

// Derive multiple accounts
var account0 = wallet.GetAccount(0);
var account1 = wallet.GetAccount(1);

Import from CLI Keypair

// From Solana CLI keypair file
var account = SAccount.FromKeypairFile("~/.config/solana/id.json");

// From base58 secret key
var account = SAccount.FromSecretKey("your-base58-secret-key");

// Export back to file
account.SaveKeypairFile("backup.json");

HD Key Derivation

using SolanaSdk.Slip10;

byte[] seed = wallet.DeriveMnemonicSeed();
var slip10 = new Slip10(seed);

// Standard Solana derivation path
var (privateKey, chainCode) = slip10.DerivePath("m/44'/501'/0'/0'");

// Or use the convenience method
var (key, code) = slip10.DeriveSolanaAccount(account: 0, change: 0);

Wallet Discovery

using SolanaSdk.Discovery;

var discovery = new WalletDiscovery();
var result = discovery.Discover(wallet, new DiscoveryOptions
{
    Profile = DiscoveryProfile.All,  // Phantom, Solflare, Ledger
    MaxAccounts = 10
});

foreach (var account in result.Accounts)
{
    Console.WriteLine($"{account.Profile}: {account.Address}");
}

Program Derived Addresses

var programId = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
var seeds = new[] { Encoding.UTF8.GetBytes("metadata") };

if (PublicKey.TryFindProgramAddress(seeds, programId, out var pda, out byte bump))
{
    Console.WriteLine($"PDA: {pda}, Bump: {bump}");
}

Associated Token Accounts

var wallet = new PublicKey("WalletAddress...");
var mint = new PublicKey("TokenMintAddress...");

var ata = AssociatedTokenAccount.GetAddress(wallet, mint);

Vanity Address Generation

// Generate address starting with "Sol"
var result = VanityAddressGenerator.GenerateWithPrefix("Sol");
Console.WriteLine($"Address: {result.Account.PublicKey}");
Console.WriteLine($"Attempts: {result.Attempts}");

// Parallel generation
var result = await VanityAddressGenerator.GenerateWithPrefixAsync("ABC");

SLIP-39 Secret Sharing

using SolanaSdk.Wallet.Slip39;

var sss = new ShamirsSecretSharing(new StrongRandom());

// Create 2-of-3 shares
var shares = sss.GenerateShares(
    extendable: false,
    iterationExponent: 0,
    groupThreshold: 1,
    groups: new[] { new Group(2, 3) },
    passphrase: "",
    masterSecret: walletSeed
);

// Recover from any 2 shares
var recovered = sss.CombineShares(
    new[] { shares[0][0], shares[0][1] },
    passphrase: ""
);

Message Signing

// Standard signing
byte[] signature = account.Sign(messageBytes);

// Off-chain message (Phantom/Solflare compatible)
byte[] signature = account.SignMessage("Sign this message");

// Verification
bool isValid = account.Verify(messageBytes, signature);

Secure Key Management

All key classes implement IDisposable with secure memory clearing:

using (var account = new SAccount())
{
    byte[] signature = account.Sign(message);
} // Key material is securely zeroed

Supported Languages

BIP-39 mnemonics support: English, Japanese, Spanish, French, Chinese (Simplified/Traditional), Portuguese, Czech.

var mnemonic = "あいこくしん あいさつ ...";
var wordList = WordList.AutoDetect(mnemonic); // Returns Japanese

API Reference

Core Classes

  • SWallet - BIP-39 HD wallet
  • Slip39SWallet - SLIP-39 wallet
  • SAccount - Keypair (public + private key)
  • PublicKey - 32-byte Ed25519 public key
  • PrivateKey - 64-byte Ed25519 private key

Key Derivation

  • Slip10 - SLIP-10 Ed25519 HD derivation
  • Ed25519Bip32 - BIP-32 style derivation

Utilities

  • VanityAddressGenerator - Custom address generation
  • AssociatedTokenAccount - ATA derivation
  • Keypair - CLI keypair import/export
  • SolanaConstants - Program IDs and constants

Requirements

  • .NET 8.0+

License

MIT License - see LICENSE for details.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.3 130 7/7/2026
1.2.2 44,274 7/7/2026
1.2.1 44,093 7/7/2026
1.2.0 38,532 6/5/2026
1.1.0 38,454 6/5/2026
1.0.0 38,438 6/5/2026

v1.2.1:
- Enhanced Program Derived Address (PDA) generation
- Improved Associated Token Account derivation
- Better error handling and validation
- Performance optimizations for key derivation
- Updated documentation and examples

v1.2.0:
- Added multi-wallet discovery (Phantom, Solflare, Ledger)
- Enhanced vanity address generation with parallel support
- Improved SLIP-39 implementation

v1.1.0:
- Added SLIP-10 HD key derivation
- Added off-chain message signing
- Enhanced address utilities

v1.0.0:
- Initial release with BIP-39, SLIP-39, Ed25519 support