getLatestLedger
For finding out the current latest known ledger of this node. This is a subset of the ledger info from Horizon.
Params
(0)Result
(getLatestLedgerResult)id
stringHash identifier of the latest ledger (as a hex-encoded string) known to Soroban RPC at the time it handled the request.
>= 64 characters<= 64 characters
Match pattern:
^[a-f\d]{64}$
protocolVersion
numberStellar Core protocol version associated with the latest ledger.
sequence
numberThe sequence number of the latest ledger known to Soroban RPC at the time it handled the request.
Example
Example request to the getLatestLedger
method.
Request
- cURL
- JavaScript
- Python
- JSON
curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 8675309,
"method": "getLatestLedger"
}' \
https://soroban-testnet.stellar.org | jq
let requestBody = {
"jsonrpc": "2.0",
"id": 8675309,
"method": "getLatestLedger"
}
let res = await fetch('https://soroban-testnet.stellar.org', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(requestBody),
})
let json = await res.json()
console.log(json)
import json, requests
res = requests.post('https://soroban-testnet.stellar.org', json={
"jsonrpc": "2.0",
"id": 8675309,
"method": "getLatestLedger"
})
print(json.dumps(res.json(), indent=4))
{
"jsonrpc": "2.0",
"id": 8675309,
"method": "getLatestLedger"
}
Result
{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"id": "c73c5eac58a441d4eb733c35253ae85f783e018f7be5ef974258fed067aabb36",
"protocolVersion": 20,
"sequence": 2539605
}
}