Giter VIP home page Giter VIP logo

navigator-sia's Issues

Navigator revamping plan

This plan aims to add these new functionalities:

  • Make Navigator independent of the Sia's explorer module
  • Add richlist functionalities support
  • Add capabilities and endpoints showing information about unspent outputs, what will enable apps related to offline signing of transactions (like Ledger tools) and Lite clients (using navigator as a trusted node)

PHASE 1:

  • Hashrate and Difficulty calculation
    • FIRST: Explore my hypotheses of Hashrate calculation creating a test script
    • IMMEDIATE: Create an script that collects hashrates and difficulty of blocks of current Db on a persistent JSON
    • IMMEDIATE: Make Siastats save on this file on every new block. Then re-arrange the array
    • Make siastats.js modules to graciously handle empty entries (null, "") hashrates and difficulties for day averages

PHASE 2:

  • Successful contract resolutions: trigger not on storage proof, but on end of the proof window:
    • The function that checks unresolved contracts has to manage both successful and unsuccessful (OPTIONAL CHANGE)
  • Handle errors better:
    • On Sia calls (check decentralizer)
    • On File read calls (check Decentralizer)
    • Check SQL error calls are being graciously handled
  • Richlist:
    • Create a new SQL table ScBalances: Address - Balance (Indexes on both)
    • Every 10000 blocks, save a persistent JSON including the distribution:
      • Request balaces > 0 order by Balance
      • Count the number of addresses
      • Balances of top10, top50 top100, top500, top1000, top5000
      • Balances of percentiles 10, 20, 30, 40..., relative to the % of Supply
    • SiaStats script that daily collects the top 10 addresses, their balance and their % of Supply
  • Outputs:
    • Create new SQL table ScOutputs: Hash* - address* - balance - spent (boolean) - createdOnBlock - spentOnBlock
    • Create output as hashtype
    • Navigator visualization of outputs (a simple table)
    • On each Sc operation: update as spent the sending outputs; create in the receiving outputs
    • Create API endpoint for unspent outputs of a certain address

PHASE 3:

  • Hashrate and Difficulty calculation
    • On each block:
      • if block < current: find the entry on the persistent JSON file
      • if there is no entry in the JSON file, leave the fields empty (Esto es una chapuza, pero hasta que anyadan esto a /consensus, es mi unica salida para dejar de usar explorer)
      • if block = current: make a consenus call: block has to be concordant (otherwise, leave empty) and synced has to be true (otherwise, repeat after timeout)
        • The difficulty of the NEXT block is included on the call. Divide by 1000 and make the floor?
        • When calculating hashrate, it uses a tally of the last 144 difficulties
        • The codeflow needs to carry on the tally of difficulties and a tally of timestamps (to use the older one for calculating hashrate)
        • I need to confim these hypotheses: create the script that collects those 144 blocks and simulates
  • Find parent unlockhashes on my own database: add a new array ("orphans") that contains: output, address, amount
  • New codeflow:
    • Data collection like right now
    • Parent finder
    • Difficulty & hashrate scripts
    • Save the SQL queries
    • Repeat for next block

Some TXs are being assigned wrongly to Block 0

I need to perform a sanity check on the block height of TXs being indexed, not allowing it to be 0 if the timestamp does not correspond with Genesis. Otherwise, assign it to "-" or "-1" (that will require me to change the type on the SQL database) or "null" or not index the TX at all.

Contract formtions made by `us`

The contract formation operations made by us look to be using a format incompatible with my code partially. While I am still accounting for each coin movement in the addresses, I am not displaying the returning change of the renter, which is indicated on siacoinoutputs[0]

To be addressed during the Navigator 1.1 revamp

Error on navigator.js

sudo node navigator.js

The output

======================================================
                  STARTING NAVIGATOR
======================================================


Logging started: 14/4/2022 - 12:32:56
* Navigator will use a local Sia instance in port 9980
* Connected to the SQLite database!
* API HTTP server running on port: 80
//// SQLite read error: SQLITE_ERROR: no such table: BlockInfo
* Creating tables for the database...
// Local Sia node unavailable for a /consensus call. Timing out 300000ms

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.