Bitcoin Forum
May 06, 2024, 08:59:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: to fix mining profit calculator code  (Read 586 times)
xbitcoinx (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 28, 2013, 10:50:29 AM
 #1

hey guys.
I've hired one php coder for mining profit calculator code.

but here got a problem from difficulty increment factor.

When a difficulty increment factor exists like every 14 days the difficulty getting increased 10% around, the earned BTC should be decreased as time goes by, then the BTC earning graph looks like curve, 
but my existing code, it shows a exponentially increased BTC earning.

Can someone help me to fix this code ?

$DifficultIncrementPer value is % one, it used to re-calculate the difficulty of next 14days as my code is shown below

Code:
$Difficulty = (isset($_REQUEST['difficulty']) ? $_REQUEST['difficulty'] : '');
$HashRate = (isset($_REQUEST['hash_rate']) ? $_REQUEST['hash_rate'] : '500');
$TimeFrame = (isset($_REQUEST['time_frame']) ? $_REQUEST['time_frame'] : '30'); // user input timeFrame
$DifficultIncrementPer = (isset($_REQUEST['diff_increment']) ? $_REQUEST['diff_increment'] : '8');  // % per every two weeks
$HashRate = ($HashRate * pow(10,6));  //mhash
$TimeArray = array($TimeFrame,"1","30","180","365");  // user timeframe,  default timeframe (1, 30, 180, 365)
$SecforBlockCurrentDiff = $Difficulty * pow(2,32) / $HashRate; 
$SecforBlockNext14dayDiff = (($Difficulty*(100+$DifficultIncrementPer)/100) * pow(2,32) / $HashRate);


if($TimeArray[$k] <= 14)
{
$BTCEarnedPrev = round((($TimeArray[$k]*25)*(60*60*24)/$SecforBlockCurrentDiff),8);  // 24hours based BTC

}
else
{

$CalcTimeFrameContent = floor(($TimeArray[$k]-14) / 14);
$BalanceTimeFrame = $TimeArray[$k] - (($CalcTimeFrameContent*14)+14);
$BTCEarnedPrev = ((14*25)*(60*60*24)/$SecforBlockCurrentDiff);

for($i=1;$i <= $CalcTimeFrameContent;$i++){

$BTCEarnedPrev += ((14*$i*25)*(60*60*24)/$SecforBlockNext14dayDiff);
}

if($BalanceTimeFrame >= 1){

$BTCEarnedPrev += (($BalanceTimeFrame*25)*(60*60*24)/$SecforBlockNext14dayDiff);

}
}
1714985986
Hero Member
*
Offline Offline

Posts: 1714985986

View Profile Personal Message (Offline)

Ignore
1714985986
Reply with quote  #2

1714985986
Report to moderator
1714985986
Hero Member
*
Offline Offline

Posts: 1714985986

View Profile Personal Message (Offline)

Ignore
1714985986
Reply with quote  #2

1714985986
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714985986
Hero Member
*
Offline Offline

Posts: 1714985986

View Profile Personal Message (Offline)

Ignore
1714985986
Reply with quote  #2

1714985986
Report to moderator
1714985986
Hero Member
*
Offline Offline

Posts: 1714985986

View Profile Personal Message (Offline)

Ignore
1714985986
Reply with quote  #2

1714985986
Report to moderator
1714985986
Hero Member
*
Offline Offline

Posts: 1714985986

View Profile Personal Message (Offline)

Ignore
1714985986
Reply with quote  #2

1714985986
Report to moderator
xbitcoinx (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 29, 2013, 04:11:43 PM
 #2

plz help me.
kodo
Newbie
*
Offline Offline

Activity: 42
Merit: 0



View Profile
May 29, 2013, 10:17:07 PM
 #3

Sorry I cant help you here.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!