getLatestLedger
Returns the latest ledger known to the node. This method uses 160 credits from your daily balance.
Parameters
None
Returns
result: (object) - The latest ledger.
id: (string) - Hex-encoded hash of the latest ledger.protocolVersion: (integer) - Stellar Core protocol version of the latest ledger.sequence: (integer) - Sequence number of the latest ledger.closeTime: (string) - Unix timestamp, as a string, of when the latest ledger closed.headerXdr: (string) - Base64-encodedLedgerHeaderfor this ledger.metadataXdr: (string) - Base64-encodedLedgerCloseMetafor this ledger.
The sample response omits metadataXdr because of its size.
Request
- curl
curl https://stellar-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "getLatestLedger"}'
Response
- JSON
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "5229d814c153675ca7a92f47780b5c0e9b8e8f0473330d2ff152805627b9728c",
"protocolVersion": 29,
"sequence": 64923230,
"closeTime": "1791901932",
"headerXdr": "AAAAHVkM+aFHp9m++uAtlJSKBX/hf2nFYQh1ZDBQ7DFK4ZxoEPYCkH+Xu4JrNG/8Ndh1csFTU4gx35ZZYiYwBJInEB4AAAAAas5A7AAAAAAAAAABAAAAAJF6qaV6rVYpKqq1XjVfHyYvW2GjLyQnfuwoC9gxe9N0AAAAQIY+vKHpAOqN9KdbBkqnT6hOF5GMK8V6U5zGVg87RWTGSo0V5jGRDT626I3W3EDXz7oJ2keBLg+BKi/oG50tZgJTRJpAfUURV84t3By7ZOKZeGU3bQ4g/nuXz1jmvdw8c9CbDZddofA8BNVaBiiVlReGTwvXwuWy8qA3vvgNaP6+A96mXg6iHrPseVthAABii3M/uYgAAAEWAAAAAG7yRLEAAABkAExLQAAAA+hOAaKo3dPKLn5U20eEAyaTzL2j+ez6bgnLLa8YnhSpBY0KBKqWXEO0pErqqn1va16I/maAQbZ9g4JxkLeap6jrcQqumeJXyz+hajTauqk4pepBPGRHoyzBExL56GE1/esqqw4jbU4IoqobhBged0Y0ebssSuWTHMczfE6dlLjXHgAAAAA="
}
}