This guide walks you through making your first Sui gRPC call.
- An Alchemy API key
- A gRPC client library for your language (grpcurl for CLI testing)
- The Sui gRPC proto definitions cloned locally (grpcurl requires the
.protofiles)
| Network | Endpoint |
|---|---|
| Mainnet | sui-mainnet.g.alchemy.com:443 |
| Testnet | sui-testnet.g.alchemy.com:443 |
Authentication uses a Bearer token in the request header:
-H "Authorization: Bearer <YOUR_API_KEY>"Start with a GetServiceInfo call to verify your connection and check the current chain state.
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/ledger_service.proto \
-d '{}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.LedgerService/GetServiceInfoExpected response:
{
"chain": "mainnet",
"chainId": "35834a8a",
"checkpointHeight": "12345678",
"epoch": "500",
"server": "alchemy"
}Query a Sui object by its ID using GetObject. Use read_mask to request specific fields.
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/ledger_service.proto \
-d '{
"object_id": "0x5",
"read_mask": {"paths": ["object_id", "version", "digest", "owner"]}
}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.LedgerService/GetObjectFetch a transaction by its digest.
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/ledger_service.proto \
-d '{
"digest": "YOUR_TX_DIGEST"
}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.LedgerService/GetTransactionQuery the SUI balance for an address.
grpcurl \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-import-path proto \
-proto sui/rpc/v2/state_service.proto \
-d '{
"owner": "0xYOUR_ADDRESS",
"coin_type": "0x2::sui::SUI"
}' \
sui-mainnet.g.alchemy.com:443 \
sui.rpc.v2.StateService/GetBalance- Sui gRPC overview for the full list of available services and methods
- Objects and ledger for detailed
LedgerServicedocumentation - Transactions for executing and simulating transactions