eoscostarica / eos-rate

EOS Block Producer Ratings and Voting Portal :star2:
https://eosrate.io
MIT License
27 stars 26 forks source link

Serve Block Producer List #6

Closed gaboesquivel closed 5 years ago

gaboesquivel commented 6 years ago

We need to serve a list of block producers to app containing relevant info from their profile.

Use info from eosio.system with: Information from the producerjson contract.

gaboesquivel commented 6 years ago

Ref https://developers.eos.io/eosio-nodeos/reference . see get_producers

gaboesquivel commented 6 years ago

Ref bp.json standard https://github.com/eosrio/bp-info-standard

gaboesquivel commented 6 years ago

@murillojorge @rubenabix the idea is to aggregate all data to display logo, location and all info we can gather from a BP on their profile page

gaboesquivel commented 6 years ago

@rubenabix usage example of EOS Camel API pkg https://github.com/gaboesquivel/eos-actions/blob/master/index.js

gaboesquivel commented 6 years ago

The RPC endpoint is not returning the data we need.

We need to:

something like this

const exec = require('await-exec')
try{
  const producersList = await exec(`cleos.sh system listproducers -j`)
}catch(err){
  logger.error(err)
}

then get all bp.jsons

const got = require('got')
const getBpJson = (url) => got(url)
const producersData = procudersList.map(bp => getBpJson(bp.bpJsonUrl))

and finally save the data to MongoDB using the Block Producer mongoose Model

gaboesquivel commented 6 years ago

Another option re-enabling a unix cron we use to have to generate that list on one of EOS Costa Rica nodes monitor.eosio.cr/mainnet-producers.json .. It's not currently working. Thoughts @xavier506 ?

gaboesquivel commented 6 years ago

Actually I think we don't want to be running a node on Zeit just to able to execute cleos to get the system producerslist

gaboesquivel commented 6 years ago

I'd look this

const got = require('got')
const producersList = await got('https://monitor.eosio.cr/mainnet-producers.json')
const getBpJson = (url) => got(url)
const producersData = procudersList.map(bp => getBpJson(bp.bpJsonUrl))
// and finally save the data to MongoDB using the Block Producer mongoose Model
gaboesquivel commented 6 years ago

I just talked to @xavier506, we are going re-enable the mainent producers json cron job / service and we'll query that.

No need to run an EOS node on this project. @rubenabix

xavier506 commented 6 years ago

Para el mainnet-producers.json estoy corriendo el siguiente cron job en el server docker exec eosio /opt/eosio/bin/cleos -u https://api.eosio.cr --wallet-url http://127.0.0.1:8888 system listproducers -l 1000 -j > /var/www/monitor.eosio.cr/public_html/mainnet-producers.json

Esto tira la lista de los primeros 1000 producers

gaboesquivel commented 6 years ago

Cool, please let us know when we can start using it.

xavier506 commented 6 years ago

Here is an initial list of BPs in JSON format

https://github.com/eoscostarica/rate.eoscostarica.io/blob/master/mainnet-producers.json

gaboesquivel commented 6 years ago

https://monitor.eosio.cr/mainnet-producers.json

gaboesquivel commented 6 years ago

hey @rubenabix we should be using the On-Chain Data instead.

https://validate.eosnation.io/data/

here you get all BPJSON data from Blockchain. https://validate.eosnation.io/bps.json .

gaboesquivel commented 6 years ago

I think we can just configure demux to listen to system_contract:regblockproducer and producerjson_contract:set

https://github.com/EOSIO/eos/blob/master/contracts/eosio.system/eosio.system.cpp

https://github.com/greymass/producerjson/blob/master/producerjson.cpp

gaboesquivel commented 5 years ago

solved by https://github.com/eoscostarica/eos-rate/commit/4838b60dc652714d1c6b911ea5a7a31e6428cea9