Understanding the Mining Process - Learning Bitcoin (2015)

Learning Bitcoin (2015)

Chapter 6. Understanding the Mining Process

"We have elected to put our money and faith in a mathematical framework that is free of politics and human error."

--Tyler Winklevoss, Entrepreneur

The Bitcoin network distributes newly-minted bitcoin through a novel approach called Mining. By voluntarily supplying raw computing power, miners serve the network by validating and confirming Bitcoin transactions. In return, the miners are awarded bitcoins from a limited supply. Along with each award, they collect fees included with the transactions they choose to validate.

Bitcoin mining, an important aspect of the network, is highly competitive and involves many technical factors. In this chapter, we will explore the mining process in more detail. With this base understanding of the process, we will be able to understand the feasibility of mining.

In this chapter, we will discuss the following topics:

· Explanation of the mining ecosystem, mining pools, and available hardware

· Setting up a mining client

· Connecting to a mining pool

· Introduction to tools to help calculate the feasibility of mining

Digital gold

The first humans certainly had an advantage with regards to finding precious materials such as gold and silver. It's easy to imagine flakes or small nuggets of gold naturally exposed by streams and lakes. Human beings walking around the area could easily collect them for trade or utility.

As time went on, more and more of the easily available precious metals and gems were picked. Miners continued their search deeper and deeper into the earth, risking their lives and wealth in search for these valuable materials.

With the expansion of human civilization to new lands and continents, new sources were found. In 1849, gold was found in a stream near Coloma, California. After the news broke, hundreds of thousands of miners, called the 49ers, rushed out to California in search of the gold.

Within a few years, most of the easily found gold was picked, driving the miners to use more advanced techniques. By the mid 1850s, the miners had adopted hydraulic mining equipment and other mechanical means to extract the gold. It was a difficult process and successful mining required skill and luck.

Bitcoin mining

The 1849 California Gold Rush is analogous to the beginning of Bitcoin's mining story. They both share similar characteristics.

First, both gold and bitcoin have a limited supply. The amount of gold on the planet is fixed and cannot increase. Similarly, Bitcoin's algorithm is designed to ensure that only a fixed amount of bitcoin will be found.

In both cases, the early miners had better results mining in the beginning. In the case of the 49ers, within the first 2 years much of the gold found was easily picked from streams and rivers. With Bitcoin mining, the number of bitcoins awarded to the miners decreases over time. The new reward block halves every 4 years and the mining difficulty increases, as it's adjusted every two weeks based on the competition to mine. Thus, many early adopters were able to easily mine more than 50 bitcoins a day using a standard computer with a fast computer or a graphics processor.

Today, mining for gold is an expensive operation and is generally left to large mining companies funded by large investments of capital. The same holds true for Bitcoin. Large mining companies and pools exist, driving the competition to find bitcoin way up.

The golden years of Bitcoin mining may be behind us, but the process of mining still plays an important role in the Bitcoin ecosystem. In addition to earning newly minted bitcoins, the miners also earn transaction fees. These fees are paid by the sender of a bitcoin transaction and create an incentive for the miners to quickly confirm their transaction.

Having a large base of miners is important to Bitcoin as it builds trust in the network. The larger the base of miners, the more difficult it is to overtake the network. As we've seen with many of the alt-coins that have been released, without any significant base of miners, there's very little trust in the currency. Ultimately, it yields a low exchange rate with little demand for the currency.

Let's begin by exploring the various aspects involved with mining a bitcoin.

Exploring the mining ecosystem

Bitcoin mining provides the network with two very important processes: the creation of new bitcoin and the confirmation of transactions.

As discussed in Chapter 4, Understanding the Blockchain, the miners listen for new and valid transactions to combine them into a new block. The block represents a scope around a group of transactions that can be easily validated against the previous blocks. Structuring the ledger this way makes the processing of transactions easy to distribute.

From the perspective of the miner, a new block is potentially valuable. The bytes from the block are used as the base for computing an answer to a difficult computing problem. The miners make many millions of attempts at solving the difficult computing problem in hope of finding the solution before any other miner.

