Reader small image

You're reading from  Bitcoin Essentials

Product typeBook
Published inFeb 2016
Publisher
ISBN-139781785281976
Edition1st Edition
Tools
Right arrow
Author (1)
Albert Szmigielski
Albert Szmigielski
author image
Albert Szmigielski

Albert Szmigielski is a thinker, a computing scientist, a software engineer, and a blockchain professional. He holds a BSc in Computer Science and an MSc in Digital Currency. He has been involved in a number of start-ups and software projects. He believes in a decentralized, distributed nature of storing information, and hence has an interest in Bitcoin and blockchain technology. Albert is a researcher at CryptoIQ and a mentor at the Blockchain Institute. He frequently contributes to his blog at blog.cryptoIQ.ca.
Read more about Albert Szmigielski

Right arrow

Chapter 4. FPGA Mining

In this chapter, we will take a look at mining with Field-Programmable Gate Arrays (FPGAs). They are microprocessors that can be programmed for a specific purpose. In the case of Bitcoin mining, they are configured to perform the SHA-256 hash function that is used in Bitcoin. FPGAs have a slight advantage over using GPUs for mining. The period of FPGA mining of Bitcoin was rather short (just under a year), as faster machines soon became available. The advent of ASIC technology for Bitcoin mining compelled a lot of miners to make the move from FPGAs to ASICs. Nevertheless, FPGA mining is worth learning about.

We will take a look at the following topics:

  • Setting up mining software and drivers to allow FPGA mining

  • What happens when mining on an FPGA

  • Benchmarks of mining speeds with different FPGAs

  • Pros and cons of FPGA mining

  • FPGA versus other hardware mining

  • The best practices when mining with FPGAs

  • Discussion of profitability

Setup and installation of the required software


In order to mine with an FPGA miner, we need to connect and configure it with a controlling computer. Most FPGAs connect to a computer via USB; therefore, we can usually connect a large number of FPGAs to a single computer using USB hubs. We will, of course, need the appropriate software and drivers to mine with our FPGAs.

Mining software

There are many mining programs out there. Our favorite is cgminer. Its GitHub repository can be found at https://github.com/ckolivas/cgminer.

The downloadable versions (for both Linux and Windows) can be found at the author's website at http://ck.kolivas.org/apps/cgminer.

The precompiled releases for MAC can be found at http://spaceman.ca/cgminer/.

We recommend using the latest version of cgminer to mine with FPGAs, the current (August 2015) version is 4.9.2, it has support for both BitForce and ModMiner FPGAs.

Linux installation instructions

The author of cgminer provides built software that is ready for distribution...

Pros and cons of FPGA mining


Mining with FPGAs has its advantages and disadvantages. Let's examine these in order to understand if and when it is appropriate to use FPGAs to mine Bitcoin. As you may recall, mining started on CPUs and then it moved over to GPUs; then people discovered that FPGAs could be used for mining as well.

Pros of FPGA mining

FPGA mining is the third step in mining hardware evolution. They are faster and more efficient than GPUs.

To summarize, mining Bitcoin with FPGAs has the following advantages:

  • FPGAs are faster than GPUs and CPUs

  • FPGAs are more electricity-efficient, per unit of hashing, than CPUs or GPUs

Cons of FPGA mining

FPGAs are rather difficult to source and program, and are not usually sold in stores open to the public. We have not touched upon programming FPGAs for Bitcoin mining, as we assumed you have acquired pre-programmed FPGAs. There are several good resources on the Internet regarding FPGA programming; electricity cost is also an issue with FPGAs, although...

Best practices when mining with FPGAs


Let's look into the recommended things to do when mining with FPGAs. Mining is fun and it can also be profitable if several factors are taken into account.

Make sure that all your FPGAs have adequate cooling. Additional fans beyond what is provided by the manufacturer are always a good idea. Remove dust frequently, as a build up of dust might have a detrimental effect on cooling efficiency and hence, mining speed.

