Git Product home page Git Product logo

hnt-explorer's Introduction

Continuous Integration

hnt-explorer

This application extracts data from helium-programs via Solana RPC and serves it via HTTP. There are CLI commands meant to run and test the data extraction logic.

Building and running

You only need to do this if you want to run the server locally and/or make changes. Otherwise, skip to the next section.

cargo run -- server starts the server. By default, it will hit the public Solana RPC so this will probably error. Use the environmental variable SOL_RPC_ENDPOINT to set a different RPC endpoint (checkout Helius for example).

Public endpoint

I am currently hosting a public endpoint here: https://hnt-explorer.herokuapp.com. Prepend the paths below with the endpoint.

Endpoints

GET /v1/accounts/{account} Provides balances of HNT, MOBILE, and IOT. This endpoint is aware of positions and delegated stakes and will provide "locked" and "pending" amounts for balances. This endpoint is not aware of pending hotspot rewards (nor does it list hotspot NFTs).

Legacy Helium pubkeys of type ed25519 will redirect to the Solana address.

GET /v1/accounts/vehnt/{dao}/top Provides a list of the top 100 accounts in DAO voting weight. Possible DAO values are vehnt, veiot and vemobile.

GET /v1/positions/{dao}

Params: limit, start, timestamp

Provides list of all positions for a given DAO. Possible DAO values are vehnt, veiot and vemobile.

When no timestamp is provided, the latest pulled data is used, including timestamp.

Data is pulled every 5 minutes. Use the timestamp to maintain index on the same batch of data and start and limit to fetch more positions.

When no limit is provided, default of 500 items is used. limit is capped also at 500.

When no start is provided, default of 0 is used.

If using more than one parameter at a time, all parameters must be encapsulated in a string. For example:

https://hnt-explorer.herokuapp.com/v1/positions/vehnt?"timestamp=1682720623?start=500"

GET /v1/positions/{dao}/{position}

Provides data of a specific position from a specific DAO, including most recently derived voting weight (at most 5 minutes old). Shows pending rewards for veHNT positions.

GET /v1/positions/vehnt/csv

Serves most recent list of all veHNT positions as a CSV file.

GET /v1/positions/vehnt/metadata

Provides information about veHNT positions, such as total HNT amount, avg/median per position, avg/median duration, etc.

GET /v1/epoch/info

Legacy Endpoints

Warning: these will be deprecated soon.

GET /v1/delegated_stakes

Params: limit, start, timestamp

Provides list of delegated stakes. When no timestamp is provided, the latest pulled data is used, including timestamp. Data is pulled every 5 minutes. Use the timestamp to maintain index on the same batch of data and start and limit to fetch more positions.

When no limit is provided, default of 500 items is used. limit is capped also at 500.

When no start is provided, default of 0 is used.

If using more than one parameter at a time, all parameters must be encapsulated in a string. For example:

https://hnt-explorer.herokuapp.com/v1/delegated_stakes?"timestamp=1682720623?start=500"

GET /v1/delegated_stakes/csv

Serves most recent list of delegated stakes as a CSV file.

GET /v1/delegated_stakes/info

Environmental variables

  • SOL_RPC_ENDPOINT - Solana RPC URL (defaults to https://api.mainnet-beta.solana.com)
  • PORT - Port to listen on (defaults to 3000)

Pushing to heroku

You can host this program on Heroku easily by creating an app and pushing the container to it. Just change the app name below from hnt-explorer to whatever your app name is.

Build the container:

heroku container:push web -a hnt-explorer

Release it:

heroku container:release web -a hnt-explorer 

Check logs:

heroku logs --tail -a hnt-explorer

hnt-explorer's People

Contributors

lthiery avatar

Stargazers

 avatar stak_at avatar  avatar  avatar Enes Ördek avatar

Watchers

 avatar  avatar

hnt-explorer's Issues

handle rate limit response

 Error pulling data: Rpc(JsonDeserialization(Error("data did not match any variant of untagged enum AllResponse", line: 0, column: 0), "[{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32429,\"message\":\"Rate limit exceeded\"}}]", "{\"jsonrpc\":\"2.0\",\"id\":\"1688711886776\",\"method\":\"getProgramAccounts\",\"params\":[\"hvsrNC3NKbcryqDs2DocYHZ9yPKEVzdSjQG6RVtK1s8\",{\"filters\":[{\"dataSize\":180},{\"memcmp\":{\"offset\":0,\"bytes\":\"SWaVqr84bon\"}}],\"encoding\":\"base64\"}]}"))

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.