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

# Slot- & Blocküberwachung mit LaserStream

> Überwachen Sie den Solana-Netzwerkkonsens, die Blockproduktion und Netzwerkstatusänderungen mit LaserStream — Slot-Timing, Block-Metadaten und gefilterte volle Blöcke.

Die Überwachung von Slots und Blöcken gibt Ihnen Einblick in den Netzwerkkonsens von Solana, das Timing der Blockproduktion und die allgemeine Gesundheit. Mit LaserStream können Sie den Slot-Fortschritt, die Block-Finalisierung und Netzwerkleistungskennzahlen in Echtzeit verfolgen, indem Sie das [`helius-laserstream`](/docs/de/laserstream/clients) SDK verwenden.

<Info>
  **Voraussetzungen:** Dieser Leitfaden setzt voraus, dass Sie das [LaserStream gRPC Quickstart](/docs/de/laserstream/grpc) abgeschlossen haben und über einen API-Schlüssel verfügen.
</Info>

***

## Überwachungstypen

<Tabs>
  <Tab title="Slot-Updates">
    **Verfolgen Sie die Fortschritte des Netzwerkkonsenses**

    Überwachen Sie den Slot-Fortschritt über Verpflichtungsniveaus hinweg:

    ```typescript theme={"system"}
    import { subscribe, CommitmentLevel, LaserstreamConfig, SubscribeRequest } from 'helius-laserstream';

    const subscriptionRequest: SubscribeRequest = {
      slots: {
        slotSubscribe: {
          filterByCommitment: false // Receive all commitment levels
        }
      },
      commitment: CommitmentLevel.CONFIRMED,
      accounts: {}, transactions: {}, transactionsStatus: {},
      blocks: {}, blocksMeta: {}, entry: {}, accountsDataSlice: [],
    };
    ```

    **Slot-Daten umfassen:** Slot-Nummer, übergeordneten Slot, Verpflichtungsstatus (`processed` / `confirmed` / `finalized`) und Führungsinformationen.

    <Note>
      **Am besten geeignet für:** Netzwerkgesundheitsüberwachung, Slot-Timing-Analyse, Konsensverfolgung.
    </Note>
  </Tab>

  <Tab title="Blockdaten">
    **Überwachen Sie vollständige Blockinformationen**

    Streamen Sie vollständige Blöcke mit Transaktionen und Kontoupdates:

    ```typescript theme={"system"}
    const subscriptionRequest: SubscribeRequest = {
      blocks: {
        blockSubscribe: {
          accountInclude: [], // All accounts
          includeTransactions: true,
          includeAccounts: true,
          includeEntries: false
        }
      },
      commitment: CommitmentLevel.CONFIRMED,
      accounts: {}, transactions: {}, transactionsStatus: {},
      slots: {}, blocksMeta: {}, entry: {}, accountsDataSlice: [],
    };
    ```

    **Blockdaten umfassen:** Block-Metadaten, Transaktionen, Kontoupdates, Block-Timing.

    <Warning>
      **Hohe Volumen:** Vollständige Block-Streams generieren erhebliche Datenmengen. Verwenden Sie `accountInclude` Filter, um das Volumen zu reduzieren.
    </Warning>
  </Tab>

  <Tab title="Block-Metadaten">
    **Leichte Blockinformationen**

    Erhalten Sie Block-Metadaten ohne Transaktionsdetails:

    ```typescript theme={"system"}
    const subscriptionRequest: SubscribeRequest = {
      blocksMeta: {
        blockMetaSubscribe: {}
      },
      commitment: CommitmentLevel.CONFIRMED,
      accounts: {}, transactions: {}, transactionsStatus: {},
      slots: {}, blocks: {}, entry: {}, accountsDataSlice: [],
    };
    ```

    **Metadaten umfassen:** Block-Hash, übergeordneter Hash, Slot, Höhe, Transaktionsanzahl, Belohnungen.

    <Tip>
      **Effizient:** Bandbreitenschonende Alternative zum vollständigen Block-Streaming.
    </Tip>
  </Tab>
</Tabs>

***

## Praktische Beispiele

### Beispiel 1: Netzwerkgesundheitsmonitor

Verfolgen Sie den Slot-Fortschritt und erkennen Sie Netzwerkprobleme:

