getLatestLedger - Stellar

Example code for the getLatestLedger JSON-RPC method. Complete guide on how to use getLatestLedger JSON-RPC in GetBlock Web3 documentation.

This method returns information about the latest known ledger on the Stellar network.

Parameters

  • None

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getLatestLedger",
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "id": "c73c5eac58a441d4eb733c35253ae85f783e018f7be5ef974258fed067aabb36",
        "protocolVersion": 20,
        "sequence": 2539605
    }
}

Response Parameters

Field
Type
Description

id

string

Hash identifier of the latest ledger

protocolVersion

integer

Current protocol version

sequence

integer

Sequence number of the latest ledger

Use Case

The getLatestLedger method is essential for:

  • Monitoring network synchronization status

  • Transaction confirmation tracking

  • Building block explorers

  • Determining current chain state

  • Sync progress verification

  • Protocol version checking

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN

503

Service Unavailable

Node is not synced

Last updated

Was this helpful?