SolSharp 2.0.0

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

SolSharp

Security checks CodeQL Unit test coverage OpenSSF Scorecard

A modern, contract-driven, Native AOT-ready .NET SDK for Solana — keys and signatures, program instructions, transaction wire formats, RPC, and WebSocket streaming. SolSharp is independently implemented in C# from pinned Anza Solana SDK, Agave, and SPL source contracts. No reflection is used by the library: JSON is source-generated, all four functional assemblies declare Native AOT compatibility, and CI native-publishes and runs a consumer of the packed package.

SolSharp is built for low latency with focused dependencies and a dependency-light Core. If you are writing bots, indexers, or backend services that talk to Solana from .NET and care about speed and control, this is aimed at you.

Why SolSharp

  • Native AOT ready. Source-generated JSON (no reflection), trimmable, AOT-clean — ship a self-contained native binary with instant startup. CI runs a native-compiled smoke test on every push and pull request targeting main.
  • Full pinned RPC coverage. The complete applicable non-admin JSON-RPC HTTP surface from the pinned Agave revision, including reads, send/simulate, airdrop, batching, and multiplexed WebSocket subscriptions with automatic reconnect. Explicit account/program subscription options preserve the effective legacy binary, base58, base64, jsonParsed fallback, and base64+zstd response union without publishing no-op Agave fields.
  • Wire-level control. Spec-accurate legacy, v0, and feature-gated SIMD-0385 V1 transaction building, signing, and decoding — money-critical encodings are checked against exact vectors from pinned Rust contracts, not only against C# round trips.
  • Complete signing workflows. Typed Ed25519 and BLS12-381 values, local/external/null signers, partial signing, Rust-compatible key import/export, vote-account-bound BLS proofs of possession, PoP-gated same-message BLS aggregation, and domain-separated Solana off-chain messages.
  • Traceable parity. Exact upstream commit pins, coverage boundaries, and exclusions are published in the Rust parity matrix; SolSharp is independently written and is not an official Anza/Solana product.
  • Purposeful dependencies. A dependency-light Core, allocation-free hot paths and span-based APIs; the RPC resilience pipeline and vetted Ed25519/BLS backends are included deliberately.
  • Measured quality. Across the four functional assemblies, the reproducible .NET 8 Linux unit-coverage baseline covers 93.7% of hand-written production lines. CI merges overlapping reports, excludes generated sources, publishes line and branch details, enforces a 90% repository-wide line floor, and rejects documentation that overstates the current result.
  • Automated security gates. Pull requests run direct/transitive NuGet auditing, dependency review, and CodeQL's extended C# queries; scheduled scans rerun the audit and CodeQL and report OpenSSF supply-chain posture. Ordinary CI/release restores are locked to committed dependency graphs, 5,000 deterministic property-based hostile-input cases exercise transaction decoding per CI run, and the release workflow attaches the verified package, SHA-256 digest, and Sigstore/SLSA build provenance.

Compared with Solnet and the official Rust contracts

Solnet is an established, ecosystem-oriented .NET SDK. This compact comparison uses its published 8.7.0 release; SolSharp is release 2.0.0; the reference column is the pinned official Rust parity matrix.

Capability Official Rust SDK / Agave SolSharp 2.0 Solnet published 8.7.0
Transactions Legacy, V0, feature-gated SIMD-0385 V1 Legacy/V0/V1 exact wire build, parse, signing, validation, and decompilation Legacy/V0; the published decoder rejects versions above 0
RPC / PubSub 53 applicable request variants; nine subscription families and their effective config unions 53/53 RPC; 9/9 PubSub, including exact HTTP/WS account-encoding unions, effective SubscribeAccountWithOptionsAsync / SubscribeProgramWithOptionsAsync configs, early signature events, and explicit V1 opt-ins 50/53 RPC; 6/9 PubSub families
Programs Canonical native and SPL crates Deep native/SPL coverage, extensive Token-2022 interfaces, typed state/instruction decoders Broader ecosystem program set; published package predates repository-head Token-2022 additions
Offline signing Fixed slots, signer/presigner/null-signer, partial signing and verification Typed fixed slots, partial/all signing, verified external signatures, Presigner / NullSigner Partial signing and externally supplied signatures
Deployment Native Rust crates One package, generated JSON metadata, declared AOT compatibility, native-publish CI Five modular packages; no published solution-wide AOT/trimming contract
Provenance Authoritative source Seven immutable upstream pins and byte-level KATs No immutable upstream revision matrix in published documentation

