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
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 bitminter.com 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.
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.
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://mint.bitminter.com:3333 --userpass=jonathanmh_crowd:password
- Run the downloaded file “minerd”
- with the
-aflag for algorithm and sha256 as the parameter
- use the correct URL you get from your mining pool
- 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://mint.bitminter.com:3333 [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://mint.bitminter.com:3333 [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!