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

> Returns the slot of the lowest confirmed block that the node has information about

## Parameters

This method does not take any parameters.

## Response

<ResponseField name="result" type="number">
  The slot of the lowest confirmed block available
</ResponseField>

## Code Examples

### Basic Request

```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"
}'
```

### Using web3.js

```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
  };
}
```

## Notes

1. Returns the slot of the lowest confirmed block available
2. This is useful for determining the node's available history
3. The value may change as the node prunes old blocks
4. Different nodes may return different values
5. The response is immediate as it reads from the current state

## Best Practices

1. Use this method to determine available block range
2. Consider node pruning when querying historical blocks
3. Cache results when appropriate to reduce RPC load
4. Handle cases where requested blocks are not available
5. Use in conjunction with other block methods

## Common Errors

| Code   | Message                       | Solution                                     |
| ------ | ----------------------------- | -------------------------------------------- |
| -32601 | Method not found              | Verify you're connected to a Solana RPC node |
| -32007 | Block information unavailable | Node may be bootstrapping or syncing         |

## Use Cases

1. **Block Range Verification**
   ```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. **Historical Data Availability**
   ```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. **Block History Analysis**
   ```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;
   }
   ```