Solnet repository head contains newer unreleased work; in particular, its current class named V1 does not yet use the pinned SIMD-0385 message body and message-first signature envelope. The full evidence-linked comparison is in the repository README.

Quick start

using SolSharp.Rpc;
using SolSharp.Wallet;
using SolSharp.Programs;

// DI with a built-in resilience pipeline (or: new SolanaRpcClient(httpClient))
services.AddSolanaRpc("https://your-rpc-endpoint");

var lamports = await rpc.GetBalanceAsync(account);

// Build, sign, and send a transfer
using var payer = Keypair.Parse(secret);
var blockhash = (await rpc.GetLatestBlockhashAsync()).Blockhash;

var tx = new TransactionBuilder()
    .SetRecentBlockhash(blockhash)
    .AddInstruction(SystemProgram.Transfer(payer.PublicKey, recipient, 1_000_000))
    .Build(payer);

var signature = await rpc.SendAndConfirmTransactionAsync(tx.Serialize());
// WebSocket streaming
using SolSharp.Rpc;
using SolSharp.Rpc.Streaming;

await using var ws = new SolanaWsClient();
await ws.ConnectAsync(new Uri("wss://your-rpc-endpoint"));
await foreach (var slot in ws.SubscribeSlotsAsync())
    Console.WriteLine(slot.Slot);

var accountChanges = await ws.SubscribeAccountWithOptionsAsync(
    account,
    new AccountSubscriptionOptions { Encoding = RpcAccountEncoding.JsonParsed });

Learn more

Security

SolSharp handles private keys and builds transactions that move funds. It has not been audited — use at your own risk. Never export a raw private key to an RPC provider, hosted service, or third-party transaction builder: keep signing behind ISigner, inspect and simulate, then send only signed bytes.

A green security badge means the automated checks found no known issue at the tested revision. It is not a guarantee that the package is vulnerability-free and does not replace an independent security audit.

BLS operations use the packaged native blst backend on linux-x64, linux-arm64, osx-x64, osx-arm64, and win-x64. Other RIDs can use the rest of SolSharp, but cannot call its BLS API.

To report a vulnerability, use the security policy — private reporting, not a public issue.

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 was computed.  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

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
3.1.0 93 8/11/2026
3.0.0 180 8/10/2026
2.0.0 146 8/9/2026
1.3.0 288 7/30/2026
1.2.0 143 7/13/2026
1.1.0 130 7/3/2026
1.0.1 131 7/3/2026
1.0.0 123 7/2/2026
0.6.0 111 7/2/2026
0.5.0 115 7/1/2026
0.4.1 120 6/29/2026
0.4.0 130 6/28/2026
0.3.0 116 6/28/2026
0.2.0 139 6/26/2026
0.1.0 123 6/19/2026
0.1.0-alpha 123 6/17/2026

2.0.0 — the contract-driven client-parity release, independently implemented against pinned Anza Solana SDK, Agave, and SPL sources. It adds exact legacy/v0/SIMD-0385 V1 transaction workflows; typed Ed25519/BLS12-381 values, offline signers, Rust-compatible key import/export, signed off-chain messages, Vote proofs of possession, and PoP-gated same-message BLS aggregation; broad native-program and Token-2022 interfaces with bounded state decoders; the complete pinned non-admin RPC/PubSub method-family surface and effective configuration variants; plus transport, malformed-input, Native AOT, package-validation, and release hardening. Migration: untyped null/default recent-blockhash or durable-nonce arguments need a string/Hash cast; DataSlice now uses ulong; and exact RPC response fields use typed unsigned/union models instead of permissive signed/JsonElement containers. These are deliberate 2.0 source and binary changes, so applications built against 1.x must be recompiled. Exact source revisions, supported contracts, exclusions, native RID requirements, and byte-vector policy are published in the parity matrix and third-party notices. Full details: https://github.com/jecacs/SolSharp/blob/v2.0.0/CHANGELOG.md