Start Mining Bitcoins

Bitcoin is a digital decentralized currency that is getting hot these days. One bitcoin, as of this writting, worths about 520 US dollars. It has been recently legalized by California. Bitcoin can be earned by helping verifying transaction, aka, mining. Mining is essentially computing hashes, many many of them.

This article will walk you through how to start mining bitcoin with a graphics card on a commodity PC. Let’s get started!

Setup a wallet

The first step is to setup a wallet to store your money(Bitcoin). There are a bunch of choices, you can choose to setup a local wallet on your computer or choose a online service. I chose to use coinbase because it’s easy to setup.

You will get a bitcoin address like 1NpnrNH12JGLhCdHrMLSZhNptnVVPfvafy which identifies a digital wallet. It can be used to send or receive bitcoins.

Find a pool

You will work with a group of other miners by joining a pool. A list of available pools can be found here. I chose the Slush’s pool as an example. After setting up your account. Put in your bitcoin address in the My Account page. In the same page, you will find one worker has been created. Its login and password will be used later by the miner. One worker is needed for each miner you setup.

Setup miner

There are a lot of miner options. You choose a miner based on your hardware and operating system. Various kinds of hardware have been used for bitcoin mining, for example: CPU, GPU, ASIC, FPGA, etc.

CGMiner On Ubuntu

My desktop PC is running Ubuntu 12.04 and has a radeon HD 6670 graphics card. There is a post about setting up CGMiner on XUbuntu. Not all the instructions work for me, so here is what I did for your reference:

Install AMD graphics card driver

Download the driver from here.

cd fglrx-14.10.1006.1001/
sudo ./

Follow the instructions in the installer.

Config driver

Check your card can be found by:

gen@ubuntu:~/bc$ sudo aticonfig --lsa
* 0. 02:00.0 AMD Radeon HD 6670

* - Default adapter

Initalize config and reboot:

sudo aticonfig --adapter=all --initial
sudo reboot

Install CGMiner

tar jxvf cgminer-3.7.2-x86_64-built.tar.bz2
cd cgminer-3.7.2-x86_64-built
export DISPLAY=:0
./cgminer -n

You are expecting this as output:

gen@ubuntu:~/bc/cgminer-3.7.2-x86_64-built$ ./cgminer -n
./cgminer: /lib/x86_64-linux-gnu/ no version information available (required by ./cgminer)
 [2014-08-24 00:15:52] CL Platform 0 vendor: Advanced Micro Devices, Inc.
 [2014-08-24 00:15:52] CL Platform 0 name: AMD Accelerated Parallel Processing
 [2014-08-24 00:15:52] CL Platform 0 version: OpenCL 1.2 AMD-APP (1445.5)
 [2014-08-24 00:15:52] Platform 0 devices: 1
 [2014-08-24 00:15:52]  0       Turks
 [2014-08-24 00:15:52] ADL Initialisation Error! Error -21!
 [2014-08-24 00:15:52] 1 GPU devices max detected
 [2014-08-24 00:15:52] USB all: found 4 devices - listing known devices
 [2014-08-24 00:15:52] No known USB devices

Note: You’d better don’t use newer version of cgminer since versions after 3.7.2 don’t support GPU anymore per this post.

Run CGMiner

Write a shell script to run cgminer:

export DISPLAY=:0
cd /<your custom path>/cgminer-3.7.2-x86_64-built
./cgminer -o http://<mining_pool>:<port> -u <username> -p <password> --api-listen --api-network -I d --gpu-reorder --auto-fan --gpu-powertune 0 --gpu-engine 800 --gpu-memclock 667


  • username and passwd are from the Find a pool section
  • mining_pool and port are for Slush’s pool
  • Find the default engine and memory clock frequency for you card and change them as needed. I once mistakenly used 1000 as the memclock which caused OS crash.
  • Find the meanings of other parameters by ./cgminer —help

Cgminer looks like this when it’s running. You can find your current hash rate, GPU temperature and many other information.

 cgminer version 3.7.2 - Started: [2014-08-21 21:39:39]
 (5s):89.76M (avg):89.50Mh/s | A:3888  R:0  HW:0  WU:1.3/m
 ST: 2  SS: 0  NB: 336  LW: 19940  GF: 0  RF: 0
 Connected to diff 8 with stratum as user liugen7.worker1
 Block: 28b147d7...  Diff:23.8G  Started: [00:15:59]  Best share: 3.68K
 [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
 GPU 0:  63.5C   0%    | 89.77M/89.50Mh/s | A:3888 R:0 HW:0 WU:1.3/m I: 3

 [2014-08-23 22:45:54] Accepted 1d5e56ad Diff 9/8 GPU 0
 [2014-08-23 23:12:15] Accepted 07986bb2 Diff 34/8 GPU 0
 [2014-08-23 23:13:47] Stratum from pool 0 detected new block
 [2014-08-23 23:14:42] Stratum from pool 0 detected new block
 [2014-08-23 23:16:45] Accepted 11504e8a Diff 15/8 GPU 0
 [2014-08-23 23:17:14] Stratum from pool 0 detected new block
 [2014-08-23 23:18:31] Accepted 053de410 Diff 49/8 GPU 0

Mining speed

Bitcoin mining speed is measured hash rate whose unit is Mhash/s which means million hashes per second. That number largely depends on the hardware used. My radeon HD 6670 is working at about 90 Mhash/s. You can find the speed of different hardware from here. Specially made ASICs have much faster hash rate than GPU and CPU.

You can calculate the earning of mining using this tool. At my current hash rate, I will earn about 3 cents per month :( So don’t expect making money by mining from your personal desktop. You should consider purchasing those much more efficient ASICs.