> ## 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.

# getFirstAvailableBlock

> Düğümün bilgi sahibi olduğu en düşük onaylanmış bloğun slotunu döndürür

## Parametreler

Bu metod herhangi bir parametre almaz.

## Yanıt

<ResponseField name="result" type="number">
  Mevcut en düşük onaylanmış bloğun slotu
</ResponseField>

## Kod Örnekleri

### Temel İstek

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getFirstAvailableBlock"
}'
```

### web3.js Kullanımı

```typescript theme={null}
import { Connection } from '@solana/web3.js';

const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');

// Get first available block
const firstBlock = await connection.getFirstAvailableBlock();
console.log('First available block:', firstBlock);

// Get block range
async function getAvailableBlockRange() {
  const firstBlock = await connection.getFirstAvailableBlock();
  const currentSlot = await connection.getSlot();
  
  return {
    firstBlock,
    currentSlot,
    totalBlocks: currentSlot - firstBlock + 1
  };
}
```

## Notlar

1. Mevcut en düşük onaylanmış bloğun slotunu döndürür
2. Düğümün mevcut geçmişini belirlemek için kullanışlıdır
3. Değer, düğüm eski blokları budadıkça değişebilir
4. Farklı düğümler farklı değerler döndürebilir
5. Mevcut durumdan okuduğu için yanıt anında gelir

## En İyi Uygulamalar

1. Mevcut blok aralığını belirlemek için bu metodu kullanın
2. Geçmiş blokları sorgularken düğüm budamasını göz önünde bulundurun
3. RPC yükünü azaltmak için uygun durumlarda sonuçları önbelleğe alın
4. İstenen blokların mevcut olmadığı durumları yönetin
5. Diğer blok metodlarıyla birlikte kullanın

## Yaygın Hatalar

| Kod    | Mesaj                         | Çözüm                                                |
| ------ | ----------------------------- | ---------------------------------------------------- |
| -32601 | Method not found              | Bir Solana RPC düğümüne bağlı olduğunuzu doğrulayın  |
| -32007 | Block information unavailable | Düğüm başlatılıyor veya senkronize ediliyor olabilir |

## Kullanım Senaryoları

1. **Blok Aralığı Doğrulaması**
   ```typescript theme={null}
   async function verifyBlockRange(startSlot: number, endSlot: number) {
     const firstBlock = await connection.getFirstAvailableBlock();
     const currentSlot = await connection.getSlot();
     
     if (startSlot < firstBlock) {
       throw new Error(`Start slot ${startSlot} is before first available block ${firstBlock}`);
     }
     
     if (endSlot > currentSlot) {
       throw new Error(`End slot ${endSlot} is after current slot ${currentSlot}`);
     }
     
     return {
       startSlot,
       endSlot,
       available: true
     };
   }
   ```

2. **Geçmiş Veri Kullanılabilirliği**
   ```typescript theme={null}
   interface BlockAvailability {
     firstAvailable: number;
     currentSlot: number;
     availableRange: number;
     requestedSlot: number;
     isAvailable: boolean;
   }

   async function checkBlockAvailability(slot: number): Promise<BlockAvailability> {
     const firstBlock = await connection.getFirstAvailableBlock();
     const currentSlot = await connection.getSlot();
     
     return {
       firstAvailable: firstBlock,
       currentSlot,
       availableRange: currentSlot - firstBlock + 1,
       requestedSlot: slot,
       isAvailable: slot >= firstBlock && slot <= currentSlot
     };
   }
   ```

3. **Blok Geçmişi Analizi**
   ```typescript theme={null}
   async function analyzeBlockHistory() {
     const firstBlock = await connection.getFirstAvailableBlock();
     const currentSlot = await connection.getSlot();
     const blocks = await connection.getBlocks(firstBlock, currentSlot);
     
     const metrics = {
       firstBlock,
       currentSlot,
       totalSlots: currentSlot - firstBlock + 1,
       availableBlocks: blocks.length,
       missingBlocks: (currentSlot - firstBlock + 1) - blocks.length,
       availabilityPercentage: (blocks.length / (currentSlot - firstBlock + 1)) * 100
     };
     
     return metrics;
   }
   ```
