Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

XRP Ledger Stats

You can use this tool to fetch all the account balance information or a specific XRPL ledger number.

This tool will connect to a rippled-server using websockets. The default server it will connect to is This server doesn't contain a lot of ledger history, so you can manually specify a different rippled-server.

Please note: the public rippled servers at (recent ledgers) and (full history) are used by many XRP apps and tools, so running your own rippled server (and connecting to that one, of course) will definitely improve performance. (rippled node: Docker Image).


You'll need to have node (nodejs) installed on your computer. Node runs the JS (Javascript) code in this repository source.

  1. If you are on Windows: install Git:
  2. Clone this repository: git clone
  3. Install dependencies: enter the cloned folder (on the commandline) using cd xrp-ledgerstats and run: npm install
  4. Fetch a specific ledger into a local json file
  5. Read the ledger data (from the local json file) and calculate stats
  6. Show the stats in your terminal, and export the stats to a json file.



Fetch ledger account data into .json file

Run the code to fetch all account balances using:

npm run fetch

If you don't append any arguments, the latest (closed) ledger will be fetched from the public server.

If you want to fetch a specific ledger, append the ledger index:

npm run fetch 38596307

Please note: to fetch a specific ledger, the server should have the data for this ledger. If you want to fetch a ledger that goes way back in time, you'll probably want to query (full history servers):

If you want to query a specific rippled node:

npm run fetch 32570

(This tool will assume secure websockets (wss://) if you only enter a hostname. Prepend ws:// to connect to an insecure host)

Instead of a ledger number (or omitting one) you can also enter one of the rippled ledger info keywords:

npm run fetch "closed"

**The tool will save the balance information for the ledger in ./data/ledgerno.json, eg. ./data/38596307.json.

JSON output format

The JSON files stored in the ./data/ folder will contain all the accounts (balances[x].a) found in the given ledger index with their balances (balances[x].b):

  "stats": {
    "close_time_human":"2013-Jan-01 03:21:10"
  "balances": [
    [ ... more data ]

Process ledger data from .json file (to stats)


npm run stats 32570

... where 32570 is the ledger index you want to process. You should -of course- have fetched this ledger first.

The stats will be displayed in the terminal and exported to ./data/ledgerno.stats.json in this format:

  meta: { ... },
  top100Balance: 123.567,
  accountPercentageBalance: [ 
      percentage: 1,
      numberAccounts: 2,
      balanceEqGt: 3
    { ... }
  accountNumberBalanceRange: [
      numberAccounts: 1,
      balanceFrom: 2,
      balanceTo: 3,
      balanceSum: 4
    { ... }

Batch processing

To download a ledger, calculate the stats, increment (backwards) and do the same all over again, you can use:

npm run batch {startledger} {rippledserver} {increment}


npm run batch 38630615 100000

... to start at ledger 38630615 and then increment backin history by 100,000 ledgers.

The batch process will cleanup the downloaded ledger data (to save storage space). The json files containing the calculation results will be stored in ./data/.


Fetch all account data from a rippled ledger (and calculate stats)








No releases published


No packages published