GraphQL APIs and real-time WebSocket subscriptions for onchain data — DEX trades, transfers, balances, token metadata, and smart contract events across 40+ chains.
- 01DEX trade history
- 02token transfer flows
- 03real-time GraphQL subscriptions
- 04cross-chain queries
- 05Solana + EVM in one schema
- pnpm add graphql graphql-request
| Variable | Scope | Description |
|---|---|---|
| BITQUERY_API_KEY | Server | Bitquery V2 API key (OAuth-style Bearer token) from account.bitquery.io. Server-only. |
Use Bitquery V2 GraphQL for indexed blockchain data. POST queries to `https://streaming.bitquery.io/graphql` with header `Authorization: Bearer $BITQUERY_API_KEY`. With `graphql-request`, instantiate `new GraphQLClient(url, { headers: { Authorization: "Bearer " + key } })` and call `.request(query, variables)`. Convert any `query { ... }` to `subscription { ... }` and connect over WebSocket at `wss://streaming.bitquery.io/eap` for real-time streams. Always set `limit` and a tight time window — points-based billing punishes wide scans.
- ⚑Pricing is points-based and opaque — a query without a `limit` or a narrow `time` filter can drain a month's quota in one call.
- ⚑Free Developer plan caps at ~10 requests/min and a small monthly point bucket; production traffic needs a paid plan.
- ⚑V1 and V2 endpoints have different schemas; new projects must target V2 (`streaming.bitquery.io`), V1 is in maintenance mode.
- ⚑Real-time `dataset: realtime` queries cost 5 points per cube regardless of row count — batch where possible.
- ⚑Schemas differ per chain (Solana vs EVM vs TRON) — write per-chain queries, don't expect a unified resolver.