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

# Yellowstone Hızlı Başlangıç

> gRPC istemcisini yükleyin, OrbitFlare'a bağlanın ve ilk aboneliğinizi gönderin

## Ön Koşullar

İhtiyacınız olanlar:

* Node.js 18+ (veya Rust istemcisi için Rust ortamı)
* OrbitFlare gRPC uç nokta URL'si ve token'ı (**Lisanslar** bölümündeki [Pano](https://orbitflare.com/dashboard)'dan edinilebilir)

## Kurulum

Resmi Yellowstone gRPC TypeScript istemcisini yükleyin:

```bash theme={null}
npm install @triton-one/yellowstone-grpc
```

Veya yarn ile:

```bash theme={null}
yarn add @triton-one/yellowstone-grpc
```

## Uç Noktanıza Bağlanın

```typescript theme={null}
import Client, { CommitmentLevel, SubscribeRequest } from "@triton-one/yellowstone-grpc";

const GRPC_URL = "https://your-endpoint.grpc.orbitflare.com";
const X_TOKEN = "YOUR_GRPC_TOKEN";

const client = new Client(GRPC_URL, X_TOKEN, {
  "grpc.max_receive_message_length": 64 * 1024 * 1024, // 64 MiB
});
```

<Note>
  gRPC URL'niz ve token'ınız OrbitFlare Panosu'nun **Lisanslar** bölümünde bulunur. Token, `new Client()`'ın ikinci argümanı olarak iletilir — TypeScript istemcisinde bir HTTP başlığı değildir.
</Note>

## Akış Açın

```typescript theme={null}
const stream = await client.subscribe();

// Handle errors and stream lifecycle
const streamClosed = new Promise<void>((resolve, reject) => {
  stream.on("error", (error) => {
    console.error("Stream error:", error);
    reject(error);
    stream.end();
  });
  stream.on("end", () => resolve());
  stream.on("close", () => resolve());
});

// Handle incoming data
stream.on("data", (data) => {
  if (data.slot) {
    console.log("Slot update:", data.slot.slot);
  } else if (data.transaction) {
    console.log("Transaction:", data.transaction);
  } else if (data.account) {
    console.log("Account update:", data.account);
  } else if (data.pong) {
    console.log("Pong received");
  }
});
```

## İlk Aboneliğinizi Gönderin

`confirmed` taahhüt düzeyinde tüm slot güncellemelerine abone olun:

```typescript theme={null}
const subscribeRequest: SubscribeRequest = {
  slots: {
    slot: { filterByCommitment: true },
  },
  commitment: CommitmentLevel.CONFIRMED,
  accounts: {},
  accountsDataSlice: [],
  transactions: {},
  transactionsStatus: {},
  blocks: {},
  blocksMeta: {},
  entry: {},
};

await new Promise<void>((resolve, reject) => {
  stream.write(subscribeRequest, (err) => {
    if (err == null) resolve();
    else reject(err);
  });
});

// Wait for the stream to close
await streamClosed;
```

## Bağlantıyı Canlı Tutun

Bulut yük dengeleyicileri, yaklaşık 10 dakika sonra boşta kalan gRPC bağlantılarını sonlandırır. Her 30 saniyede bir ping gönderin:

```typescript theme={null}
const pingRequest: SubscribeRequest = {
  ping: { id: 1 },
  accounts: {},
  accountsDataSlice: [],
  transactions: {},
  transactionsStatus: {},
  blocks: {},
  blocksMeta: {},
  slots: {},
  entry: {},
};

const pingInterval = setInterval(async () => {
  await new Promise<void>((resolve, reject) => {
    stream.write(pingRequest, (err) => {
      if (err == null) resolve();
      else reject(err);
    });
  });
}, 30_000);

// Clear the interval when the stream closes
streamClosed.finally(() => clearInterval(pingInterval));
```

## Yeniden Bağlanma

Üretim uygulamaları için üstel geri alma ile otomatik yeniden bağlanma uygulayın:

```typescript theme={null}
async function connectWithRetry(maxRetries = 10) {
  let attempt = 0;
  let delay = 1000;

  while (attempt < maxRetries) {
    try {
      const stream = await client.subscribe();
      // ... attach handlers and send subscription
      await streamClosed; // waits until stream closes
      break; // clean exit
    } catch (err) {
      attempt++;
      console.error(`Stream error (attempt ${attempt}):`, err);
      if (attempt >= maxRetries) throw err;
      await new Promise((r) => setTimeout(r, delay));
      delay = Math.min(delay * 2, 30_000); // max 30s backoff
    }
  }
}
```

## Sonraki Adımlar

<CardGroup cols={2}>
  <Card title="Hesap İzleme" icon="user" href="/tr/data-streaming/yellowstone-account-monitoring">
    Token bakiyelerini, cüzdan değişikliklerini ve program hesabı güncellemelerini akış olarak alın.
  </Card>

  <Card title="İşlem İzleme" icon="receipt" href="/tr/data-streaming/yellowstone-transaction-monitoring">
    Canlı işlemleri programa veya hesaba göre filtreleyin ve işleyin.
  </Card>

  <Card title="Slotlar ve Bloklar" icon="cube" href="/tr/data-streaming/yellowstone-slot-block-monitoring">
    Konsensüs ilerlemesini ve tam blok verisini takip edin.
  </Card>

  <Card title="Giriş İzleme" icon="code" href="/tr/data-streaming/yellowstone-entry-monitoring">
    Düşük seviyeli blok girişlerine erişin.
  </Card>
</CardGroup>
