getBlockHeight — Solana JSON-RPC

Status: Available

Returns the current block height of the node — the number of confirmed blocks beneath the latest confirmed block.

POSThttps://triport.io/sol
Network
Solana
Scope
sol_read_rpc
Auth
x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
Rate limit
free+ · 20 / 60 / 200 / 600 rps (free / basic / pro / business)

Endpoint and plans: Solana RPC endpoint.

getBlockHeight returns the current block height as a u64 integer. The block height is the count of confirmed blocks below the current block — it increments by one for every block that is actually produced.

Use it when you need a monotonic, gap-free measure of chain progress. A common use is to compare a transaction's lastValidBlockHeight against the current height to decide whether the transaction's blockhash has expired.

Distinguish from getSlot: block height counts only the blocks that were produced, while a slot is a fixed ~400 ms time unit that advances even when its leader skips block production. Because skipped slots increment the slot but not the block height, the slot value is always greater than or equal to the block height.

All Solana JSON-RPC methods POST to the same base path /v1/sol; the method field in the request body selects the call.

Parameters

The single positional parameter is an optional config object.

configobjectoptional
Configuration object (see fields below). Omit it entirely for defaults.
config.commitmentstringoptional
Commitment level for the query: processed, confirmed, or finalized. Defaults to finalized.
config.minContextSlotinteger (u64)optional
The minimum slot at which the request may be evaluated.

Response

Response fields

FieldTypeDescription
jsonrpcstringAlways "2.0".
idstring | integerEchoes the id from the request, for correlating responses.
resultinteger (u64)Current block height — the count of confirmed blocks.

Errors

Errors arrive in the standard JSON-RPC error object (code, message, data).

CodeTriport codeWhen it happens
-32602invalid_paramsThe config object contains an unknown field or a malformed value (e.g. an invalid commitment enum value).
429rate_limitedYou exceeded your tier's sustained RPS for sol_read_rpc. An HTTP error, not a JSON-RPC one — the request is rejected before the RPC layer: body {"error":"rate_limited", …} with limit_rps, burst_capacity and retry_after_sec, plus Retry-After and X-RateLimit-Reset headers.

See the shared errors reference for the full envelope, the data fields, and which errors are plain HTTP rather than JSON-RPC.

Examples

JavaScript (fetch)

const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getBlockHeight",
    params: [{ commitment: "finalized" }],
  }),
});


const { result: blockHeight } = await res.json();
console.log(blockHeight); // 285432109

Notes

  • commitment defaults to finalized when omitted.
  • Block height is gap-free and monotonically increasing; slot numbers are not (skipped slots leave gaps). Use this method, not getSlot, when you need a count of actual blocks.
  • id may be any client-chosen string or integer; it is echoed back so you can correlate responses.
  • This is a sol_read_rpc method available from the Free trial up; throughput scales with your plan (20 → 600 rps) with burst allowance. There is no daily quota.
  • Related: getBlockTime, getBlocks, getLatestBlockhash.
  • Slot vs block height: skipped slots make the slot number run ahead of block height — see Solana slot vs block height.