"; echo "
$t
(Let's hope I got the statistics correct :P)

"; # $difficultydef = ''; $btcperblock = ''; # if (isset($_SESSION['bitvalues'])) { $force = getparam('force', false); if ($force != '') unset($_SESSION['bitvalues']); else { if (isset($_SESSION['bitvalues']['difficultydef'])) $difficultydef = $_SESSION['bitvalues']['difficultydef']; if (isset($_SESSION['bitvalues']['btcperblock'])) $btcperblock = $_SESSION['bitvalues']['btcperblock']; } } if ($difficultydef == '' or $btcperblock == '') { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); if ($difficultydef == '') { curl_setopt($ch, CURLOPT_URL, 'http://blockexplorer.com/q/getdifficulty'); $res = curl_exec($ch); if (curl_errno($ch)) { # $difficultydef = '1690895.80305'; $difficultydef = '1888786.7053531'; echo "Failed to get current difficulty - using default for 4-Aug-2011 = $difficultydef
"; } else { $difficultydef = $res; $_SESSION['bitvalues']['difficultydef'] = $res; } } if ($btcperblock == '') { curl_setopt($ch, CURLOPT_URL, 'http://blockexplorer.com/q/bcperblock'); $res = curl_exec($ch); if (curl_errno($ch)) { $btcperblock = 50; echo "Failed to get current BTC per Block - using default for 4-Aug-2011 = $btcperblock
"; } else { $btcperblock = $res; $_SESSION['bitvalues']['btcperblock'] = $res; } } curl_close($ch); } # $poolghsdef = '60'; $failhrsdef = '100'; $sharesdef = '10000000'; # $difficulty = $difficultydef; $poolghs = $poolghsdef; $failhrs = $failhrsdef; $shares = $sharesdef; $probfail = ''; $probshare = ''; $failmsg = ''; $sharefail = ''; $sharemsg = ''; $mhperblock = ''; $ghperblock = ''; $sharesperblock = ''; $poolavtimeperblock = ''; $tt = ''; $poolblocksperday = ''; $poolbtcperday = ''; $sub = getparam('Calculate', false); if ($sub == 'Calculate') { $poolghs = getparam('poolghs', false); if ($poolghs == '' or $poolghs <= 0) $poolghs = $poolghsdef; $failhrs = getparam('failhrs', false); if ($failhrs == '' or $failhrs <= 0) $failhrs = $failhrsdef; $shares = getparam('shares', false); if ($shares == '' or $shares <= 0) $shares = $sharesdef; $shares = floor($shares); $mhperblock = ((float)(1) / (float)(1000000)) * pow(2, 48) / (float)(65535); $mhperblock *= floatval($difficulty); $ghperblock = $mhperblock / 1000; // hashes per share = 4G $sharesperblock = number_format(round($mhperblock / pow(2, 32) * 1000000), 0) . ' shares'; $blockprobability = 1000 * $poolghs / $mhperblock; $avtimeblock = 1 / $blockprobability; $poolavtimeperblock = $avtimeblock; $s = floor($poolavtimeperblock); $fr = round(($poolavtimeperblock - $s) * 1000) / 1000; if ($fr >= 1) { $fr--; $s++; } $m = floor($s / 60); $s = $s % 60; $h = floor($m / 60); $m = $m % 60; $d = floor($h / 24); $h = $h % 24; if ($d == '1') $plu = ' '; else $plu = 's '; $tt = $d.'day'.$plu.$h.'hr '.$m.'min '.$s.substr($fr, 1).'sec'; $poolblocksperday = (float)(60 * 60 * 24) / $poolavtimeperblock; $poolbtcperday = round(($poolblocksperday * $btcperblock) * 100000000) / 100000000; $probblock = 1 - (($poolghs * 60 * 10 * 1000) / $mhperblock); if ($failhrs != '') { $blockratio = $failhrs * 6; $probability = pow($probblock, $blockratio); $probfail = number_format($probability * 100, 8) . '%'; $failmsg = " ${failhrs}hrs"; } if ($shares != '') { // shares per block = difficulty // hashes per share = 4G $hashes = $shares * pow(2, 32); $shareratio = $hashes / ($poolghs * 1000000000) / 600; $shareprob = pow($probblock, $shareratio); $sharefail = number_format($shareprob * 100, 8) . '%'; $sharemsg = ' '.number_format($shares, 0).' shares'; } $poolavtimeperblock .= 'sec'; $poolbtcperday .= ' BTC + t2'; } # echo "
 
Current Difficulty $r1$difficulty$r2
Difficulty average Gh per Block: $a1$ghperblock$a2
Difficulty average shares per Block: $a1$sharesperblock$a2
 
Pool Gh/s: 
Fail hours: 
Shares: 
A share is assumed to be 2^32 hashes
 
Probability of failing$failmsg:$a1$probfail$a2
 
Probability of reaching$sharemsg:$a1$sharefail$a2
 
Pool Average Time per Block: $a1$poolavtimeperblock$a2
= $a1$tt$a2
 
1 Block = $r1$btcperblock$r2 ${a1}BTC + t1$a2 
Pool Average Blocks per Day: $a1$poolblocksperday$a2
= $a1$poolbtcperday$a2
 
  Force update $r1$rname$r2 values:
 
"; # foot(); # echo "
"; # ?>