If found, the miner quickly broadcasts the solution to the network to make the claim. If it is confirmed by the network, the miner receives the new bitcoin, as well as all the fees included with each transaction in the block. The new block then serves as the latest block in the blockchain. The miners then start the race again by listening for new transactions and repeating the process. The following Figure 6.1 summarizes the process:

Exploring the mining ecosystem

Figure 6.1 - A summary of the Bitcoin mining process

Validating transactions

Each transaction broadcasted to the network must be checked for double spending, that is, sending more bitcoin than what's available, and for a valid digital signature. To confirm the available balance, the miner must have a validated copy of the entire blockchain.

As described in Chapter 5, Installing a Bitcoin Node, after installation, a client will connect to the network and begin requesting each block sequentially from the other nodes on the network. After checking each block against the previous blocks, one by one, the blockchain is replicated and stored locally.

The local copy of the blockchain contains every transaction from the beginning of time. This ledger is maintained and used to validate the spending balance of each new transaction. If a transaction is found to be invalid, it is simply ignored and discarded.

The second check requires validation of the digital signature. Using cryptographic algorithms, the miner is able to check the signature attached to the transaction to validate the integrity of the transaction. Any modification to the transaction will result in an invalid signature, and thus the miner is able to confirm that the transaction to be processed was the original version sent from the holder of the private key.

With a list of valid transactions, the miner assembles a new block and uses it as the base for solving a difficult computing problem.

Proof-of-Work

In Chapter 4, Understanding the Blockchain we described a hash as the result of a mathematical function applied to a set of data. In our case, the data is the new block of valid transactions. When a hashing function is applied to the data, a numerical value is returned. If we change any byte of the data and recompute the hash, we'll get a completely new hash value that's radically different to the original.

Mining involves using the hash function to generate a hash result. If the hash result matches the target, it's considered the solution. If the result is invalid, a throwaway number called a nonce is added to the data. The data set is then hashed again, giving the miner another try. This process is repeated until a solution is found.

When a solution is found, it's broadcast to the network as a new block, which also contains the difficulty target and the winning nonce. This is called proof-of-work. The other nodes on the network can recompute the hash on the block and the nonce to verify the proof-of-work.

If accepted, the new block becomes part of the blockchain. The nodes that agree on the solution then share the new block with the other nodes on the network. The end result is that the new bitcoins and the transaction fees collected are awarded to the winning miner.

SHA-256

Computing a hash value is computationally expensive. To produce the proof-of-work, the hashing function is executed many times until a valid hash is found. Thus, the work is described as "solving a difficult computing problem".

Bitcoin uses a hash function called SHA-256. It's a secure cryptographic hash function that can computed by software or more efficiently by hardware.

Specifically, the miners are looking for a hash value that's less than the target value. They will perform many millions of hashes per second looking for the winning hash result. Since any small change to the data set produces a different hash value, a nonce is added to the set. Each retry of the hash includes an increment to the nonce. When incremented, the resulting hash is completely different to the previous hash. This gives the miner another chance at finding a hash value that's lower than the published difficulty level.

Illustrated next in figure 6.2, the block data, consisting of valid transactions and a nonce, is hashed many times until a hash value is found that is less than the difficulty level:

SHA-256

Figure 6.2 - Mining involves incrementing a nonce to generate a hash until a solution is found.

In figure 6.2, we can see that the same data from the block is used with an incremented hash to compute the hash values. Using a brute force approach, the miner makes many millions of attempts to find n, the nonce that produces the winning hash result.

Scrypt

Litecoin, as well as many other alt-coins, uses a different configuration for the hashing algorithm. Scrypt also uses SHA-256 for hashing, but with an additional algorithm called Salsa20, which requires a large amount of memory, or RAM, to compute. Thus, the scrypt algorithm is not only computationally expensive; it's memory intensive as well.

The rationale behind using an additional component, in this case, a large amount of RAM, is to make it harder to scale the mining process using computer processors alone. This gives those with access to individual computers an advantage over the mining operations that scale with processors.

Mining rewards

