So You Want to Start a Bitcoin Mine

in #cryptocurrency7 years ago (edited)

Warning – Herein Be Math

In my last post, I gave an overview of bitcoin mining as an investment. In particular, I compared two ways of acquiring bitcoin, mining and purchasing, in a qualitative hand-waving manner. In this post, I dig a little deeper into mining and how it works, and things you need to know as a potential or newish miner. I will show how to free yourself from online mining calculators, using junior-high mathematics. In full disclosure, I'm a newish miner myself, sharing what I've learned and experienced, and I hope rehashing it in a slightly different way.

Bitcoin Mining and Factors Affecting Production and Revenue

Skip if you already know this. Mining starts with laying out some cash to buy mining production capacity, measured in hashes per second. A hash is a computing operation essential to solving the decryption problem that yields bitcoin. You need a lot of them, so the rate (let's call it H) is usually expressed in gigahash (GH, a billion hashes) or terahash (TH, a trillion hashes) per second. You can get them from an ASIC (application-specific integrated circuit, if you must know) mining machine, like Bitmain's Antminer S9, or by contracting it out to the cloud through a provider like Hashflare or Genesis Mining. (Second warning: I'm defining symbols. Can an equation be far off?)

Immediately your mine starts crunching hashes, working to solve blocks in the chain and bring up the coveted block reward (B, currently 12.5 BTC). You get no partial credit for solving a block. First miner to solve it gets the reward, and miners compete furiously to find a bitcoin nugget worth over $100,000. Working on your own, you will never do it. For that reason, mining pools exist. You contribute your hashpower to a pool, and its combined hashrate keeps you in the game. Periodically, the pool shares out its haul. They have various formulae for figuring your share, but it's usually proportional to the hashrate you contribute. And of course, the pool takes a bit off the top (P, typically about 2%) for providing service.

By design, the bitcoin system regulates the rate of bitcoin production to about one block every ten minutes. It does so by adjusting the difficulty (D) of the block decryption problem. Every 2,016 blocks, the network calculates a new D meant to reset the block solution time to ten minutes. As of today (3 Feb 2018), D = 2,603,077,300,218. Over the past 24 hours, that difficulty held the block solution time at 8.61 minutes against a total network hashpower of about 20 million TH/s (that's right, 2 x 10^19 hash/s). Expect the next adjustment to D around 9 February. You can find the current value and history of D, along with many other network-related facts and figures, at https://blockchain.info/stats.

Mining writers often overlook another potential source of mining revenue: transaction fees (F). The blocks miners compete to solve comprise batches of bitcoin transactions, each of which incurred a fee. That fee goes to the miners who solved the block, and it varies from block to block. Most pools keep the transaction fees for themselves, but a few (notably Slushpool) share them out along with the block rewards.

Paying the Piper

Not only must you shell out up front for mining capacity, but wait, there's more. Hashing requires electricity, and equipment requires maintenance. These constitute the main ongoing operating expenses of a bitcoin mine. Your mine must produce enough bitcoin to pay its operating expenses, or you have to shut it down. I'll write more about operating expenses in a future post.

Final Warning, Here Comes the Math

Buried under all the complex math of the bitcoin blockchain lies a fairly simple formula for the expected value of mining yield (Y, in BTC/s):

Y = B H / D / (2^32 hash) .

Reality check: Let's plug in the figures for the entire network, and see how many bitcoin emerge from the ether in 8.61 minutes.

Y x (60x8.61) s = 8.61 x 60 s x 12.5 BTC x 2.03x10^19 hash/s / 2.60x10^12 / 2^32 hash = 11.7 BTC

That falls a little short of the expected 12.5 BTC, probably due to using 24-hour averages for the block time and network hashrate.

In one day, 86,400s, the estimated daily bitcoin yield is then

Y x 86400 s = 86400 s x B H / D / (2^32 hash) = B H / D / 49710.

If you keep track of such things, the constant 49,710 has units of hashes/second. If you express H in terahash/second and D in trillions (currently 2.603 trillion), the 'H/D' part is much easier to deal with.

Pay No Attention to the Man Behind the Curtain

All of the common mining calculators use this same formula. If you have any skill with spreadsheets, you don't need online calculators any more. Enjoy your new freedom! To verify at the calculator of your choice, enter zero for the cost of equipment, electricity usage, and pool fee. If it needs an exchange rate, use $1. See what it gives you for a 1 TH/s (1000 GH/s) hashrate. Compare to my formula, making sure you and the online calculator use the same block reward and difficulty. Please let me know if they don't match!

What Does All This Mean to Me?

As a miner, you can estimate your daily mining revenue (R) in bitcoin using

R = (1-P) (Y x 86,400 s + F) = (1-P) (B H / D / 49710 + F) .

In words, you get daily block rewards based on your mine's hashrate, plus whatever transaction fees your pool shares with you, reduced by the percentage the pool takes. Actual results will fluctuate with the total network hashrate, and random variations in your pool's ability to find the solution before anyone else.

To convert to fiat currency, just multiply R by the appropriate exchange rate (E). Ignoring for now transaction-fee income, we come to an Important Truth about mining. In fiat terms, the main source of mining revenue, block rewards, is proportional to E/D (exchange rate divided by mining difficulty). If the two keep pace with each other (going up or down), top-line mining income (before capital and operating expenses) remains fairly stable. In 2018 so far, the US dollar exchange rate has declined while the difficulty increased. That spelled doubly bad news for miners.

Next Time

In the next post, I'll build on this and look at expenses and the bottom line. We are heading toward putting the whole picture together, and all the things you need to consider when trying to project mining profits. Thanks for reading!

Previous post: Bitcoin Mining Profitability Perspective
Next post: Operating a Bitcoin Mine

Sort:  

Good post. Thnx for the calculations.looking forward to see your next post where you talk more about the equipment need. I'm also interested in starting a mining project, but the cost right now seem way to high. Will upvote.

Thanks very much! I agree now is not a good time to start mining, or to add hashrate to an existing mine. Part of my purpose with these posts is to help people reach that conclusion for themselves, and to help decide rationally when the time is right.

I think your post was really well written and I think it deserves a wider audience. You should think of posting a link to reddit or other cryptocurrency boards.

Many thanks! I will indeed consider that.