[DEV] Blockexplorer

This topic is to talk about the development of our Blockexplorer.
Currently accessible under http://chain.nem.ninja

Of course Feedback is also welcomed here.

This topic is to talk about the development of our Blockexplorer.
Currently accessible under http://chain.nem.ninja

Of course Feedback is also welcomed here.

@freigeist:

I just deployed your latest changes. The chart looks really nice !
You forgot to commit d3.js though  :wink:

@freigeist:
There is a small bug in the display of the average times:



The second snapshot was taken one block later. The entire average graph shifted a few seconds up.

Hello.

@BloodyRookie , thanks for the info.
I have fund the bug and resolved it.
BTW: How did you get this -100 value for the time and averages scales in the chart, do you know
if there were any negative values for the block time in the output?!

@patmast3r:
I have updated the javascript code in the repository you can update nem-be.js file online
when you find the time.

Thanks.
Bye.


BTW: How did you get this -100 value for the time and averages scales in the chart, do you know
if there were any negative values for the block time in the output?!


Good question! You can see that the gray lines go below zero every now and then. But I don't know if that is just a drawing bug. There should be no negative block times.

It'd be cool if the time series chart could be zoomable and pan-able with a mouse, instead of having discrete zoom levels.


If there are too many points at a given zoom level, instead of averaging, I have an algorithm that was developed that better represents the trend of the data. Simply averaging can often destroy important details in time series data. I'll try to post that code tomorrow.


It'd be cool if the time series chart could be zoomable and pan-able with a mouse, instead of having discrete zoom levels.


If there are too many points at a given zoom level, instead of averaging, I have an algorithm that was developed that better represents the trend of the data. Simply averaging can often destroy important details in time series data. I'll try to post that code tomorrow.


I was thinking about making more levels or just returning a fuckload of blocks and let freigeist pick the ones he needs but I think those aren't exactly priorities right now :)

I need to finaly find a way to keep redis in sync properly or drop redis and query NIS directly.

What features are we missing ?

Right now it is always averaging over 60 blocks. Would be interesting to see how it's getting smoother if we average of more than 60 blocks (having a second slider).


Right now it is always averaging over 60 blocks. Would be interesting to see how it's getting smoother if we average of more than 60 blocks (having a second slider).


This could be done. I thing that the average slider will define the max and the min values for the chart display slider.
For example selecting the 120 averages will not give the possibility to select 60 block display od 940 display but
minimum 120 block display and maximum 880 block display.
Before I start with this I would like to wait for Makoto's algorithm so see what other kind of data he wants to put me on that chart!

Regardign to the negative values in chart I have not been able to replicate them in firefox neither in chromium.
Do you still see sometimes negative values in the chart? Please write down the last block height when that happens
so that I can verify the API output.

@freigeist: Will you have time to make those changes anytime soon?


@freigeist: Will you have time to make those changes anytime soon?


Hello.

Unfortunately I'm busy this weekend so I think I will have time from Monday
to add the second slider to the graph.
If I manage to find some free time this weekend I could manage to implement this
but i will not give any guarantees so lets keep it from Monday.

thanks, freigeist :slight_smile:


thanks, freigeist :)


@BloodyRookie
No problem! It has been implemented! ;)

@patmast3r:
I have updated the git repository with new code please update the blockchain when you find the time!
Thanks! :)

Hello.

@patmast3r: i had discussion with BloodyRookie about the block chain explorer and he thinks that is taking too much time
to show the chart when the averages for 1000 blocks are calculated so I'm gonna check if there is or where is the bottleneck in my code.

During this discussion we came to conclusion that some small changes in the output of the API are needed from your side.

Could you please change or add the API call that it returns number of blocks
similar to this:
http://chain.nem.ninja/api/stats/blocktimes?numBlocks=450

currently I can get only predefined number of blocks  with lvl parameter
http://chain.nem.ninja/api/stats/blocktimes?lvl=1  (2,3)

Also is it possible for you to send block ordered by block height as I see now (check the link above) the blocks are not sorted by height.

I have found one bug in your output please check the block
http://alice2.nem.ninja:7890/debug/block-info/get?height=41563

the value that i got from the API call at http://chain.nem.ninja/api/stats/blocktimes?lvl=3
was check the block "41563": -50000

I think that is all for now.
Bye.


Hello.

@patmast3r: i had discussion with BloodyRookie about the block chain explorer and he thinks that is taking too much time
to show the chart when the averages for 1000 blocks are calculated so I'm gonna check if there is or where is the bottleneck in my code.


It takes like a second for me. It's actually a lot faster than i would have anticipated.


During this discussion we came to conclusion that some small changes in the output of the API are needed from your side.

