TriportRPC

eth_blockNumber

POSThttps://api.triport.io/v1/ethereum

Returns the number of the most recent block on the Ethereum chain.

Ethereumeth_read_rpcfree 10 RPS · basic 20 RPS · pro 100 RPS · business 250 RPS

eth_blockNumber returns the index of the latest block the node has seen, encoded as a 0x-prefixed hexadecimal string. It takes no parameters and is the canonical way to learn the current chain head.

Use it to track chain progress, to pick a concrete latest block height before issuing a batch of historical reads, or as a lightweight liveness/health probe against the RPC endpoint. The value advances roughly once every ~12 seconds on Ethereum mainnet.

Because the result is hex, remember to convert it before using it as a decimal number — e.g. parseInt("0x149e2c1", 16)21619905.

Parameters

This method takes no parameters; pass an empty array.

_(none)_arrayrequired
Must be [].

Response

Response fields

FieldTypeDescription
jsonrpcstringJSON-RPC version, always "2.0".
idnumberEchoes the request id.
resultstringLatest block number as a 0x-prefixed hex string (e.g. 0x149e2c1 = 21619905).

Errors

CodeMeaningWhen it happens
-32001trial_expiredThe account's trial period has ended.
-32002tier_insufficientThe account's tier does not grant access to this method.
-32003rate_limitedThe per-tier RPS limit was exceeded. Back off and retry.
-32004subscription_expiredThe account's paid subscription has lapsed.
-32005unauthorizedMissing or invalid API key.
-32601method_unknownThe method name is not recognized.

See errors.md for the full error envelope and handling guidance.

Examples

JavaScript (fetch)

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


const { result } = await res.json();
console.log("latest block:", parseInt(result, 16)); // 21619905

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const result = await client.ethereum.request<string>("eth_blockNumber", []);
console.log("latest block:", parseInt(result, 16));

Python (triport-sdk)

import os
from triport import Triport


client = Triport(api_key=os.environ["TRIPORT_API_KEY"])


result = client.ethereum.request("eth_blockNumber", [])
print("latest block:", int(result, 16))

Notes

  • The result is a hex string, not a number — convert with base 16 before arithmetic.
  • eth_blockNumber is available on the free tier (eth_read_rpc category).
  • Rate limiting is RPS-per-tier with burst; there is no daily quota. A -32003 rate_limited error means you should back off and retry shortly.
  • To fetch the block itself, follow up with eth_getBlockByNumber. To read the current gas price alongside the head, see eth_gasPrice.