Skip to main content

Kafka Streams for Blockchain Data: Topics, Setup and Examples

Bitquery Kafka streams push every trade, transfer, balance change, transaction and block as protobuf messages on chain-specific topics, plus a multi-chain trading topic with USD prices. They carry the same data as the GraphQL subscriptions with a shorter pipeline, so latency is lower and a consumer can replay from an offset without gaps. Messages stay on the broker for four hours. Access uses separate SASL credentials issued by sales, not the IDE token, and Kafka is billed as its own line item, not from query points. Kafka runs server-side only; there is no browser client and no server-side filtering, so your consumer drops what it does not need.

This page is the map of the Kafka section. Start with the concepts guide if Kafka is new to you, then jump to the chain and language you use.

Which topics exist

GroupTopicsGuide
Multi-chain tradingTrades, token and pair prices with USD values across the Trading cube chainsMulti-chain trading streams
EVM chainsTransactions, calls, events, transfers, balances and blocks for Ethereum, BNB Chain, Base, Polygon, Optimism, Robinhood Chain and Arc testnetEVM protobuf streams
SolanaShred-level transactions, DEX trades, transfers and balances, ahead of block confirmationSolana shred streams
Solana perpetualsOrders, fills, positions, PnL, liquidations and pricesSolana perpetuals stream
TronTransactions, transfers, balances and blocksTron protobuf streams
BitcoinBlocks, transactions, inputs and outputsBitcoin protobuf streams

The full topic list with names, including Hyperliquid, is in Complete list of topics.

Pick the guide

You want toRead
Understand topics, offsets, SASL auth and protobuf payloadsKafka streaming concepts
Connect, authenticate, handle offsets, timestamps and retentionKafka operations cookbook
Consume from GoGo example
Consume from PythonPython tutorial
Consume from JavaScriptJavaScript tutorial
Keep only the messages you needFiltering Kafka streams
Get Solana data before the block landsReal-time Solana data
Build your own indexer on the streamReal-time indexer with Kafka
Feed a trading botTrading bot on Kafka streams

Try the same data without Kafka credentials

Every Kafka topic has a GraphQL subscription with the same rows, so you can see the shape of the data in the Bitquery IDE on a free account before asking for Kafka access. This stream is the WebSocket twin of the multi-chain trading topic, filtered to Ethereum:

subscription {
Trading {
Trades(where: { Pair: { Market: { NetworkBid: { is: "bid:eth" } } } }) {
Block {
Time
}
Pair {
Token {
Symbol
}
QuoteToken {
Symbol
}
Market {
Protocol
}
}
Side
PriceInUsd
AmountsInUsd {
Base
}
}
}
}

Change bid:eth to bid:solana, bid:bsc, bid:base or another chain id from the Crypto Price API to switch chains. When the subscription does what you need and you want lower latency, replay from an offset or several consumers on one feed, move to the Kafka topic that carries the same rows.

How access and billing work

  • Ask sales for Kafka credentials on the official Telegram or through the website form. IDE tokens do not work on Kafka.
  • Kafka is a separate line item from the GraphQL plan. Streams are billed by simultaneous streams and stream time, not by query points; each consumer group counts as its own stream. Details are on how billing works.
  • Messages are kept for four hours. A consumer that is down longer than that misses data, so use offsets and monitor lag as the operations cookbook describes.

Frequently Asked Questions

How do I get access to Bitquery Kafka streams?

Contact sales on the official Telegram channel or through the website form to get SASL credentials. IDE tokens do not work on Kafka. Kafka access is billed separately from the GraphQL plan and counts stream time rather than query points.

How long are Kafka messages retained?

Four hours. A consumer can replay anything within that window from an offset; anything older is gone, so keep consumers running and watch lag.

Kafka or WebSocket subscriptions: which should I use?

Both carry the same rows. Kafka has lower latency, replays from offsets without gaps and lets several consumers split one feed, but runs server-side only with a fixed schema. WebSocket subscriptions work from a browser, can be filtered and reshaped in the query, and run in the IDE. Prototype on WebSocket, move to Kafka when latency or reliability matters.

Can I filter a Kafka topic on the server?

No. Topics have a fixed protobuf schema and carry every message for that chain and data type; filtering happens in your consumer. The filtering guide shows the patterns, and the GraphQL subscription of the same data is the place to filter server-side.

Which chains have Kafka topics?

Ethereum, BNB Chain, Base, Polygon, Optimism, Robinhood Chain, Arc testnet, Bitcoin, Solana (including shred-level and perpetuals topics), Tron and Hyperliquid, plus the multi-chain trading topics with USD prices. The complete list with topic names is on the concepts page.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.