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

# Stream Solana Slots and Blocks with gRPC

> Choose slot updates, block metadata, or filtered block payloads with Yellowstone gRPC. Track commitment changes and handle gaps.

Use slot updates for progress and status, block metadata for hashes and counts, and full blocks when you need the included transactions or account writes.

Save the [quickstart helper](https://docs.solanatracker.io/yellowstone-grpc/quickstart.md) as `stream.mts` in the same directory. These examples use the same environment variables and dependencies.

## Subscribe to slots and metadata

```typescript slots.mts theme={null}
import { subscribe } from "./stream.mts";

for await (const update of subscribe({
  slots: { slots: { filterByCommitment: true } },
  blocksMeta: { blocks: {} },
})) {
  if (update.slot) {
    console.log("slot", update.slot.slot, update.slot.parent, update.slot.status);
  }
  if (update.blockMeta) {
    console.log("block", update.blockMeta.slot, update.blockMeta.blockhash,
      update.blockMeta.executedTransactionCount);
  }
}
```

```bash theme={null}
npx tsx slots.mts
```

`filterByCommitment: true` aligns slot notifications with the request commitment. A slot can have several status updates; keep status as well as slot number when recording transitions.

## Request filtered blocks

```typescript filtered-blocks.mts theme={null}
import { subscribe } from "./stream.mts";

const address = process.env.WATCH_ADDRESS;
if (!address) throw new Error("Set WATCH_ADDRESS");

for await (const update of subscribe({
  blocks: {
    selected: {
      accountInclude: [address],
      includeTransactions: true,
      includeAccounts: false,
      includeEntries: false,
    },
  },
})) {
  if (!update.block) continue;
  console.log(update.block.slot, update.block.transactions.length);
}
```

The three include flags control transactions, accounts, and entries independently. A filtered transaction array can be smaller than the block’s total executed transaction count.

## Handle missing slots

Slots are opportunities to produce blocks; some have no block. A gap can also come from a disconnect, filtering, or lag. Compare commitment and RPC block availability before counting a gap as lost data. Measure actual slot intervals instead of assuming a fixed delivery time.

## Related guides

> [card] [Entry metadata](https://docs.solanatracker.io/yellowstone-grpc/entry-monitoring.md)

> [card] [Reliability and performance](https://docs.solanatracker.io/yellowstone-grpc/best-practices.md)


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