Real-Time Streams

Subscribe to live data feeds from Slipstream. Available on QUIC, gRPC, and WebSocket protocols. Streams can be enabled at config time or subscribed to after connecting.

Stream Types

StreamConfig FlagDescription
Leader Hintsleader_hints (default: true)Upcoming leader schedule with proximity scores and per-region RTT
Tip Instructionsstream_tip_instructionsRecommended tip amounts per sender with confidence scores
Priority Feesstream_priority_feesCurrent priority fee percentiles with landing probability
Latest Blockhashstream_latest_blockhashBlockhash updates with last valid block height
Latest Slotstream_latest_slotSlot progression notifications

Enable at Config Time

1let config = Config::builder()
2    .api_key("sk_live_...")
3    .leader_hints(true)
4    .stream_tip_instructions(true)
5    .stream_priority_fees(true)
6    .stream_latest_blockhash(true)
7    .stream_latest_slot(true)
8    .build()?;

Leader Hints

Real-time leader proximity data with per-region RTT to optimize transaction timing.

Leader Hints — Rust

1let mut rx = client.subscribe_leader_hints().await?;
2
3while let Some(hint) = rx.recv().await {
4    println!("Slot {}: leader={}", hint.slot, hint.leader_pubkey);
5    println!("  Preferred region: {}", hint.preferred_region);
6    println!("  Backup regions: {:?}", hint.backup_regions);
7    println!("  Confidence: {}%", hint.confidence);
8    println!("  TPU RTT: {}ms", hint.metadata.tpu_rtt_ms);
9    println!("  Region score: {:.2}", hint.metadata.region_score);
10    if let Some(rtt_map) = &hint.metadata.region_rtt_ms {
11        for (region, rtt) in rtt_map {
12            println!("    {}: {}ms", region, rtt);
13        }
14    }
15}

Leader Hints — TypeScript

1await client.subscribeLeaderHints();
2
3client.on("leaderHint", (hint) => {
4    console.log(`Slot ${hint.slot}: leader=${hint.leaderPubkey}`);
5    console.log(`  Preferred region: ${hint.preferredRegion}`);
6    console.log(`  Backup regions: ${hint.backupRegions}`);
7    console.log(`  Confidence: ${hint.confidence}%`);
8    console.log(`  TPU RTT: ${hint.metadata.tpuRttMs}ms`);
9    if (hint.metadata.regionRttMs) {
10        for (const [region, rtt] of Object.entries(hint.metadata.regionRttMs)) {
11            console.log(`    ${region}: ${rtt}ms`);
12        }
13    }
14});

Leader Hints — Python

1await client.subscribe_leader_hints()
2
3@client.on("leader_hint")
4async def on_leader_hint(hint):
5    print(f"Slot {hint.slot}: leader={hint.leader_pubkey}")
6    print(f"  Preferred region: {hint.preferred_region}")
7    print(f"  Confidence: {hint.confidence}%")
8    print(f"  TPU RTT: {hint.metadata.tpu_rtt_ms}ms")

Tip Instructions

Get recommended tip amounts per sender based on current network conditions.

Tip Instructions — Rust

1let mut rx = client.subscribe_tip_instructions().await?;
2
3while let Some(tip) = rx.recv().await {
4    println!("Sender: {} ({})", tip.sender_name, tip.sender);
5    println!("  Tip wallet: {}", tip.tip_wallet_address);
6    println!("  Tip amount: {} SOL ({})", tip.tip_amount_sol, tip.tip_tier);
7    println!("  Expected latency: {}ms", tip.expected_latency_ms);
8    println!("  Confidence: {}%", tip.confidence);
9    println!("  Valid until slot: {}", tip.valid_until_slot);
10    for alt in &tip.alternative_senders {
11        println!("  Alt: {} — {} SOL, confidence {}%",
12            alt.sender, alt.tip_amount_sol, alt.confidence);
13    }
14}

Tip Instructions — TypeScript

1await client.subscribeTipInstructions();
2
3client.on("tipInstruction", (tip) => {
4    console.log(`Sender: ${tip.senderName} (${tip.sender})`);
5    console.log(`  Tip: ${tip.tipAmountSol} SOL (${tip.tipTier})`);
6    console.log(`  Latency: ${tip.expectedLatencyMs}ms, confidence: ${tip.confidence}%`);
7    for (const alt of tip.alternativeSenders) {
8        console.log(`  Alt: ${alt.sender}${alt.tipAmountSol} SOL`);
9    }
10});

Tip Instructions — Python

1await client.subscribe_tip_instructions()
2
3@client.on("tip_instruction")
4async def on_tip(tip):
5    print(f"Sender: {tip.sender_name}{tip.tip_amount_sol} SOL ({tip.tip_tier})")
6    print(f"  Latency: {tip.expected_latency_ms}ms, confidence: {tip.confidence}%")

Cached Tips

The SDK caches the latest tip instruction. Access it without subscribing:

1if let Some(tip) = client.get_latest_tip() {
2    println!("Latest tip: {} SOL via {}", tip.tip_amount_sol, tip.sender_name);
3}
1const tip = client.getLatestTip();
2if (tip) console.log(`Latest tip: ${tip.tipAmountSol} SOL via ${tip.senderName}`);
1tip = client.get_latest_tip()
2if tip:
3    print(f"Latest tip: {tip.tip_amount_sol} SOL via {tip.sender_name}")

Priority Fees

Current priority fee percentiles with landing probability estimates.

Priority Fees — Rust

1let mut rx = client.subscribe_priority_fees().await?;
2
3while let Some(fee) = rx.recv().await {
4    println!("{} — {} micro-lamports/CU (limit: {})",
5        fee.speed, fee.compute_unit_price, fee.compute_unit_limit);
6    println!("  Est. cost: {} SOL", fee.estimated_cost_sol);
7    println!("  Landing probability: {}%", fee.landing_probability);
8    println!("  Congestion: {}", fee.network_congestion);
9    println!("  Success rate: {:.1}%", fee.recent_success_rate * 100.0);
10}

Priority Fees — TypeScript

1await client.subscribePriorityFees();
2
3client.on("priorityFee", (fee) => {
4    console.log(`${fee.speed}${fee.computeUnitPrice} micro-lamports/CU`);
5    console.log(`  Est. cost: ${fee.estimatedCostSol} SOL`);
6    console.log(`  Landing probability: ${fee.landingProbability}%`);
7});

Blockhash & Slot

Blockhash — Rust

1let mut rx = client.subscribe_latest_blockhash().await?;
2while let Some(bh) = rx.recv().await {
3    println!("Blockhash: {} (valid until height {})",
4        bh.blockhash, bh.last_valid_block_height);
5}

Slot — Rust

1let mut rx = client.subscribe_latest_slot().await?;
2while let Some(slot) = rx.recv().await {
3    println!("Slot: {}", slot.slot);
4}

Next Steps