If you have a computer with some graphics cards and a lot of memory, mining within the Ethereum network is one of the easiest and quickest ways to obtain the cryptocurrency Ether.
To mine Ether using GPUs, two programs are needed. Firstly, Ethminer is required to do the hashing work and utilize your GPUs. Secondly, you will also need Geth, the program that communicates with the Ethereum network and keeps the blockchain updated.
1. Installing Ethminer:
To get Ethminer up and running, we must take a few steps involving building the program from source:
The first step is to download the Visual Studio Express Community Edition 2013.
Next, depending on your GPU platform, you must then download the OpenCL SDK. For example, if you have AMD GPU’s, the SDK to download is the AMD APP SDK v2.9.1. Similarly, for Nvidia GPU’s.
Thirdly, install Git for Windows and it would be beneficial to become familiar with the commands in Git for the later steps.
Fourthly, install CMake for Windows; where you should use the installer package.
Using Git, check out cpp-ethereum by opening a command prompt, finding a directory you like, typing the following command; git clone https://github.com/ethereum/cpp-ethereum.
Next, the “develop branch” of cpp-ethereum needs to be switched. To do this, in that same terminal, ‘cd’ into the /cpp-ethereum directory (the one created by the previous Git command), and then type the following command; git checkout develop.
Next, cd into /cpp-ethereum/extdep, and run the following command; getstuff.bat.
After running this command, you should see numerous downloads in progress.
Next, cd back into /cpp-ethereum, and run the following command;
cmake -DETHASHCL=1 -G “Visual Studio 12 2013 Win64”
This will prepare the project for compiling.
The next step is to open Visual Studio and locate the ethereum.sln solution file within the /cpp-ethereum directory. Once you have found it, open it up. Visual Studio might display complaints about some things being in the wrong format; just ignore this and let Visual Studio just do its thing.
After it opens, it will scan some files and configurate to make Visual Studio happy.
Following this, a list of projects should appear on your right-hand side. Locate ‘ethminer’, right click on it and select the Build option. This will build the project from source. Lots of warning boxes will appear but you should not worry; this flurry of warnings should finish with a message stating, “Build project succeeded.”
If you fail to obtain this message, then something is wrong and you may have to check you have correctly followed the preceding steps.
If everything has been done as described and you successfully build the project, then the next step is to use the command prompt. In the command prompt or PowerShell you used previously, 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`. This is due to a build error which causes that name to be incorrect and consequently ethminer fails if the ‘d’ is not removed.
From here, you should be able to run ethminer.exe from within that Debug folder. However, before we start using the Ethminer, installation of geth is required.
2. Installing Geth:
To install Geth, follow the instructions on their project wiki; we first need the Git program (which we have already installed beforehand.) Next, we need to install Golang. Then, install winbuilds from http://win-builds.org/1.5.0/win-builds-1.5.0.exe to c:\winbuilds and run win builds here. Next, we setup environment paths;
- Add GOROOT pointed to c:\go and GOPATH to c:\godev (you are free to pick these paths.)
- Set PATH to %PATH%;%GOROOT%\bin;%GOPATH%\bin;c:\winbuilds\bin.
Open a terminal and install godep first: go get -u github.com/tools/godep.
Then open a terminal and download go-ethereum go get -d -u github.com/ethereum/go-ethereum.
Try building ethereum with go dep, navigate to c:\godev\src\github.com\ethereum\go-ethereum\cmd\geth and run git checkout develop && godep go install.
Setting up environment paths may be the trickiest part of this process, so if you are new to this concept.
After installing geth, the executable should be globally accessible from the command line.
3. Running Geth:
Firstly, create a new account with geth. This can be done by running the command;
geth accounts new
Enter a strong password twice and you are all set. Keep a copy of the address that gets created in a safe place as this is where you will receive all of your mined Ether.
Next, you want to make sure geth is running and connected to the network. To do this, you must run the following command;
geth.exe -rpc -unlock=primary
Since the size of the network is so large, geth is going to take a long time to download those blocks.Once geth displays the message “importing 256 blocks” or something similar, then you know that blocks are being added to the network. However, if you run geth and this mesage is absent after a few minutes, then it is likely there is some connection issue.
Running geth with a higher verbosity may be a solution if you think you are not connecting correctly, which can be done with the following command;
geth.exe -rpc -unlock=primary -verbosity=4
Once you are connected and things are progressing smoothly, eventually Geth will connect to peers in the network and import the Ethereum blockchain. Once geth approaches the current block height, then this is when you will want to begin running Ethminer.
4. Running Ethminer:
As indicated by the name, Ethminer is where the actual mining happens. Obtaining work from Geth, Ethminer communicates with your computer’s GPU and performs the work. To run ethminer, we have to tell it where geth is located:
ethminer.exe -G -t 3 -F “http://localhost:8545”
This command should be run from /cpp-ethereum/ethminer/Debug, as the compiled executable file is put there by Visual Studio. Now let us break this command down into bitesize chunks;
Firstly, -G tells ethminer we want to mine with GPU instead of your computer’s CPU.
Secondly, -t tells ethminer how many GPUs you want to mine with. Earlier we have compiled Ethminer to use AMD or Nvidia OpenCL code, so ethminer crashes if your onboard GPU is used. Therefore, check Windows to see how many GPUs your computer has and ignore the onboard graphics chip. So, we would only like to use the GPUs that are AMD or Nvidia. Therefore, for a computer with four GPUs, we set -t 3 and we are effectively stating to ethminer that the first three GPUs, that is the AMD GPUs, should be used and to ignore the onboard GPU.
Finally, the -F option tells ethminer where the geth program is located. The steps outlined are correct under the assumption you are using the same windows device for both ethminer and geth. 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 as it should, the output will recognize your graphics card and will start working away. The amount of hashes processed per second will also be visible; it should be a large, non-zero number. If you do not see either of these, then you should check the Ethereum GPU mining forum as others are likely to have run into the same problems that you may be experiencing.
Ethminer will output a smiley face and bear the message “Block submitted and accepted!” if you find a block when you are mining while geth will bear a message “Mined block #xxxx.” Also, if you mine stale blocks, that is blocks that were discovered by someone else, you will still get a partial block reward and geth will display the following message; “Mined stale block #xxxx.”
Moreover, if you have more time and resources on hand, you could build larger Ethereum mining rigs instead of just using your computer. The Ethereum Community Forum has a lot of posts on how to build Ethereum mining rigs step-by-step.
Source: Read Full Article