Parameters
This method does not accept any parameters
Returns
chainId
string
The unique identifier for the chain. It's the digest of the genesis checkpoint (sequence number 0).
chain
string
A human-readable name for the chain (e.g., 'mainnet', 'testnet', 'devnet').
epoch
string
The current epoch number based on the highest executed checkpoint.
checkpointHeight
string
The sequence number of the most recently executed checkpoint.
timestamp
string
The Unix timestamp (ISO 8601 format) of the most recent executed checkpoint.
lowestAvailableCheckpoint
string
The lowest checkpoint for which transaction and checkpoint data are still available.
lowestAvailableCheckpointObjects
string
The lowest checkpoint for which object data is available.
server
string
The full version string of the running Sui node software.
Request
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{}' \6docs-demo.sui-mainnet.quiknode.pro:9000 \7sui.rpc.v2.LedgerService/GetServiceInfo8
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{}' \6docs-demo.sui-mainnet.quiknode.pro:9000 \7sui.rpc.v2.LedgerService/GetServiceInfo8
1package main23import (4"context"5"crypto/tls"6"encoding/json"7"fmt"8"log"9"time"1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"13"google.golang.org/grpc/metadata"14"google.golang.org/protobuf/encoding/protojson"1516pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}22// token will be : abcde1234567892324var (25token = "YOUR_TOKEN_NUMBER"26endpoint = "YOUR_QN_ENDPOINT:9000"27)2829func main() {30creds := credentials.NewTLS(&tls.Config{})31conn, err := grpc.Dial(endpoint, grpc.WithTransportCredentials(creds))32if err != nil {33log.Fatalf("Failed to connect: %v", err)34}35defer conn.Close()3637client := pb.NewLedgerServiceClient(conn)3839ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)40defer cancel()41ctx = metadata.AppendToOutgoingContext(ctx, "x-token", token)4243req := &pb.GetServiceInfoRequest{}4445resp, err := client.GetServiceInfo(ctx, req)46if err != nil {47log.Fatalf("GetServiceInfo failed: %v", err)48}4950marshaler := protojson.MarshalOptions{51UseProtoNames: true,52EmitUnpopulated: true,53Indent: " ",54}5556jsonBytes, err := marshaler.Marshal(resp)57if err != nil {58log.Fatalf("Failed to marshal response to JSON: %v", err)59}6061var prettyJSON map[string]interface{}62if err := json.Unmarshal(jsonBytes, &prettyJSON); err != nil {63log.Fatalf("Failed to unmarshal JSON: %v", err)64}6566prettyJSONBytes, err := json.MarshalIndent(prettyJSON, "", " ")67if err != nil {68log.Fatalf("Failed to format JSON: %v", err)69}7071fmt.Println(string(prettyJSONBytes))72}73
1package main23import (4"context"5"crypto/tls"6"encoding/json"7"fmt"8"log"9"time"1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"13"google.golang.org/grpc/metadata"14"google.golang.org/protobuf/encoding/protojson"1516pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}22// token will be : abcde1234567892324var (25token = "YOUR_TOKEN_NUMBER"26endpoint = "YOUR_QN_ENDPOINT:9000"27)2829func main() {30creds := credentials.NewTLS(&tls.Config{})31conn, err := grpc.Dial(endpoint, grpc.WithTransportCredentials(creds))32if err != nil {33log.Fatalf("Failed to connect: %v", err)34}35defer conn.Close()3637client := pb.NewLedgerServiceClient(conn)3839ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)40defer cancel()41ctx = metadata.AppendToOutgoingContext(ctx, "x-token", token)4243req := &pb.GetServiceInfoRequest{}4445resp, err := client.GetServiceInfo(ctx, req)46if err != nil {47log.Fatalf("GetServiceInfo failed: %v", err)48}4950marshaler := protojson.MarshalOptions{51UseProtoNames: true,52EmitUnpopulated: true,53Indent: " ",54}5556jsonBytes, err := marshaler.Marshal(resp)57if err != nil {58log.Fatalf("Failed to marshal response to JSON: %v", err)59}6061var prettyJSON map[string]interface{}62if err := json.Unmarshal(jsonBytes, &prettyJSON); err != nil {63log.Fatalf("Failed to unmarshal JSON: %v", err)64}6566prettyJSONBytes, err := json.MarshalIndent(prettyJSON, "", " ")67if err != nil {68log.Fatalf("Failed to format JSON: %v", err)69}7071fmt.Println(string(prettyJSONBytes))72}73
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Path to proto file6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');78// Load proto definitions9const packageDefinition = protoLoader.loadSync(PROTO_PATH, {10keepCase: true,11longs: String,12enums: String,13defaults: true,14oneofs: true,15includeDirs: [path.join(__dirname, 'protos/proto')],16});1718const proto = grpc.loadPackageDefinition(packageDefinition) as any;19const LedgerService = proto.sui.rpc.v2.LedgerService;2021// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token22// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678923// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}24// token will be : abcde1234567892526const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';27const token = 'abcde123456789';2829// Create gRPC client with TLS30const client = new LedgerService(endpoint, grpc.credentials.createSsl());3132// Metadata with token33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Empty request for GetServiceInfo37const request = {};3839// Make the gRPC call40client.GetServiceInfo({}, metadata, (err: grpc.ServiceError | null, response: any) => {41if (err) {42console.error('gRPC Error:', {43code: err.code,44message: err.message,45details: err.details,46});47return;48}49console.log('Service Info:');50console.log(JSON.stringify(response, null, 2));51});
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Path to proto file6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');78// Load proto definitions9const packageDefinition = protoLoader.loadSync(PROTO_PATH, {10keepCase: true,11longs: String,12enums: String,13defaults: true,14oneofs: true,15includeDirs: [path.join(__dirname, 'protos/proto')],16});1718const proto = grpc.loadPackageDefinition(packageDefinition) as any;19const LedgerService = proto.sui.rpc.v2.LedgerService;2021// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token22// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678923// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}24// token will be : abcde1234567892526const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';27const token = 'abcde123456789';2829// Create gRPC client with TLS30const client = new LedgerService(endpoint, grpc.credentials.createSsl());3132// Metadata with token33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Empty request for GetServiceInfo37const request = {};3839// Make the gRPC call40client.GetServiceInfo({}, metadata, (err: grpc.ServiceError | null, response: any) => {41if (err) {42console.error('gRPC Error:', {43code: err.code,44message: err.message,45details: err.details,46});47return;48}49console.log('Service Info:');50console.log(JSON.stringify(response, null, 2));51});
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2 import ledger_service_pb2, ledger_service_pb2_grpc678def get_service_info():9# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token10# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678911# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}12# token will be: abcde1234567891314endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';15token = 'abcde123456789';1617channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())18stub = ledger_service_pb2_grpc.LedgerServiceStub(channel)1920# GetServiceInfo doesn't require any specific parameters21request = ledger_service_pb2.GetServiceInfoRequest()2223metadata = [("x-token", token)]2425return stub.GetServiceInfo(request, metadata=metadata)262728def parse_response_to_json(response):29return json.dumps(30MessageToDict(response, preserving_proto_field_name=True),31indent=232)333435def main():36try:37response = get_service_info()38print(parse_response_to_json(response))39except grpc.RpcError as e:40print(f"{e.code().name}: {e.details()}")414243if __name__ == "__main__":44main()45
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2 import ledger_service_pb2, ledger_service_pb2_grpc678def get_service_info():9# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token10# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678911# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}12# token will be: abcde1234567891314endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';15token = 'abcde123456789';1617channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())18stub = ledger_service_pb2_grpc.LedgerServiceStub(channel)1920# GetServiceInfo doesn't require any specific parameters21request = ledger_service_pb2.GetServiceInfoRequest()2223metadata = [("x-token", token)]2425return stub.GetServiceInfo(request, metadata=metadata)262728def parse_response_to_json(response):29return json.dumps(30MessageToDict(response, preserving_proto_field_name=True),31indent=232)333435def main():36try:37response = get_service_info()38print(parse_response_to_json(response))39except grpc.RpcError as e:40print(f"{e.code().name}: {e.details()}")414243if __name__ == "__main__":44main()45
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free