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.
| Prefix | Environment | Rate Limits |
|---|---|---|
sk_live_ | Production | Per tier |
sk_test_ | Testing | 10 req/sec |
Config Builder — Rust
1use allenhark_slipstream::{Config, Protocol, BackoffStrategy, PriorityFeeConfig};
2use std::time::Duration;
3
4let config = Config::builder()
5 // Required
6 .api_key("sk_live_...")
7
8 // Region — optional, auto-discovered if omitted
9 // Region IDs are dynamic (e.g. "us-east-2", "eu-central", "eu-west-4", "ap-southeast-1")
10 .region("us-east-2")
11
12 // Direct endpoint — bypasses discovery
13 .endpoint("84.32.34.7")
14
15 // Discovery URL (default: https://discovery.allenhark.network)
16 .discovery_url("https://discovery.allenhark.network")
17
18 // Billing tier (default: "pro")
19 // "free" | "standard" | "pro" | "enterprise"
20 .tier("pro")
21
22 // Timeouts
23 .connection_timeout(Duration::from_secs(10))
24
25 // Retries
26 .max_retries(3)
27 .retry_backoff(BackoffStrategy::Exponential)
28
29 // Preferred protocol — SDK falls back automatically:
30 // QUIC (2s) → gRPC (3s) → WebSocket (3s) → HTTP (5s)
31 .preferred_protocol(Protocol::Quic)
32
33 // Protocol-specific timeouts
34 .protocol_timeouts(ProtocolTimeouts {
35 quic: 2000,
36 grpc: 3000,
37 websocket: 3000,
38 http: 5000,
39 })
40
41 // Stream subscriptions — enable at connect time
42 .leader_hints(true) // default: true
43 .stream_tip_instructions(false) // default: false
44 .stream_priority_fees(false) // default: false
45 .stream_latest_blockhash(false) // default: false
46 .stream_latest_slot(false) // default: false
47
48 // Routing confidence threshold (0-100, default: 70)
49 .min_confidence(70)
50
51 // Keep-alive
52 .keepalive(true) // default: true
53 .keepalive_interval(5) // seconds, default: 5
54
55 // Priority fee config
56 .priority_fee(PriorityFeeConfig { speed: PriorityFeeSpeed::Fast })
57
58 // Idle timeout — disconnect after inactivity
59 .idle_timeout(Duration::from_secs(300))
60
61 // Webhooks
62 .webhook_url("https://yourapp.com/webhooks/slipstream")
63 .webhook_events(vec!["transaction.confirmed".into()])
64 .webhook_notification_level("final") // "all" | "final" | "confirmed"
65
66 .build()?;
67
68let client = SlipstreamClient::connect(config).await?;Config Builder — TypeScript
1import { SlipstreamClient, configBuilder } from "@allenhark/slipstream";
2
3const config = configBuilder()
4 .apiKey("sk_live_...")
5
6 // Region — optional, auto-discovered if omitted
7 .region("us-east-2")
8
9 // Direct endpoints — bypass discovery
10 .endpoint("84.32.34.7")
11 .wsEndpoint("ws://84.32.34.7:9000")
12
13 // Discovery URL
14 .discoveryUrl("https://discovery.allenhark.network")
15
16 // Billing tier
17 .tier("pro")
18
19 // Timeouts
20 .connectionTimeout(10000)
21
22 // Retries
23 .maxRetries(3)
24 .retryBackoff("exponential")
25
26 // Protocol-specific timeouts
27 .protocolTimeouts({ quic: 2000, websocket: 3000, http: 5000 })
28
29 // Stream subscriptions
30 .leaderHints(true)
31 .streamTipInstructions(false)
32 .streamPriorityFees(false)
33 .streamLatestBlockhash(false)
34 .streamLatestSlot(false)
35
36 // Routing confidence (0-100)
37 .minConfidence(70)
38
39 // Keep-alive
40 .keepAlive(true)
41 .keepAliveIntervalMs(5000)
42
43 // Priority fee
44 .priorityFee({ speed: "fast" })
45
46 // Idle timeout
47 .idleTimeout(300000)
48
49 // Webhooks
50 .webhookUrl("https://yourapp.com/webhooks/slipstream")
51 .webhookEvents(["transaction.confirmed"])
52 .webhookNotificationLevel("final")
53
54 .build();
55
56const client = await SlipstreamClient.connect(config);Config Builder — Python
1from allenhark_slipstream import SlipstreamClient, config_builder
2
3config = config_builder() \
4 .api_key("sk_live_...") \
5 .region("us-east-2") \
6 .tier("pro") \
7 .connection_timeout(10000) \
8 .max_retries(3) \
9 .retry_backoff("exponential") \
10 .leader_hints(True) \
11 .stream_tip_instructions(False) \
12 .stream_priority_fees(False) \
13 .stream_latest_blockhash(False) \
14 .stream_latest_slot(False) \
15 .min_confidence(70) \
16 .keep_alive(True) \
17 .keep_alive_interval(5.0) \
18 .webhook_url("https://yourapp.com/webhooks/slipstream") \
19 .webhook_events(["transaction.confirmed"]) \
20 .webhook_notification_level("final") \
21 .build()
22
23client = await SlipstreamClient.connect(config)Protocol Fallback Chain
The SDK automatically falls back through the protocol chain if the preferred protocol fails:
| Order | Protocol | Default Timeout |
|---|---|---|
| 1 | QUIC | 2000ms |
| 2 | gRPC | 3000ms |
| 3 | WebSocket | 3000ms |
| 4 | HTTP | 5000ms |
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
| Setting | Default |
|---|---|
tier | "pro" |
connection_timeout | 10,000ms |
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 |
keepalive | true |
keepalive_interval | 5 seconds |
webhook_notification_level | "final" |
Next Steps
- Transactions — Submit transactions with options
- Bundles — Atomic transaction bundles
- Multi-Region — Dynamic region discovery