```typescript [expandable] theme={"system"}
import { subscribe, CommitmentLevel, LaserstreamConfig, SubscribeRequest } from 'helius-laserstream';

let lastSlot = 0;
let lastTimestamp = Date.now();
const slotTimes: number[] = [];

// CommitmentLevel only ships the forward (name → number) mapping, so we keep
// a small reverse lookup for the numeric status the SDK returns on slot updates.
const STATUS_NAMES = ['PROCESSED', 'CONFIRMED', 'FINALIZED'] as const;

async function monitorNetworkHealth() {
  const subscriptionRequest: SubscribeRequest = {
    slots: {
      slotSubscribe: {
        filterByCommitment: true // Track processed commitment levels
      }
    },
    commitment: CommitmentLevel.PROCESSED,
    accounts: {}, transactions: {}, transactionsStatus: {},
    blocks: {}, blocksMeta: {}, entry: {}, accountsDataSlice: [],
  };

  const config: LaserstreamConfig = {
    apiKey: 'YOUR_API_KEY',
    endpoint: 'https://laserstream-mainnet-ewr.helius-rpc.com',
  };

  await subscribe(config, subscriptionRequest, async (data) => {
    if (!data.slot) return;
    const slot = data.slot;
    // The SDK returns u64 fields as strings to preserve precision.
    const currentSlot = Number(slot.slot);
    const currentTime = Date.now();

    console.log(`\n📊 Slot Update:`);
    console.log(`  Slot: ${currentSlot}`);
    console.log(`  Parent: ${slot.parent}`);
    // slot.status is a numeric enum (0=processed, 1=confirmed, 2=finalized).
    console.log(`  Status: ${STATUS_NAMES[slot.status] ?? slot.status}`);

    if (lastSlot > 0) {
      const slotDiff = currentSlot - lastSlot;
      const timeDiff = currentTime - lastTimestamp;

      if (slotDiff === 1) {
        slotTimes.push(timeDiff);
        if (slotTimes.length > 100) slotTimes.shift();

        const avg = slotTimes.reduce((a, b) => a + b, 0) / slotTimes.length;
        console.log(`  Slot Time: ${timeDiff}ms`);
        console.log(`  Avg Slot Time: ${avg.toFixed(1)}ms`);

        if (timeDiff > 800) {
          console.log(`  ⚠️  SLOW SLOT: ${timeDiff}ms (normal ~400ms)`);
        }
      } else if (slotDiff > 1) {
        console.log(`  ⚠️  SKIPPED ${slotDiff - 1} SLOTS`);
      }
    }

    lastSlot = currentSlot;
    lastTimestamp = currentTime;
  }, async (error) => {
    console.error('Stream error:', error);
  });
}

monitorNetworkHealth().catch(console.error);
```

### Beispiel 2: Blockproduktionsmonitor

Verfolgen Sie die Blockproduktion und das Transaktionsvolumen:

```typescript [expandable] theme={"system"}
async function monitorBlockProduction() {
  const subscriptionRequest: SubscribeRequest = {
    blocksMeta: {
      blockMetaSubscribe: {}
    },
    commitment: CommitmentLevel.CONFIRMED,
    accounts: {}, transactions: {}, transactionsStatus: {},
    slots: {}, blocks: {}, entry: {}, accountsDataSlice: [],
  };

  const config: LaserstreamConfig = {
    apiKey: 'YOUR_API_KEY',
    endpoint: 'https://laserstream-mainnet-ewr.helius-rpc.com',
  };

  await subscribe(config, subscriptionRequest, async (data) => {
    if (!data.blockMeta) return;
    const blockMeta = data.blockMeta;

    console.log(`\n🧱 Block Produced:`);
    console.log(`  Slot: ${blockMeta.slot}`);
    // blockHeight is a wrapper object: { blockHeight: '397657352' }
    console.log(`  Block Height: ${blockMeta.blockHeight?.blockHeight}`);
    console.log(`  Block Hash: ${blockMeta.blockhash}`);
    console.log(`  Parent Slot: ${blockMeta.parentSlot}`);
    console.log(`  Parent Hash: ${blockMeta.parentBlockhash}`);
    console.log(`  Transactions: ${blockMeta.executedTransactionCount}`);
    console.log(`  Entries: ${blockMeta.entriesCount}`);
    if (blockMeta.blockTime?.timestamp) {
      // blockTime.timestamp is a u64 as a string (Unix seconds).
      console.log(`  Block Time: ${new Date(Number(blockMeta.blockTime.timestamp) * 1000).toISOString()}`);
    }

    // rewards is a wrapper object: { rewards: [...], numPartitions: number | null }
    if (blockMeta.rewards?.rewards?.length > 0) {
      console.log(`  Rewards:`);
      blockMeta.rewards.rewards.forEach((r: any) => {
        console.log(`    ${r.pubkey}: ${r.lamports} lamports (${r.rewardType})`);
      });
    }

    if (Number(blockMeta.executedTransactionCount) > 3000) {
      console.log(`  🔥 HIGH ACTIVITY: ${blockMeta.executedTransactionCount} transactions`);
    }
  }, async (error) => {
    console.error('Stream error:', error);
  });
}
```

