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

ledger

Retrieves information about a ledger version, including its header and optionally its transactions.

This method will use 40 Compute Units.


Reference: Here

Parameters

  • ledger_hash (string, optional) A 32-byte hex string for 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, closed or current.

  • transactions (boolean, optional) If true, return information on transactions in the specified ledger version. The default is false.

  • expand (boolean, optional) Provide full JSON-formatted transaction information instead of only hashes. The default is false. Ignored unless you request transactions.

  • owner_funds (boolean, optional) If true, include an owner_funds field in the metadata of OfferCreate transactions. Ignored unless transactions are included and expand is true.

  • binary (boolean, optional) If true, and transactions and expand are both true, return transaction information in binary format instead of JSON.

  • queue (boolean, optional) If true, and the command is requesting the current ledger, include an array of queued transactions in the results.

Returns

  • ledger (object) The complete ledger header data, including account_hash, close_flags, close_time, close_time_human, close_time_iso, close_time_resolution, closed, ledger_hash, ledger_index, parent_close_time, parent_hash, total_coins, transaction_hash and, if requested, transactions.

  • ledger_hash (string) The unique identifying hash of the entire ledger, as hexadecimal.

  • ledger_index (number) The ledger index of this ledger.

  • validated (boolean) If true, this is a validated ledger version.

  • queue_data (array) Omitted unless requested with the queue parameter. Queued transactions, in the same order as the queue.

Over WebSocket, send {"id":1,"command":"ledger","ledger_index":"validated","transactions":false,"expand":false} to wss://mainnet.xrpl.validationcloud.io/v1/<YOUR_API_KEY_HERE>.

Requesting transactions: true with expand: true returns every transaction in the ledger in full, including metadata. This is the heaviest call on this endpoint; a busy mainnet ledger can return several megabytes. Request hashes only (expand: false) and fetch individual transactions with tx when you do not need the whole ledger.

Last updated

Was this helpful?