Mining Ethereum on Windows

Tim Coulter
Jun 1, 2015 · 6 min read

This is going to be a quick guide. I’ve got things to do, people to see, food to digest. You get the point. Still, mining on Windows involved enough technical steps — and a few random guesses along the way — that it’s likely I’ve forgotten something. Comment, and I’ll attempt to fill in the spots I missed.

Credit Where Credit’s Due

Before I get started, most of what I’ve learned comes from Geniol’s post on the GPU mining forum. Alot can be found there. If you have questions, it’s worth a read.

General Layout

In order to mine correctly, we’re going to need to run two programs. The first is ethminer, which talks to your GPUs and does all the hashing work. The second is geth, which talks to the network and keeps up-to-date with the blockchain. Ethminer is written in C++ and comes from the project cpp-ethereum, whereas geth is written in Go and comes from the project go-ethereum. We’ll talk about installing both, and then follow up with how you’ll run each together.

Installing Ethminer

Ethminer comes with a few mostly simple steps, but you are building from source. If you haven’t built anything from source before this could be daunting. I’ll try to make it as easy as possible, but again, I’ve got things to do and all that jazz.

  1. Download Visual Studio Express Community Edition 2013
  2. Download the OpenCL SDK for your GPU platform. I have AMD GPUs. The SDK I downloaded was the AMD APP SDK v2.9.1. I’m not sure what to download for NVidia cards, but you’ll likely get what you need by googling “download NVidia OpenCL SDK”.
  3. Install Git for Windows, if you don’t already have it. You’ll need to get familiar with how to use git as well, but I’ll try to lay out the commands here.
  4. Install CMake for Windows. You should use the installer package.
  5. Using git, check out cpp-ethereum. You’ll want to open a command prompt or PowerShell, find a directory you like, then type this command: git clone
  6. Next, you’ll want to switch to the “develop branch” of cpp-ethereum. To do this, in that same terminal, ‘cd’ into the /cpp-ethereum directory (the one created by the previous git command), and then type:
    git checkout develop
  7. Next, cd into /cpp-ethereum/extdep, and run:
    This should download a bunch of stuff. You just gotta wait for it to finish.
  8. Next, cd back into /cpp-ethereum, and run:
    cmake -DETHASHCL=1 -G “Visual Studio 12 2013 Win64”
    This will prepare the project for compiling.
  9. Great, you’re most of the way there. Next, open up Visual Studio, and then find the ethereum.sln solution file within the /cpp-ethereum directory. Open that up. Visual Studio might complain about some things being the wrong format — if it does, say okay and just let it do its thing.
  10. After it opens, it’s gonna scan some files and do some project’y-type organizational things that make Visual Studio happy. Let it do those, because when it doesn’t it crashes on me. Whatevs.
  11. After that, you should see a list of projects on the right hand side. Find ‘ethminer’, right click on the name, and select Build. This will build the project from source. You’re going to see hundreds of warnings pile up in the warnings box, but it should finish with “Build project succeeded”, and it should have zero errors. If it doesn’t say succeeded, and it has errors, something is wrong.
  12. Hopefully at this step everything is great. In the command prompt or PowerShell you used above, cd into /cpp-ethereum/ethminer/Debug. You’re going to see a file called `libcurld.dll`. Make a copy of that file and place it in the same directory, removing the ‘d’ in the name to make it `libcurl.dll`. I’m not sure why, but there’s some build error which causes that name to be incorrect, which causes ethminer to fail at runtime.
  13. From here, you should be able to run ethminer.exe from within that Debug folder. We’ll get to running it in a second. Now we have to install geth.

Installing Geth

Haha, gotcha! I’m not actually going to tell you how to install geth. That’s because they have pretty good Windows installation instructions on their project wiki, under the heading Building From Source. You’ll want to ignore step #1 (you’ve already got git, and you don’t need mercurial). Also, step #5 is likely to be the hardest and most error prone part. I’d follow this guide for setting your environment variables if you don’t know how. Note that after setting your environment variables, you’ll need to close and reopen any command prompts or PowerShells for those settings to take effect.

After installing geth, the executable should be globally accessible from the command line.

Running Geth

First, you’ll want to create a new account with geth. You can do this by running this command:

geth accounts new

Enter a strong password twice and you should be good to go. Take note of the address that gets created — this is the address that will receive all your mined Ether.

Next, you want to make sure geth is running and connected to the network. To do this, you’ll want to run this command:

geth.exe -rpc -unlock=primary

As of this writing, the network is already over 450,000 blocks, so geth is going to take a long time to download those blocks. Your only indication that blocks are being added to the network is if it says “importing 256 blocks” (or something to that effect). If you run geth and don’t see that after a few minutes (or a few seconds?) you’re likely not connecting correctly.

If you think you may not be connecting correctly, your best bet is to run geth with a higher verbosity:

geth.exe -rpc -unlock=primary -verbosity=4

If you see a message of the form “Synchronization canceled”, and you’re only seeing that message, then geth isn’t connecting to any peers. In that case, you’ll likely need to port forward port 30303 from your router to the internal IP address of your computer running geth. Port fowarding is different for every router, but these guides might be helpful.

If you’re connected and things are running smoothly, geth should eventually connect to peers and import the blockchain. When it’s close to the current block height (you can check the current block height at, you’ll want to start running ethminer.

Running Ethminer

As the name might suggest, ethminer is where the actual mining happens. Ethminer interfaces with the GPUs and performs the work, and it gets it work from geth. To run ethminer, we have to tell it where geth is located:

ethminer.exe -G -t 3 -F “http://localhost:8545”

There are a couple things about that command I’d like to mention before we go further:

  1. You should be running that command from /cpp-ethereum/ethminer/Debug, as the compiled executable file gets put there by Visual Studio.
  2. -G tells ethminer that you want to mine with your GPUs instead of your CPU.
  3. -t tells ethminer how many GPUs you want to mine with. This is highly dependent on the amount of GPUs in your system, so can be confusing, but is very important. My system has (1) R9 295x2 card, (1) R9 280x card, and (1) onboard Intel Graphics chip. Though I have three physical GPUs, Windows actually registers four because the R9 295x2 card has two cores. So, with four cores, what I’m telling ethminer to do by passing the ‘-t 3’ option is to use the first three (thankfully, the AMD cores) and ignore the onboard Intel graphics chip. We compiled ethminer to use AMDs OpenCL code above, so ethminer will crash if it tries to mine using the onboard chip using AMDs code. Safely ignored, everything should work fine.
  4. The -F option tells ethminer where geth lives. I’ve been assuming that you’re installing geth and ethminer on the same Windows machine. If so, then “http://localhost:8545” is the address of geth’s service for sending work to ethminer. If you installed geth on a different machine, you’ll have to provide ethminer with geth’s IP address instead of localhost.

If everything works correctly, you should see output that recognizes your graphics cards, and then starts chugging away. You should also see your amount of hashes processed per second be non-zero (and a high number, at that). If you see both of those things, you’re golden. If not, I recommend checking the GPU mining forum as other people have likely ran into similar if not the same issues.

Once you start mining, if you find a block ethminer will output a smiley face and say “Block submitted and accepted!” and geth will output “Mined block #xxxxx”. You might also see geth say “Mined stale block #xxxxx”. Unlike other coins you could mine, stale blocks are actually worth something, so if you see stales that just means someone found the block before you did (but you still contributed). You’ll still receive a partial block reward in this case.

Hopefully this helped! Cheers!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store