For the complete documentation index, see llms.txt. This page is also available as Markdown.

ledger_data

Retrieves contents of the specified ledger's state tree. You can iterate through several calls with the returned marker to retrieve the entire contents of a single ledger version.

This method will use 40 Compute Units.


Reference: Here

Parameters

  • ledger_hash (string, optional) The hash of the ledger version to use.

  • ledger_index (number or string, optional) The ledger index of the ledger to use, or a shortcut string such as validated.

  • binary (boolean, optional) If true, return ledger entries as hexadecimal strings instead of JSON. The default is false.

  • limit (number, optional) Limit the number of ledger entries to retrieve. Cannot be more than 2048 (binary) or 256 (JSON).

  • marker (marker, optional) Value from a previous paginated response. Resume retrieving data where that response left off.

  • type (string, optional) Filter results to a specific type of ledger entry, such as account, amm, offer, state, nft_page or payment_channel.

Returns

  • ledger (object) The complete ledger header data for this ledger version.

  • ledger_index (unsigned integer) The ledger index of this ledger version.

  • ledger_hash (string) Unique identifying hash of this ledger version.

  • state (array) Array of ledger entries from the ledger's state tree. In JSON mode each has LedgerEntryType, index and the fields for that entry type; in binary mode each has data and index.

  • marker (marker) Server-defined value indicating the response is paginated. Pass this to the next call to resume.

Over WebSocket, send {"id":1,"command":"ledger_data","ledger_index":"validated","limit":2} to wss://mainnet.xrpl.validationcloud.io/v1/<YOUR_API_KEY_HERE>.

With a type filter the server still scans limit entries per call and returns only the matching ones, so a page can come back with an empty state array and a marker. Keep paging with the marker.

Last updated

Was this helpful?