For the complete documentation index, see llms.txt. This page is also available as Markdown.

LedgerService/GetServiceInfo - SUI

Example code for the LedgerService/GetServiceInfo gRPC method. Complete guide on how to use LedgerService/GetServiceInfo gRPC method in GetBlock Web3 documentation.

Returns general information about the Sui node's current state, including the chain ID, network name (mainnet, testnet, devnet), current epoch, current checkpoint height, and the range of locally available checkpoints. This is the most useful single method for confirming connectivity, sync status, and whether a node serves archival or only recent data.

Service: sui.rpc.v2.LedgerService Proto file: sui/rpc/v2/ledger_service.proto Full method path: sui.rpc.v2.LedgerService/GetServiceInfo

Request Fields

  • The request message is empty — no fields are required.

Request Example

# Clone the official proto files first (one-time setup):
#   git clone https://github.com/MystenLabs/sui-apis.git && cd sui-apis

grpcurl \
  -import-path proto \
  -proto sui/rpc/v2/ledger_service.proto \
  -H "x-grpc-web: 1" \
  -d '{}' \
  go.getblock.io:443/<ACCESS-TOKEN> \
  sui.rpc.v2.LedgerService/GetServiceInfo
import * as grpc from '@grpc/grpc-js';
import * as protoLoader from '@grpc/proto-loader';
import * as path from 'path';

const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');
const ACCESS_TOKEN = '<ACCESS-TOKEN>';

const packageDef = protoLoader.loadSync(PROTO_PATH, {
    includeDirs: [path.join(__dirname, 'protos/proto')],
    keepCase: true, longs: String, enums: String, defaults: true,
});
const proto = grpc.loadPackageDefinition(packageDef) as any;
const ServiceClient = proto.sui.rpc.v2.LedgerService;

const metadata = new grpc.Metadata();
metadata.add('authorization', `Bearer ${ACCESS_TOKEN}`);

const client = new ServiceClient('go.getblock.io:443', grpc.credentials.createSsl());

const request = {};

client.GetServiceInfo(request, metadata, (err: any, response: any) => {
    if (err) {
        console.error('Error:', err);
        return;
    }
    console.log(JSON.stringify(response, null, 2));
});

Response Example

Responses are encoded in Protocol Buffers binary format on the wire. The example below shows the protobuf JSON encoding for readability.

Response Fields

Field
Type
Description

chain_id

string

Genesis-derived chain identifier; mainnet is 4btiuiMPvEENsttpZC7CZ53DruC3MAgfznDbASZ7DR6S

chain

string

Network name — mainnet, testnet, or devnet

epoch

string

Current epoch number (uint64 as decimal string)

checkpoint_height

string

Latest executed checkpoint sequence number

timestamp

Timestamp

Timestamp of the latest checkpoint — seconds and nanos since Unix epoch

lowest_available_checkpoint

string

Lowest checkpoint stored locally — useful for detecting archive vs pruning nodes

lowest_available_checkpoint_objects

string

Lowest checkpoint with full object data available

server

string

Sui node software version string

Use Cases

  • Confirming connectivity and network identity (mainnet vs testnet)

  • Sync-status monitoring before routing reads

  • Detecting archive vs pruning nodes via lowest_available_checkpoint

  • Single-call health check before launching application workloads

Error Handling

gRPC uses status codes rather than JSON-RPC numeric error codes. The most relevant for this method:

Status Code
Numeric
Cause

UNAUTHENTICATED

16

Missing or invalid <ACCESS-TOKEN> in the URL path

INVALID_ARGUMENT

3

Request fields are missing, malformed, or fail validation

UNAVAILABLE

14

Node is overloaded or temporarily unable to handle the request — retry with backoff

DEADLINE_EXCEEDED

4

Request did not complete within the timeout window

RESOURCE_EXHAUSTED

8

Rate limit exceeded for your plan

SDK Integration

Was this helpful?