Showing Real Time Block/Witness in Witness Page

in #witness-category4 years ago

To obtain the current witness and block, you can use the following Steem-Js code

steem.api.getDynamicGlobalProperties(function(err, result) {
        if (err) return;
        if (!result) return;
         var block = result.head_block_number;            
         var witness = result.current_witness;
         //update information: witness is producing the block
});

When we call the above function using setInterval like every 3 seconds, the block numbers are updated realtime.

image.png

Witness Ranking Table: https://steemyy.com/witness-ranking/
Chinese Version: https://steemyy.com/witness-ranking-table/


I hope this helps!

Steem On!~

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com

Sort:  

Just because I needed something to occupy my time, here's something similar in bash shell script for linux...

#!/bin/bash
# Take API from first command line argument.  Use steemit if none given.
STEEMAPI="${1:-https://api.steemit.com}"

show_time_block_witness()
{
   NOW=$(date)
   curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_dynamic_global_properties", "params":[], "id":1}' ${STEEMAPI} \
      2>/dev/null \
      | jq -c -S '.result | {head_block_number, current_witness}' \
      | tr '[,:"{}]' ' ' \
      | ( read LBL1 BLOCK LBL2 WITNESS ; echo ${NOW}: ${BLOCK} ${WITNESS} )
}

SLEEPTIME=3
MAX=20 # Approximately 1 minute
for (( i=1; i <= ${MAX} ; i++ ))
do
   sleep ${SLEEPTIME} &
   show_time_block_witness
   wait
done

Nice. thank you!

Showing Real Time Block/Witness in Witness Page

is it show error ?

what error?

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.032
BTC 63617.36
ETH 3070.79
USDT 1.00
SBD 3.82