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

> 返回节点拥有信息的最低已确认区块的 slot

## 参数

此方法不接受任何参数。

## 响应

<ResponseField name="result" type="number">
  可用的最低已确认区块的 slot
</ResponseField>

## 代码示例

### 基本请求

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

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

## 注意事项

1. 返回可用的最低已确认区块的 slot
2. 这对于确定节点的可用历史记录很有用
3. 随着节点修剪旧区块，该值可能会变化
4. 不同节点可能返回不同的值
5. 响应是即时的，因为它从当前状态读取

## 最佳实践

1. 使用此方法确定可用的区块范围
2. 查询历史区块时考虑节点修剪
3. 适当时缓存结果以减少 RPC 负载
4. 处理请求的区块不可用的情况
5. 与其他区块方法结合使用

## 常见错误

| 错误码    | 消息                            | 解决方案                  |
| ------ | ----------------------------- | --------------------- |
| -32601 | Method not found              | 验证是否连接到 Solana RPC 节点 |
| -32007 | Block information unavailable | 节点可能正在启动或同步中          |
