} $qt .= "<TR {$oe}><TD></TD><TD><B>--- BLOCK BOUNDARY---</B></TD> <TD></TD> <TD></TD></TR>"; if ($oddeven) { $oe = " class=\"oddblockconfirmed\""; $oddeven = 0; } else { $oe = " class=\"blockconfirmed\""; $oddeven = 1; } $value['balance'] -= $maxbal; $alltotal += $maxbal; $total = 0; $blocks++; $paynum++; } else { $qt .= "<TR {$oe}><TD>{$paynum}</TD><TD><A HREF=\"/~wizkid057/newstats/userstats.php/{$key}\" id =\"{$key}\">{$key}</A></TD> <TD>" . prettyDuration(time() - $value['oldest']) . "</TD><TD>" . prettySatoshis($value['balance']) . "</TD></TR>"; if ($oddeven) { $oe = " class=\"oddblockconfirmed\""; $oddeven = 0; } else { $oe = " class=\"blockconfirmed\""; $oddeven = 1; } $total += $value['balance']; $alltotal += $value['balance']; $value['balance'] = 0; $paynum++; } } } $qt .= "</TABLE>";
} else { print " then you will be eligible for a payout of your balance (which is less than the automatic payout threshhold of " . prettySatoshis(1048576) . ") in a manual payout no sooner than " . prettyDuration($timetoqueue) . " from now."; } } else { print " then your less than " . prettySatoshis(131072) . " balance will remain unpaid and donated to the pool in approximately " . prettyDuration(3600 * 24 * 60 - (time() - $balupdate)) . ". If you are concerned about this small balance you should mine until your balance is greater than " . prettySatoshis(131072) . "."; } } if ($u16avghash > 0) { $sql = "select id,(pow(10,((29-hex_to_int(substr(encode(solution,'hex'),145,2)))::double precision*2.4082399653118495617099111577959::double precision)+log( (65535::double precision / hex_to_int(substr(encode(solution,'hex'),147,6)))::double precision )::double precision))::double precision as network_difficulty from shares where server={$serverid} and our_result=true order by id desc limit 1;"; $result = pg_exec($link, $sql); $row = pg_fetch_array($result, 0); $netdiff = $row["network_difficulty"]; $shares = $diff / (2500000000 / $netdiff); $stime = $shares / ($u16avghash / 4294967296); $netdiff = round($netdiff, 2); print " Maintaining your 3 hour hashrate average, this will take at least another " . prettyDuration($stime) . " at current network difficulty of " . number_format($netdiff, 2) . "."; } if ($minpay != 4194304) { print "<BR><BR>Note: Your minimum payout was customized to " . prettySatoshis($minpay) . " under 'My {$poolname}'."; } } else { # add up balances and see where we end up. $tb = 0; $bc = 0; $overflow = 0; foreach (preg_split("/((\r?\n)|(\r\n?))/", $payoutqueue) as $pquser) { if ($pquser != $givenuser) { $tb += $balanacesjsondec[$pquser]["balance"]; while ($tb > 2500000000) { $tb = $tb - 2500000000; $bc++;
?> <BR><BR> Current network difficulty: <?php echo $netdiff; ?> <BR> Current maximum PPS at this difficulty: <?php $xpps = sprintf("%.12f", currentPPSsatoshi($netdiff) / 100000000); $pps = substr($xpps, 0, 10); $subpps = substr($xpps, 10, 4); print "{$pps}<small>{$subpps}</small>"; ?> BTC<BR> Average time to find a block at <?php echo $phash; ?> at this difficulty: <?php echo prettyDuration($netdiff / ($sharesperunit * 20)); ?> <BR> Average pool blocks per day at <?php echo $phash; ?> at this difficulty: <?php echo printf("%.2f", 86400 / ($netdiff / ($sharesperunit * 20))); ?> <BR> <?php print_stats_bottom();
$output["rows"][$ri]["age"] = $row["age"]; $output["rows"][$ri]["roundstart"] = $row["start_unix"]; $output["rows"][$ri]["roundend"] = $row["time_unix"]; $output["rows"][$ri]["hashrate"] = sprintf("%u", $hashrate); $output["rows"][$ri]["percent_of_network"] = 100 * ($hashrate / ($row["network_difficulty"] * 7158278.82667)); $output["rows"][$ri]["accepted_shares"] = sprintf("%u", $row["acceptedshares"]); $output["rows"][$ri]["network_difficulty"] = sprintf("%.4f", $row["network_difficulty"]); $output["rows"][$ri]["block_finder"] = $fulladdress; $output["rows"][$ri]["block_finder_user_id"] = $row["user_id"]; if ($showpretty) { $output["rows"][$ri]["luck_pretty"] = number_format(round($luck, 1), 1) . "%"; $output["rows"][$ri]["roundstart_pretty"] = substr($row["roundstart"], 0, 19); $output["rows"][$ri]["roundend_pretty"] = substr($row["time"], 0, 19); $output["rows"][$ri]["percent_of_network_pretty"] = number_format(round($output["rows"][$ri]["percent_of_network"], 1), 1) . "%"; $output["rows"][$ri]["hashrate_pretty"] = prettyHashrate($hashrate); $output["rows"][$ri]["age_pretty"] = prettyDuration($row["age"], false, 1); $output["rows"][$ri]["duration_pretty"] = "{$hours}:{$minutes}:{$seconds}"; $output["rows"][$ri]["network_difficulty_pretty"] = formatSI($row["network_difficulty"], 2); if ($row["confirmations"] >= 120) { $confs = "Confirmed"; } else { if ($row["confirmations"] == 0) { $confs = "Stale"; } else { $confs = $row["confirmations"] . " of 120"; } } $output["rows"][$ri]["confirmations_pretty"] = $confs; } } if ($counts = apc_fetch("api.php - getblocks - blockcounts")) {
function block_table_row($row, $isodd) { $blocks_row = ""; if (isset($row["acceptedshares"])) { $luck = 100 * ($row["network_difficulty"] / $row["acceptedshares"]); } else { $luck = 0; } if ($luck > 9000) { $luck = "<A STYLE=\"color:#3B4033;font-weight:normal;text-decoration:none;cursor:default\" HREF=\"9000.php\">>9,000%</A>"; } else { $luck = number_format(round($luck, 1), 1) . "%"; } $roundstart = substr($row["roundstart"], 0, 19); if ($row["confirmations"] >= 120) { $confs = "Confirmed"; } else { if ($row["confirmations"] == 0) { $confs = "Stale"; $luck = "n/a"; $roundstart = "<SMALL>(" . substr($row["time"], 0, 19); $roundstart .= ")</SMALL>"; } else { $confs = $row["confirmations"] . " of 120"; } } $dbid = $row["blockid"]; if ($row["confirmations"] == 0) { $blocks_row .= "<TR id=\"blockrow{$dbid}\" BGCOLOR=\"#FFDFDF\" class=\"{$isodd}" . "blockorphan\">"; } else { if ($row["confirmations"] >= 120) { $blocks_row .= "<TR id=\"blockrow{$dbid}\" class=\"{$isodd}" . "blockconfirmed\">"; } else { $rowcolour = $isodd ? array(0xd3, 0xeb, 0xe3) : array(0xeb, 0xed, 0xe9); $uccolour = array(0xff, 0x7f, 0); $rowcolour = blend_colours($uccolour, $rowcolour, $row["confirmations"] / 120); $blocks_row .= "<TR class=\"{$isodd}" . "blockunconfirmed\" id=\"blockrow{$dbid}\" style=\"background-color: " . csscolour($rowcolour) . "\">"; } } $blocks_row .= "<TD sorttable_customkey=\"" . $row["age"] . "\" style=\"font-size: 0.9em;\">" . prettyDuration($row["age"], false, 1) . "</TD>"; $blocks_row .= "<TD style=\"font-size: 0.8em;\">" . $roundstart . "</TD>"; if (isset($row["duration"])) { list($seconds, $minutes, $hours) = extractTime($row["duration"]); $seconds = sprintf("%02d", $seconds); $minutes = sprintf("%02d", $minutes); $hours = sprintf("%02d", $hours); $blocks_row .= "<td sorttable_customkey=\"" . $row["duration"] . "\" style=\"width: 1.5em; text-align: right;\">{$hours}:{$minutes}:{$seconds}</td>"; $hashrate = $row["acceptedshares"] * 4294967296 / $row["duration"]; $hashratenum = $hashrate; $hashrate = prettyHashrate($hashrate); $hashrate = substr($hashrate, 0, -2); $percentofnetwork = $hashratenum / ($row["network_difficulty"] * 7158278.82667); $percentofnetwork = sprintf("%.2f%% of network", $percentofnetwork * 100); $hashrate = "<span title=\"{$percentofnetwork}\">{$hashrate}</span>"; } else { $blocks_row .= "<td style=\"text-align: right;\">n/a</td>"; $hashrate = "n/a"; } $blocks_row .= "<TD style=\"text-align: right;\" sorttable_customkey=\"" . $row["acceptedshares"] . "\">" . ($row["acceptedshares"] > 0 ? number_format($row["acceptedshares"]) : "n/a") . "</TD>"; $blocks_row .= "<TD style=\"text-align: right;\" sorttable_customkey=\"" . $row["network_difficulty"] . "\">" . formatSI($row["network_difficulty"], 2) . "</TD>"; $blocks_row .= "<TD style=\"text-align: right;\">" . $luck . "</TD>"; $hashratenum = sprintf("%.0f", $hashratenum); $blocks_row .= "<TD style=\"text-align: right; font-size: 0.9em;\" sorttable_customkey=\"" . $hashratenum . "\" >" . $hashrate . "</TD>"; $blocks_row .= "<TD class=\"blockconfirms\" style=\"text-align: right;\">" . $confs . "</TD>"; if (isset($row['keyhash'])) { $fulladdress = \Bitcoin::hash160ToAddress(bits2hex($row['keyhash'])); $address = substr($fulladdress, 0, 10) . "..."; } else { $fulladdress = ""; $address = "(Unknown user)"; } $blocks_row .= "<TD style=\"font-family:monospace;\"><A HREF=\"userstats.php/" . $fulladdress . "\">" . $address . "</A></TD>"; if (isset($row["height"]) && $row["height"] > 0) { $ht = number_format($row["height"]); } else { $ht = "n/a"; } $blocks_row .= "<TD style=\"text-align: right;\">{$ht}</TD>"; $nicehash = "..." . substr($row["blockhash"], 46, 18); $blocks_row .= "<TD style=\"font-family:monospace;\"><A HREF=\"blockinfo.php/" . $row["blockhash"] . "\">" . $nicehash . "</A></TD>"; $blocks_row .= "</TR>"; return $blocks_row; }