16 Jul, 2018

Yiimp API currencies network hashrate and reward patch

This time i needed to have in API currencies more data, so i changed

$data[$symbol] = array(
'algo' => $coin->algo,
'port' => getAlgoPort($coin->algo),
'name' => $coin->name,
'height' => (int) $coin->block_height,
'workers' => $workers,
'shares' => (int) arraySafeVal($shares,'shares'),
'hashrate' => round($factor * $algo_hashrate),
'estimate' => $btcmhd,
//'percent' => round($factor * 100, 1),
'24h_blocks' => (int) arraySafeVal($res24h,'a'),
'24h_btc' => round(arraySafeVal($res24h,'b',0), 8),
'lastblock' => $lastblock,
'timesincelast' => $timesincelast,
);

with

//Add network hash difficulty and symbol
$min_ttf = $coin->network_ttf>0? min($coin->actual_ttf, $coin->network_ttf): $coin->actual_ttf;
$network_hash = $coin->difficulty * 0x100000000 / ($min_ttf? $min_ttf: 60);

$data[$symbol] = array(
'algo' => $coin->algo,
'port' => getAlgoPort($coin->algo),
'name' => $coin->name,
'reward' => $coin->reward,
'height' => (int) $coin->block_height,
'difficulty' => $coin->difficulty,
'workers' => $workers,
'shares' => (int) arraySafeVal($shares,'shares'),
'hashrate' => round($factor * $algo_hashrate),
'network_hashrate' => $network_hash,
'estimate' => $btcmhd,
//'percent' => round($factor * 100, 1),
'24h_blocks' => (int) arraySafeVal($res24h,'a'),
'24h_btc' => round(arraySafeVal($res24h,'b',0), 8),
'lastblock' => $lastblock,
'timesincelast' => $timesincelast,
'symbol' => $coin->symbol,
);

Now go ahead and visit http://yourwebsitepool.com/api/currencies

Should look like this : http://multi.asicpool.org/api/currencies

About : adminux

Leave a Reply

Your email address will not be published. Required fields are marked *