Documentation index

Configuration

Customize the Slipstream SDK to match your use case — protocol preferences, timeouts, streams, and more.

API Keys

API keys follow the format sk_live_* for production and sk_test_* for testing. Generate keys in the AllenHark Console.

PrefixEnvironmentRate Limits
sk_live_ProductionPer tier
sk_test_Testing10 req/sec

Config Builder — Rust

Rust
use allenhark_slipstream::{Config, Protocol, BackoffStrategy, PriorityFeeConfig};
use std::time::Duration;

let config = Config::builder()
    // Required
    .api_key("sk_live_...")

    // Region — optional, auto-discovered if omitted
    // Region IDs are dynamic (e.g. "us-east-2", "eu-central", "eu-west-4", "ap-southeast-1")
    .region("us-east-2")

    // Direct endpoint — bypasses discovery
    .endpoint("84.32.34.7")

    // Discovery URL (default: https://discovery.allenhark.network)
    .discovery_url("https://discovery.allenhark.network")

    // Billing tier (default: "pro")
    // "free" | "standard" | "pro" | "enterprise"
    .tier("pro")

    // Timeouts
    .connection_timeout(Duration::from_secs(10))

    // Retries
    .max_retries(3)
    .retry_backoff(BackoffStrategy::Exponential)

    // Preferred protocol — SDK falls back automatically:
    // QUIC (2s) → gRPC (3s) → WebSocket (3s) → HTTP (5s)
    .preferred_protocol(Protocol::Quic)

    // Protocol-specific timeouts
    .protocol_timeouts(ProtocolTimeouts {
        quic: 2000,
        grpc: 3000,
        websocket: 3000,
        http: 5000,
    })

    // Stream subscriptions — enable at connect time
    .leader_hints(true)                  // default: true
    .stream_tip_instructions(false)      // default: false
    .stream_priority_fees(false)         // default: false
    .stream_latest_blockhash(false)      // default: false
    .stream_latest_slot(false)           // default: false

    // Routing confidence threshold (0-100, default: 70)
    .min_confidence(70)

    // Keep-alive
    .keepalive(true)                     // default: true
    .keepalive_interval(5)               // seconds, default: 5

    // Priority fee config
    .priority_fee(PriorityFeeConfig { speed: PriorityFeeSpeed::Fast })

    // Idle timeout — disconnect after inactivity
    .idle_timeout(Duration::from_secs(300))

    // Webhooks
    .webhook_url("https://yourapp.com/webhooks/slipstream")
    .webhook_events(vec!["transaction.confirmed".into()])
    .webhook_notification_level("final")  // "all" | "final" | "confirmed"

    .build()?;

let client = SlipstreamClient::connect(config).await?;

Config Builder — TypeScript

TypeScript
import { SlipstreamClient, configBuilder } from "@allenhark/slipstream";

const config = configBuilder()
    .apiKey("sk_live_...")

    // Region — optional, auto-discovered if omitted
    .region("us-east-2")

    // Direct endpoints — bypass discovery
    .endpoint("84.32.34.7")
    .wsEndpoint("ws://84.32.34.7:9000")

    // Discovery URL
    .discoveryUrl("https://discovery.allenhark.network")

    // Billing tier
    .tier("pro")

    // Timeouts
    .connectionTimeout(10000)

    // Retries
    .maxRetries(3)
    .retryBackoff("exponential")

    // Protocol-specific timeouts
    .protocolTimeouts({ quic: 2000, websocket: 3000, http: 5000 })

    // Stream subscriptions
    .leaderHints(true)
    .streamTipInstructions(false)
    .streamPriorityFees(false)
    .streamLatestBlockhash(false)
    .streamLatestSlot(false)

    // Routing confidence (0-100)
    .minConfidence(70)

    // Keep-alive
    .keepAlive(true)
    .keepAliveIntervalMs(5000)

    // Priority fee
    .priorityFee({ speed: "fast" })

    // Idle timeout
    .idleTimeout(300000)

    // Webhooks
    .webhookUrl("https://yourapp.com/webhooks/slipstream")
    .webhookEvents(["transaction.confirmed"])
    .webhookNotificationLevel("final")

    .build();

const client = await SlipstreamClient.connect(config);

Config Builder — Python

Python
from allenhark_slipstream import SlipstreamClient, config_builder

config = config_builder() \
    .api_key("sk_live_...") \
    .region("us-east-2") \
    .tier("pro") \
    .connection_timeout(10000) \
    .max_retries(3) \
    .retry_backoff("exponential") \
    .leader_hints(True) \
    .stream_tip_instructions(False) \
    .stream_priority_fees(False) \
    .stream_latest_blockhash(False) \
    .stream_latest_slot(False) \
    .min_confidence(70) \
    .keep_alive(True) \
    .keep_alive_interval(5.0) \
    .webhook_url("https://yourapp.com/webhooks/slipstream") \
    .webhook_events(["transaction.confirmed"]) \
    .webhook_notification_level("final") \
    .build()

client = await SlipstreamClient.connect(config)

Protocol Fallback Chain

The SDK automatically falls back through the protocol chain if the preferred protocol fails:

OrderProtocolDefault Timeout
1QUIC2 s
2gRPC3 s
3WebSocket3 s
4HTTP5 s

Region Discovery

Regions are dynamic — they are discovered at connect time from the discovery service. Available regions change as infrastructure scales. The SDK queries https://discovery.allenhark.network/v1/discovery to get the current list of regions and workers, then probes latency to select the best one.

You can optionally pin to a specific region by passing its ID (e.g. "us-east-2", "eu-central"), but auto-discovery is recommended.

Configuration Defaults

SettingDefault
tier"pro"
connection_timeout10 s (set in ms in the SDK)
max_retries3
retry_backoffExponential
leader_hintstrue
stream_tip_instructionsfalse
stream_priority_feesfalse
stream_latest_blockhashfalse
stream_latest_slotfalse
min_confidence70
keepalivetrue
keepalive_interval5 seconds
webhook_notification_level"final"

Next Steps