ethereumclassic / explorer

EthereumClassic Block Explorer
MIT License
263 stars 252 forks source link

Create API for miner stats #27

Closed elaineo closed 8 years ago

elaineo commented 8 years ago

something like this: http://etherscan.io/stats/miner?range=7

kimisan commented 8 years ago

Look good, but may I start it from 2D donut chart first? I will upgrade it to 3D or more features in the near future. By the way, may you provide me the API for ETC miner's share percentage ?

elaineo commented 8 years ago

Go ahead and make the chart first. If you define the API you want, I will format the output to look like what you need. I'll work on this later today.

elaineo commented 8 years ago

Actually, if you define all the stats you need re: miners charts, that will help me build the DB

kimisan commented 8 years ago

Ok, got it. And I start to define all the stats I need.

elaineo commented 8 years ago

I'm now working on the server-side processing of blocks to stat recording mining stats history. (just an update)

elaineo commented 8 years ago

@kimisan what source are you using to record the hashrate stats? Do you prefer hosting that on your own DB, or should I build the API on the server?

kimisan commented 8 years ago

API on the server is bettter, I am planing changing the hashrate chart source to API on the server

kimisan commented 8 years ago

Now, the chart source source is come from @matthewjamesr 's API , and save at my own DB.

elaineo commented 8 years ago

okay, thanks. i'll create a separate db on the server for this.

On Mon, Aug 8, 2016 at 11:04 PM, Kimi Sian-yu Chen <notifications@github.com

wrote:

Now, the chart source source is come from @matthewjamesr https://github.com/matthewjamesr 's API

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ethereumproject/explorer/issues/27#issuecomment-238461813, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPZr2ht0FPZS7vOXATLD3Sed59F2jveks5qeBh0gaJpZM4JfA62 .

kimisan commented 8 years ago

@elaineo Please refer to the url. http://drawpie.com/etc_data_vis_json_format

data_array contain hour average data, one day 24 , one month around 24*32 = 768 I will get around 768 data for latest 1 month stats. I will design more chart with this data.

elaineo commented 8 years ago

@kimisan Does this work for the top miners? curl -H "Content-Type: application/json" -X POST -d '{"action":"miners"}' http://blocks.elaineou.com/stats

kimisan commented 8 years ago

@elaineo @@, can you provide more information? this commend of "curl -H "Content-Type: application/json" -X POST -d '{"action":"miners"}'" I am not sure how to use it @@

elaineo commented 8 years ago

it's an ajax post with those options.

request({
    method: 'POST',
    uri: '/stats',
    multipart: [
      {
        'content-type': 'application/json',
        body: JSON.stringify({"action":"miners"})
      },
kimisan commented 8 years ago

Look like i got the empty... Does it need run the node ./tools/grabber.js for listen mode? Now I just run node app.js

my code request({ method: 'POST', //preambleCRLF: true, //postambleCRLF: true, uri: 'http://127.0.0.1:3000/stats', multipart: [ { 'content-type': 'application/json', body: JSON.stringify({"action":"miners"}) } ] }, function (error, response, body) { if (error) { return console.error('upload failed:', error); } console.log('Upload successful! Server responded with:', body); });

elaineo commented 8 years ago

use tools/stats.js to populate the db

kimisan commented 8 years ago

Ok, got it . for 『 use tools/stats.js 』 But I have meet two issues, 1 . { Error: Trying to open unclosed connection.

maybe related to db close issue

  1. Error: Aborted due to error on block number 2079026: WriteError({"code":11000,"index":0,"errmsg":"E11000 duplicate key error collection: blockDB.blockstats index: number_1 dup key

maybe related to duplicate key

kimisan commented 8 years ago

For 『ajax post』 , it can work now, can get the miner information.

success bundle_hashrate.js:214 "[{\"_id\":\"0x9eab4b0fc468a7f5d46228bf5a76cb52370d068d\",\"count\":1},{\"_id\":\"0xa8d0e61c254efc29e9fccca3a0c28b50b556b34d\",\"count\":1},{\"_id\":\"0x929835a1a7721d4cd8be6535700e2761d898b39d\",\"count\":1},{\"_id\":\"0x0e9b9bb146e0af0174121b966a53e8f1cd20f48a\",\"count\":1},{\"_id\":\"0x8c5535afdbdeea80adedc955420f684931bf91e0\",\"count\":1}]"

elaineo commented 8 years ago

@kimisan : oh shoot, I forgot -- for the setInterval part at the bottom of tools/stats.js, I have it set to 0 minutes for testing. You can change it to 10 minutes, or whatever interval you want to use for updating your data.

Also, the Error: Aborted is fine, it ends when it comes to a block it has already seen. I should have given it a friendlier message, but yeah :)

kimisan commented 8 years ago

@elaineo, For miner Hashrate distribution chart is under design

By the way, can you provide Geographic coordinate api for getting data from db, which i can make a world heatmap map of ETC activity.

–]finish-the-thought 3 watching http://fork.ethstats.net/ is fun; blockheights (cant wait for the epic day ETC overtakes ETH) , block intervals and hashrates and the weird shapes created in the disagram (or visualization?) below. A more elaborate version would be awesome. also anything on a world map/globe ;)

elaineo commented 8 years ago

I don't know how to get the geographic coordinates. Is someone out their keeping track of all the nodes and IP addresses?

On Wed, Aug 17, 2016 at 11:01 AM, Kimi Sian-yu Chen < notifications@github.com> wrote:

@elaineo https://github.com/elaineo, For miner Hashrate distribution chart is under design

By the way, can you provide Geographic coordinate api for getting data from db, which i can make a world heatmap map of ETC activity.

–]finish-the-thought 3 watching http://fork.ethstats.net/ is fun; blockheights (cant wait for the epic day ETC overtakes ETH) , block intervals and hashrates and the weird shapes created in the disagram (or visualization?) below. A more elaborate version would be awesome. also anything on a world map/globe ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ethereumproject/explorer/issues/27#issuecomment-240495131, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPZr7Hbaud93CpV20pdRb3Aw2oNRB1Hks5qg0yJgaJpZM4JfA62 .

kimisan commented 8 years ago

Ok, i see. track all of the nodes is not easy.

elaineo commented 8 years ago

I just merged this one