Compare BTC and BCH/BCC show daily payouts and profit

Hi Folks,

in the last days I often look for a Website where I could check my daily payouts for Bitcoin BTC and Bitcoin Cash.
I cannot even find one site where I was able to compare both crypto currencies, so I decide to create a little PHP script to do it by myself.
For that reason, I create a new GitHub project where I upload my final PHP site, so everybody could use it too.

Github Project for Compare BTC wiht BCH

The first difficulty was to find Bitcoins API’s, I search for a while but there is also not even 1 Bitcoin API where I get all needed values.
We need Exchange Rates for BTC and BCH and of course the difficulty for both.

First, I choose to get the Exchange rates for BTC, for my personal needs, it would be fine to have just USD and EUR, but if you want, there are many more currencies.

$url = "";
$stats = json_decode(file_get_contents($url), true);
print "The current Bitcoin (BTC) Exchange-Rate is:
print "{$stats['EUR']['15m']} {$stats['EUR']['symbol']}
print "{$stats['USD']['15m']} {$stats['USD']['symbol']}
#print "{$stats['CHF']['15m']} {$stats['CHF']['symbol']}
#print "{$stats['DKK']['15m']} {$stats['DKK']['symbol']}
#print "{$stats['SEK']['15m']} {$stats['SEK']['symbol']}
#print "{$stats['INR']['15m']} {$stats['INR']['symbol']}
#print "{$stats['RUB']['15m']} {$stats['RUB']['symbol']}

Then I decide to get the BCH exchange rate from

$rate_usd_bch = exec("curl -s | jq -r '.[] | .price_usd'");
print "The current Bitcoin Cash exchange rate is:
print "$rate_usd_bch USD
print "based on!

After that, we need of course your hash rate I include this with a text field and a Button:

form action="index.php" method="POST"
input type="text" name="hashrate" value="3.5"/
input type="submit" value="Calculate" /

After that, I catch the current Difficulties from BTC and BCH I calculate the daily profit for both and I show some results:

$th = $_POST['hashrate'];
$diff = exec("curl -s | jq -r '.difficulty'");
$diff_cash = exec("curl -s | jq -r '.data[0] | .difficulty'");
$rate_usd = "{$stats['EUR']['15m']}";
$rate_eur = "{$stats['EUR']['15m']}";
$daybtc = round(($hash*12.5*86400)/($diff*4294967296),8);
$daybch = round(($hash*12.5*86400)/($diff_cash*4294967296),8);
print "
print "Your daily mined Bitcoin amount is $daybtc BTC or $daybch BCH.";
print "
$btc_d_usd = round(($rate_usd * $daybtc),2);
$bch_d_usd = round(($rate_usd_bch * $daybch),2);
print "Your current daily paypout would be $btc_d_usd USD for BTC or $bch_d_usd USD for BCH.";
print "
$yearbtc = round(($daybtc*365),8);
$yearbch = round(($daybch*365),8);
print "Your annual Bitcoin amount is $yearbtc BTC and $yearbch BCH.


That was all, have fun with it.

BR WiKrie

%d bloggers like this: