Created
August 17, 2017 17:13
-
-
Save cicrijerzs/1171b664853d0ff46fe3c5fc65b11615 to your computer and use it in GitHub Desktop.
Bitcoin Cash mining calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2,simplejson,sys | |
# usage python cashmine.py <ths> | |
# example to calculate bitcoin cash earning for 14 ths, python cashmine.py 14 | |
def calc(): | |
usd = simplejson.load(urllib2.urlopen("https://api.coinmarketcap.com/v1/ticker/bitcoin-cash/"))[0]["price_usd"] | |
month_bcc = (30* int(sys.argv[1]) * 1e12 * 12.5 * 86400) / (simplejson.load(urllib2.urlopen("https://cashexplorer.bitcoin.com/api/status?q=getDifficulty"))["difficulty"]*2**32) | |
print "[*]Bitcoin Cash mining calculator using %s ths" %sys.argv[1] | |
print "[*]Difficulty changes every 2016 blocks, 2 weeks" | |
print "Hour: %f bcc ||-> %.2f usd" %(month_bcc / 30 / 24, float(usd) * month_bcc / 30 / 24) | |
print "Day: %f bcc ||-> %.2f usd" %(month_bcc / 30 , float(usd) * month_bcc / 30 ) | |
print "Week: %f bcc ||-> %.2f usd" %(month_bcc / 30 * 7, float(usd) * month_bcc / 30 * 7) | |
print "Month: %f bcc ||-> %.2f usd" %(month_bcc, float(usd) * month_bcc) | |
if __name__ == '__main__': | |
calc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I