TriportRPC

getFirstAvailableBlock

Last updated:

`getFirstAvailableBlock` returns the slot of the **oldest confirmed block that is still retained** in the ledger — i.e. the lower bound of the history you can currently query. Older blocks have been purged and can no longer be fetched with methods such as [`getBlock`](./getBlock.md) or [`getBlockTime`](./getBlockTime.md).

Use it to discover the earliest slot you may pass to range or per-block queries before paginating forward with [`getBlocks`](./getBlocks.md). Treating any slot below this value as available will result in "block not available" errors.

> **Gotchas** > - Contrast with `minimumLedgerSlot`, which reports the lowest slot for which > the node has *any* ledger data — that value may include slots that were > never confirmed. `getFirstAvailableBlock` only counts **confirmed** blocks, > so it is the correct floor for block-fetching requests. > - The returned slot advances over time as the ledger is trimmed. Do not cache > it as a permanent value; re-query before long-running backfills.

Parameters

This method takes no parameters.

Returns

getFirstAvailableBlock return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getFirstAvailableBlock","params":[]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "getFirstAvailableBlock",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getFirstAvailableBlock","params":[],"jsonrpc":"2.0"})
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does getFirstAvailableBlock do?
Returns the slot of the lowest confirmed block that has not been purged from the ledger.
How many credits does getFirstAvailableBlock cost?
getFirstAvailableBlock costs 1 credit(s) per call on Triport by default.
Is getFirstAvailableBlock available over WebSocket?
getFirstAvailableBlock is an HTTP JSON-RPC method.