GithubHelp home page GithubHelp logo

dev-ptera / yellow-spyglass-server Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 517 KB

Express API used to explore the banano network.

Home Page: https://www.yellowspyglass.com

TypeScript 98.18% JavaScript 1.82%
api banano-currency banano typescript express representative uptime-monitor wallets

yellow-spyglass-server's Introduction

Deprecation Notice

This repo has been archived; see Spyglass API for an alternative.

Yellow Spyglass Server (Deprecated)

https://www.yellowspyglass.com

Yellow Spyglass is a BANANO explorer and can be viewed here.

This explorer was written & maintained by dev-ptera, the batman representative.

Stack

This API was written with Express & Typescript.

RPC Calls

The NPM package @dev-ptera/nano-node-rpc is used to communicate with a local BANANO node via RPC commands.

Client

The client was written in a different repo and can be found here.

Running Locally

Copy the ENV variables

/* Can be 'production' or 'development' */
NODE_ENV=development
/* Port that listens for incoming requests. */
PORT=3000
/* URL used to send RPC commands. */
RPC_URL=[RPC_URL]
/* Used to fetch coinmarketcap price data. */
CMC_API_KEY=[key] 
/* Used to interact with the nano RPC node. */
RPC_AUTH=[key]

You will need a local .env file to run this project. It helps to have direct access to a BANANO RPC node so that the configuration can go as smooth as possible.

Copy the .env.template file, rename it to .env & provide the required fields.

Install Dependencies

Run yarn or npm install to install the dependencies.

Setup Data Sources

Price Service

In order for the price.service to work correctly, you will need a CoinMarketCap API key.
If you do not provide your own key, this service will fail to fetch the latest price information.

Known Accounts

The only other service that relys on an outside API is the known-accounts.service. It uses Kirby's public accounts API found here. Thanks, Kirby.

All Other Services

All other services rely on a local BANANO node to fetch data.

Start

yarn start will run the server locally.

Running this API & a BANANO Node on two separate machines?

Consider using @dev-ptera/nano-rpc-proxy, which can be configured to filter out any non-authenticated request and will refuse to run any disabled rpc-actions.

Contributing

Contributors are welcome! There's a contributing file for more info on how to help. I don't have a CONTRIBUTORS file on every repo, but all of my repos are open to contributors.

Issues?

Please either contact me via [email protected] or put a bug on the issues tab.

yellow-spyglass-server's People

Contributors

dev-ptera avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ffd-fly

yellow-spyglass-server's Issues

Bug: Small Reps marked as offline

Any rep with less than 100K Banano is marked as offline because they are getting filtered out in the rep-service. Fix this.

Example:
ban_1nannerspntaoqyrtnzjj76joe6yqjcterj6ef3qkdc6kfgswqu3pfaaqphe

Use the representatives_online RPC command.

online-reps API call results don't always match representatives table

// Get all online reps from nano rpc.
// The representatives_online RPC call is unreliable, so I mark reps as offline if they have been offline for OFFLINE_AFTER_PINGS pings.
const onlineReps = (await NANO_CLIENT.representatives_online().catch((err) =>
Promise.reject(LOG_ERR('cacheRepresentatives.representatives_online', err))
)) as RPC.RepresentativesOnlineResponse;

// Update online pings
AppCache.onlineReps.clear();
AppCache.repPings.currPing++;
for (const address of onlineReps.representatives) {
    // Use nano rpc results to add online/offline status to untracked reps.
    AppCache.onlineReps.add(address);
    AppCache.repPings.map.set(address, AppCache.repPings.currPing);
}

// Use the AppCache to mark trackedReps as online or offline.
for (const address of trackedReps.keys()) {
    const rep = trackedReps.get(address);
    rep.online = isRepOnline(address);
    // Update onlinReps cache results to match trackedReps cache results.
    rep.online ? AppCache.onlineReps.add(rep.address) : AppCache.onlineReps.delete(rep.address);
}

TODO

  1. Catch uncaught promises
  2. Insights Max TX check

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.