Skip to content

LedgerService.GetEpoch ​

Get epoch through sui.rpc.v2.LedgerService/GetEpoch on Inodra's Sui gRPC endpoint.

Endpoint ​

NetworkHostAuthentication
Mainnetmainnet-grpc.inodra.com:443x-api-key metadata
Testnettestnet-grpc.inodra.com:443x-api-key metadata

Full method name: sui.rpc.v2.LedgerService/GetEpoch. Unary: one request, one response. Get a key from the dashboard; the same key works on every protocol.

Request: GetEpochRequest ​

FieldTypeDescription
epochuint64The requested epoch. If no epoch is provided the current epoch will be returned.
read_maskgoogle.protobuf.FieldMaskMask specifying which fields to read. If no mask is specified, defaults to epoch.

Response: GetEpochResponse ​

FieldTypeDescription
epochEpoch

Epoch ​

FieldTypeDescription
epochuint64
committeeValidatorCommitteeThe committee governing this epoch.
system_stateSystemStateSnapshot of Sui's SystemState (0x3::sui_system::SystemState) at the beginning of the epoch, for past epochs, or the current state for the current epoch.
first_checkpointuint64
last_checkpointuint64
startgoogle.protobuf.Timestamp
endgoogle.protobuf.Timestamp
reference_gas_priceuint64Reference gas price denominated in MIST
protocol_configProtocolConfig

grpcurl ​

bash
grpcurl -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "read_mask": {
    "paths": [
      "epoch"
    ]
  }
}' \
  mainnet-grpc.inodra.com:443 \
  sui.rpc.v2.LedgerService/GetEpoch

Server reflection is enabled, so no proto files are needed for grpcurl. Field masks are written as {"paths": [...]}.

TypeScript ​

typescript
import { GrpcWebFetchTransport, SuiGrpcClient } from '@mysten/sui/grpc'

const transport = new GrpcWebFetchTransport({
  baseUrl: 'https://mainnet-grpc.inodra.com',
  meta: { 'x-api-key': process.env.INODRA_API_KEY! }
})
const client = new SuiGrpcClient({ network: 'mainnet', transport })

// No epoch: returns the current epoch
const { response } = await client.ledgerService.getEpoch({
  readMask: { paths: ['epoch', 'reference_gas_price'] }
})
console.log(response.epoch?.epoch, response.epoch?.referenceGasPrice)

@mysten/sui v2 has no typed method for this RPC, so the sample calls the generated client.ledgerService service client. Install with npm install @mysten/sui and set INODRA_API_KEY. The gRPC gateway guide covers native gRPC transport for backends.

Credits ​

1 credit per call. Reads served from the archival tier cost 2x; the response metadata carries x-inodra-backend naming the tier that answered. See credits and billing for the full table.

The full-stack Sui data layer.