SolSharp 4.0.0
Prefix Reserveddotnet add package SolSharp --version 4.0.0
NuGet\Install-Package SolSharp -Version 4.0.0
<PackageReference Include="SolSharp" Version="4.0.0" />
<PackageVersion Include="SolSharp" Version="4.0.0" />
<PackageReference Include="SolSharp" />
paket add SolSharp --version 4.0.0
#r "nuget: SolSharp, 4.0.0"
#:package SolSharp@4.0.0
#addin nuget:?package=SolSharp&version=4.0.0
#tool nuget:?package=SolSharp&version=4.0.0
SolSharp
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.
Upgrading from 3.x: HTTP transaction/block reads and WebSocket block subscriptions now advertise
V1 support, and full options default MaxSupportedTransactionVersion to 1. Existing base58/binary
configurations need an explicit 0 or null; use base64, JSON, or jsonParsed to accept V1. The
4.0 migration guide
shows how to retain the previous behavior.
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,
jsonParsedfallback, andbase64+zstdresponse 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 10 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 4.0.0; the reference column is the pinned official Rust parity matrix.
| Capability | Official Rust SDK / Agave | SolSharp 4.0.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 V1 reads by default |
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 base pins, a scoped RPC freshness extension, 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
- Usage guide — a task-oriented cookbook: keys, export, mnemonics, signed off-chain messages, reads, SPL token state, priority fees, v0 + address lookup tables, SIMD-0385 V1, durable nonces, decoding transactions, subscriptions, batching, and confirmation.
- GitHub repository
- Changelog
- Upstream parity and provenance
- Third-party notices
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- BouncyCastle.Cryptography (>= 2.7.0)
- Microsoft.Extensions.Http (>= 10.0.12)
- Microsoft.Extensions.Http.Resilience (>= 10.10.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Nethermind.Crypto.Bls (>= 1.1.0)
- SimpleBase (>= 5.6.4)
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 |
|---|---|---|
| 4.0.0 | 114 | 9/20/2026 |
| 3.2.0 | 243 | 8/29/2026 |
| 3.1.0 | 202 | 8/11/2026 |
| 3.0.0 | 318 | 8/10/2026 |
| 2.0.0 | 168 | 8/9/2026 |
| 1.3.0 | 305 | 7/30/2026 |
| 1.2.0 | 156 | 7/13/2026 |
| 1.1.0 | 143 | 7/3/2026 |
| 1.0.1 | 143 | 7/3/2026 |
| 1.0.0 | 135 | 7/2/2026 |
| 0.6.0 | 126 | 7/2/2026 |
| 0.5.0 | 131 | 7/1/2026 |
| 0.4.1 | 143 | 6/29/2026 |
| 0.4.0 | 138 | 6/28/2026 |
| 0.3.0 | 131 | 6/28/2026 |
| 0.2.0 | 152 | 6/26/2026 |
| 0.1.0 | 136 | 6/19/2026 |
| 0.1.0-alpha | 134 | 6/17/2026 |
4.0.0 — V1 transactions by default. Breaking change: HTTP transaction/block reads and WebSocket block subscriptions now advertise transaction version 1; full configuration objects also default MaxSupportedTransactionVersion to 1. Use explicit version 0 to retain legacy/v0-only reads, or null in full options to omit the version field. Base58/binary encodings require an explicit version 0 or null; use base64, JSON, or jsonParsed for V1. Adds GetTransactionOptions.MinContextSlot and GetSignatureStatusesWithOptionsAsync with history, commitment, and minimum-context-slot options. Updates NuGet dependencies and the pinned .NET 10 toolchain, fixes the SourceLink security-audit failure, and synchronizes solution, benchmark, and packed AOT locks. Verified with default V1 HTTP/WebSocket tests, a read-only mainnet V1 regression, and packed Native AOT smoke checks. Full details: https://github.com/jecacs/SolSharp/blob/v4.0.0/CHANGELOG.md