Sandbox version
For experimental use only. Proceed with caution.
ledger
Retrieves ledger header and optionally transaction data from the XRP Ledger.

The ledger method returns information about a specific ledger by index or hash, or the latest validated ledger. See: XRPL Protocol Reference → ledger.

HTTP (JSON-RPC)
##

Request the latest validated ledger header:

Bash
curl -s https://honeycluster.dev \
  -H 'Content-Type: application/json' \
  -d '{
    "method": "ledger",
    "params": [
      {
        "ledger_index": "validated",
        "transactions": false,
        "expand": false
      }
    ]
  }'
WebSocket
##
Bash
echo '{
  "command": "ledger",
  "ledger_index": "validated",
  "transactions": false,
  "expand": false
}' | websocat wss://honeycluster.dev
TypeScript
// npm i xrpl
import { Client } from 'xrpl';

async function getValidatedLedger(): Promise<void> {
  const client = new Client('wss://honeycluster.dev');
  await client.connect();
  const res = await client.request({
    command: 'ledger',
    ledger_index: 'validated',
    transactions: false,
    expand: false,
  });
  console.log(res);
  await client.disconnect();
}

getValidatedLedger().catch(console.error);
Notes
##
  • Use ledger_index: validated in production for consistent results.

  • Set transactions: true and expand: true to include full transaction objects.