How to mine Bitcoin with your CPU

This post is about how to mine bitcoin with your CPU on Linux, MacOS or Windows. This is the first part in my bitcoin adventure series and I’m not a professional miner, I’m just trying out everything I can get between my fingers.

Disclaimer: I am not saying this is a smart idea. Actually it’s not. The only purpose you should use this for is if you’re curious what the flip bitcoin is and how all of this works.

Update: You might be interested in mining Monero with your CPU.

What is Bitcoin again?

It’s the most recognized cryptocurrency, it’s probably explained better by Wikipedia:

Bitcoins are created as a reward for payment processing work in which users offer their computing power to verify and record payments into the public ledger. This activity is called mining and is rewarded by transaction fees and newly created bitcoins. Besides mining, bitcoins can be obtained in exchange for different currencies

WikiPedia: Bitcoin

If you want to have a look at a really basic explanation of bitcoin, they have an official video for that:

As said before, your CPU is not a good mining interface, because graphic cards and specialised hardware like FPGAs and ASICs are much faster at doing the computation that creates the actual bitcoins, which are stored in your wallet, a virtual collection that just contains some strings of text.

Mining Bitcoin with your CPU

I really wanted to try mining and I didn’t care if it would cost me more than I would make in Bitcoin, so I looked around and stumbled across a bunch of different programs for mining. The one I found for using your CPU was funnily enough one named cpuminer.

Now on it’s own it’s not going to do a lot, but actually we’ll have to hook it up to a mining pool, if we don’t have the entire 6GB bitcoin ledger so far and a server center and so on. Pools are basically networks of people who mine bitcoin and distribute the workload among their machines.

I picked as a mining pool. It’s pretty small, but allows some OpenID logins, takes 1% off my mining efforts as a fee and seems like a legit place from what I could read on forums. It shows you statistics for how much your individual workers make and how much of a bitcoin block you have contributed to mining.

To get started, you just need to sign up for some mining pool and then download the cpuminer.

If you want to see which pools mine a lot (they split the income, so it’s not a primary factor) you can check the graph at blockchain about the hashrate distribution across mining pools.

bitcoin-hashrate-mining-pool-distributionthe graph at blockchain about the hashrate distribution across mining pools

Once it is in your download directory and extracted you can use it. If you have not a lot of experience in the terminal, you can use something like the following commands, if you have downloaded cpuminer from the sourceforge page that fits your operating system.

tar zxf pooler-cpuminer-2.4.2-linux-x86_64
chmod +x minderd # making sure it's executable

Now you run a command like the following:

./minerd -a sha256d --url=stratum+tcp:// --userpass=jonathanmh_crowd:password

This will:

  1. Run the downloaded file “minerd”
  2. with the -a flag for algorithm and sha256 as the parameter
  3. use the correct URL you get from your mining pool
  4. append the username, underscore and worker, followed by the password

With this command you can by the way also help me mine a bitcoin (my set goal, currently worth ~220€).

Careful: your CPU might get somewhat hot. Also, I’m not doing it because I’m greedy, but because I want to blog about it, so you’re just keeping these blog posts going faster if you decide to give me a couple of hours of your CPU time 😉

The output you get from the mentioned command would be something like the following:

[2015-06-16 06:48:46] Starting Stratum on stratum+tcp://
[2015-06-16 06:48:46] Binding thread 2 to cpu 2
[2015-06-16 06:48:46] Binding thread 3 to cpu 3
[2015-06-16 06:48:46] 4 miner threads started, using 'sha256d' algorithm.
[2015-06-16 06:48:46] Binding thread 1 to cpu 1
[2015-06-16 06:48:46] Binding thread 0 to cpu 0
[2015-06-16 06:48:53] thread 2: 2097152 hashes, 9563 khash/s
[2015-06-16 06:48:53] thread 3: 2097152 hashes, 9554 khash/s
[2015-06-16 06:48:53] thread 0: 2097152 hashes, 9543 khash/s
[2015-06-16 06:48:53] thread 1: 2097152 hashes, 9566 khash/s
[2015-06-16 06:52:01] accepted: 1/1 (100.00%), 36441 khash/s (yay!!!)

which goes on for a loooong time and keeps spitting out lines like this.

The lines followed by (yay!!!) are a little indicator of successfully submitted progress, which you later can see in your mining pools interface.


If you don’t specify the -a sha256d option, you will get output that resembles this:

[2015-06-16 06:50:18] Starting Stratum on stratum+tcp://
[2015-06-16 06:50:18] 4 miner threads started, using 'scrypt' algorithm.
[2015-06-16 06:50:18] Binding thread 3 to cpu 3
[2015-06-16 06:50:18] Binding thread 2 to cpu 2
[2015-06-16 06:50:18] Binding thread 0 to cpu 0
[2015-06-16 06:50:18] Binding thread 1 to cpu 1
[2015-06-16 06:50:19] Stratum requested work restart
[2015-06-16 06:50:19] thread 3: 4104 hashes, 9.32 khash/s
[2015-06-16 06:50:19] thread 1: 4104 hashes, 9.23 khash/s
[2015-06-16 06:50:19] thread 0: 4104 hashes, 9.30 khash/s
[2015-06-16 06:50:19] thread 2: 4104 hashes, 8.99 khash/s
[2015-06-16 06:50:48] thread 1: 245712 hashes, 8.70 khash/s
[2015-06-16 06:50:48] accepted: 0/1 (0.00%), 36.30 khash/s (booooo)

Where the last line tells you, that your hashes were rejected by the mining pool, because they simply were generated by the wrong method. This will not mine you any bitcoins.

Now that’s basically it! You now know how to mine Bitcoin with your CPU, which is not recommended, but fun to try and shows the process of how you do it. If you have specialised hardware, you basically just use another program, which I’ll get into later in the series of posts 😉

My CPU by the way is the following:

CPU: Quad core Intel Core i5-4440 CPU (-MCP-) cache: 6144 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) 
 Clock Speeds: 1: 3101.00 MHz 2: 3101.00 MHz 3: 3101.00 MHz 4: 3101.00 MHz

Thank you for reading and be sure to leave your thoughts in the comments or hit me up on one of the social networks listed on the left!

Thank you for reading! If you have any comments, additions or questions, please leave them in the form below! You can also tweet them at me

If you want to read more like this, follow me on feedly or other rss readers

16 thoughts on “How to mine Bitcoin with your CPU”

  1. Can’t connect to BitMinter: Connection timed out: no further information:
    I get the above error. Is it something to do with the router or ISP?

    1. hello,
      I am also facing same problen in windown 8 system .please help.
      Hi Curio have you solve the problem.


  2. I have pooler-cpuminer-2.5.0-win32 on my pc. I create slush pool account and a get stratum code but its not connect to the website. please help me.

  3. Have you tried using multiple CPU machines with many cores? I am wondering if a cluster could solve sha256 with any real efficiency. Starting to develop a 128 core cluster for another project and wanted to see if it could dual purpose. Can you share what chip you used for your testing? Cant tell if you had four processors or four cores from the screen shots

Leave a Reply

Your email address will not be published. Required fields are marked *