### Beispiel 3: Gefilterter Blockmonitor

Überwachen Sie Blöcke, die spezifische Programmaktivitäten enthalten:

```typescript [expandable] theme={"system"}
async function monitorDEXBlocks() {
  const subscriptionRequest: SubscribeRequest = {
    blocks: {
      blockSubscribe: {
        accountInclude: [
          "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", // Raydium
          "CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK", // Raydium CLMM
          "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"   // Jupiter
        ],
        includeTransactions: true,
        includeAccounts: false,
        includeEntries: false
      }
    },
    commitment: CommitmentLevel.CONFIRMED,
    accounts: {}, transactions: {}, transactionsStatus: {},
    slots: {}, blocksMeta: {}, entry: {}, accountsDataSlice: [],
  };

  const config: LaserstreamConfig = {
    apiKey: 'YOUR_API_KEY',
    endpoint: 'https://laserstream-mainnet-ewr.helius-rpc.com',
  };

  await subscribe(config, subscriptionRequest, async (data) => {
    if (!data.block) return;
    const block = data.block;

    let successfulDexTx = 0;
    let totalFees = 0; // lamports
    block.transactions?.forEach((tx: any) => {
      if (tx.meta && !tx.meta.err) {
        successfulDexTx++;
        // tx.meta.fee is a u64 string — coerce before adding.
        totalFees += Number(tx.meta.fee ?? 0);
      }
    });

    console.log(`\n🔄 DEX Activity Block:`);
    console.log(`  Slot: ${block.slot}`);
    console.log(`  Block Height: ${block.blockHeight?.blockHeight}`);
    console.log(`  Block Hash: ${block.blockhash}`);
    console.log(`  Total transactions in block: ${block.executedTransactionCount}`);
    console.log(`  Matched DEX transactions: ${block.transactions?.length ?? 0}`);
    console.log(`  Successful DEX transactions: ${successfulDexTx}`);
    if (successfulDexTx > 0) {
      console.log(`  Total Fees: ${(totalFees / 1e9).toFixed(4)} SOL`);
      console.log(`  Avg Fee: ${(totalFees / successfulDexTx / 1e9).toFixed(6)} SOL`);
    }
  }, async (error) => {
    console.error('Stream error:', error);
  });
}
```

***

## Datenstrukturen

<Accordion title="Slot-Datenstruktur">
  ```typescript theme={"system"}
  {
    slot: string;     // Current slot number (u64 as string)
    parent: string;   // Parent slot number (u64 as string)
    status: number;   // CommitmentLevel enum: 0 = processed, 1 = confirmed, 2 = finalized
  }
  ```

  Jeder Slot repräsentiert ca. 400 ms Netzwerkzeit. Die drei Verpflichtungsniveaus spiegeln zunehmend stärkere Garantien wider: `processed` (initial), `confirmed` (supermajority voted), `finalized` (irreversible).

  <Tip>
    u64 Felder (Slot, übergeordnet) werden als Strings angezeigt, um die Präzision über `Number.MAX_SAFE_INTEGER` hinaus zu bewahren. Konvertieren Sie mit `Number(slot.slot)`, wenn Sie Rechenoperationen benötigen. `status` ist ein numerisches Enum — verwenden Sie `CommitmentLevel[slot.status]` für den menschenlesbaren Namen.
  </Tip>
