Bitcoin has had quite a year this 2017, up to more than 1700% increase year to date (checked on Dec 17, 2017). With this exponential increase, comes an equivalent interest in mining them. Some think it’s a scam, while others think it’s a great investment. Given what I’ve seen online, and the many variables involved, I haven’t really encountered a thorough article that allows me to draw an unbiased conclusion by myself. This article is my attempt to gather my thoughts and hopefully provide that.

### BEFORE EVERYTHING ELSE

Feel free to point out mistakes in this article if you see any. If you don’t know Bitcoin or blockchain technology you can check this article by Mohit Mamoria. If you want something more technical you can check out Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos , I have only started reading the book myself, but I’ve heard a lot of good things about it. Shoutout to Michael Galero for painstakingly helping me learn and appreciate this technology throughout the years.

**mithi/crypto**

*crypto - Is Bitcoin Cloud Mining Profitable? Check the notebook to find out! (Not Clickbait)*github.com

This article was originally written as an interactive Jupyter Notebook a few days ago. The notebook mentioned is slightly more in depth, this is a condensed version. More importantly, this was written when HashFlare offered their cloud mining contracts with an upfront free of `$1.50 per 10 GH/s`

, but because of the demand it seems like they increased it to `$2.20`

. All the default values for the variables here including are taken from a few days back. Update as you see fit.

### Scam or Legit?

### FORMULATING A PROBLEM

Let’s make the problem more specific.

#### Given:

1. There is a service called HashFlare that lets you rent a SHA-256 algorithm miner for a year (assume 52 weeks or 364 days), you can choose how much share of hashrate you get. (`$1.50 per 10 GH/s`

when this was written)

2. Every day for the whole year you get an automatic payout in BTC but a maintenance fee will be automatically deducted from this given current the exchange rate between BTC and USD. The maintenance fee is `0.0035 USD /(10 GH/s) / 24 hrs`

.

#### Important Assumption:

Bitcoins mined by the network comes from the block reward only and not from transaction fees.

#### Find:

- Will I make money? If so how much?

As with all investments, we are never 100% certain, we can only make estimates based on what we currently know and assumptions that are hopefully sound. Needless to say, how much money we will gain or lose depends on how much we put in.

### First Things First

- How much hash rate will I get if I make an initial investment of
`x`

USD? - How much in USD should I initially invest if I want to have
`y`

amount of hash rate?

1. If I had`I am willing to invest, I can buy a contract with a hash rate of:`

450.0 USD`given an upfront fee of`

3.0 TH/s`.`

$1.50 per 10 GH/s

2. Also, given an exchange rate of`(USD per BTC) my`

17790.0`is equivalent to`

450.0 USD

0.025295109612141653 BTC

IF I WANTED TO BUY:`-`

- SHA-256 cloud mining one-year contract in HashFlare.3 TH/s

THEN:- Given an upfront fee of`$`

, I would pay an upfront fee of1.50 per 10 GH/s

450.0 USD

- Every`hours,`

24`would be deducted from the BTC I have mined based on the exchange rate at that time.`

1.05 USD

- This will amount to a total of`for the span of`

382.2USD52weeks.

- In total, the HashFlare cloud mining service will take a total of`from me, given that the maintenance fee is`

832.2 USD

0.0035 USD /(10 GH/s) / 24 hrs

### How much will I mine every 10 minutes?

Theoretically and on average, it is targeted that every `10`

minutes, a block is solved by the network of miners. Each time a block is solved, a number of BTC is added to the network by being awarded to the miner (or mining pool) which solved it. This number of BTC is the block reward which is currently `12.5`

. This value will halve every` 210,000`

blocks, with the next halving still more than `2`

years away (**See: Bitcoin Block Half**). Estimating your piece of the pie or the fraction you will get is simple; it's your hash rate divided by the total hash rate of all the computers participating in the network. The current network hash rate can be seen **here**.

`btc_per_block = block_reward * h / Hn`

blocks_per_day = 24 * 6

*(24 hours in a day, one block per 10 minutes, so that 6 blocks per hour)*

`---`

Given the following:

- your hashrate in TH/s :3

- current network hashrate in TH/s :13408415

(from:blockchain.info/charts/hash-rate)

- block reward in TH/s :12.5(from:bitcoinblockhalf.com)

Then:Bitcoin you'd mine per block (10 minutes):2.7967511447102433e-06Bitcoin you'd mine per day:0.000402732164838275

### THE NETWORK HASH RATE VARIES OVER TIME

The network hash rate `Hn`

and difficulty `D`

is related by this equation:

`Hn = D * 2**32 / 600`

The complicated thing is that the difficulty is adjusted every `2016 `

blocks (`2`

weeks) based on the time it takes to find the previous `2016`

blocks.

Learn more here:

### Also, looking at its history, the difficulty and consequently network hash rate tends to increase exponentially over time.

Let’s use this information!

Given a rate of increase of0.06490055902005132every two weeks,

after 52 weeks, from a starting difficulty of0.31T,

the final difficulty is1.5900000000000025T

Initial Difficulty (in trillions) :0.31 (2016-12-23)

Current Difficulty (in trillions):1.59(2017-12-16)

Number of weeks between given difficulties:52

Rate of increase is0.06490055902005132compounded every two weeks.

Values from:blockchain.info/charts/difficulty

### We can estimate the increase of difficulty. Can we please estimate how much BTC we will mine in a year?

I’m glad you asked!

Given a mining contract of52weeks, with a hash rate of3.0 TH/s

