Giter Site home page Giter Site logo

pinkdiamond1 / xrplwinanalyzer-proof-of-concept Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xrplwin/xrplwinanalyzer-proof-of-concept

0.0 0.0 0.0 163 KB

XRP Ledger Analyzer by XRPLWin

License: ISC License

Shell 0.52% PHP 96.60% Blade 2.88%

xrplwinanalyzer-proof-of-concept's Introduction

XRPLWin Analyzer

WebUI is located here: https://github.com/XRPLWin/xrplwinanalyzer-ui

Motivation

When working on xrpl.win website it has shown it is hard to get aggregated data of specific account without querying XRPL by using markers. To show account value history and draw a graph, one needs to fetch all account transactions, parse them and cherry pick to show some coherent data.

Doing analytics like connection between two accounts and or issuer accounts is also fairly CPU time expensive.

About

XRPLWin Analyzer is software which analyzes and organizes XRPLedger data. Data is fetched and stored in local/cloud database to easy access. Once data is fetched it will not query Ledger again for the same queries, this will mitigate unnecessary requests to XRPL.

Account historical value

With analyzed transactions it is easy to get historical value of specific account, draw graph and pin-point incoming transactions. This will help users to calculate gains over time for TAX purposes, viewing gains/losses etc...

Account connections (scam detection)

Find which accounts are connected to other accounts. This data will help to identify Token owners back to source of created account.

Token scamming is serious problem and via this feature by analyzing Issuer account, those connections will be revealed. For example: It is possible to detect which tokens are issued same owner via direct method like account creator or indirect like cold/hot wallets owners, and/or who holds majority (see rules) of tokens.

Point is to analyze issuers and output warnings if those tokens are in connection to "Blacklisted" account.

Blacklisting and account local metadata

With account (r...) there will be local metadata connected and stored in local DB. This can contain various notes and comments.

Custom rules

Rules will allow fine tuning when detecting connections between accounts.

Use cases

  • Dashboard for XRP accounts
    • Build UI for displaying data provided by Analyzer via REST API calls
    • Account Value by Holding Tokens and XRP over time (historical data)
    • Easy access to data for calculating TAX purposes (US citizens)
  • Scam detection and prevention
    • Flagged (blacklisted) accounts and their involvement in relation to issued Tokens
    • Issued currency trend analysis and tracking
  • Other...

Analyzed data sharing between Analyzer Nodes

For each analyzed account some time is allocated for that work to be done, this can be resource expensive for analyzer server and for XRPLedger.

When running multiple instances (nodes) of XRPLWin Analyzer, (eg. official hosted on analyzer.xrpl.win and your own), it is possible to pull analyzed data from other nodes in an efficient manner via JSON data dumps. For this to work both instances need to be on same version and same code HASH.

For each instance to be aware of others, there will be official registry of nodes hosted by xrpl.win.

Sample workflow

Analyzer 1 (analyzer.xrpl.win) analyzes rACCOUNT...1 and finishes after X minutes/hours. Analyzer 2 (foo.example.com) needs analyzed data of rACCOUNT...1, instead of going to ledger it can lookup that account on each of available nodes. First successful find will be on "Analyzer 1", stream download will be pulled via e.g. https://analyzer.xrpl.win/account/rACCOUNT...1/dump.json

Analyzer 2 then parses and inserts/updates local database.

Requirements

  • Web server (Nginx)
  • PHP 7.4.x
  • MySQL DB
  • Redis
  • Varnish v4 with Tags support (optional)
  • php libs: BCMath

Installation

See: https://laravel.com/docs/8.x/installation

Copy .env.example to .env and setup variables

composer install --no-dev
php artisan key:generate
php artisan config:cache
php artisan route:cache
chown -R root:daemon ../
find storage/ -type d -exec chmod 770 {} \;
find storage/ -type f -exec chmod 760 {} \;

Services via systemd

/etc/systemd/system/xrplwinanalyzer-queue-default.service

[Unit]
Description=Artisan Analyzer Default Queue

[Service]
User = root
Group = daemon
Restart=on-failure
WorkingDirectory=/opt/nginx/htdocs/xrplwinanalyzer
ExecStart=/opt/php/bin/php /opt/nginx/htdocs/xrplwinanalyzer/artisan  queue:work --sleep=3 --tries=1

[Install]
WantedBy=multi-user.target

To reload service if configuration changed: systemctl daemon-reload
To enable on startup systemctl enable xrplwinanalyzer-queue-default.service
systemctl [start/stop/reload/status] <domain>-queue-<laravelqueuename>.service
Log: journalctl -u xrplwinanalyzer-queue-default.service
To gracefully restart laravel queue run: php artisan queue:restart

Caching

Although it is possible to cache responses in various ways it is recommended to use Redis for internal caching and Varnish for REST API responses.

Bug reports

If you discover a bugs within XRPLWin Analyzer, please send an e-mail to XRPLWin via [email protected].

License

XRPLWin Analyzer is open-sourced software licensed under the ISC License.

xrplwinanalyzer-proof-of-concept's People

Contributors

zgrguric avatar

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.