Giter Club home page Giter Club logo

supply-calculator's Introduction

XRPL supply calculator

This tool will fetch an entire ledger from the XRPL (a websocket node), and store it in SQLite3. It'll then allow you to crunch the fetched data to balance stats per account. The balance stats per account result in the final number of spendable (free flowing) XRP.

Please note: the SQLite file will end up well over 3GB when this tool is done with the data.

Fetches an entire ledger (all objects) to a SQLite3 database, then to crunch some numbers.

Use the DEBUG=xrplstats* prefix (env. var.) to get output on your terminal while running.

Best performance when writing to a ramdisk, use the output folder, eg. when checked out to /data/supply-calculator:

mount -t tmpfs -o rw,size=4G tmpfs /data/supply-calculator/output

Fetch a ledger

This will fetch all ledgers into output/LEDGERINDEX.sqlite, table objects.

If this process gets stuck (eg. disconnected XRPL node) you can safely quit it and restart the process: it will continue fetching data where it left off (thanks to the marker in the meta table)

npm run fetch LEDGERINDEX

eg.

npm run fetch 63638161

Optional environment variables:

  • SERVER (a ws:// or wss:// URL)
  • LIMIT (number: the amount of markers to follow)
  • ACCOUNTS (a comma separated list with accounts to fetch data for)

Sample (raw) command:

SERVER=ws://10.40.4.3:8080 LIMIT=100000 DEBUG=xrplstats* node src/index.js 63638161

Calculate results

You can always stop the calculation mid process, it will pick up where it left off.

After calculating and writing the per account stats to the SQLite3 file, a LEDGERINDEX.json file will be placed in the output directory containing the ledger index, ledger close time(human), amount of XRP spendable (by all accounts combined) and the amount of accounts with spendable balance.

npm run calc LEDGERINDEX

eg.

npm run calc 63638161

Sample (raw) command:

DEBUG=xrplstats* src/calc.js 63638161

supply-calculator's People

Contributors

wietsewind avatar alloynetworks avatar

Stargazers

Yuriy B. avatar

Forkers

1qbits-com

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.