For your particular mining machine, search online for all the optimization tweaks to get all the hashing power that is possible. However, due to a large variety of mining machines, we cannot provide all the possible tweaks in our book.

When setting up a mining operation for profit, keep in mind that the electricity cost will be a large percentage of your overall cost; hence, seek a location with the lowest electricity rates. Think about cooling costs; perhaps it will be the most beneficial to mine where the climate is cooler.

When purchasing FPGAs...

Benchmarks of mining speeds with different FPGAs


As we have mentioned earlier, the Bitcoin network hash rate is really high now, and even mining with FPGAs does not guarantee profits. This is due to the fact that during the mining process you are competing with other miners to try to solve a block. If those other miners are running a larger percentage of the total mining power, you will be at a disadvantage, as they are more likely to solve a block.

To compare the mining speed of a few FPGAs, look at the following table:

FPGA

Mining speed MH/s

Power used watts

Efficiency W/MH/s

Bitcoin Dominator X5000

100

6.8

0.068

Icarus

380

19.2

0.051

Lancelot

400

26

0.065

ModMiner Quad

800

40

0.05

Butterflylabs Mini Rig

25,200

1250

0.05

Table 4.1: Comparison of mining speed of different FPGAs

FPGA versus GPU and CPU mining


As you can see, from a comparison between table 4.1 and tables 3.1 and 2.1, FPGAs hash much faster than any other hardware. The fastest in our list reaches 25,000 MH/s. FPGAs are faster at performing hashing calculations than both CPUs and GPUs. They are also more efficient as measured by the use of electricity per hashing unit. The increase in hashing speed in FPGAs is a significant improvement over GPUs and even more so over CPUs.

Profitability of FPGA mining


In calculating your potential profit, keep in mind the following factors:

  • The cost of your FPGAs

  • Electricity costs to run the hardware

  • Cooling costs—FPGAs generate a decent amount of heat

  • Your percentage of the total network hashing power

To calculate expected rewards from mining, we can do the following. First calculate what percentage of total hashing power you command. To look up the network mining speed, execute the getmininginfo command in the console of the Bitcoin Core wallet. We will do our calculations with an FPGA that can hash at 1GH/s (which is 0.001 TH/s). If the Bitcoin network hashes at 400000 TH/s, then our proportion of the hashing power is 0.001/400000=0.0000000025 of the total mining power.

A Bitcoin block is found on an average of every 10 minutes, so six per hour and 144 for a 24-hour period. The current reward per block is 25 BTC; therefore, in a day we have 144*25=3600 BTC mined.

If we command a certain percentage of the mining power, then on...

Summary


In this chapter, we explored FPGA mining. We explained how to install the mining software and how to set up the appropriate drivers. Cgminer was our software of choice. We set it up on both Linux and Windows operating systems. We also connected to a mining pool to make sure everything was working as planned.

We examined the advantages and disadvantages of mining with FPGAs. It would serve any miner well to ponder these when deciding to start mining, or when thinking about improving current mining operations. We touched upon the best practices that we recommend keeping in mind.

We also investigated the profitability of mining, given current conditions. A simple way of calculating, on average, your earnings was also presented. We concluded that mining competition is fierce; therefore, any improvements you can make will serve you well.

In the next chapter, we will look at mining with the fastest technology available—ASICs.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Bitcoin Essentials
Published in: Feb 2016Publisher: ISBN-13: 9781785281976
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Albert Szmigielski

Albert Szmigielski is a thinker, a computing scientist, a software engineer, and a blockchain professional. He holds a BSc in Computer Science and an MSc in Digital Currency. He has been involved in a number of start-ups and software projects. He believes in a decentralized, distributed nature of storing information, and hence has an interest in Bitcoin and blockchain technology. Albert is a researcher at CryptoIQ and a mentor at the Blockchain Institute. He frequently contributes to his blog at blog.cryptoIQ.ca.
Read more about Albert Szmigielski