getLatestLedger
Stellar / https://triport.io/rpc/stellar
Minimum tier: Free
Last updated:
Returns the newest ledger known to the selected node, including sequence, identifier, close time, and protocol version.
Use it for a compact chain-head marker. Use getLedgers for retained history or getHealth for the oldest retained boundary.
Optional header and metadata XDR fields are described from the OpenRPC schema even when absent from the fixture.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| getLatestLedgerResponse | object |
Examples
curl https://triport.io/rpc/stellar \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"jsonrpc":"2.0","id":1,"method":"getLatestLedger","params":[]}'const res = await fetch("https://triport.io/rpc/stellar", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestLedger",
"params": []
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/rpc/stellar",
headers={"Authorization": "Bearer <api-key>"},
json={"jsonrpc":"2.0","id":1,"method":"getLatestLedger","params":[]},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Chain: Stellar.
- Clusters: mainnet.
- Credit cost: 1 per call.
FAQ
- What does getLatestLedger do?
- Returns latest known ledger through Stellar Soroban JSON-RPC.
- How many credits does getLatestLedger cost?
- getLatestLedger costs 1 credit(s) per call on Triport by default.
- Is getLatestLedger available over WebSocket?
- getLatestLedger is an HTTP JSON-RPC method.