fix: CRITICAL - Revert to Helius RPC (Alchemy breaks Drift SDK)

ISSUE CONFIRMED:
- Alchemy RPC does NOT support WebSocket subscriptions (accountSubscribe method)
- Drift SDK REQUIRES WebSocket support to function properly
- When using Alchemy:
  * SDK initializes with 100+ accountSubscribe errors
  * Claims 'initialized successfully' but is actually broken
  * First API call (openPosition) sometimes works
  * Subsequent calls hang indefinitely OR
  * Positions open without TP/SL orders (NO RISK MANAGEMENT)
  * Position Manager doesn't track positions

SOLUTION:
- Use Helius as primary RPC (supports all Solana methods + WebSocket)
- Helius free tier: 10 req/sec sustained, 100 burst
- Rate limits manageable with retry logic (5s exponential backoff)
- System fully operational with Helius

ALCHEMY INCOMPATIBILITY:
- Alchemy Growth (10,000 CU/s) excellent for raw transaction throughput
- But completely incompatible with Drift SDK architecture
- Cannot be used as primary RPC for Drift Protocol trading

User confirmed: 'after changing back the settings it started to act up again'
This is Common Pitfall #1 - NEVER use RPC without WebSocket support
This commit is contained in:
mindesbunister
2025-11-14 20:53:16 +01:00
parent 78ab9e1a94
commit f30a2c4ed4

11
.env
View File

@@ -31,13 +31,12 @@ API_SECRET_KEY=2a344f0149442c857fb56c038c0c7d1b113883b830bec792c76f1e0efa15d6bb
# Solana RPC URL (Required for blockchain access)
#
# PRIMARY: Alchemy Growth (10,000 CU/s, best for transactions)
# Used for: Transaction submission and confirmation
SOLANA_RPC_URL=https://solana-mainnet.g.alchemy.com/v2/5A0iA5UYpsmP9gkuezYeg
# PRIMARY: Helius (supports all Solana RPC methods including WebSocket subscriptions)
# Drift SDK REQUIRES WebSocket support for accountSubscribe - Alchemy doesn't support this
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=5e236449-f936-4af7-ae38-f15e2f1a3757
# FALLBACK: Helius (for WebSocket subscriptions if needed)
# Used for: Account subscriptions (Drift SDK initialization)
SOLANA_FALLBACK_RPC_URL=https://mainnet.helius-rpc.com/?api-key=5e236449-f936-4af7-ae38-f15e2f1a3757
# Note: Alchemy doesn't support WebSocket subscriptions, causes Drift SDK to malfunction
# SOLANA_FALLBACK_RPC_URL=https://solana-mainnet.g.alchemy.com/v2/5A0iA5UYpsmP9gkuezYeg
# Alternative RPC providers (reference):
#