</Accordion>

<Accordion title="Block-Metadatenstruktur">
  ```typescript theme={"system"}
  {
    slot: string;                                  // u64 as string
    blockhash: string;
    rewards: {
      rewards: Array<{
        pubkey: string;
        lamports: string;                          // u64 as string
        rewardType: string;                        // "fee" | "rent" | "voting" | "staking"
      }>;
      numPartitions: number | null;
    };
    blockTime: { timestamp: string };              // Unix seconds as a u64 string
    blockHeight: { blockHeight: string };          // u64 as string, wrapped
    parentSlot: string;                            // u64 as string
    parentBlockhash: string;
    executedTransactionCount: string;              // u64 as string
    entriesCount: string;                          // u64 as string
  }
  ```

  <Tip>
    Numerische Felder (Slot, parentSlot, ausgeführteTransaktionsanzahl, EinträgeAnzahl, die Werte innerhalb von `blockHeight` und `blockTime`) werden als Strings ausgegeben, weil sie u64 im zugrunde liegenden Proto sind. Verpacken Sie sie in `Number(...)` für Rechenoperationen oder Vergleiche.
  </Tip>
</Accordion>

<Accordion title="Vollständige Blockstruktur">
  ```typescript theme={"system"}
  {
    slot: string;                                  // u64 as string
    blockhash: string;
    rewards: {
      rewards: Array<{
        pubkey: string;
        lamports: string;                          // u64 as string
        rewardType: string;
      }>;
      numPartitions: number | null;
    };
    blockTime: { timestamp: string };              // Unix seconds (u64 string)
    blockHeight: { blockHeight: string };          // u64 as string, wrapped
    parentSlot: string;                            // u64 as string
    parentBlockhash: string;
    executedTransactionCount: string;              // total executed tx in the block (u64 as string)
    updatedAccountCount: string;                   // total account updates in the block (u64 as string)
    entriesCount: string;                          // u64 as string
    transactions: Array<{
      signature: Buffer;                           // base58-encode for display
      isVote: boolean;
      transaction: TransactionMessage;             // full transaction payload
      meta: TransactionMeta;                       // execution metadata (fee, err, balances, …)
      index: string;                               // u64 as string
    }>;
    accounts: AccountUpdate[];                     // populated when includeAccounts: true
    entries: Entry[];                              // populated when includeEntries: true
  }
  ```

  Volle Blöcke können mehrere MB mit allen Transaktionen und Konten umfassen. Dasselbe u64-als-String-Konvention gilt — verpacken Sie numerische Felder mit `Number(...)` für Rechenoperationen. Innerhalb jeder Transaktion sind `meta.fee`, `meta.preBalances`, `meta.postBalances` usw. ebenfalls Strings.
</Accordion>

***

## Leistungsüberlegungen

<CardGroup cols={2}>
  <Card title="Slot-Überwachung" icon="clock">
    Leichtgewichtig: sehr niedrige Bandbreite, minimaler Verarbeitungsaufwand. Gut für Überwachungs-Dashboards.
  </Card>

  <Card title="Block-Metadaten" icon="info">
    Ausgewogen: moderate Bandbreite, Blockebenen-Einblicke ohne vollständige Daten. Geeignet für Analysen.
  </Card>

  <Card title="Vollständige Blöcke" icon="database">
    Hohes Volumen: vollständige Transaktionsdaten, erfordert robuste Verarbeitung. Immer mit Filtern kombinieren.
  </Card>

  <Card title="Gefilterte Blöcke" icon="filter">
    Optimiert: Verwenden Sie `accountInclude`, deaktivieren Sie `includeAccounts`/`includeEntries`, die Sie nicht benötigen.
  </Card>
</CardGroup>

***

## Anwendungsfälle

