> For the complete documentation index, see [llms.txt](https://docs.coinvera.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinvera.io/integration/solana/rpc/getfirstavailableblock.md).

# getFirstAvailableBlock

The `getFirstAvailableBlock` RPC method returns the **slot number of the oldest confirmed block** still retained in the ledger by the queried RPC node. This is helpful for understanding how much historical block data a node currently stores and where its ledger history begins.

***

#### ✅ Common Use Cases

* **Historical Data Access**\
  Identify the earliest slot from which you can query confirmed block or transaction data using methods like `getBlock`, `getTransaction`, or `getConfirmedSignaturesForAddress2`.
* **Evaluate Ledger Retention**\
  Understand the storage configuration and pruning behavior of a specific node—useful for analytics tools or explorers.
* **Cross-Node Comparison**\
  While not a direct measure of synchronization, comparing results from different nodes can indicate which ones retain deeper historical data.

***

#### 🛠 Request Parameters

This method **does not require any parameters**.

***

#### 📦 Response Structure

The `result` field returns a single value:

```json
{
  "jsonrpc": "2.0",
  "result": 12345678,
  "id": 1
}
```

**`result`** (*u64*):\
The **slot number** of the first available confirmed block on the node.

***

💡 **Example: Get First Available Block Slot**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getFirstAvailableBlock"
}
```

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getFirstAvailableBlock(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getFirstAvailableBlock'
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getFirstAvailableBlock(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_first_available_block(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getFirstAvailableBlock'
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_first_available_block(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}
```

#### 🧠 Developer Tips

* **Node-Specific Results**\
  Each RPC node has its own ledger retention policy. Some nodes (e.g., archival nodes) may retain millions of slots, while others prune older data more aggressively.
* **Continuously Increases**\
  The returned slot number will **increase over time** as older blocks are pruned to conserve disk space.
* **Confirmed Blocks Only**\
  This method returns the **first confirmed block** still available. It does not reflect processed or unconfirmed slots.
* **Use in Data Pipelines**\
  Ideal for setting the **lower bound** when scanning transaction histories or backfilling analytics data.
