TriportRPC

getShards

POSThttps://triport.io/rpc/ton

Returns active shardchain block IDs at a masterchain sequence number.

TON mainnetton:rpcfree+; ton_read_rpc_heavy: 15 / 20 / 100 / 250 RPS (free / basic / pro / business; default, unmeasured)

getShards maps a masterchain sequence number to liteServer.getAllShardsInfo and returns the active shardchain block IDs at that point. Each item is a complete block ID with workchain, shard, sequence, root hash, and file hash.

Use it to discover which shardchain blocks correspond to a masterchain block before fetching their headers or bodies. It differs from getMasterchainInfo, which returns only the current masterchain reference, and from lookupBlock, which resolves one block in a specified workchain and shard.

The masterchain seqno is a JSON number. Every returned shard identifier is rendered as signed decimal text so its 64-bit value remains exact.

Parameters

JSON-RPC params is a by-name object.

Params: object (by-name).

seqnointegerrequired
Non-negative masterchain block sequence number.

Response

Response fields

FieldTypeDescription
jsonrpcstringJSON-RPC protocol version.
idnumber or stringCorrelates the response with the request.
resultarrayActive shardchain block IDs.
result[].workchainintegerWorkchain ID.
result[].shardstringSigned 64-bit shard ID as decimal text.
result[].seqnointegerShardchain block sequence number.
result[].root_hashstringShardchain block root hash.
result[].file_hashstringShardchain block file hash.

The response is copied from the accepted live fixture.

Errors

See TON errors for the shared envelope and retention handling.

CodeMeaningWhen it happens
-32602Invalid paramsseqno is missing, negative, malformed, or passed positionally.
beyond_retentionShard state unavailableThe selected liteserver does not retain state at the requested masterchain block.
-32601Method not foundThe method is outside the published read-only catalog.
401UnauthorizedThe API key is missing or invalid.
429Rate limitedThe ton_read_rpc_heavy budget is exceeded.

Examples

const response = await fetch("https://triport.io/rpc/ton", {
  method: "POST",
  headers: { "x-token": process.env.TRIPORT_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", id: "shards", method: "getShards", params: { seqno: 90110366 } }),
});
const { result: shards } = await response.json();

Notes

  • The input seqno identifies a masterchain block; item seqno values identify shardchain blocks and therefore need not equal it.
  • Pruned liteservers had a measured floor of 86 860 000. Genesis availability was observed on two nodes, but ls-17 had a measured gap.
  • Requests use named params and batch results are matched by id.
  • No REST gateway or WebSocket shard subscription is published for TON.
  • Related methods: getMasterchainInfo, getBlockHeader, and getBlock.