<Tabs>
  <Tab title="Netzwerküberwachung">
    Verfolgen Sie Netzwerkgesundheit und Leistung — Slot-Timing, Überlastung, Konsens.

    ```typescript theme={"system"}
    const targetSlotTime = 400; // ms
    const tolerance = 200; // ms
    if (Math.abs(slotTime - targetSlotTime) > tolerance) {
      console.log(`Network performance issue detected`);
    }
    ```
  </Tab>

  <Tab title="Analysen & Metriken">
    Sammeln Sie Blockchain-Analysedaten — Transaktionsvolumen, Gebührenanalyse, Blockgröße, Aktivitätsmuster.

    ```typescript theme={"system"}
    const dailyStats = {
      date: new Date().toDateString(),
      totalTransactions: 0,
      totalFees: 0,
      blockCount: 0
    };
    ```
  </Tab>

  <Tab title="Anwendungssynchronisation">
    Halten Sie Anwendungen mit dem Netzwerk synchronisiert — Slot-basierte Updates, Blockbestätigungen.

    ```typescript theme={"system"}
    if (data.slot && data.slot.status === 'finalized') {
      updateApplicationState(data.slot.slot);
    }
    ```
  </Tab>
</Tabs>

***

## Fehlerbehandlung

<Accordion title="Fehlende Slots">
  **Symptom:** Lücken im Slot-Fortschritt.

  **Ursachen:** Netzwerkverbindungsprobleme, Validator-Ausfallzeiten, Verzögerungen bei der Client-Verarbeitung.

  **Lösungen:** Verfolgen Sie Slot-Lücken und alarmieren Sie; implementieren Sie Catch-up-Logik über [historisches Replay](/docs/de/laserstream/historical-replay); überwachen Sie die Verbindungsstabilität.
</Accordion>

<Accordion title="Hohes Volumen">
  **Symptom:** Zu viele Blockdaten.

  **Lösungen:** Verwenden Sie Block-Metadaten anstelle vollständiger Blöcke; wenden Sie Kontenfilter an; deaktivieren Sie unnötige Einfügungen (Einträge, Konten); verarbeiten Sie asynchron.
</Accordion>

<Accordion title="Timing-Probleme">
  **Symptom:** Inkonsistentes Slot-Timing.

  **Analyse:** Berechnen Sie gleitende Durchschnitte; verfolgen Sie Abweichungen; überwachen Sie Netzwerkgesundheitsmetriken; korrelieren Sie mit der Leistung des Validators.
</Accordion>

***

## Beste Praktiken

<Note>
  **Produktionsleitlinien:**

  * **Starten Sie mit Metadaten** — verwenden Sie Block-Metadaten, bevor Sie sich auf vollständige Blöcke abonnieren
  * **Wenden Sie Filter an** — verwenden Sie `accountInclude`, um irrelevante Daten auszuschließen
  * **Überwachen Sie das Timing** — verfolgen Sie den Slot-Fortschritt als Netzwerkgesundheitsindikator
  * **Behandeln Sie Lücken** — kombinieren Sie mit [historischem Replay](/docs/de/laserstream/historical-replay), sodass fehlende Slots beim Wiederverbinden automatisch gefüllt werden
  * **Verarbeiten Sie asynchron** — blockieren Sie Stream-Verarbeitung nicht mit aufwändigen Berechnungen
  * **Passen Sie die Verpflichtung an den Bedarf an** — `processed` für latenzarme UIs, `confirmed`/`finalized` für Zustandsänderungen
</Note>

***

## Nächste Schritte

<CardGroup cols={2}>
  <Card title="Transaktionsüberwachung" icon="receipt" href="/docs/de/laserstream/guides/transaction-monitoring">
    Filtern Sie Transaktionen nach Programm, Konto, Abstimmung oder Fehlstatus.
  </Card>

  <Card title="Stream Pump AMM-Daten" icon="chart-line" href="/docs/de/laserstream/guides/stream-pump-amm-data">
    Praxisbeispiel: Überwachen Sie Pump-AMM-Transaktionen.
  </Card>

  <Card title="Dekodierung von Transaktionsdaten" icon="binary" href="/docs/de/laserstream/guides/decoding-transaction-data">
    Analysieren Sie die binären `transactionUpdate` Nutzlasten in lesbare Solana-Transaktionen.
  </Card>

  <Card title="Yellowstone-Protokollreferenz" icon="book" href="/docs/de/grpc/slot-and-block-monitoring">
    Der gleiche Workflow gegen das rohe Yellowstone gRPC-Protokoll.
  </Card>
</CardGroup>
