eth_getBlockByNumber
https://triport.io/rpc/tronReturns the EVM representation of a Tron block by quantity or latest.
eth_getBlockByNumber returns an EVM-shaped block object or null. The block
selector is either an EVM hex quantity or the literal latest; the second
parameter chooses whether transactions are requested in their full form.
Use this method when an EVM-compatible client needs block data. The native
wallet alternative getblockbynum accepts a
decimal JSON integer and returns a native Tron wallet object. Historical block
availability is a per-node capability, not a pool-wide archive guarantee.
Parameters
JSON-RPC params is [block, fullTransactions].
blockstringrequiredlatest.fullTransactionsbooleanrequiredResponse
Response fields
| Field | Type | Description |
|---|---|---|
jsonrpc | string | JSON-RPC protocol version. |
id | number | Correlates the response with the request. |
result | object or null | EVM block object, or null when unavailable. |
result.number | string | Block number shown in the captured example as a hex quantity. |
Other block-object fields are intentionally not enumerated: the result schema
permits implementation-defined properties and the fixture only guarantees
number.
Errors
See Tron errors for the shared envelope.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | The selector is not a quantity or latest, or the flag is not boolean. |
-32601 | Method not found | The method is outside the published catalog. |
401 | Unauthorized | The API key is missing or invalid. |
429 | Rate limited | The tron_read_rpc budget is exceeded. |
Examples
const response = await fetch("https://triport.io/rpc/tron", {
method: "POST",
headers: { "x-token": process.env.TRIPORT_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_getBlockByNumber", params: ["latest", false] }),
});
const { result: block } = await response.json();Notes
- Unlike current-state methods, this method accepts a hexadecimal block quantity.
- An unavailable historical block is represented by
nullin the result schema. - There is no WebSocket block stream on the Tron product surface.