Skip to content

Instantly share code, notes, and snippets.

@vic-cieslak
Created December 2, 2021 14:10
Show Gist options
  • Save vic-cieslak/f84e9c8732ca65ad5d8db463b604eb47 to your computer and use it in GitHub Desktop.
Save vic-cieslak/f84e9c8732ca65ad5d8db463b604eb47 to your computer and use it in GitHub Desktop.
import requests
# usage python cashmine.py <ths>
# example to calculate bitcoin cash earning for 14 ths, python cashmine.py 14
def calc():
print('getting price in usdt')
res = requests.get("https://www.exbitron.com/api/v2/peatio/public/markets/xpiusdt/tickers").json()
usd = float(res['ticker']['avg_price'])
print('getting difficulty')
res = requests.get("https://explorer.givelotus.org/api/getdifficulty").json()
difficulty = float(res)
ths = 14 # wtf is ths?
month_bcc = 30* ths * 1e12 * 12.5 * 86400 / difficulty*2**32
print( f"[*]Bitcoin Cash mining calculator using {ths} ths")
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