TriportRPC

getMasterchainInfo

POSThttps://triport.io/rpc/ton

Returns the current masterchain block, state root, and zero-state reference.

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

getMasterchainInfo calls liteServer.getMasterchainInfo and returns the selected server's current masterchain reference. The result includes the latest full block ID, its state root hash, and the zero-state block ID.

Use it to obtain a starting block reference for getBlock, getBlockHeader, or a nearby lookupBlock request. The last.seqno value is the selected liteserver's view of the head; it is not a transaction logical time.

Successful responses pass the TON freshness gate before they are served. This is a current-head method and does not establish that the same liteserver retains every block between the returned init and last references.

Parameters

JSON-RPC params is an empty by-name object.

Params: object (by-name).

optional
This method has no parameters; send params: {}.

Response

Response fields

FieldTypeDescription
jsonrpcstringJSON-RPC protocol version.
idnumber or stringCorrelates the response with the request.
resultobjectCurrent masterchain information.
result.lastobjectSelected server's latest full masterchain block ID.
result.state_root_hashstringState root hash associated with the current reference.
result.initobjectMasterchain zero-state block ID.
result.last.workchainintegerWorkchain ID.
result.last.shardstringSigned shard ID as decimal text.
result.last.seqnointegerCurrent masterchain sequence number.
result.last.root_hashstringCurrent block root hash.
result.last.file_hashstringCurrent block file hash.

The JSON is copied without invention from the accepted live fixture.

Errors

See TON errors for the shared envelope.

CodeMeaningWhen it happens
-32602Invalid paramsA non-empty or positional parameter structure is malformed.
-32601Method not foundThe method is outside the published read-only catalog.
401UnauthorizedThe API key is missing or invalid.
429Rate limitedThe ton_read_rpc 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: "head", method: "getMasterchainInfo", params: {} }),
});
const { result: masterchain } = await response.json();

Notes

  • Use last as a full block reference; init identifies zero state and does not promise that all intervening data is retained.
  • Two liteservers answered from genesis, but only one showed confirmed continuity; ls-17 had a measured gap. Pruned servers had a floor of 86 860 000.
  • This is a polling method because TON WebSocket subscriptions are not published. Public HTTP gateways are not used as upstreams.
  • Named params and response correlation by id also apply inside batches.
  • Related methods: getBlock, getBlockHeader, and getTime.