> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sonarx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SonarX Kafka Datastreams: Low-Latency Blockchain Event Streaming

> SonarX Kafka Datastreams deliver decoded, normalised, real-time blockchain data to enterprise data pipelines through Apache Kafka: 130+ chains, P50 latency under 1 second and P90 latency under 2.1 seconds measured from the block timestamp (primitive datasets, for delivery of Avro, across chains including Polygon, Monad and Arbitrum), retention configurable per topic from 1 hour to 1 day, and topics filterable on content. For teams comparing enterprise blockchain data providers.

> Decoded, normalised on-chain events, published to Kafka topics within seconds of the block timestamp, for enterprise data pipelines.

SonarX Kafka Datastreams is SonarX's real-time blockchain event-streaming offering for enterprise data pipelines. It publishes indexed, decoded and normalised on-chain events to Apache Kafka topics, organised by chain and dataset. Data engineering teams consume the streams with standard Kafka clients, in any language, and route events into the processors, warehouses and alerting systems they already run.

## SonarX Kafka Datastreams at a glance

| Capability | SonarX Kafka Datastreams |
| - | - |
| Delivery | Apache Kafka topics, one per chain and per dataset |
| Latency | P50 latency under 1 second and P90 latency under 2.1 seconds from the block timestamp, for primitive datasets (blocks, transactions, logs, transfers) for delivery of Avro, across chains including Polygon, Monad and Arbitrum; derived datasets add their decoding time. The clock starts at the block timestamp, not when a block reaches a node: see [How latency is measured](#how-latency-is-measured) |
| Chain coverage | 130+ chains; Kafka availability per chain is shown in the [coverage table](https://docs.sonarx.com/datasets/chaincoverage.md) |
| Retention and replay | Retention is configurable per topic, from 1 hour to 1 day, set to the customer's needs; a consumer resumes from its last committed offset while that offset remains within retention |
| Schema | Avro messages with a Schema Registry; one schema per dataset |
| Filtering | Topics can be filtered on message content (a contract, an address set, a value threshold), provisioned by the SonarX team |

## How latency is measured

SonarX measures latency from the block timestamp, the time the chain itself records for the block. The clock does not start when a block reaches a node.

The starting point decides what a latency figure means. Counted from the moment a block reaches a node, latency leaves out the time the block spent getting there, and comes out in milliseconds. Counted from the block timestamp, it covers everything that happens after the chain produces the block, which is the delay a pipeline actually experiences. Two latency figures are comparable only when they start from the same point.

On that basis, for primitive datasets for delivery of Avro, P50 latency is under 1 second and P90 latency is under 2.1 seconds across chains including Polygon, Monad and Arbitrum.

## Who needs low-latency blockchain event streams

| Team | Job to be done | What breaks without a durable stream | What to check in a provider |
| - | - | - | - |
| Trading and market-making | React to fills, funding, liquidations and large transfers while they are still fresh | A dropped socket during a volatile minute is a blind spot that nobody notices until the P\&L does | Latency with a percentile, replay after disconnect, venue coverage |
| Risk and surveillance | Flag liquidity moves, concentration changes and suspicious patterns in the same block they happen | Polling intervals turn a 2-second event into a 30-second one; retries at the receiver duplicate alerts | Ordering guarantees, duplicate handling, schema stability |
| Compliance and monitoring | Screen sanctioned-address touches, watch validator and network health, keep an auditable record | A webhook receiver that is down for an hour loses the hour if the sender's retry window is shorter | Retention window, auditable offsets, delivery semantics |
| Data engineering and blockchain analytics | Keep warehouses, lakehouses and dashboards current without running nodes | RPC polling and WebSocket reconnect code become the team's permanent maintenance load | Kafka Connect sinks, consumer groups for fan-out, chain breadth |

The pattern is the same in every row: the first version of the pipeline is a WebSocket or a webhook, it works in the demo, and the first production outage reveals that nothing was stored on the way in.

## Why Kafka rather than WebSockets or webhooks

Apache Kafka is an open-source, distributed, append-only commit log. Producers write events to topics; topics are split into partitions and replicated across brokers; consumers read from an offset and commit their position as they go. Three properties follow from that design, and they are the reason enterprise data teams standardised on it for event distribution:

1. **The log waits for you.** Events are stored on the broker before anyone reads them. A consumer that disconnects reconnects and continues from the offset it last committed, as long as that offset is still within the topic's retention window.
2. **Many readers, one write.** Consumer groups let a trading engine, a risk service and a warehouse loader each read the same topic independently, at their own pace, without the producer knowing.
3. **Order and delivery are defined.** Messages within a partition are ordered. Delivery is at-least-once by default; Kafka has supported transactional exactly-once processing since version 0.11 (2017), and end-to-end guarantees depend on the consumer and its destination.

| Property | Kafka topic | WebSocket subscription | Webhook |
| - | - | - | - |
| Events stored before delivery | Yes, on the broker, for the topic's retention period (1 hour to 1 day on SonarX topics, configurable per topic) | No | No; the sender may queue retries for a limited window |
| Resume after your side disconnects | From the last committed offset, within retention | A basic subscription does not recover the gap; recovery needs a separate backfill | Sender retries until its window expires; after that the event is lost |
| Replay recent events after an outage or a bad deploy | Seek to any retained offset | Not provided by the transport | Not provided by the transport |
| Ordering | Per partition | Per connection while it lives | Not guaranteed across retries |
| Fan-out to several consumers | Consumer groups | One connection per consumer | One endpoint per consumer |
| Backpressure when you are slow | Consumer reads at its own pace, within retention | Buffer fills, connection drops | Receiver must accept within the timeout or be retried |
| Recovery and duplicate handling | The client manages offsets; the application coordinates commits with processing and handles duplicate effects | The application manages reconnect, gap recovery and duplicates | The application handles retries and duplicates according to the sender's behaviour |
| Receiver must be reachable from the internet | No, you connect out | No | Yes |

WebSockets and webhooks are good transports for a browser tab or a notification. They are not storage. Kafka is both.

## What it takes to consume

You need four things from SonarX: a bootstrap server, SASL credentials, Schema Registry credentials, and the list of topics provisioned for you. Everything else is a standard Kafka client.

**Minimal consumer example** (Python, `confluent-kafka`). Offsets are committed only after the event has been processed, so a crash mid-batch replays the batch rather than skipping it.

```python theme={null} theme={null}
from confluent_kafka import Consumer
from confluent_kafka.schema_registry import SchemaRegistryClient
from confluent_kafka.schema_registry.avro import AvroDeserializer
from confluent_kafka.serialization import MessageField, SerializationContext

consumer = Consumer({
    "bootstrap.servers": "<bootstrap-server-url>",
    "group.id": "<your-consumer-group>",
    "auto.offset.reset": "earliest",      # new group: start from the beginning of retention
    "enable.auto.commit": False,          # commit only after processing
    "security.protocol": "SASL_SSL",
    "sasl.mechanisms": "PLAIN",
    "sasl.username": "<API-KEY>",
    "sasl.password": "<API-SECRET>",
})
deserializer = AvroDeserializer(SchemaRegistryClient({
    "url": "<schema-registry-url>",
    "basic.auth.user.info": "<SR-KEY>:<SR-SECRET>",
}))

consumer.subscribe(["<chain>.<dataset>"])          # topic names are provisioned per customer
try:
    while True:
        msg = consumer.poll(1.0)
        if msg is None:
            continue
        if msg.error():
            raise RuntimeError(msg.error())          # surface it; do not skip silently
        event = deserializer(msg.value(), SerializationContext(msg.topic(), MessageField.VALUE))
        handle(event)                               # your code; return only on success
        consumer.commit(message=msg, asynchronous=False)
finally:
    consumer.close()
```

That is the connection and consumption path. A production consumer adds its own error handling, monitoring and a downstream write that tolerates a replayed event. The same credentials work from Java, Go, Node, .NET or Rust clients, from Kafka Streams and Flink, and from Kafka Connect sinks into Snowflake, Databricks, BigQuery, S3, GCS or Azure Blob. The full example is on the [Apache Kafka quick-start](https://docs.sonarx.com/api-reference/kafka.md).

> [!NOTE]
>
> **Resuming after downtime.** Keep `group.id` stable and commit offsets after processing. If retention still covers your committed offset when the consumer returns, it resumes from there and nothing is lost. Retention on SonarX topics is configurable per topic, from 1 hour to 1 day, so agree a window with the team that covers your longest expected stop. History older than the retention window is available through the [historical datasets](https://docs.sonarx.com/datasets/overview.md).

## Coverage and filtering

SonarX offers Kafka streaming across the chains in its [coverage table](https://docs.sonarx.com/datasets/chaincoverage.md); the Kafka column shows availability per chain, and topics are provisioned by the SonarX team. Every dataset SonarX indexes on a supported chain can be delivered as a topic: raw blocks, transactions, receipts, logs and traces; decoded token transfers, priced transfers and net transfers; approvals, NFT transfers and token metadata on EVM chains; DEX trades, staking and validator events, and chain-specific datasets where the chain has them. The data on the topic is the same decoded, normalised data SonarX delivers through its data shares, so a field means the same thing on the stream as it does in the warehouse.

Topics are always scoped to one chain and one dataset. Within that scope, a topic can be filtered on its content, so a desk that only wants transfers above a threshold for two tokens, or every event touching a list of addresses, receives exactly that and nothing else. Filtered topics are set up by the SonarX team as part of the white-glove service every customer receives. Tell us the chain, the dataset and the predicate.

## Kafka streams, APIs and historical datasets

SonarX delivers real-time blockchain data two ways: Kafka Datastreams for continuous event consumption, and [low-latency APIs](https://docs.sonarx.com/api-reference-tab/apioverview.md) for request-response access to balances, holdings and transfers. Historical datasets are delivered as data shares and files. This page covers Kafka; the API and historical paths are separate integrations with their own documentation.

## Hyperliquid on Kafka

Hyperliquid runs its order books on-chain with one-block finality, so there is no slower fallback to poll. Every dataset on the [Hyperliquid page](https://docs.sonarx.com/datasets/HYPERLIQUID/Hyperliquid.md) can be streamed as a Kafka topic, covering Hyperliquid Core and HyperEVM:

* **Hyperliquid Core:** orders, orders failed, order status updates, node fills (liquidations are fills carrying a liquidation marker with the liquidated user, mark price and method), funding rates, open interest and perp positions, ledger updates (deposits, withdrawals, account transfers), transfers, transactions and transactions failed, events, staking events, delegator and validator details. Full-depth L2 and L4 order-book data is offered separately for purchase.
* **HyperEVM:** the full EVM set, the same tables SonarX delivers on every EVM chain.

A perps desk, a risk team watching open interest, or a monitor on validator health subscribes to the topics it needs and reads them as they are indexed. How liquidations are recorded on HyperCore, and how to read them out of the fills data, is explained in [Hyperliquid Liquidations Data Explained](https://www.sonarx.com/blog/hyperliquid-liquidations-data).

## Frequently asked questions

**Does SonarX provide low-latency blockchain event streaming for enterprise data pipelines?** Yes. SonarX Kafka Datastreams publish decoded, normalised on-chain events to Apache Kafka topics, one per chain and per dataset, across 130+ chains, with retention configurable per topic from 1 hour to 1 day and content filtering. For blocks, transactions, logs and transfers for delivery of Avro, P50 latency is under 1 second and P90 latency is under 2.1 seconds from the block timestamp, across chains including Polygon, Monad and Arbitrum.

**How fast is it?** For primitive datasets (blocks, transactions, logs, transfers) for delivery of Avro, P50 latency is under 1 second and P90 latency is under 2.1 seconds from the block timestamp, across chains including Polygon, Monad and Arbitrum. Derived datasets add their decoding time on top.

**Where does the latency clock start?** At the block timestamp, the time the chain itself records for the block, not at the moment a block reaches a node. A figure counted from node receipt leaves out the time the block took to get there and comes out in milliseconds; a figure counted from the block timestamp is the delay a pipeline actually experiences. See [How latency is measured](#how-latency-is-measured).

**How long can I replay?** Retention is configurable per topic, from 1 hour to 1 day, based on what you need. Set `auto.offset.reset` to `earliest` on a new consumer group to read from the start of retention. History older than the window is available through the [historical datasets](https://docs.sonarx.com/datasets/overview.md).

**Is delivery exactly-once?** Delivery is at-least-once by default, so consumers should tolerate a replayed event. Kafka supports transactional exactly-once processing; end-to-end guarantees depend on your consumer and its destination.

**Can I get a filtered topic?** Yes. Topics are per chain and per dataset, and can be filtered on message content. Send the team the chain, dataset and predicate; provisioning it is part of the white-glove service every SonarX customer receives.

**Which chains and datasets?** Any chain with Kafka availability in the [coverage table](https://docs.sonarx.com/datasets/chaincoverage.md), any dataset SonarX indexes on it, including everything on the [Hyperliquid page](https://docs.sonarx.com/datasets/HYPERLIQUID/Hyperliquid.md).

**How is it sold?** Kafka Datastreams are available on their own or alongside Real-Time Streams and the historical datasets, at different price points. Ask the team.

**What do I need to connect?** A Kafka client, SASL credentials and Schema Registry credentials from SonarX. No node, no RPC endpoint, no WebSocket reconnect logic.

## Next steps

> [card] [Apache Kafka quick-start](https://docs.sonarx.com/api-reference/kafka.md)
>
> Full consumer example, credentials, and getting-started steps.

> [card] [Real-Time Streams overview](https://docs.sonarx.com/datasets/RTS/overview.md)
>
> How SonarX sources, verifies and scales real-time data across chains.

> [card] [Hyperliquid datasets](https://docs.sonarx.com/datasets/HYPERLIQUID/Hyperliquid.md)
>
> Every Hyperliquid Core and HyperEVM dataset available for streaming.

Request access through the [SonarX Console](https://console.sonarx.com) or contact the team.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.