Skip to content

Latest commit

 

History

364 Commits

Folders and files

Solana Stream SDK

Solana Stream SDK: Rust or TypeScript. Built for speed. Green crystal module with a metal plate.

Real-time Solana data for Rust and TypeScript.

Build indexers, monitors, and event-driven applications with Geyser gRPC, Shreds gRPC, or UDP Shreds. One open-source repository with SDKs, working clients, and protocol migration guides.

Rust crate TypeScript package Apache-2.0

Choose a stream · Quick start · Documentation · Releases

Choose your stream

Stream Best for Language Working example
Geyser gRPC Structured transactions, accounts, slots, and blocks with server-side filters and resilient subscriptions Rust / TypeScript Rust · TypeScript
Shreds gRPC Receiving and decoding shred-derived entries over a gRPC connection Rust / TypeScript Rust · TypeScript
UDP Shreds Packet-level Solana data for latency-sensitive custom processing, where packet loss and incomplete data can be handled Rust Receiver · Integration guide

New to Solana streams? Start with Geyser gRPC. It offers structured updates and supported subscription filters. Choose Shreds when you need the lower-level data path and understand the trade-offs.

This repository contains client libraries and examples, not a hosted data service. Bring a compatible stream endpoint or UDP forwarding source. ERPC is one option; other compatible providers can be used.

Quick start

1. TypeScript: run the Geyser client

Requires Node.js 22+ and pnpm. The source workspace uses pnpm 11.

git clone https://github.com/ValidatorsDAO/solana-stream.git
cd solana-stream
pnpm install

cp client/geyser-ts/.env.example client/geyser-ts/.env
# Set GEYSER_ENDPOINT and SOLANA_RPC_ENDPOINT; add X_TOKEN if your provider requires it.

pnpm -F @validators-dao/solana-stream-sdk build
pnpm -F geyser-ts dev

The example includes reconnect handling, stream resumption, bounded processing, and transaction/account handlers. Configuration and application hooks.

For an existing TypeScript project, install the published library with pnpm add @validators-dao/solana-stream-sdk. See the package API and examples.

2. Rust: run the Shreds gRPC client

Requires Rust 1.98.1+ and access to a Shreds gRPC endpoint.

git clone https://github.com/ValidatorsDAO/solana-stream.git
cd solana-stream/client/shreds-rs

cp .env.example .env
# Replace SHREDS_ENDPOINT and SOLANA_RPC_ENDPOINT with your own endpoints.

cargo run

For a Rust application, add solana-stream-sdk = "5.2.1" to your Cargo.toml, then follow the Shreds example or Geyser example.

3. Rust: receive UDP Shreds

If you have a UDP Shreds source, set the listener in settings.jsonc and forward packets to its IP and port:

# From the repository root
cargo run -p shreds-udp-rs --bin generic_logger

The workspace receiver and standalone UDP starter default to erasure recovery for coverage. To prioritize first observations across multiple feeds, set SHREDS_UDP_RECOVERY_MODE=data-only and accept that gaps may cost detections. See choosing a recovery mode for the trade-off and version availability.

This is a listener, not a data-source simulator; output requires incoming packets. The UDP integration guide covers configuration, assembly, custom handlers, and signature verification.

Built for streaming applications

  • Resilient Geyser subscriptions: Rust subscribe_with_reconnect and TypeScript subscribeWithReconnect expose disconnections and partial banks, with replay support. Consumers must handle replayed updates idempotently.
  • Modern Solana data formats: Supports Transaction v1 and Alpenglow block markers; see the compatibility notes.
  • High-throughput Rust gRPC configuration: Rust SDK 5.x uses 16 MiB HTTP/2 receive windows for ShredstreamClient::connect; use tune_geyser_grpc_builder for the upstream Geyser builder.
  • Composable UDP processing: The Rust udp feature offers shred decoding, fixed 32:32 FEC recovery, deshredding, program watchers, and custom sinks without pulling solana-ledger into consumer builds.

Performance measurements and methodology include the scope and limitations of the published local benchmarks.

Versions and compatibility

Package Published version (as of 2026-12-02) Notes
solana-stream-sdk (Rust) 5.2.1 Select data-only for first observations or recover for coverage. Fixed 32:32 recovery was introduced in 5.1.0. UDP guide · v5 migration
@validators-dao/solana-stream-sdk (TypeScript) 4.0.0 4.1.0 is in the repository source but not yet published to npm; npm 4.0 does not include the new 16 MiB Geyser defaults
@validators-dao/solana-shreds-client (Node native) 2.0.1 Serializes Shreds gRPC entries directly to the existing JSON callback. Includes native binaries for Linux and macOS on x64 and ARM64.

The packages follow independent version lines. Check the package-registry badges above for newer releases. Rust SDK 5.2.1 requires Rust 1.98.1+; the repository pins 1.99.1. TypeScript requires Node.js 22+.

Important behavior

  • Shreds gRPC filters are experimental: Use empty filter maps. Geyser gRPC filters are supported.
  • UDP is not finality: Packets may be lost or out of order, and observations may contain failed transactions. The sample UDP receive loop does not verify leader signatures by default. See verification guidance.
  • Reconnects may replay data: Handle Disconnected events, discard partial-bank state, and make application processing idempotent.
  • Flow control is not a server-limit bypass: Larger HTTP/2 receive windows do not fix a slow consumer or override upstream constraints.

Documentation

Topic Guide
Geyser gRPC TypeScript client · Rust client
Shreds gRPC TypeScript client · Rust client
UDP Shreds Integration and operational guide · Rust receiver sample
Protocol upgrades Rust v5 migration · v4 migration · Alpenglow · Transaction v1
Performance Benchmarks and gRPC flow control
SDK packages Rust crate · TypeScript package
Release history Changelog · GitHub releases

Contributing and support

Issues, fixes, and improvements are welcome. See Contributing, Security, and the Code of Conduct. Report SDK bugs through GitHub Issues; for ERPC account or endpoint support, use the ERPC dashboard.

Maintained by Validators DAO. Licensed under Apache-2.0. Powered by Solana.

The ERPC key visual is covered by the ELSOUL LABO brand notice.