quorum-sdk 0.1.0

Official Rust SDK for Quorum routing intelligence on Solana
Documentation

quorum-sdk

Official Rust SDK for Quorum — high-performance routing intelligence and direct TPU transaction execution for Solana.

Crates.io Docs.rs License


Overview

quorum-sdk replaces blind single-RPC transaction submission with real-time Solana cluster topology awareness, direct QUIC TPU multi-leader fanout, and dynamic priority fee optimization.

Standard Flow:    [Client] ──────► [Single RPC Node] ──(Blind Submission)──► [Leader TPU]

With Quorum:      [Client] ──────► [Quorum Intelligence Engine]
                                      ├─► [Path 1] Direct QUIC Leader TPU Fanout (119ms)
                                      ├─► [Path 2] Staked RPC Fallback Forwarding
                                      └─► Dynamic Priority Fee Optimization

Features

  • Zero-Knowledge Key Isolation: The SDK never requests, handles, or stores private keys. Transactions are signed locally with standard Solana SDK primitives; only the signed wire payload is submitted.
  • Dual-Path Execution: Simultaneously broadcasts over direct QUIC TPU sockets to upcoming leader slots and parallel staked RPC fallbacks to prevent packet-drop landing failures under heavy congestion.
  • Real-Time Cluster Intelligence: Powered by continuous gossip sweeps measuring live latency across 130+ Solana validator nodes to route around congested or dead nodes.
  • Dynamic Priority Fee Injection: Fetch real-time fee recommendations based on live congestion metrics and automatically prepend ComputeBudget instructions.
  • 4 Execution Objectives: Tailored routes for latency (Fastest), landing rate (HighestLanding), cost (LowestFee), or MEV safety (MevProtected).
  • Memory-Safe & Secure: #![deny(unsafe_code)] enforced crate-wide. Memory-safe TLS (rustls) with automatic sanitization of IP addresses and credentials across all diagnostic streams.
  • Universal Transaction Support: Seamlessly supports legacy Transaction, versioned VersionedTransaction (v0), base64 strings, and raw wire byte slices.

Installation

Add quorum-sdk to your Cargo.toml:

[dependencies]
quorum-sdk = "0.1.0"

Optional Features

  • websocket: Enables real-time streaming strategy feeds.
[dependencies]
quorum-sdk = { version = "0.1.0", features = ["websocket"] }

Quick Start

Execute a Signed Transaction (3 Lines)

use quorum_sdk::{QuorumClient, Objective, compute_budget};
use solana_sdk::{
    hash::Hash,
    signature::Keypair,
    signer::Signer,
    system_instruction,
    transaction::Transaction,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 1. Initialize client (points to default Quorum routing gateway)
    let quorum = QuorumClient::default();

    // 2. Fetch real-time recommended priority fee
    let fee = quorum.get_recommended_fee(Objective::Fastest).await?;

    // 3. Build instructions & prepend dynamic compute budget
    let payer = Keypair::new();
    let recipient = Keypair::new().pubkey();
    let mut instructions = vec![
        system_instruction::transfer(&payer.pubkey(), &recipient, 1_000_000)
    ];
    compute_budget::prepend_priority_fee(&mut instructions, fee);

    // 4. Sign transaction locally (Keypair never leaves your machine)
    let recent_blockhash = Hash::default(); // Replace with live blockhash
    let tx = Transaction::new_signed_with_payer(
        &instructions,
        Some(&payer.pubkey()),
        &[&payer],
        recent_blockhash,
    );

    // 5. Submit via Quorum dual-path routing
    let result = quorum.execute(&tx, Objective::Fastest).await?;
    println!("Landed: {}, Signature: {:?}", result.landed, result.signature);

    Ok(())
}

Execution Objectives

Objective Routing Behavior Ideal Use Case
Objective::Fastest Lowest-latency direct TPU QUIC route (~119ms - 121ms) High-frequency trading, arbitrage
Objective::HighestLanding Multi-leader fanout with concurrent staked RPC fallback Liquidations, NFT mints, limit orders
Objective::LowestFee Cost-optimized route balancing fee and landing probability Batch transfers, scheduled jobs
Objective::MevProtected Routes via non-sandwiching leaders (Jito bundles on mainnet) Large DEX swaps, AMM trades

Client Configuration

use std::time::Duration;
use quorum_sdk::QuorumClient;

// 1. Zero-configuration (Managed Gateway)
let client = QuorumClient::default();

// 2. From environment variables (QUORUM_API_URL, QUORUM_API_KEY)
let client = QuorumClient::from_env()?;

// 3. Custom node configuration
let client = QuorumClient::builder()
    .endpoint("https://custom-quorum-node.xyz")
    .timeout(Duration::from_secs(15))
    .max_retries(3)
    .api_key("your-api-key") // Optional API key header
    .build()?;

Environment Variables

Variable Description Default
QUORUM_API_URL Base endpoint URL for your Quorum node Managed gateway
QUORUM_API_KEY Optional API authentication key None

API Reference

// Submit a signed Transaction, VersionedTransaction, raw bytes, or base64 string
let result = client.execute(&tx, Objective::Fastest).await?;

// Submit pre-encoded base64 wire transaction
let result = client.execute_encoded(&wire_b64, Objective::Fastest).await?;

// Get current recommended fee for an objective (in micro-lamports)
let fee = client.get_recommended_fee(Objective::Fastest).await?;

// Get optimal routing strategy and scored leader TPUs
let strategy = client.get_strategy(Objective::Fastest).await?;

// Query all tracked validators and composite health scores
let validators = client.get_validators().await?;

// Query real-time cluster congestion signals
let congestion = client.get_congestion().await?;

// Liveness check
let health = client.health().await?;

Security Model

  1. Local Signing Only: All transactions must be fully signed before passing to the SDK. Private keys are never accepted, transmitted, or parsed.
  2. Telemetry & Log Sanitization: All error messages, debug formatters, and telemetry automatically mask IP addresses ([REDACTED_IP]), database connection strings ([REDACTED_CONNECTION_STRING]), and authentication tokens.
  3. Zero Unsafe Code: Enforced via #![deny(unsafe_code)].
  4. Memory-Safe TLS: Built exclusively on rustls.

Examples

Run any of the included runnable examples:

# Live Solana transfer with dynamic priority fee and latency breakdown
cargo run --example devnet_sol_transfer

# Anchor client integration pattern
cargo run --example anchor_program_client

# Cluster health and validator scores inspector
cargo run --example inspect_cluster

# Real-time strategy listener
cargo run --example live_strategy_watcher

License

Licensed under either of:

at your option.