Previously I have written about setting up Bitcoin mining with the Block Erupter in Ubuntu, however a more efficient way to mine can be to use of a Raspberry Pi to control the Block Erupter(s). The major benefit to this is the greatly reduced power consumption, provided by the Raspberry Pi compared to a desktop computer or a laptop.
Controlling the mining of a Block Erupter does not require huge amounts of system resources, so the Pi can also be used for other tasks at the same time (ssh tunnelling, small webserver and so on).
Initial Requirements and Expected Outcome
Hardware
Raspberry Pi (preferably model B)
Block Erupter (as used in this guide, but other miners should also work if connectable)
Powered USB hub
Small fan (cooling the miner, necessary for Block Erupter)
Low HW errors, definitely under 1%, but better in the range of 0.4-0.6%
Continuous running without the need of reboot or maintenance of any sort
No "hungs" of the Raspberry Pi, mining and configuration to be done without physical access to the hardware after initial setu
Remote access and configuration (reach the Raspberry Pi through ssh)
Installation
Installing bfgminer
I have installed the latest version (as of December 2013) of bfgminer 3.9.0. This will be the reference in this guide. If you choose to install another version, please change the commands accordingly.
ssh into the Raspberry Pi. You will need root privileges.
Configure. Note that by default all miner configuaations are enabled, so no extra argumetns are required if building for Block Erupters. (If you would like to disable some miners because you will not be using them, check out the README file that comes with bfgminer)
./configure
And finally make
sudo make
Technically it is done and bfgminer can be run.Navigate to the directory and
Where "-S erupter:all" is important as it tells bfgminer to search for all connected Block Erupters and use them for mining.
The problem of running bfgminer like this is that it is only running until you have the ssh tunnel open. Once you close it, bfgminer shuts down. Hence one would need to have a computer running 24/7 in order to keep the ssh tunnel open and contiue mining. To overcome this problem, screen will be used. [2]
Running bfgminer "as a service" with screen
"Screen is a full-screen window manager that multiplexes a physical terminal between several processes." [3] Technically it allows to run a command in a virtual terminal window in the background, which allows running the miner in the background too without the need of a live ssh connection to the Raspberry pi.
Simply install screen with sudo apt-get install screen After that, running bfgminer with screen goes as the following.
Start Bfgminer sudo screen -dmS miner ./bfgminer -o pool:port -u usrname -p password -S erupter:all Note: that this assumes you are in the directory of bfgminer. If you want to make a general command append the route to before ./bfgminer.
This will start bfgminer in a new screen session, detached, so no output will be shown on the screen, you will be returned to the command line. Here is a short explanation what the parts of the above command do.
screen: start a new screen sessions
-dm : Start screen in "detached" mode. This creates a new session but
doesn’t attach to it. This is useful for system startup
scripts.
-S: Session name.
When creating a new session, this option can be used to specify a
meaningful name for the session. As above I named the session "miner", one may choose a more specific name as well.
Switch to the Screen Session
sudo screen -dR miner
This will switch to the screen session where bfgminer is running. Here you can monitor the miner, accepted shares, stales and so on. Once you checked the miner is running OK, exit the screen session properly, without interrupting the miner!
Stop Screen Sessions CTRL+A+D
This will properly detach the screen session, without interrupting the miner. Note if you exit the screen session with CTRL+C or exit the miner with "q", the mining will stop.
Observations
Choice of Miner
Originally I tried to make mining work with cgminer as that was more familiar to me and have been using it for quite a while. However, I have encountered several problems that I could not overcome.
I tried virtually every version of cgminer from 2.8 until the latest version to see which one works best, but none could perform reliably. Hardware errors (HW) were in the 10% range (!) which is far above the expected value. First I feared that I bought a somehow faulty chip and this was the reason for getting so many HW errors.
The miner was also somehow unstable and caused the Raspbery Pi to hung after about ~20h of running and required a maanual reboot. This was definitely not what I was looking for.
All this might not be caused by cgminer as I find it a great software for mining (works great on my computer), however I could not get it to work the way I wanted to with he raspberry Pi.
Bfgminer seems to have solved all these issues. The miner runs steady with a low ~0.50% HW error and it did not get hung so far after some extensive testing. Configuration is easy and it works pretty much "out of the box".
Pool
Some pools implement a high stratum difficulty which means that a 330MH/s miner will have a hard time submitting shares at all. I found this issue with quite a few pools. Triplemining on the other hand has a stratum difficulty of 1 and I am submitting a share about every 30-40 seconds.
Cooling and Hardware
As mentioned before in my setting up Bitcoin mining with the Block Erupter in Ubuntu article, the Block Erupter requires some cooling. Initially I wanted to add some small copper heat sinks, however this plan failed due to delayed delivery of the heat sinks. Hence I am only using a small fan directed over the Block Erupter and somewhat creating a slight air movement over the rasoberry Pi as well. See some pictures below. Not a masterpiece for sure, but runs fine and was a nice experiment!
With the new rise of Bitcoin prices yet again more and more people invest in buying coins and mining hardware. This drives the prices up, not only of the coins themselves but the hardware too.
There are still people who consider bitcoin as a learning process, hobby or simply don't have the money to invest thousands of Euros in mining hardware, but would like to mine efficiently. The solution can be the Block Erupter Bitcoin miner.
Block Erupter is a small USB ASIC miner (Application Specific Integrated Circuit) that consumes very low power and gives a reasonable hash rate in return (roughly half of that of a modern GPU, but at a fraction of the cost!). It is small, "plug and play" and makes a perfect gift or hobby investment for enthusiasts.
In Europe the price of these miners has climbed quite strong after the price of Bitcoins went high (800-1000€ range), a Block Erupter was selling for around 25€ at the beginning of November where it is selling at around 75€ at mid December.
Technical Specifications
Dimensions: 2x4 cm (WxH; without USB connector)
Connection: USB port
Power Usage: 2.5W (5V DC, 500-510mA)
Hash Rate: 300-336 MH/s
Price: Varies, cheapest new devices is ~50€ as of 2013 Dec 15 (ebay)
Additional: Green LED indicates the status (LED on=standby, LED blinking=share is found/hashing)
In this example I will describe how to mine using cgminer[2] software under Ubuntu 12.10. If your Ubuntu is newer, it is not a problem, the steps should also work on the newer system.
The device is "plug and play" under Linux, it doesn't require any drivers to be installed (unlike in Windows) so it is pretty easy to set up. Individual problems (missing packages and such) may arise during installation, however these are rather easy to solve. If you are having problems, leave a comment and I will get back to you ASAP to find the problem and help you get going.
Open a terminal (CTRL+T) and navigate to your download folder, by default cd Downloads
Untar the file tar -xjvf cgminer-x.x.x.tar.bz2
Go into the newly created directory cd cgminer-x.x.x.tar.bz2
./configure --enable-icarus
If you got any errors at the end of configuration, check them and see what package(s) are you missing. Install them with sudo apt-get install <package-name> OR from the synaptic package manager (sudo synaptic from he terminal) After eliminating the errors run sudo make && sudo make install
Copy the example configuration file into a new configuration file that contains your pool's details. cp example.conf yourconfig.conf
Now edit the config file you just created. This will have lines in it with pool address, worker name and passwords. Fill these out and save them. gedit yourconfig.conf
Then to run cgminer, but note that you have to be root in order for Ubuntu to recognize the USB miner, so sudo cgminer --config yourconfig.conf
Alternatively, if you do not want to use a config file you can also run cgminer with sudo cgminer -o pooladdress:port -u minername -p port
Block Erupter mining under my Ubuntu machine
Suggestions
Now the down side, the Block Erupter gets hot in normal operating conditions. And by hot I mean HOT. After about 5 minutes of testing it almost burned my finger when I touched it. Hence it is advised to invest into cooling to prolong the lifetime of the miner.
Additional:
Powered USB Hub (each Block Erupter requires ~0.5A)
Cooling fan
Heat sinks
OPTIONAL: Raspberry Pi to control the miner(s)
Powered USB Hub
Make sure it can supply enough power to the miners. Each miner takes 0.5A at 5V DC giving 2.5 Watts of power consumption (Power=Voltage*Current). Hence a 5 USB port hub should get at least 5*0.5A=2.5A of current in order to supply enough power if 5 miners are connected. Even better, it is advised to get one with a slightly higher rating, say 3A supply for 5 miners. On the other side if you need 2.5A and you only have 2, it won't work.
Cooling
Passive Cooling
Generally preferred in power electronics as there are no components to fail (in the cooling system). Efficiency is lower than that of forced air or liquid cooling, but the miner should be built so that it can function out of the box as well. Although I doubt that the Block Erupter would live too long if running extensively without some cooling measures.
Forced Air Cooling
Installing a small fan to provide airflow over the miner is a common technique. USB fans are the easiest to use as they are "plug and play", however it is going to take 1 of the USB ports
A12V DC CPU fan can also do the job, and most likely provide better cooling performance as well. However, a CPU fan requires a separate 12V DC power supply. While practically it can run off from 5V DC, the airflow will be severely limited.
I have seen many people using a fan such as this one, I assume it does a nice job.
Personal Experience
I have decided to cover the top of my Block Erupter in heat sinks to increase heat transfer to the environment. I have ordered some small Copper heat sinks from eBay with some thermal paste sticker on the back for easy application. I will mount these on the front side of my miner and then direct a small USB fan on it as well. I hope to keep the temperature of the miner as low as possible using this method.
USB fan (source:Amazon.com)
Update: Unfortunately, my heat sinks didn't arrive from eBay so I have decided to give up this plan. Instead I have found a small USB fan I bought previously that I can use here. (see image on the left) The fan produces quite a strong air flow so I have decided to have a go at it.
I have removed the outer case so I am left with the inside only that allows me to better direct the airflow over the Block Erupter.
It is a little noisy, but I am running it in the basement so it doesn't bother anyone.
This fan keeps the ASIC miner at room temperature without any problem, it doesn't heat anywhere as much as without the fan.
As a footnote I noticed that when operating the miner from a USB port on my laptop it heats up much faster than when powering it via an USB hub. Also I noticed that (at least when plugged into my laptop) the miner heats up even when I am not mining with it, LED lighting.
Conclusion
Is it worth to buy a Bloc Erupter? It depends why you want to buy it. It could be considered more of a hobby rather than a serious income. With the ~300 MH/s one will not get rich, it is just enough to make up for the price of electricity and the initial investment.
Unfortunately I do not have any data on the lifetime of the small miners, nor could I find anything related online. So I cannot clearly state whether they are worth their money (on a purely economical basis) or not. I will record my progress of using my Block Erupter and update this article depending on my findings. One thing is for sure, it is a fun thing to have around, showing your support and liking of the Bitcoin community and possibly spreading the word about Bitcoins to your friends.
This article contains some help for those starting to get into using bitcoin and contains help I have found when reading through different forums and experiences made. It also assumes some basic knowledge about Bitcoin in general, bitcoin client the meaning of mining, mining software, blocks, hashing rate and so on. All this information can be found in the Bitcoin Wiki and only requires some reading and no actual deep programming knowledge.
Contents of this Article
About Bitcoin
Installing the Bitcoin Client
Mining & Mining Software
Where to Mine
Downloads & Links
Earn Your First Coins (for free)
Sources
About Bitcoin
"Bitcoin uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of bitcoins is carried out collectively by the network. Bitcoin is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part."[1]
Originally Bitcoin was developed by an anonymous person calling himself "Satoshi Nakamoto", his real identity is still unknown. [2]
The network uses the SHA256 algorithm that is very fast to compute and hence allowed technology companies to develop specialized hardware for bitcoin mining, the coin generation process. The mining process includes a "puzzle" a machine can solve and based on the outcome of this puzzle a block might be generated. Upon finding a new block, 25 BTC is added to the miner. Blocks are generated on a predictable rate (1 block every 10 minutes) and the reward for finding a block halves on a pre-determined basis. These factors limit the total number of available bitcoins in the system, which will be 21 million coins once the system reaches this point in the future.
The easy calculation of SHA256 hashes made it available to develop specialized hardware such as FPGAs (Field programmable Gate Array) and ASICs (Application Specific Integrated Circuit) that specialize in bitcoin mining. Such hardware have dramatically shifted the bitcoin mining process and increased the global hash rate of the network. Whether this is good or bad, everyone has to decide for him/herself. one thing is for sure, bitcoin is growing faster than before. Currently 1 coin (BTC) is worth over 500$ and it does not seem to slow down.
And here is a short video explaining a few things and introducing Bitcoin.
Installing the Bitcoin Client
First of all what you should know that there are 2 versions of the official bitcoin client, bitcoin and bitcoin-qt. Bitcoin is the command line client that is for more advanced users while bitcoin-qt is the graphical user interface (GUI) version that is easier to use (aim to use the bitcoin-qt, GUI version).
Known issue with the client under Ubuntu: The icon does not show in the Unity menu bar (top of the screen where email etc is.). It shows up when first installing, but after that it is gone. As said above, I tried building from source to see if the problem is solved that way, but it isn't. Not a big impact, just a minor issue, but I personally would like to be displayed there, hopefully this will be fixed soon. Update: This issue has been fixed in theLatest Client (as far as I saw).
1. Amending Software Sources (PPA) - Recommended
Update: This seems to be the predominantly supported and easiest way of installing bitcoin-qt on an Ubuntu system.
Edit your software sources by,
sudo gedit /etc/apt/sources.list
and add the 2 lines at the end of the file,
deb http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu YOUR_UBUNTU_VERSION_HERE main deb-src http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu YOUR_UBUNTU_VERSION_HERE main
Where of course you replace "YOUR_UBUNTU_VERSION_HERE" with the name of your Ubuntu version, e.g. 12.04 is "precise". If this is not perfectly clear for you or you are using another version than 12.04 of Ubuntu then check out this link for help: https://launchpad.net/~bitcoin/+archive/bitcoin.
After this simply run in the terminal,
It is now installed on your system in /home/[USER]/.bitcoin
You can create a desktop launcher or launch it from unity panel or your favourite place.
If you need more help: Bitcoin.org
2. Installing the Bitcoin Client - Alternative 1
Installation by downlaoding the latest bitcoin *.tar.gz file. As per the README file tells:
Download the latest *.tar.gz file from bitcoin.org
Unzip the contents into a folder
Run sudo apt-get install libqtgui4 to install Qt4 runtime libraries (if you had a previous version installed this should already exist on your system)
Run either of the 4 executable installers (according to your system)
This should install the bitcoin client onto your system.
3. Building from Source - Alternative 2
To get the bitcoin client clone the official github repository first and then decide whether you need the GUI version (bitcoin-qt) or just the terminal one. Clone the github repository,
where "ROUTE" is the route to the folder you want to copy to. Leave empty to clone it to your home directory. Also you will need some packages installed, get these by running
This is fully in the terminal. After the github repository as been downloaded and the necessary packages applied, simply execute (as per doc/readme-qt.rst)
qmake
make
Now note that as said this is the terminal version of the bitcoin client, it comes with no graphical interface, all arguments must be given in the terminal. It is highly advised that you do not use this option.
If qmake gives an error, try
qmake "USE_UPNP=-"
make
3.b. GUI Version
You have to get a program called "Qt-creator" from the software centre so go ahead and download it.
Also you will need the packages as mentioned above so install those if you have not done so already.
If you have it navigate to the cloned github repository, right-click bitcoin-qt.pro and select "Open with Qt Creator"
This will open up Qt, here click on run on the bottom left of the screen
and this will create an executable file in the bitcoin folder that will run bitcoin-qt. Run as you would any other file.
Mining & Mining Software
You can either mine alone - in "solo" - where the possibility of you finding a block (25 BTC ~ 7000 Euros, but doesn't matter as it is changing all the time) is above 40 years, or you can mine for a group - called "pools" - where you get a share of the 25 BTC based on the help you provided. With solo mining you may not receive anything at all, but you might find a block and get the total 25 BTC, whereas in a pool you will have more steady, but smaller payments. As the difficulty and global hash rate are high, it is highly advised to join and mine a pool.
Installing poclbm-GUI
Either way you want to go, you need a software to mine and start hashing. I suggest using poclbm-gui miner which is easy to set up and gives the same functions as the terminal version. The things you will need on your system installed are,
python 2.6 or above (3 is not supported) wxpython, get them from synaptic package manager.
nVidia Cards: numpy and PyOpenCL, that can again be again installed from synaptic package manager.
Launch synaptic package manager with:
sudo synaptic
and make a search for the packages and install.
ATI video cards:
If you have an ATI card and plan to use it for mining (which will be much faster than CPU or nVidia cards) the you also need an ATI Stream SDK downloaded and installed.
You can get the latest version of poclbm GUI miner from github,
git clone https://github.com/Kiv/poclbm
and then to run,
cd /home/[USER]/poclbm
python guiminer.py
This will run the guiminer (the front end software) and also poclbm miner, however if you want to use other mining software (e.g. cgminer), it has to be downloaded and installed manually (see links at end of the post and at List of Bitcoin Mining Software). I leave this to you, you have to decide what software you want to use or rather what does your hardware support (!). With all the different ASICS out you will need to check for support. Cgminer is generally a good option to go for and installing it is very simple and it is described in the readme file.
Look for what you need; clone git repo, cd to git repo, ./configure, make, make install or refer to documentation.
After say you have downlaoded cgminer, you can use the GUIminer to control it. This virtually poses no overhead on your hash rate. Make sure you set the correct path to your mining software! Refer to software screenshots below. I recommend you create a "miners" directory within the guiminer and put all miners you use in here. Just to keep things in one place.
Mining in Solo
Firstly go to ~/.bitcoin directory (to see hidden folders press "Ctrl+H" in the file manager, in your home directory) and create a new file called bitcoin.conf if you do not have it already. Put 3 lines in the file,
Keep these secure.
Setting up solo mining requires the bitcoin client to be started up in server mode. To do this, close the client if you have it already running and and start bitcoin-qt with the following command from the terminal,
Where192.168.0.* is you local IP address range, note that this might be different based on your home network settings. This is to tell the client to allow miner connections from the local network.
Start mining software as normal and set up a new solo miner, refer to picture below.
Ext. Path: Absolute path to your miners installed. Make sure it is pointing to the right executable file.
Server: Choose solo Host:localhost Port: Just use 8332, make sure it is the same as you have launched the client with & set in your bitcoin.conf
Username: As per set in ~/.bitcoin/bitcoin.conf Password: As per set in ~/.bitcoin/bitcoin.conf Extra flags: Flags for the miner, like "-v -w 128', this depends on the miner and graphics card you are using. You can look up a list of best settings for different cards Bitcoin Wiki
After setting up to mine in solo, you should see a similar window:
Ubuntu
Windows
If you have launched the client right, got the matching username & password you should be mining in solo.
Mining for a Pool
Pooled mining is the "easier" from the 2. From the dropdown menu simply choose which pool you want to mine for - or choose "other" if it is not listed - type in your account credentials and other information necessary, specified on the pool's homepage and start mining. Please refer to the images and information discussed above in "Mining in Solo".
Of course, username and password in this case will be the ones specific to your pool's one and not the one set it ~/.bitcoin/bitcoin.conf !
If you are looking for a pool to mine for, scroll to the bottom of this post!
Note:
Setting all these up is not difficult at all, once you have figured out how to do it. I hope I could save you some time of looking around the internet and browsing through different forums for finding the right information.
If you however require any further help or anything was not clear or just got stuck, leave a comment and I will get back to you and do my best to help.
Downloads & Links
poclbm with GUI - Github (Kiv); GPU miner using OpenCL, Nvida & ATI; Recommendedas it contains GUI and mining software alike!
Ufasoft CPU/GPU miner - darkgamex.ch; has to be built from source (Windows & Linux)
Diablo GPU miner - Github (Diablo);Uses Java ant the OpenCL framework for hashing; ATI & Nvidia cards
cgminer - ck.kolivas.org; multi-threaded multi-pool GPU, FPGA and CPU miner
Dailybitcoins.org - Some micro bitcoins every hour, random prizes and advertising opportunity. Nice option for those new to Bitcoin to make their first coins fast and for people who want to advertise alike. Bitvisitor.org - Earn bitcoins for watching videos CoinURL.com - Earn bitcoins for publishing ads on your website, by shortening URLs and you can even advertise with bitcoins.
Where to Mine
Update: Please note that "hobby mining" may no longer be profitable with the ever-increasing difficulty and even the cheapest electricity prices. Furthermore cloudmining is often leading to losses and not to profit! At this point I can personally only recommend LTCGear that offers profitable mining power that scales with the difficulty and the below linked GAWminers.
After registration you will be given a short tutorial about the website. Click through the tutorial. (Important!)
At the end of the tutorial you will be given aGenesis Hashlet (10GH/s)
Select a Bitcoin mining pool for it and drag&drop onto your new hashlet.
You are done and mining Bitcoin with 10GH/s!
CEX.io
Join me mining and trading at CEX.io, here you get the following benefits:
Mine in the ghash.io pool with 0% fee
Rent Hashing Power (GH/s) (With BTC or NMC)
You can buy & sell GH/s from the cloud that will work for you OR you can simply make a profit on buying and selling these shares. No fee.
Invite others and get 3% bonus of their GH/s in extra to your account (this does not affect the invited person in a negative manner)
Merged mining ofBitcoin, Namecoin, Devcoin and IXcoin. These do not require extra work, but increase your profit.
Warning! Maintenance fees are so high that it practically only makes sense to TRADE at CEX.io. Buying hashing power and letting it work will make you lose money on the long term!
Triplemining
You can also join me mining at Triplemining where:
The pool gets all the shares
You have a chance to win the weekly jackpot of around ~0.4 BTC
You can make your own "minipool" and earn more by inviting others
Lowest payout limit that I have seen among pools (0.01 BTC)