goldrush-streaming-api
GoldRush Streaming API
Real-time blockchain data via GraphQL subscriptions over WebSocket. Sub-second latency for OHLCV price feeds, DEX pair events, and wallet activity.
Quick Start
IMPORTANT: Always prioritize using the official available GoldRush Client SDKs best suited for your development ecosystem. Only use a GraphQL WebSocket Client like graphql-ws if there are specific requirements or contraints to avoid dependencies on available Client SDKs.
The GoldRush Client SDKs provides automatic authentication, connection management, retry logic, type safety, and a simplified API for all streaming operations. see SDK Guide for more details.
import {
GoldRushClient,
StreamingChain,
StreamingInterval,
StreamingTimeframe
} from "@covalenthq/client-sdk";
const client = new GoldRushClient(
"YOUR_API_KEY",
{},
{
onConnecting: () => console.log("Connecting..."),
onOpened: () => console.log("Connected!"),
onError: (error) => console.error("Error:", error),
}
);
client.StreamingService.subscribeToOHLCVTokens(
{
chain_name: StreamingChain.BASE_MAINNET,
token_addresses: ["0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b"],
interval: StreamingInterval.ONE_MINUTE,
timeframe: StreamingTimeframe.ONE_HOUR,
},
{
next: (data) => console.log("OHLCV:", data),
error: (error) => console.error(error),
complete: () => console.log("Done"),
}
);
Install: npm install @covalenthq/client-sdk
Available Streams
The Streaming API offers two types of endpoints:
- Subscriptions — real-time push via WebSocket. Covers OHLCV price candles (by token or pair), new DEX pair creation, pair updates (price/liquidity/volume), and live wallet activity.
- Queries — one-time GraphQL fetch. Covers token search and trader PnL analysis.
For the full list of endpoints with parameters and response schemas, see endpoints.md.
Common Tasks → Stream
| Task | Endpoint |
|---|---|
| Live token price candles | subscribeToOHLCVTokens |
| Live pair price candles | subscribeToOHLCVPairs |
| Monitor new DEX pairs | subscribeToNewPairs |
| Track pair price/liquidity/volume | subscribeToPairUpdates |
| Stream wallet activity | subscribeToWalletActivity |
| Search tokens by name/symbol | searchTokens (query) |
| Analyze trader PnL | getTradersPnl (query) |
Key Differences from Foundational API
| Aspect | Foundational API | Streaming API |
|---|---|---|
| Protocol | REST (HTTPS) | GraphQL over WebSocket |
| Chain name format | eth-mainnet (kebab-case) |
ETH_MAINNET (SCREAMING_SNAKE_CASE) |
| Authentication | Authorization: Bearer KEY |
GOLDRUSH_API_KEY in connection_init payload |
| Data delivery | Request/response | Push-based (subscriptions) |
| Latency | Block-by-block | Sub-second |
| Use case | Historical data, batch queries | Real-time feeds, live monitoring |
Critical Rules
- Chain names use SCREAMING_SNAKE_CASE —
ETH_MAINNET, noteth-mainnet - WebSocket URL —
wss://streaming.goldrushdata.com/graphql - Protocol header —
Sec-WebSocket-Protocol: graphql-transport-ws - Auth payload —
{ "type": "connection_init", "payload": { "GOLDRUSH_API_KEY": "YOUR_KEY" } } - Auth errors are deferred —
connection_ackalways succeeds; auth errors only appear on subscription start - SDK is recommended — handles WebSocket lifecycle, reconnection, and type safety automatically
- Singleton WebSocket — SDK reuses one connection for multiple subscriptions
- Cleanup subscriptions — call the returned unsubscribe function when done; call
disconnect()to close all
Price Feed Sources
- DEX swap events — prices derived from onchain trades across supported DEXes
- Onchain oracle feeds — ultra-low-latency CEX-aggregated prices on select chains (e.g., Redstone Bolt on MegaETH at 2.4ms update frequency)
Reference Files
Read the relevant reference file when you need details beyond what this index provides.
| File | When to read |
|---|---|
| overview.md | Need connection setup, supported chains/DEXes list, quickstart code samples, or authentication details |
| endpoints.md | Building a subscription or query — full parameters, response schemas, decoded event types |
| sdk-guide.md | Need SDK patterns for multiple subscriptions, React integration, raw GraphQL queries, or troubleshooting WebSocket issues |
More from covalenthq/goldrush-agent-skills
goldrush-foundational-api
GoldRush Foundational API — REST API for historical and near-real-time blockchain data across 100+ chains. Use this skill whenever the user needs wallet token balances, transaction history, NFT holdings, token prices, token approvals, cross-chain activity, block data, portfolio value tracking, or any on-chain data query via REST. This is the default skill for blockchain data lookups, portfolio dashboards, tax tools, compliance checks, block explorers, and any application that fetches historical or current chain data. If the user needs real-time streaming or WebSocket push data, use goldrush-streaming-api instead. If the user needs pay-per-request access without an API key, use goldrush-x402 instead.
53goldrush-cli
GoldRush CLI — terminal-first blockchain data tool with MCP support for Claude Desktop and Claude Code. Use this skill whenever the user wants to query blockchain data from the command line, stream DEX pairs or wallet activity in a terminal, set up GoldRush as an MCP tool provider, or run quick one-off queries without writing code (e.g., 'check a wallet balance', 'what's the gas price', 'search for a token'). Also use this when the user mentions 'goldrush' CLI commands, 'npx @covalenthq/goldrush-cli', or MCP integration with GoldRush. The CLI is the fastest path for ad-hoc blockchain lookups from the terminal. If the user needs programmatic API access in an application, use goldrush-foundational-api or goldrush-streaming-api instead. If the user needs pay-per-request access without an API key, use goldrush-x402 instead.
42goldrush-x402
GoldRush x402 — pay-per-request blockchain data access using the x402 protocol (HTTP 402 Payment Required). Use this skill whenever the user is building an AI agent that needs blockchain data without API keys, wants wallet-based micropayments for on-chain data, needs autonomous or no-account access to the GoldRush API, mentions the x402 protocol, or wants no-signup/no-onboarding blockchain data access. This is the right skill for autonomous agents, serverless applications, and prototyping without onboarding. Provides access to 60+ Foundational API endpoints through a transparent reverse proxy with stablecoin payments on Base. If the user needs a traditional API key with monthly billing, use goldrush-foundational-api instead. If the user needs real-time streaming data via WebSocket, use goldrush-streaming-api instead.
35