- a block reward of12.5 BTCfor the whole lifetime of the contract

- a starting difficulty of1.59trillion,

- and an assumed rate of increase in difficulty of6.49percent every two weeks.

Expect to mine:0.08773878181855241 BTC

### Great! Did I actually make a profit?

The thing is, the USD per BTC exchange rate is very volatile and daily maintenance fee is subtracted from your BTC mined that day given the exchange rate at that time. So we have to make a few more assumptions about the exchange rate which is difficult to predict.

#### Assumption A: Constant Exchange Rate Scenario — The USD per BTC doesn’t change the whole year (You wish!)

The simplest case for the lazy! If you think the rate will go up and down but will average out through the year then it’s not a very bad assumption.

#### Assumption B: Bitcoin Crash Scenario — Right after you bought the contract, the USD per BTC exchange rate drops to X fraction of what it was and stays flat for the whole year.

You might think this would be a ridiculous assumption, but consider these:

*November 30, 2013: *1 BTC = 1,149.14 USD

*May 5, 2014:* 1 BTC = 428.98 USD (dropped to a third in about six months!)

*May 7, 2015:* 1 BTC = 232 USD (almost halved in about a year!)

If BTC’s value halves, then HashFlare will get twice as much of your BTC given its maintenance fees are pegged in USD!

---------------------------------------------------------------

PARAMETERS

---------------------------------------------------------------

hashflare_maintenance_fee : 0.0035

optimistic_rate : 6.5

hashflare_hashrate_fee : 1.5

difficulty_start : 1.59

block_reward : 12.5

pessimistic_rate : 10.0

crash_number : 0.5

usd_per_btc : 17790.0

upfront_investment : 450.0---------------------------------------------------------------

COMPUTED VALUES

---------------------------------------------------------------

best_btc_return : 0.04088467743021228

best_fees_btc : 0.02148397976391231

my_hashrate : 3.0

worst_btc_mined : 0.066934348960718

worst_btc_return : -0.0013287201792482745

worst_mined_minus_fees : 0.02396638943289338

upfront_btc : 0.025295109612141653

best_mined_minus_fees : 0.06617978704235393

worst_fees_btc : 0.04296795952782462

best_btc_mined : 0.08766376680626624

---------------------------------------------------------------

The constant rate scenario with optimistic difficulty increase

---------------------------------------------------------------

Best case, you'll successfully net: 0.04088467743021228 BTC!---------------------------------------------------------------

The bitcoin crash scenario with pessimistic difficulty increase

---------------------------------------------------------------

You will lose: 0.0013287201792482745 BTC. Worst case, you have been scammed. Should you have invested in gold??---------------------------------------------------------------

Important Suggestions!

---------------------------------------------------------------

The secret to happiness is low expectations.Suggestion 1:

- Maybe you've used rates of difficulty increase that are too optimistic?optimistic_rateandpessimistic_rate

- A rate of difficulty increase in percent

- The higher the more conservative

- A conservative assumption is probably between 10 and 25Suggestion 2:

- Maybe you chosecrash_numberthat is too optimistic?

- Consider a Bitcoin crash scenario: right after you bought the contract, the USD per BTC, exchange rate drops to X fraction of what it was an stays flat for the whole year.

- A number between 0.0 and 1.0, the smaller the number, the worse the crash is

- This is a number between 0.0 and 1.0

- The smaller the worse the crash is

- Make it smaller, so you don't get dissapointed.

- A good assumption is probably between 0.1 and 0.4---------------------------------------------------------------

DEFINITIONS

---------------------------------------------------------------

difficulty_start :Get the current difficulty from: blockchain.info/charts/difficultyblock_reward :Get the current block reward from: bitcoinblockhalf.com. Constant for the whole contract (1 year).

usd_per_btc :Current exchange rate from: coinmarketcap.com

hashflare_hashrate_fee :1.50 per 10 GH/s from hashflare.iohashflare_maintenance_fee :0.0035 usd per 10GH/s per 24 hours from hashflare.io

upfront_investment :How much are you willing to invest in USD?

pessimistic_rateandoptimistic_rate :Rate of difficulty increase in percent. The optimistic_rate must be less than pessimistic_rate. The higher the more conservative.A conservative assumption is probably between 10 and 25.

crash_number :A number between 0.0 and 1.0. The smaller the number, the worse the crash is.Consider a Bitcoin crash scenario: Right after you bought the contract, the USD per BTC exchange rate drops to X fraction of what it was and stays flat for the whole year.

my_hashrate :Your hash rate share in TH/s

upfront_btc :How much BTC you'd have if you bought BTC instead of buying a contract.

worst_btc_return :Optimistically your net profit in BTC.worst_mined_minus_fees :Pessimistically, the amount of BTCs you'd have after the contract.

worst_btc_mined :Pessimistically, the BTC you've mined before subtracting the maintenance fee.

worst_fees_btc :Pessimistically, the total amount in BTC HashFlare took from you.

best_btc_return :Optimistically your net profit in BTC.

best_mined_minus_fees :Optimistically, the amount of bitcoins you'd have after the contract.

best_btc_mined: Optimistically, the BTC you've mined before subtracting the maintenance fee.

best_fees_btc :Optimistically, the total amount in BTC HashFlare took from you.

### CONCLUSION?

Given everything that has been said, what do you think? Feel free to point out mistakes if you see any.

If you like this article, consider sending me some BTC:

33Mudy961bUk9zz35p68g9fE3uuHLRduRp