'; $o2 = ''; $g1 = ''; $g2 = ''; # $showeq = false; # $avaldef = '0.8'; $feepercdef = '2'; $sharecapdef = '5'; $feeppsdef = '3'; $sharediffdef = '10'; $workdiffdef = '1'; # $aval = $avaldef; $feeperc = $feepercdef; $sharecap = $sharecapdef; $feepps = $feeppsdef; $sharediff = $sharediffdef; $workdiff = $workdiffdef; # $t = $ps; echo "$t"; echo "
$t

"; # $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 = '3370181.7992778'; echo "Failed to get current difficulty - using default for 20-Dec-2012 = $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 = 25; echo "Failed to get current BTC per Block - using default for 20-Dec-2012 = $btcperblock
"; } else { $btcperblock = $res; $_SESSION['bitvalues']['btcperblock'] = $res; } } curl_close($ch); } # $btcperblockdsp = number_format($btcperblock, 2); # $difficulty = $difficultydef; # $btcperblockpaid = ''; $btcperblockpaiddsp = ''; $shares = ''; $sharesdsp = ''; $sharevalue = ''; $sharevaluedsp = ''; $potvalue = ''; $potvaluedsp = ''; $ppsperc = ''; $ppspercdsp = ''; # $didcap = false; # $sub = getparam('Calculate', false); if ($sub == 'Calculate') { $aval = getparam('aval', false); if (!is_numeric($aval) or $aval == '' or $aval < 0.0001) $aval = $avaldef; $feeperc = getparam('feeperc', false); if (!is_numeric($feeperc) or $feeperc == '' or $feeperc < 0 or $feeperc > 50) $feeperc = $feepercdef; $feepps = getparam('feepps', false); if (!is_numeric($feepps) or $feepps == '' or $feepps < 0 or $feepps > 50) $feepps = $feeppsdef; $sharediff = getparam('sharediff', false); if (!is_numeric($sharediff) or $sharediff == '' or $sharediff < 0.0001) $sharediff = $sharediffdef; $workdiff = getparam('workdiff', false); if (!is_numeric($workdiff) or $workdiff == '' or $workdiff < 0.0001) $workdiff = $workdiffdef; $sharecap = getparam('sharecap', false); if (!is_numeric($sharecap) or $sharecap == '' or $sharecap < 0.0001) $sharecap = $sharecapdef; $cap = $sharecap * $difficulty; if ($sharediff > $cap) $didcap = true; $btcperblockpaid = $btcperblock * (100 - $feeperc) / 100; $btcperblockpaiddsp = number_format($btcperblockpaid, 8); while (substr($btcperblockpaiddsp, -1) === '0' && substr($btcperblockpaiddsp, -2) !== '.0') $btcperblockpaiddsp = substr($btcperblockpaiddsp, 0, -1); # $factor = (1 - $aval); # $F = "(1 - ${g1}a$g2)"; # $Fv = "(1 - $g1$aval$g2)"; $a = $aval; $factor = (1-$a) / (1 - ($a * pow($workdiff, (1-$a)) * pow($cap, ($a-1)))); $F = "((1-${g1}a$g2) / (1 - (${g1}a$g2 * (${o1}WorkDiff$o2 ^ (1-${g1}a$g2))) * (Cap ^ (${g1}a$g2-1))))"; $Fv = "((1-$g1$a$g2) / (1 - ($g1$a$g2 * ($o1$workdiff$o2 ^ (1-$g1$a$g2))) * ($cap ^ ($g1$a$g2-1))))"; #(1 - $a) / (1 - $a * pow($wd, (1 - $a)) * pow($X, ($a - 1))) $shares = $workdiff * $factor * pow(min($sharediff, $cap) / $workdiff, $aval); $sharesdsp = number_format($shares, 8); $sharevalue = $btcperblockpaid / $difficulty; $sharevaluedsp = number_format($sharevalue, 8); $potvalue = $shares * $sharevalue; $potvaluedsp = number_format($potvalue, 8) . ' BTC'; $ppsperc = ($shares / $workdiff) * 100 / (1 - $feepps / 100); $ppspercdsp = number_format($ppsperc, 2) . '%'; $showeq = true; } # echo "
"; if ($showeq === true) { echo ""; } echo ""; echo "
 
Current Difficulty $r1$difficulty$r2
 
'a' Value:
% Pool POT Fee:%
Share Cap: * $r1$difficulty$r2
% Pool PPS Fee:%
 
Your Share Difficulty:"; if ($didcap === true) echo "$a1($cap)$a2"; echo "
Your Work Difficulty:
 
BTC per Block $r1$btcperblockdsp$r2
BTC per Block Paid $btcperblockpaiddsp
BTC per 1diff Share $sharevaluedsp
 
POT Shares $a1$sharesdsp$a2
POT Value $a1$potvaluedsp$a2
PPS Percent $a1$ppspercdsp$a2
 
  Force update $r1$rname$r2 values:
 
 POT = (${o1}Work Diff$o2 * BTC Reward / ${r1}Current Diff$r2)
* $F
* ((min(${o1}Share Diff$o2, Cap) / ${o1}Work Diff$o2) ^ ${g1}a$g2) 
 
 POT = ($o1$workdiff$o2 * $btcperblockpaiddsp / $r1$difficulty$r2)
* $Fv
* (("; if ($didcap) echo "$a1$cap$a2"; else echo "$o1$sharediff$o2"; echo " / $o1$workdiff$o2) ^ $g1$aval$g2) 
 
"; # foot(); # echo "
"; # ?>