Saltar al contenido principal

getLedgers

The getLedgers method returns a detailed list of ledgers starting from the user specified starting point that you can paginate as long as the pages fall within the history retention of their corresponding RPC provider.

Params

(2)

Please note that parameter structure within the request must contain named parameters as a by-name object, and not as positional arguments in a by-position array

1. startLedger (required)

Ledger sequence number to start fetching responses from (inclusive). This method will return an error if startLedger is less than the oldest ledger stored in this node, or greater than the latest ledger seen by this node. If a cursor is included in the request, startLedger must be omitted.

number

Sequence number of the ledger.

2. pagination

Pagination in RPC is similar to pagination in Horizon. See Pagination.

cursor
string

A unique identifier (specifically, a TOID) that points to a specific location in a collection of responses and is pulled from the paging_token value of a record. When a cursor is provided, RPC will not include the element whose ID matches the cursor in the response: only elements which appear after the cursor will be included.

limit
number

The maximum number of records returned by the endpoint.

Result

(getLedgersResult)
ledgers
array[object]
hash
string

The hash of the ledger header which was included in the chain

sequence
number

The sequence number of the ledger (sometimes called the 'block height').

ledgerCloseTime
string

The timestamp at which the ledger was closed.

headerXdr
string

A base64 encoded string of the raw LedgerHeader xdr struct for this ledger.

metadataXdr
string

A base64 encoded string of the raw LedgerCloseMeta xdr struct for this ledger.

latestLedger
number

The sequence number of the latest ledger known to Stellar RPC at the time it handled the request.

latestLedgerCloseTimestamp
string

The unix timestamp of the close time of the latest ledger known to Stellar RPC at the time it handled the request.

oldestLedger
number

The sequence number of the oldest ledger ingested by Stellar RPC at the time it handled the request.

oldestLedgerCloseTimestamp
string

The unix timestamp of the close time of the oldest ledger ingested by Stellar RPC at the time it handled the request.

Example

Query a list of ledgers starting from the given startLedger.

Request

curl -X POST \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 8675309,
"method": "getLedgers",
"params": {
"startLedger": 36233,
"pagination": {
"limit": 2
}
}
}' \
https://soroban-testnet.stellar.org | jq

Result

{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"ledgers": [
{
"hash": "434de11b427aa4b6f8cda259ac2111a6aa148d2ab6b4c7affe864e94a9f4bd80",
"sequence": 36233,
"led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RdWGvtDvnkIVhlmrF9bT/F50/CmwchjuRTC+41OZJYAAAAXSGYyqAAAIcQAABcjAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAI2IAAAAAGdbPEQAAAAAAAAAAQAAjYoAAAAAAAAAADUXVhr7Q755CFYZZqxfW0/xedPwpsHIY7kUwvuNTmSWAAAAF0hmMeAAACHEAAAXIwAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAACNiAAAAABnWzxEAAAAAAAAAAMAAAAAAAAAAgAAAAMAAI2KAAAAAAAAAAA1F1Ya+0O+eQhWGWasX1tP8XnT8KbByGO5FML7jU5klgAAABdIZjHgAAAhxAAAFyMAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAjYgAAAAAZ1s8RAAAAAAAAAABAACNigAAAAAAAAAANRdWGvtDvnkIVhlmrF9bT/F50/CmwchjuRTC+41OZJYAAAAXSGYx4AAAIcQAABckAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAI2KAAAAAGdbPE4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANUF7AAAAAAAAAAA"
}
],
"latestLedger": 36379,
"latestLedgerCloseTime": 1734033188,
"oldestLedger": 29312,
"oldestLedgerCloseTime": 1733997822,
"cursor": "36234"
}
}