> For the complete documentation index, see [llms.txt](https://chaincontext.gitbook.io/help-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaincontext.gitbook.io/help-center/building/streaming-subscriptions.md).

# Streaming Subscriptions

The `subscribe` block wraps `eth_subscribe` (EVM) or `logsSubscribe` (Solana) and exposes the event stream as an **MCP Resource**. AI clients subscribe to the resource and receive `notifications/resources/updated` as new events arrive.

## Three subscription kinds

| Kind                  | What it streams                              |
| --------------------- | -------------------------------------------- |
| `logs`                | Contract events filtered by address + topics |
| `newHeads`            | Every new block header                       |
| `pendingTransactions` | Mempool entries before inclusion             |

## Block schema

```ts
{
  type:         'subscribe',
  kind:         'logs',
  networkId:    'base',
  address:      '0xContract…',
  topics:       ['0xddf252ad…'],  // e.g. Transfer event topic
  outputField:  'resourceUri',
  resourceName: 'USDC Transfers',
  maxBuffer:    100,  // ring-buffer size
}
```

## How it flows

1. Block runs → writes a `streaming_subscriptions` row, returns a resource URI like `ccx-sub://{projectId}/{subId}`
2. Runtime spawns a viem `watchEvent` / `watchBlocks` / `watchPendingTransactions`
3. Events land in a Redis ring buffer (`subscription:{subId}`)
4. Reading the resource (MCP `resources/read`) returns the latest N events
5. On new events, runtime emits `notifications/resources/updated` to subscribed clients

## Plan limits

| Plan       | Max active subscriptions per project |
| ---------- | ------------------------------------ |
| Free       | Not available                        |
| Builder    | 5                                    |
| Studio     | 25                                   |
| Enterprise | Unlimited                            |

## Why it matters

Most blockchain MCPs poll on a timer. Real subscriptions enable live whale alerts, price-cross notifications, contract event monitors, and mempool-based trading signals — all with sub-block latency.

## References

* [eth\_subscribe logs (Chainstack docs)](https://docs.chainstack.com/reference/ethereum-native-subscribe-logs)
* [MCP Resources spec — subscriptions](https://modelcontextprotocol.io/specification/draft/server/resources#subscriptions)
