<? require_once($_SERVER['DOCUMENT_ROOT'].'/private/config.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/init/mysql.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/private/func.php'); $hashrate = 10*1000000; $power = 0.25; $price = 2; $fee = 1; $decode_diff = get_json_param('block'); $decode = get_json_param('rur'); $difficulty = $decode_diff['diff']; $blockreward = blockreward($decode_diff['num'], $difficulty); $dash = $decode['rur']*$decode['dash_usd']; $seconds_per_day = 24*60*60; // 86400 $coins_per_day = ($seconds_per_day * $blockreward * $hashrate) / ($difficulty * (pow(2, 48) / hexdec('0x00000000ffff'))); $cost_per_day = round($power*$price*24, 2); $coins_per_hour = round($coins_per_day/24, 4); $coins_per_week = round($coins_per_day*7, 3); $coins_per_month = round($coins_per_day*30, 2); $coins_per_year = round($coins_per_day*365, 2); $cost_per_hour = round($cost_per_day/24, 2); $cost_per_week = round($cost_per_day*7); $cost_per_month = round($cost_per_day*30); $cost_per_year = round($cost_per_day*365); $fee_hour = round(($coins_per_hour*1/100)*$dash, 4); $fee_day = round(($coins_per_day*1/100)*$dash, 2);
$query_data->bindParam(':address', $row['address'], PDO::PARAM_STR); $query_data->execute(); if($query_data->rowCount() == 0) continue; while($row_data = $query_data->fetch()){ $all_reward = $all_reward+blockreward($row_data['bid'] ,$row_data['diff']); } $hashrate = $all_reward * ($row_avg_diff['AVG(diff)'] * (pow(2, 48) / hexdec('0x00000000ffff'))) / ($seconds_per_day * blockreward($row_avg_diff['MAX(bid)'], $row_avg_diff['AVG(diff)'])); if($row['address'] == 'P2Pool') $row['label'] = 'P2Pool'; if(empty($row['label'])){ $k = $k+$query_data->rowCount(); $other_reward = $other_reward+$all_reward; $all_reward = 0; continue;} $arr_count[] = $query_data->rowCount(); $percent = round($query_data->rowCount()/$all_data*100, 2); array_push($pools_stats, [ 'name' => $row['label'], 'blocks' => $query_data->rowCount(), 'reward' => round($all_reward, 2), 'hashrate' => $hashrate, 'percent' => round($percent, 2)]); $all_reward = 0; } $hashrate = $other_reward * ($row_avg_diff['AVG(diff)'] * (pow(2, 48) / hexdec('0x00000000ffff'))) / ($seconds_per_day * blockreward($row_avg_diff['MAX(bid)'], $row_avg_diff['AVG(diff)'])); array_push($pools_stats, [ 'name' => 'Unknown', 'blocks' => $k, 'reward' => round($other_reward, 2), 'hashrate' => $hashrate, 'percent' => round($k/$all_data*100, 2)]); foreach ($pools_stats as $key => $value) { $pools_all_blocks += $value['blocks']; $pools_all_reward += $value['reward']; $pools_all_hashrate += $value['hashrate']; } array_push($pools_stats, [ 'name' => 'Все', 'blocks' => $pools_all_blocks, 'reward' => $pools_all_reward, 'hashrate' => $pools_all_hashrate, 'percent' => 100]); uasort($pools_stats, 'myCmp'); foreach ($pools_stats as $key => $value) { $tpools = $tpools."<tr><td>{$value['name']}</td><td>{$value['blocks']}</td><td>{$value['reward']}</td><td>".auto_hash($value['hashrate'])."</td><td>{$value['percent']} %</td></tr>"; }