Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: kalgecin on May 09, 2013, 11:18:26 PM



Title: [PERL][YAC] YaCoin stats
Post by: kalgecin on May 09, 2013, 11:18:26 PM
I hacked together a perl script to show live stats. to use it, you need to install libjson-perl.
For Ubuntu people:

Code:
sudo apt-get install libjson-perl

I don't have windows, so if someone gets this running on windows please share what you needed to install.

Code:
#!/usr/bin/perl
use JSON;
$numsecs = 30;               #seconds to refresh
$hashespersec = 400000;  #Your mining speed
$input = `./yacoind getinfo`;
#print "Input:\n".$input."\n";
$json = JSON->new->allow_nonref;
$arrs = $json->decode($input);
$oldblocks = $arrs->{'blocks'};
sleep $numsecs;
while(1==1){
$input = `./yacoind getinfo`;
# print "Input:\n".$input."\n";
$json = JSON->new->allow_nonref;
$arrs = $json->decode($input);
# print "old: $oldblocks, new: ". $arrs->{'blocks'}."\n";
$secsperblock = ($numsecs/($arrs->{'blocks'}-$oldblocks));
print "Block: $secsperblock s ";
$hashesperblock = (2**32)*$arrs->{'difficulty'};
        $blocks = $arrs->{'blocks'}-$oldblocks;
        $speed = ($blocks*$hashesperblock)/$numsecs;
$time = $hashesperblock/400000;
$speed = $speed/$hashespersec;
        printf "Netspeed: %.3f MH/s %.3f hrs/b\n",$speed,$time/3600;
$oldblocks = $arrs->{'blocks'};
sleep $numsecs;
}

usage:
Code:
kalgecin@laptop:~/yacoin/src$ perl ~/yacoin.pl
suggestions for improvement are being accepted. Criticism is also accepted  :P ;)

Donations: Y7HPdphiDdH1Q7T2NJ4gxvNxP6XqPnVcNR


Title: Re: [PERL][YAC] YaCoin stats
Post by: limitless on May 09, 2013, 11:20:52 PM
nicely done!