Could you please change or add the API call that it returns number of blocks
similar to this:
http://chain.nem.ninja/api/stats/blocktimes?numBlocks=450


Sure. I will set a max of 1000 though so noone can come and tell the server to work too hard ;)


currently I can get only predefined number of blocks  with lvl parameter
http://chain.nem.ninja/api/stats/blocktimes?lvl=1  (2,3)

Also is it possible for you to send block ordered by block height as I see now (check the link above) the blocks are not sorted by height.


They are ordered in height. Have you tried http://chain.nem.ninja/api/stats/blocktimes?lvl=1  in your browser ?
If i do i get this:

{"blocktimes": {"42496": 49000, "42497": 148000, "42498": 16000, "42499": 6000, "42500": 52000, "42501": 46000, "42502": 26000, "42503": ...}}

Notice the keys are ordered from 42496 to 42503.



I have found one bug in your output please check the block
http://alice2.nem.ninja:7890/debug/block-info/get?height=41563

the value that i got from the API call at http://chain.nem.ninja/api/stats/blocktimes?lvl=3
was check the block "41563": -50000

I think that is all for now.
Bye.


I'll look into it.

http://chain.nem.ninja/api/stats/blocktimes remains the same so I don't break the current function

http://chain.nem.ninja/api/stats/v2/blocktimes?height=1000&numBlock=100

I had to change the json to order it - I hope you can work with it.
I haven't yet set a limit on the numBlock because the API spits out the entire current chain in about 2,5 seconds. Let me know what your max is and I'll limit it later on :wink:


http://chain.nem.ninja/api/stats/blocktimes remains the same so I don't break the current function

http://chain.nem.ninja/api/stats/v2/blocktimes?height=1000&numBlock=100

I had to change the json to order it - I hope you can work with it.
I haven't yet set a limit on the numBlock because the API spits out the entire current chain in about 2,5 seconds. Let me know what your max is and I'll limit it later on ;)


Ok thanks.

I have tried to use the v2 API calls it seems is not working properly if i want to retrieve last n blocks.
For example if I want to get the last 1000 blocks I would need to make a similar request
because currently last block is 44470

http://chain.nem.ninja/api/stats/v2/blocktimes?height=44470&numBlock=1000
the output is as follows:
{"blocktimes": [[44470, 20000]]}



http://chain.nem.ninja/api/stats/blocktimes remains the same so I don't break the current function

http://chain.nem.ninja/api/stats/v2/blocktimes?height=1000&numBlock=100

I had to change the json to order it - I hope you can work with it.
I haven't yet set a limit on the numBlock because the API spits out the entire current chain in about 2,5 seconds. Let me know what your max is and I'll limit it later on ;)


Ok thanks.

I have tried to use the v2 API calls it seems is not working properly if i want to retrieve last n blocks.
For example if I want to get the last 1000 blocks I would need to make a similar request
because currently last block is 44470

http://chain.nem.ninja/api/stats/v2/blocktimes?height=44470&numBlock=1000
the output is as follows:
{"blocktimes": [[44470, 20000]]}


The height parameter is for the height to start from. So if you wanted the last 1000 blocks it's be better to just to

http://chain.nem.ninja/api/stats/v2/blocktimes?numBlock=1000

If you don't provide a height you'll get the last numBlock of blocks :)

If you want the 100 blocks after height 1000 you'd do

http://chain.nem.ninja/api/stats/v2/blocktimes?height=1000&numBlock=100


The height parameter is for the height to start from. So if you wanted the last 1000 blocks it's be better to just to

http://chain.nem.ninja/api/stats/v2/blocktimes?numBlock=1000

If you don't provide a height you'll get the last numBlock of blocks :)

If you want the 100 blocks after height 1000 you'd do

http://chain.nem.ninja/api/stats/v2/blocktimes?height=1000&numBlock=100


Aha so the values in the output
{"blocktimes": [[1000, 27000], [999, 130000], [998, 67000],....
(1000,999,988...) are not block heights!
So blocks are requested from (height) -> (height + num) but output is sorted in reverse!
I get it now.
Ok thanks.

I can work further with this new API output but i must say i the older output format had one advantage
and this is that you can know exactly what block height had which block time value
and it was easier to spot error in the output for example a missing block or negative value
can be immediately linked to block of height (N) just by looking at the output.

Maybe would be good idea to make also the v2 API output
similar in a way that instead of showing 1000,999,988... the block height value is placed in array like:
{"blocktimes": [[44470, 27000], [44469, 130000], [44468, 67000],....

EDIT:
one small bug i found is that
the api call without any parameter http://chain.nem.ninja/api/stats/v2/blocktimes
returns last 117 blocktime values not 120 like the other api called without parameters.