Parameters
- start_checkpointstring
Optional. Start of the checkpoint range to query (inclusive). Defaults to genesis.
- end_checkpointstring
Optional. End of the checkpoint range to query (exclusive). Defaults to the current indexed ledger tip.
- read_maskobject
Optional. Mask for specifying which parts of the Checkpoint should be returned (e.g. summary, contents, signature).
- pathsarray<string>
List of fields to include, such as 'sequence_number', 'digest', 'summary'.
- filterobject
Optional. DNF filter over indexed transaction dimensions. A checkpoint matches if any transaction it contains satisfies the filter. If absent, all checkpoints in the range are returned.
- termsarray
Terms are ORed together; each term is an AND of signed predicate literals (sender, affected_address, move_call, etc.).
- optionsobject
Optional cursor-bounded query options. If unspecified, reads in ascending order with the default item limit.
- limitinteger
The maximum number of items to return. The server enforces a maximum item limit and silently coerces larger values down to it.
- afterstring
Opaque exclusive lower bound cursor. Pass the last received
watermark.cursorhere to resume an ascending scan.
- beforestring
Opaque exclusive upper bound cursor. Pass the last received
watermark.cursorhere to resume a descending scan.
- orderingstring
ORDERING_ASCENDING (default) or ORDERING_DESCENDING.
Returns
- checkpointobject
One matching checkpoint. Set on frames that deliver an item; unset on progress/terminal frames.
- sequenceNumberstring
The height of this checkpoint.
- digeststring
The digest of this checkpoint's summary.
- summaryobject
The CheckpointSummary for this checkpoint, present when included in
read_mask.
- watermarkobject
Progress watermark present on every frame. Use
cursorasoptions.after/options.beforeon the next request to resume the scan.- cursorstring
Opaque resume cursor at this scan position.
- checkpointstring
The checkpoint fully covered by the scan so far, in the scan direction. Unset until the first checkpoint is fully covered.
- endobject
Set exactly once, on the final frame of a successful stream.
- reasonstring
Why the stream stopped: QUERY_END_REASON_ITEM_LIMIT, QUERY_END_REASON_SCAN_LIMIT, QUERY_END_REASON_CHECKPOINT_BOUND, QUERY_END_REASON_CURSOR_BOUND, or QUERY_END_REASON_LEDGER_TIP.
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"start_checkpoint": "306133000",7"read_mask": {8"paths": [9"sequence_number",10"digest",11"summary"12]13},14"options": {15"limit": 316}17}' \18docs-demo.sui-mainnet.quiknode.pro:9000 \19sui.rpc.v2.LedgerService/ListCheckpoints20
1grpcurl \2-import-path . \3-proto sui/rpc/v2/ledger_service.proto \4-H "x-token: YOUR_TOKEN_VALUE" \5-d '{6"start_checkpoint": "306133000",7"read_mask": {8"paths": [9"sequence_number",10"digest",11"summary"12]13},14"options": {15"limit": 316}17}' \18docs-demo.sui-mainnet.quiknode.pro:9000 \19sui.rpc.v2.LedgerService/ListCheckpoints20
1package main23import (4"context"5"crypto/tls"6"encoding/json"7"fmt"8"io"9"log"10"time"1112"google.golang.org/grpc"13"google.golang.org/grpc/credentials"14"google.golang.org/protobuf/encoding/protojson"15"google.golang.org/protobuf/types/known/fieldmaskpb"1617pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path18)1920// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token21// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678922// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}23// token will be : abcde1234567892425var (26token = "YOUR_TOKEN_NUMBER"27endpoint = "YOUR_QN_ENDPOINT:9000"28)2930// Auth structure for x-token31type auth struct {32token string33}3435func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {36return map[string]string{"x-token": a.token}, nil37}38func (a *auth) RequireTransportSecurity() bool {39return true40}4142func main() {43creds := credentials.NewTLS(&tls.Config{})44opts := []grpc.DialOption{45grpc.WithTransportCredentials(creds),46grpc.WithPerRPCCredentials(&auth{token}),47}4849conn, err := grpc.Dial(endpoint, opts...)50if err != nil {51log.Fatalf("Failed to connect: %v", err)52}53defer conn.Close()5455client := pb.NewLedgerServiceClient(conn)5657startCheckpoint := uint64(306133000)58limit := uint32(3)5960req := &pb.ListCheckpointsRequest{61StartCheckpoint: &startCheckpoint,62ReadMask: &fieldmaskpb.FieldMask{63Paths: []string{"sequence_number", "digest", "summary"},64},65Options: &pb.QueryOptions{66Limit: &limit,67},68}6970// ListCheckpoints is bounded by start/end checkpoint and options.limit, so the71// stream terminates on its own once the QueryEnd frame is sent.72ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)73defer cancel()7475stream, err := client.ListCheckpoints(ctx, req)76if err != nil {77log.Fatalf("ListCheckpoints failed: %v", err)78}7980marshaler := protojson.MarshalOptions{81UseProtoNames: true,82EmitUnpopulated: true,83Indent: " ",84}8586fmt.Println("Streaming checkpoints...")8788for {89resp, err := stream.Recv()90if err == io.EOF {91fmt.Println("Stream ended")92break93}94if err != nil {95log.Fatalf("Stream error: %v", err)96}9798jsonBytes, err := marshaler.Marshal(resp)99if err != nil {100log.Printf("Failed to marshal: %v", err)101continue102}103104var pretty map[string]interface{}105if err := json.Unmarshal(jsonBytes, &pretty); err != nil {106log.Printf("Failed to parse JSON: %v", err)107continue108}109110out, _ := json.MarshalIndent(pretty, "", " ")111fmt.Printf("Received frame:\n%s\n", string(out))112113if resp.GetEnd() != nil {114fmt.Printf("Query ended: %s\n", resp.GetEnd().GetReason())115}116}117}118
1package main23import (4"context"5"crypto/tls"6"encoding/json"7"fmt"8"io"9"log"10"time"1112"google.golang.org/grpc"13"google.golang.org/grpc/credentials"14"google.golang.org/protobuf/encoding/protojson"15"google.golang.org/protobuf/types/known/fieldmaskpb"1617pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path18)1920// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token21// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678922// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}23// token will be : abcde1234567892425var (26token = "YOUR_TOKEN_NUMBER"27endpoint = "YOUR_QN_ENDPOINT:9000"28)2930// Auth structure for x-token31type auth struct {32token string33}3435func (a *auth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {36return map[string]string{"x-token": a.token}, nil37}38func (a *auth) RequireTransportSecurity() bool {39return true40}4142func main() {43creds := credentials.NewTLS(&tls.Config{})44opts := []grpc.DialOption{45grpc.WithTransportCredentials(creds),46grpc.WithPerRPCCredentials(&auth{token}),47}4849conn, err := grpc.Dial(endpoint, opts...)50if err != nil {51log.Fatalf("Failed to connect: %v", err)52}53defer conn.Close()5455client := pb.NewLedgerServiceClient(conn)5657startCheckpoint := uint64(306133000)58limit := uint32(3)5960req := &pb.ListCheckpointsRequest{61StartCheckpoint: &startCheckpoint,62ReadMask: &fieldmaskpb.FieldMask{63Paths: []string{"sequence_number", "digest", "summary"},64},65Options: &pb.QueryOptions{66Limit: &limit,67},68}6970// ListCheckpoints is bounded by start/end checkpoint and options.limit, so the71// stream terminates on its own once the QueryEnd frame is sent.72ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)73defer cancel()7475stream, err := client.ListCheckpoints(ctx, req)76if err != nil {77log.Fatalf("ListCheckpoints failed: %v", err)78}7980marshaler := protojson.MarshalOptions{81UseProtoNames: true,82EmitUnpopulated: true,83Indent: " ",84}8586fmt.Println("Streaming checkpoints...")8788for {89resp, err := stream.Recv()90if err == io.EOF {91fmt.Println("Stream ended")92break93}94if err != nil {95log.Fatalf("Stream error: %v", err)96}9798jsonBytes, err := marshaler.Marshal(resp)99if err != nil {100log.Printf("Failed to marshal: %v", err)101continue102}103104var pretty map[string]interface{}105if err := json.Unmarshal(jsonBytes, &pretty); err != nil {106log.Printf("Failed to parse JSON: %v", err)107continue108}109110out, _ := json.MarshalIndent(pretty, "", " ")111fmt.Printf("Received frame:\n%s\n", string(out))112113if resp.GetEnd() != nil {114fmt.Printf("Query ended: %s\n", resp.GetEnd().GetReason())115}116}117}118
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Configuration6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');78// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token9// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678910// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}11// token will be : abcde1234567891213const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';14const token = 'abcde123456789';1516// Load protobuf definitions17const packageDefinition = protoLoader.loadSync(PROTO_PATH, {18keepCase: true,19longs: String,20enums: String,21defaults: true,22oneofs: true,23includeDirs: [path.join(__dirname, 'protos/proto')],24});2526const proto = grpc.loadPackageDefinition(packageDefinition) as any;27const LedgerService = proto.sui.rpc.v2.LedgerService;2829// Create secure client30const client = new LedgerService(endpoint, grpc.credentials.createSsl());3132// Add token metadata33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Request payload37// ListCheckpoints is bounded by start/end_checkpoint and options.limit, so the38// stream ends on its own — no Ctrl+C handling needed.39const request = {40start_checkpoint: '306133000',41read_mask: {42paths: ['sequence_number', 'digest', 'summary'],43},44options: {45limit: 3,46},47};4849const call = client.ListCheckpoints(request, metadata);5051console.log('Streaming checkpoints...');5253call.on('data', (response: any) => {54console.log('Received frame:', JSON.stringify(response, null, 2));55if (response.end) {56console.log('Query ended:', response.end.reason);57}58});5960call.on('error', (error: any) => {61console.error('Stream error:', error);62});6364call.on('end', () => {65console.log('Stream ended');66});67
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Configuration6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/ledger_service.proto');78// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token9// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678910// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}11// token will be : abcde1234567891213const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';14const token = 'abcde123456789';1516// Load protobuf definitions17const packageDefinition = protoLoader.loadSync(PROTO_PATH, {18keepCase: true,19longs: String,20enums: String,21defaults: true,22oneofs: true,23includeDirs: [path.join(__dirname, 'protos/proto')],24});2526const proto = grpc.loadPackageDefinition(packageDefinition) as any;27const LedgerService = proto.sui.rpc.v2.LedgerService;2829// Create secure client30const client = new LedgerService(endpoint, grpc.credentials.createSsl());3132// Add token metadata33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Request payload37// ListCheckpoints is bounded by start/end_checkpoint and options.limit, so the38// stream ends on its own — no Ctrl+C handling needed.39const request = {40start_checkpoint: '306133000',41read_mask: {42paths: ['sequence_number', 'digest', 'summary'],43},44options: {45limit: 3,46},47};4849const call = client.ListCheckpoints(request, metadata);5051console.log('Streaming checkpoints...');5253call.on('data', (response: any) => {54console.log('Received frame:', JSON.stringify(response, null, 2));55if (response.end) {56console.log('Query ended:', response.end.reason);57}58});5960call.on('error', (error: any) => {61console.error('Stream error:', error);62});6364call.on('end', () => {65console.log('Stream ended');66});67
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_grpc, query_options_pb267def list_checkpoints():8# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token9# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678910# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}11# token will be : abcde1234567891213endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';14token = 'abcde123456789';1516channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())17stub = ledger_service_pb2_grpc.LedgerServiceStub(channel)1819read_mask = FieldMask(paths=["sequence_number", "digest", "summary"])2021# ListCheckpoints is bounded by start/end_checkpoint and options.limit, so22# the stream ends on its own once the server sends the QueryEnd frame.23request = ledger_service_pb2.ListCheckpointsRequest(24start_checkpoint=306133000,25read_mask=read_mask,26options=query_options_pb2.QueryOptions(limit=3)27)2829metadata = [("x-token", token)]3031return stub.ListCheckpoints(request, metadata=metadata)3233def parse_response_to_json(response):34return json.dumps(35MessageToDict(response, preserving_proto_field_name=True),36indent=237)3839def main():40print("Streaming checkpoints...")4142try:43response_stream = list_checkpoints()4445for response in response_stream:46print("Received frame:")47print(parse_response_to_json(response))48if response.HasField("end"):49reason = query_options_pb2.QueryEndReason.Name(response.end.reason)50print(f"Query ended: {reason}")5152print("Stream ended")5354except grpc.RpcError as e:55print(f"{e.code().name}: {e.details()}")5657if __name__ == "__main__":58main()59
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_grpc, query_options_pb267def list_checkpoints():8# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token9# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678910# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}11# token will be : abcde1234567891213endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';14token = 'abcde123456789';1516channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())17stub = ledger_service_pb2_grpc.LedgerServiceStub(channel)1819read_mask = FieldMask(paths=["sequence_number", "digest", "summary"])2021# ListCheckpoints is bounded by start/end_checkpoint and options.limit, so22# the stream ends on its own once the server sends the QueryEnd frame.23request = ledger_service_pb2.ListCheckpointsRequest(24start_checkpoint=306133000,25read_mask=read_mask,26options=query_options_pb2.QueryOptions(limit=3)27)2829metadata = [("x-token", token)]3031return stub.ListCheckpoints(request, metadata=metadata)3233def parse_response_to_json(response):34return json.dumps(35MessageToDict(response, preserving_proto_field_name=True),36indent=237)3839def main():40print("Streaming checkpoints...")4142try:43response_stream = list_checkpoints()4445for response in response_stream:46print("Received frame:")47print(parse_response_to_json(response))48if response.HasField("end"):49reason = query_options_pb2.QueryEndReason.Name(response.end.reason)50print(f"Query ended: {reason}")5152print("Stream ended")5354except grpc.RpcError as e:55print(f"{e.code().name}: {e.details()}")5657if __name__ == "__main__":58main()59