1 people like it.

Bitcoin mining profitability calculation

Calculates profitability of a Bitcoin mining operation today (February 25, 2017) using current difficult level, Bitcoin price and a state of the art Bitcoin miner.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46: 
47: 
48: 
49: 
50: 
51: 
52: 
53: 
54: 
// Bitcoin mining profitability calculation

// Units of measure
[<Measure>] type USD
[<Measure>] type BTC
[<Measure>] type sec
[<Measure>] type hour
[<Measure>] type H
[<Measure>] type GH
[<Measure>] type Watt
[<Measure>] type KW

// Unit conversions
let hashesPerGH : float<H/GH> = 1000000000.0<H/GH>
let secondsPerHour : float<sec/hour> = 3600.0<sec/hour>
let wattsperKilowatt = 1000.0<Watt/KW>

// Specification of S9 Antminer
let unit_hash_power  = 13000.0<GH/sec> 
let unit_consumption = 1375.0<Watt>
let unit_cost = 
   2100.0<USD> // miner cost
  + 200.0<USD> // psu cost

let hash_rate =  unit_hash_power * hashesPerGH

// Difficulty is recalculated every 2016 blocks (~ 14 days)
let difficulty = 440779902287.0<H> 

// Block time solo mining
let block_time : float<hour> = difficulty * (2.0 ** 32.0) / (hash_rate * secondsPerHour)

// How many miners you need to mine 1 block per day
let number_of_miners = block_time / 24.0<hour>

// Is it profitable ?

let psu_efficiency = 0.97 // 97% 

let electricity_price = 0.12<USD/(KW*hour)>/wattsperKilowatt
let btc_price    = 1157.00<USD/BTC> // Bitcoin price
let block_reward = 12.5<BTC>

let daily_power_consumption = number_of_miners * unit_consumption * 24.0<hour> / psu_efficiency

let daily_electricity_cost = daily_power_consumption * electricity_price

let daily_profit = block_reward*btc_price - daily_electricity_cost

// Hardware cost.
let hardware_cost = unit_cost * number_of_miners

// Asuming it is profitable, daily_profit > 0.0<USD>
let months_to_roi = hardware_cost / (daily_profit * 30.0)
Multiple items
type MeasureAttribute =
  inherit Attribute
  new : unit -> MeasureAttribute

Full name: Microsoft.FSharp.Core.MeasureAttribute

--------------------
new : unit -> MeasureAttribute
[<Measure>]
type USD

Full name: Script.USD
[<Measure>]
type BTC

Full name: Script.BTC
[<Measure>]
type sec

Full name: Script.sec
[<Measure>]
type hour

Full name: Script.hour
[<Measure>]
type H

Full name: Script.H
[<Measure>]
type GH

Full name: Script.GH
[<Measure>]
type Watt

Full name: Script.Watt
[<Measure>]
type KW

Full name: Script.KW
val hashesPerGH : float<H/GH>

Full name: Script.hashesPerGH
Multiple items
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------
type float = System.Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>
val secondsPerHour : float<sec/hour>

Full name: Script.secondsPerHour
val wattsperKilowatt : float<Watt/KW>

Full name: Script.wattsperKilowatt
val unit_hash_power : float<GH/sec>

Full name: Script.unit_hash_power
val unit_consumption : float<Watt>

Full name: Script.unit_consumption
val unit_cost : float<USD>

Full name: Script.unit_cost
val hash_rate : float<H/sec>

Full name: Script.hash_rate
val difficulty : float<H>

Full name: Script.difficulty
val block_time : float<hour>

Full name: Script.block_time
val number_of_miners : float

Full name: Script.number_of_miners
val psu_efficiency : float

Full name: Script.psu_efficiency
val electricity_price : float<USD/(Watt hour)>

Full name: Script.electricity_price
val btc_price : float<USD/BTC>

Full name: Script.btc_price
val block_reward : float<BTC>

Full name: Script.block_reward
val daily_power_consumption : float<Watt hour>

Full name: Script.daily_power_consumption
val daily_electricity_cost : float<USD>

Full name: Script.daily_electricity_cost
val daily_profit : float<USD>

Full name: Script.daily_profit
val hardware_cost : float<USD>

Full name: Script.hardware_cost
val months_to_roi : float

Full name: Script.months_to_roi

More information

Link:http://fssnip.net/7Sh
Posted:7 days ago
Author:Ademar Gonzalez
Tags: bitcoin , units of measure