Rollercoin Profit Calculator with Python

Do repost and rate:

Hey in this article I will explain you how to do a profit calculator for Rollercoin.

If you don't know what Rollercoin is, it's a website where you can play mini-games to earn hashing power and earn real cryptocrurency (BTC, ETH, DOGE). You can also buy miners to get lifetime hashing power. I say lifetime because when you play mini-games, the power expire after a certain amount of time (depending on your pc , check image below).

TL;DR: you earn hashing power by playing mini-games and earn cryptocurrency with this hashing power.

If you aren't registered yet you can register here: https://rollercoin.com/.

Making the profit calculator with python

Ok now that you know what is Rollercoin let's make a profit calculator. 

First we ask the user for his hashrate, the network hashrate and define the rewards for each coin

current_hashrate = float(input("Your hashrate (TH/s): "))network_powers = [float(input("BTC network power (EH/s): ")), float(input("DOGE network power (EH/s): ")), float(input("ETH network power (EH/s): "))]rewards = [0.00009, 240, 0.0017]names = ["BTC", "DOGE", "ETH"]

Then we fetch the current price of each coin with the coingecko API

r = urllib.request.urlopen("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin%2Cdogecoin%2Cethereum&vs_currencies=usd")data = json.loads(r.read())prices = [data["bitcoin"]["usd"], data["dogecoin"]["usd"], data["ethereum"]["usd"]]

Ok, now that we have all of our data we can start to make calculations. The profit formula is: network_reward * (hashrate / total_hashrate) Thanks to yanis for the formula

We convert our hashrate into EH/s, and calculate the profit for each coin and store it in the earnings array

current_hashrate /= 1000000earnings = []for i, (network_power, reward, price) in enumerate(zip(network_powers, rewards, prices)):    currency_gain = reward * (current_hashrate / network_power)    earnings.append(currency_gain * float(price))

Finally we take the higher value of the array and display the coin with the best profit and the profit ??

max_index = earnings.index(max(earnings))print("\n---------------------------\n\n{} is the most profitable\n{}$ per block\n".format(names[max_index], earnings[max_index]))input("Press enter to close")

If you want to calculate your daily profit or something similar there is, in average, 1 block every 5 minutes

The full code: https://gist.github.com/Bilaboz/56572e81ace7b47d4302d6f5840118aa

If you enjoyed (or learned something ), you can tip and like this article ?? Thanks!

Regulation and Society adoption

Ждем новостей

Нет новых страниц

Следующая новость