Newly minted bitcoins are awarded for proof-of-work confirmed by the network. The number of bitcoins awarded is set on a curve, which halves every 210,000 blocks.

The first rewards were set at 50 bitcoins. After approximately four years, the first 210,000 blocks were mined and the reward was reduced by half to 25. The rate will continue halving, to 12.5, 6.25, and so on, until the last fraction of a bitcoin is found. The total number of bitcoins is fixed at 21,000,000 and the smallest fraction is 0.00000001.

Note

The smallest unit of Bitcoin is called a Satoshi, named after its developer.

The curve, which declines in half over time, is intended to offset the anticipated increase in available computing power. In other words, as the cost of computing power decreases, the difficulty of earning the reward increases to balance the equation.

Difficulty metrics

As competition for the rewards increases, the rate of solutions found to the difficult computing problem will increase. With more miners searching for the solution, the average rate could become less than the intended rate of one new block every 10 minutes.

To offset this, a difficulty level is calculated and adjusted every 2016 blocks. The calculation considers the last two weeks of transactions to produce a target difficulty. If the average is below the 10 minute average, the difficulty is increased, and if it is above, the difficulty is decreased (source: https://en.wikipedia.org/wiki/File:Difficulty.svg).

Difficulty metrics

Figure 6.3 - Relative mining difficulty from 2009 to 2015

Using the difficulty metrics, a miner can make some basic predictions about how much computing power will be required to mine a single bitcoin.

Note

These are some quick facts to remember about the Bitcoin mining process:

· Approximately every 10 minutes, a block reward is found

· Every two weeks, the difficulty level is adjusted

· Every four years, the block reward is halved

· Only 21 million bitcoins will be found

Circa 2015, over 60% of all bitcoins have been mined, with the current block reward set at 25.

Mining hardware

In Bitcoin's early days, standard CPUs were used to compute the hashes. Included in the original Bitcoin client was a feature that allowed you to use the CPU to mine. In the early days of Bitcoin, it was easy for a single CPU to earn a full award of bitcoin. However, as the number of miners increased, CPUs quickly became obsolete for mining.

As mining competition increased, software was adapted to utilize graphic processing units (GPUs). GPUs are optimized to perform mathematical operations many times faster than CPUs. They are used to accelerate the computation of complex graphics applications such as gaming and rendering. Because of their optimizations, they are well suited to performing the mathematical operations needed to quickly compute a hash.

The mining operators often maintained racks of GPUs. Several graphics cards could be connected to one computer. This resulted in the generation of large amounts of heat. To maintain peak performance of the equipment, air conditioning units were required to keep it cool.

Soon after the GPUs were adopted as the standard for mining, computer chip manufactures began developing microchips that performed the hashing computations directly. This resulted in a large increase in the number of hash performed per second, with a fraction of the electricity needed.

Initially, Field-Programmable Gate Arrays, (FPGAs) were configured and used for building the mining rigs. These are special integrated chips that allow a programmer to encode the hardware level instruction to be executed directly on the chip. They provided the miners with fast hashing speeds and used much less electricity.

Application Specific Integrated Chips (ASICs), quickly became the hot item for mining. These chips could perform billions of hashes per second while using far less power.

Note

In the beginning, the technology was brand new and in high demand. ASIC vendors often accepted large amounts of pre-orders while anticipating a successful delivery.

While some vendors were able to deliver on their promises, others were unable to, resulting in major losses for some customers.

Buyers should be careful with placing pre-orders. Always research new vendors and their claims.

In the following table 6.1, the various types of mining hardware are listed with their performance statistics:

Hardware

Performance (hps = hashes/sec)

Power (Watts)

CPU

1–50 million hps

150–300 watts

GPU

100–800 million hps

500–1000 watts

FPGA

100–800 million hps

5–40 watts

ASIC

10,000–1,000,000 million hps

200–600 watts

Table 6.1 - Performance by available Bitcoin mining hardware

Referring to the table 6.1, one can see how the performance per watt has dramatically decreased with the introduction of the ASIC mining equipment. ASICs can have a wide variance in both performance and power consumption, so upfront costs and hashes per watt are important to consider.

In Bitcoin mining, all the CPU and GPU, and most FPGA, processors have been replaced by the ASIC mining hardware. Due to the competition and the costs involved, mining with anything other than an ASIC is not viable.

Mining conditions

Due to the demands placed on the equipment, it's crucial that it be kept and maintained in a proper environment to sustain conditions for peak performance.

Most notable are the cooling requirements. Air conditioning may be required to maintain a constant temperature for the equipment to operate. Make sure that you factor a cooling system into your budget and design.

Electricity usage from both the equipment and the cooling must be assessed and arranged. Clean and stable electricity is important so as to not damage the equipment. Electrical spikes and high loads can cause interruptions to your mining operation.

Constant monitoring of the equipment is important. Downtime could result in a much lower return on investment than anticipated. Thus, it is common for serious mining operations to have a full time staff to monitor the conditions and maintain the equipment.

Mining pools

It can be quite difficult for a single ASIC miner to find the necessary proof-of-work to earn the rewards from a new block. This is especially true if every miner on the network is working individually as well. Thus, the chances of earning the bitcoin are either all or nothing with regards to a single block reward. To improve the chances of earning the bitcoin, a strategy for mining called pooling exists.

The mining operators are able to join together their collective power to form mining pools. As a group, their chances of finding the difficult to generate proof-of-work become much better. Upon winning the reward, the pool agrees to share the profits based on the work contributed by the individual miners.

Mining pools give lower powered miners an advantage because it can be very difficult for them to earn a full block alone. When operating as part of a collective, their computing power is awarded based on the amount of computing power provided.

Mining shares

In a pool, the work is measured in shares. One share is issued for each proof-of-work submitted. However, in the case of a mining pool, the proof-of-work is accepted based on the easiest difficulty level.

At the easiest difficulty level, a much larger range of nonces are eligible as the solution to the computing problem. Proof-of-work generated against an easy difficulty level is how the individual miners are able to prove to the pool that they have been working.

Eventually, when a share meets the network's difficulty level, the whole pool earns the reward, as it is divided and distributed to the individual miners based on the shares submitted.

Fees and Payout

The mining pools charge fees, typically ranging from 0.5 percent to 3.0 percent, depending on the payout method. Based on the payout methods, the mining pool operator may be at risk from a miner who cheats about the share reported. Generally, the more risk the mining operates assumes, the higher the fees.

A round is usually used in the calculation, and represents the current block being mined. After a new block has been found, the round is closed and another is started.

Payout from the mining operator is based on various methods. Some methods are optimized for quicker payouts, while others give incentives for new shares. The various methods are designed to reduce or prevent cheating. The mining pools use different methods, along with completive fees, to encourage miners to join their pool.

Some common payout methods are listed in the following table 6.2:

Payout

Description

Proportional

The block reward is paid to all the miners in proportion to the number of shares found.

Pay per share

The miners are paid for each share submitted. The amount paid depends on the current difficulty. The pool operator assumes the risk. Therefore, the fees paid to the pool tend to be the highest.

Score

A proportional reward weighted by the time submitted. Later shares are worth much more than earlier shares, based on a weighted score by time.

Table 6.2 - Common mining pool payout schemes

Cloud mining

Mining contracts are available for those who wish to outsource the mining process to another company. Companies offering Cloud Mining services allow one to purchase a contract for a specific amount of time and hash rate. The service operates similarly to the mining pool process.

The advantages of cloud mining are obvious, as the buyer doesn't have to own the equipment, maintain it, and mange its uptime. All the equipment is based in a remote data center and is maintained by the cloud mining company.

However, the buyer must beware. The returns on profit can be much lower than a normal investment. Furthermore, there have been scams reported and losses from malicious companies. Make sure that you do your research on a service before paying for any services or contracts.

Estimating profitability

There are many factors involved in estimating mining profitability. The significant variables are hardware costs, electricity, and mining difficulty.

Hardware efficiency

Starting with the hardware, one must consider the hashing speed of the equipment against the power used. A simple formula for evaluating the mining efficiency would consider these two variables:

Hashes per second / power consumption = efficiency

Hardware efficiency calculations are useful for evaluating the hardware. Be aware that the hash rates published by the vendors could vary from the actual rates. Additionally, it may take some time for the equipment to arrive. Make sure that you do some research on the forums to see what hash rates the other customers are getting.

Factoring in the difficulty level

One must compare the difficulty rate against the available hardware to project an estimate of the possible returns. Using some simple math, the rewards from mining at a specified hash rate can be estimated.

We start with the hash rate:

hashes = number of hashes per second

Given that there are 86,400 seconds in a day, we can calculate the number of hashes per day:

hashes * 86400 = hashes per day

The chance of a hash being a valid share is approximately one in 2^32:

(hashes * 86400) / 2^32 = shares per day

Factoring in the difficulty level, we can estimate that the shares' chances of being the solution to a new block is as follows:

(hashes * 86400) / (2^32 difficulty) = blocks per day

Finally, we apply the block reward:

(hashes * 86400 * reward) / (2^32 * difficulty) = average bitcoins per day

Using the formula, we can make a quick estimate of the average number of bitcoins we can earn per day, based on some published hardware statistics.

For example, given today's difficulty level, 49,692,386,355, and a block reward of 25BTC, we can estimate the return of a high performance ASIC miner.

Using the Spondoolies SP35 Yukon for our example, its listed performance is 5.5 tera-hashes. Thus, the average daily return would be as follows:

(5500000000000 * 86400 * 25) / (2^32 * 49692386355) = 0.05566301499 BTC

This is only an estimated bitcoin return, based on the difficulty and the hashing rate. For a more elaborate estimate of mining profitability, one would also include the hardware costs, the electricity rates, and the maintenance costs.

Selecting a currency

When looking to estimate profitability, it's important to consider the crypto-currency with the best chances of making a profit. Difficulty level and exchange rate are the two important variables involved.

With over 500 alt-coins in existence, a miner has a large set of options to choose from. To help with analyzing the data, one can rely on some tools to help with the calculations.

Coinwarz (www.coinwarz.com) is a useful site for evaluating profitability across the various crypto-coins. As shown in the following figure 6.5, one can easily select and compare the statistics across the various currencies and provide sort parameters based on different exchange rates:

Selecting a currency

Figure 6.4 - Coinwarz is used to compare the profitability of various crytpocoins

Coinwarz maintains difficulty statistics, exchange rates, and volumes, and uses them to give a historical view of profit rations. Using this information, one can make an educated guess about the various trends happening between crypto currencies and optimize their chances for an investment in mining.

Exchange rates

The current exchange rate for the currency you are mining is an unpredictable factor in calculating mining profitability. Many miners have an optimistic view of Bitcoin for the long term, yet in the short term the volatility leads to uncertainty with mining investments.

Given the risks, we can still make some broad assumptions and use calculators to give us a range of returns.

The Coinwarz website offers some useful tools for calculating future earnings based on hash rates, difficulty, electricity costs, and block rewards. Referring to our previous example with the SP35 Yukon, we can project an estimated annual return, as illustrated in thefollowing figure (http://www.coinwarz.com/calculators/bitcoin-mining-calculator):

Exchange rates

Figure 6.5 - Coinwarz's Mining Calculator

Setting up a mining client

After doing the proper analysis of costs and return on investment, one may decide if it's the right time to proceed with setting up a mining operation.

Requirements

In general, you'll need to have the proper conditions to set up a basic mining operation. To start with, we'll briefly cover the essentials: capital, hardware, facilities, and availability.

Capital

Most return on investment calculations for Bitcoin mining show profitability over a period of time, exceeding one year. The assumption made for the projection includes a stable exchange rate and difficulty level. However, these two factors often vary, which can seriously affect the actual profits.

Essential to starting a mining operation is sufficient capital to carry the operation forward. Before starting the venture, make sure you have enough capital to cover the costs for at least 1 to 2 years, based on the various projected conditions.

Hardware

The purchase of hardware is one of the more volatile aspects of mining. Hardware vendors are constantly designing and improving their equipment. Often, new equipment is pre-sold with several months of backorder time.

Without high-performance hardware, one cannot begin mining. Thus, be sure you have access to a decent set of equipment before securing the rest of your mining operation.

Another aspect to consider when purchasing equipment is the future value of the equipment based on its performance and operational life. Bitcoin mining equipment is changing rapidly and can be outdated within a year. After its useful life is finished, you may have to resell the equipment or recycle it in order to upgrade to new and more powerful equipment.

This was the unfortunate result of a large surge in miners buying the GPU cards. Large orders of GPUs were purchased and used to mine, but when the ASIC chips arrived, the GPUs were quickly replaced. Many miners ended up with large quantities of hardware unusable for mining Bitcoin. Much of the equipment was used for mining other alt-coins or sold.

Note

Remember, an important aspect of one's mining operation is being constantly up to date with the latest vendors and releases.

Facilities

Early mining enthusiasts started their mining operations from their homes, often in spare bedrooms, garages, or basements. These operations quickly grew into racks and racks of equipment, with fans constantly running as make-shift cooling systems.

The sustainability of these operations running from a personal residence or a family dwelling quickly diminishes. Therefore, it's important to secure a permanent place to set up your mining racks with proper ventilation and cooling.

Easy access to the hardware is important. The ability to diagnose and replace the equipment helps to ensure maximum uptime of your mining operation. Also, one should consider the future expansion of their mining operation. Be sure to plan ahead with space if you plan to grow your operation.

Your mining facilities should include a stable and clean power supply. The mining equipment will pull a constant wattage. Thus, it's important to ensure proper power lines, connections, and outlets to provide adequate wattage.

With all the equipment running at full speed, the sound volume and vibrations can be an issue. Make sure to consider planning for sound proofing the facility if excessive noise is an issue for the neighbors.

Finally, make sure that your facilities are properly protected from theft and other environmental factors, such as flooding and/or earthquakes. It may be possible to have the facilities and its equipment insured. Be sure to check with your agent.

While mining hardware can operate continuously without interruption, a quick response from its operators is important to manage uptime. Hardware and software failures can happen at any time. Without a quick response, the downtime can seriously affect the profitability.

Therefore, it's important to be able to monitor your operations with a quick response time. It is advisable to have a partner or a small team on staff to provide backup or to cover shifts.

Note

In October 2014, an online publication called Motherboard gained access to a large Bitcoin mining operation based in China. The short documentary uncovers many aspects involved with the mining operation and can give some insight to mining on a massive scale. The video is available online at http://motherboard.vice.com/read/chinas-biggest-secret-bitcoin-mine.

Choosing the equipment

Procuring high-performance equipment is crucial to the success of your mining operation. As an important aspect of your business, you should research the latest vendors and their equipment.

ASIC miners start in price at around $2,000 and can easily pass $8,000. In addition to the cost of the hardware, you should factor in the equipment's mining efficiency. As mentioned earlier in the chapter, divide the hash rate by the wattage to estimate the equipment's efficiency.

Note

Personal USB ASIC miners are available within the price range of $40 - $100. They are capable of mining a few Satoshis in a reasonable amount of time, but are considered non-competitive in the market. They can make an interesting project for experimentation and learning.

Another metric often used in evaluating equipment's efficiency is Mhash/J or millions of hashes per joule. One joule of energy is equal to one watt of power used for one second. Hashes per joule can be used to evaluate the efficiency over time.

Note

Online reviews of vendors and equipment are available. The Bitcoin wiki has some general information that one can use to begin. Refer to https://en.bitcoin.it/wiki/Mining_hardware_comparison.

Make sure to factor in the crypto-currencies you're most interested in mining. Many alt-coins use Scrypt and cannot be mined by most ASIC hardware. You'll have to do some research depending on the currency, its difficulty level, and the hardware available to mine it.

Choosing the software

Once you have your hardware purchased and setup with a computer, you'll need to setup the mining software.

The mining software will manage connecting to a mining pool and interacting with the hardware. Part of the process is assigning work from the mining pool to your mining equipment and reporting the shares back to the pool. The two most popular packages arecgminer and BFGMiner.

Cgminer supports ASIC and FPGA Bitcoin mining, and is available for Windows, OS/X, and Linux. It supports connecting with multiple mining pools. You can download the source code from GitHub (https://github.com/ckolivas/cgminer). Provided with the source code are instructions on how to setup and install the software. Also provided are examples of how to connect to the hardware and the mining pools.

BFGMiner also supports ASIC and FPGA Bitcoin mining and is available for Windows and Linux. It can be downloaded from its website at http://bfgminer.org.

With your hardware and software set and ready to work, the next step would be to connect to a mining pool.

Connecting to a mining pool

There are many options available for joining a mining pool, depending on your preferences. You should make an educated decision on which mining pool to use, based on the payout method, the fees charged, and how often a block reward is found. Other features that are nice to have include statistics, easy withdrawal of funds, and various types of merged mining.

The payout method

The payout method can vary between the mining pools. Check the method and the fees included to make sure they match your risk and ability to wait for payouts. Depending on your mining operation's availability, the type of payout may affect your rewards. For example, the miners who do not run stable mining operation will be punished using a score based payout. This means that if your miner gets disconnected for some time, your score may drop to zero.

Also, consider the terms for the payout. Some mining pools release earnings automatically, while others may impose a threshold.

The pool fees

Some pools may charge a fee. The amount usually depends on their assessment of risk and the features they offer. Generally, paying no fees is best, but in some cases paying a fee could mean better chances of earning a block reward. For example, Deepbit charges 3 percent fees but pays for every solved block, even it becomes invalid.

The pool speed

The number of rewards earned by a pool is directly related to the overall pool speed. The faster the hash rate for the pool, the more blocks found. In the long term, the rate of rewards found will average out, but with smaller pools you could wait days or weeks to receive a payout.

Additional features

After identifying the payout method, the fees, and the speed that best suits your needs, you can evaluate the pool's additional feature set. Some pools offer nice graphs and statistics, or e-mail notifications and alerts.

Listed next in table 6.3 are the top Bitcoin mining pools. Also listed are the payout methods used:

Pool Name

URL

Payout Method

Speed (Ph/s)

Antpool

antpool.com

Pay per last N shares, 0% fee

Pay per share, 2.5% fee

Solo, 1.0% fee

74.72

Eligius

eligius.st

Capped pay per share, 0% fee

11.96

BitcoinCZ

mining.bitcoin.cz

Score-based payouts, 2% fee

10.62

GHash.io

ghash.io

Pay per last N shares, 0% fee

9.3

BitMinter

bitminter.com

Pay per last N shifts, 1% fee

3.03

Table 6.3 - Popular Bitcoin mining pools (speed is measured in peta hashes / sec)

Avoiding large pools

The larger the pool size, the more concern there is for it to approach the theoretical 51% attack size. Although there is some debate about how effective the attack would be, the large pools can quickly raise concern in the community.

Generally, miners have more incentive to not join a large pool as it diminishes the overall value of the network. Since the miners are working to earn bitcoin, they have an interest in keeping the network functioning properly.

There was a case, early in 2014, in which the mining pool GHash.io reached 42% of the network. As the pool size was approaching 51 percent, many miners began voicing the issue and the need to reduce the pool size. Within 24 hours, many miners had left the pool, bringing the size back down to 38 percent.

Running the client

Once your account is setup with the mining pool of choice, you can quickly configure your mining software to connect to the pool and start the mining process.

Assuming you've installed cgminer, simply execute:

cgminer -o http://pool:port -u username -p password

The software will start by connecting to the pool. If everything checks out, the mining software will begin issuing work to your mining equipment, as shown in figure 6.6 (source: http://hashfast.com/cgminerscreenshots/):

Running the client

Figure 6.6 - cgminer running, showing statistics and block updates

Summary

Mining Bitcoin can be a complicated yet rewarding venture. In this chapter, we covered many aspects of planning and setting up a mining operation. Yet, it's important to remember that conditions for profitability are constantly subject to change as this new field of technology develops and matures.

In the next chapter, we're going to look at how to program Bitcoin and explore some interesting areas with digital contracts.