diff --git a/calculator.php b/calculator.php index 45e9970..26abeb1 100644 --- a/calculator.php +++ b/calculator.php @@ -1,32 +1,24 @@ \ No newline at end of file +?> diff --git a/explorer.php b/explorer.php deleted file mode 100644 index 4a5a5a2..0000000 --- a/explorer.php +++ /dev/null @@ -1,23 +0,0 @@ -explorer . "getblockcount"); - } - - function getBlockHash($blockHeight) { - return file_get_contents($this->explorer . "getblockhash?index=" . $blockHeight); - } - - function getBlock($blockHash) { - return json_decode(file_get_contents($this->explorer . "getblock?hash=" . $blockHash)); - } - - function getDifficulty($block) { - return $block->difficulty; - } -} -?> \ No newline at end of file diff --git a/index.php b/index.php index 091b885..14842d8 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,11 @@ + - +
@@ -17,8 +17,8 @@Insert your hashrate, and amount of masternodes owned and click "submit"; the program will output an estimated amount of daily coins earned. - Decimal values are supported, for example if you own 25% of a shared Masternode, input 0.25 under "Amount of Masternodes". - Both fields are optional.
+ Decimal values are supported, for example if you own 25% of a shared Masternode, input 0.25 under "Amount of Masternodes". Both fields are optional. + This calculator assumes the network hash over the past 1 hour, and dynamically calculates blocktime based on the last 101 blocks.The source code is available on Github.
@@ -31,7 +31,8 @@ getNetworkHashPs(30); + $masternode_count = $gincoin->getMasternodeCount(); + $difficulty = $gincoin->getDifficulty(); -/* OLD WAY OF CALCULATING COINS/DAY, SLOW AND LOTS OF CALLS TO GINCOIN BLOCK EXPLORER - * $blockHeight = $explorer->getBlockHeight(); //get current blockheight - * for ($i = $blockHeight; $i > $blockHeight - 30; $i--) { //get the difficulties of the current block, and the previous 29 blocks - * $block = $explorer->getBlock($explorer->getBlockHash($i)); - * $difficulty = $explorer->getDifficulty($block); - * $difficulties[$i] = $difficulty; - * } - * $avg_difficulty = $calculator->averageArray($difficulties); //take the average of the current block, and the previous 29 blocks */ - - $difficulty = round($rpcclient->getDifficulty(), 0); - //NEW WAY TO CALCULATE COINS/DAY WITH GINCOIND getnetworkhashps - $networkHashPs = $rpcclient->getNetworkHashPs(30); - $masternode_count = $rpcclient->getMasternodeCount(); - - $pow_coins = round(($calculator->calculatePoWCoinsByNetworkHashPs($hashrate, $networkHashPs)), 8); - $masternode_coins = round(($calculator->calculateMasternodeCoins($masternode_multiplier, $masternode_count)), 8); - $totalCoins = round(($pow_coins + $masternode_coins), 8); + $calculator = new calculator(); + $pow_coins = round(($calculator->calculatePoWCoinsByNetworkHashPs($hashrate, $networkHashPs, $gincoin->powReward, $gincoin->blocktime)), 2); + $masternode_coins = round(($calculator->calculateMasternodeCoins($masternode_multiplier, $masternode_count, $gincoin->mnReward, $gincoin->blocktime)), 2); + $totalCoins = round(($pow_coins + $masternode_coins), 2); + $ticker = new ticker(); $GINprice = $ticker->getGIN()->last; $pow_coins_worth = round(($pow_coins * $GINprice), 8); $masternode_coins_worth = round(($masternode_coins * $GINprice), 8); $total_coins_worth = round(($pow_coins_worth + $masternode_coins_worth), 8); - echo "You will make an average of $pow_coins GIN per day by Proof of Work, equal to $pow_coins_worth BTC.
";
- echo "You will make an average of $masternode_coins GIN per day by Masternodes, equal to $masternode_coins_worth BTC.
";
- echo "You will make a total of $totalCoins GIN per day, equal to $total_coins_worth BTC.
You will make an average of $pow_coins GIN per day by Proof of Work, equal to $pow_coins_worth BTC.
";
+ echo "You will make an average of $masternode_coins GIN per day by Masternodes, equal to $masternode_coins_worth BTC.
";
+ echo "You will make a total of $totalCoins GIN per day, equal to $total_coins_worth BTC.
The current difficulty is $difficulty.
";
- echo "The current amount of Masternodes is $masternode_count.
The calculator assumed a nethash of " . round($networkHashPs/1000000000, 3) . " GHs over the past hour.
";
+ echo "The average blocktime over the past 101 blocks was " . round($gincoin->blocktime) . " seconds.
";
+ echo "The current amount of Masternodes is $masternode_count.
Generic formula for calculating Proof-of-Work coins by difficulty: coins_day=(seconds_day/(d*2^32/hashrate))*block_reward, where 2^32 is the average number of shares needed to find a block at a difficulty of 1
- Generic formula for calculating Proof-of-Work coins by nethash: coins_day=(hashrate/nethash)*((seconds_day/block_time)*block_reward)
- Generic formula for calculating Masternode coins: coins_day=(((seconds_day/block_time)*block_rewards)/masternode_count)
Tipjar (GIN): GXUQQXBr5i2gKcPaa5SJHqQ9M9G9SgL1X1
- \ No newline at end of file +