getblockbynum
https://triport.io/rpc/tron/wallet/getblockbynumReturns a native Tron block by its decimal block number.
getblockbynum returns the native wallet block object for a non-negative
decimal height. Wallet HTTP uses a JSON integer here, unlike
eth_getBlockByNumber, whose EVM selector is a hexadecimal quantity.
Historical availability is a property of the selected node. One public wallet node had a measured retention window of 2,219,797 blocks; that observation is not a pool-wide archive promise. A schema-valid request can therefore return an empty object when the selected node lacks the requested block.
Parameters
The JSON body contains one required field.
numintegerrequiredResponse
The concrete response example is unknown because the OpenAPI contract has
no response example. {} is a schema-valid placeholder and also illustrates
why an empty response must not be treated as proof of a pool-wide absence.
responseobjectErrors
Wallet failures use HTTP status plus JSON. See Tron errors.
| HTTP | Meaning | When it happens |
|---|---|---|
400 | Bad request | num is missing, negative, or not a decimal integer. |
401 | Unauthorized | The API key is missing or invalid. |
403 | Forbidden | The scope or tier does not permit the request. |
429 | Rate limited | The tron_read_rpc_heavy budget is exceeded. |
Examples
const response = await fetch("https://triport.io/rpc/tron/wallet/getblockbynum", {
method: "POST",
headers: { "x-token": process.env.TRIPORT_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ num: 1 }),
});
const block = await response.json();Notes
numis decimal JSON, not an EVM quantity.- Retention depth varies by node; the measured 2,219,797-block window is not an SLA.
- Related:
eth_getBlockByNumber.