----------------------------
11/27/2015
This guide is now OUTDATED and has been updated: The New Guide
-----------------------------
7/30/2015
Updated Multi-GPU commands
Updated instructions for building cpp-ethereum
7/29/2015 @ 11:46pm
Added instructions on transitioning from testnet to Frontier.
-----------------------------
I tried for two days to install Ethereum for GPU mining and I was tired of reading the Ethereum.org posts and getting no where. I'm a novice when it comes to all this collaborative code development so I just needed a simple-stupid guide for me! I've collated everything in one place for those that are running Ubuntu. This works from a clean install of Ubuntu 14.04 LTS.
Note: I found this works best if you don't have your GPU card in while doing the initial Ubuntu install (this caused issues for me as the on-board video and GPU were fighting for monitor control or I was hallucinating).
Start Install:
at the command line type: sudo apt-get -y update
sudo apt-get -y upgrade -f
go to system& settings>Software&Updates>Updates &click Pre-released updates (trusty proposed)shut down the computerinstall the GPU and GPU power
boot up the computer
then go to system & settings > Additional Drivers & your GPU should be listed there, select Using video driver fror the AMD graphics accelerators from fglrx-updates (proprietary)
apply changes and close
back to the command line:
sudo apt-get -y install git
sudo apt-get -y install software-properties-common
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install -y build-essential libgmp3-dev golang
sudo apt-get -y upgrade
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
backup your old key file (if you mined on test net):
sudo cp -r ~/.ethereum/keystore ~/Desktop/
Now lets continue with geth install and get the latest version of geth:
git checkout master
Clear out your old blockchain (only if you've run geth on test net previously)
sudo rm -r ~/.ethereum/extra/
sudo rm -r ~/.ethereum/state/
sudo rm -r ~/.ethereum/blockchain/
we need to do some last things to setup for Frontier:
sudo apt-get install curl
cd ~
sudo apt-get install -y python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
mkdir genfiles
cd genfiles
curl -O -k https://raw.githubusercontent.com/ethereum/genesis_block_generator/master/mk_genesis_block.py
curl -O -k https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo python -m pip install bitcoin
cd ..
cd go-ethereum
make geth
(if you throw an error on make geth and you go back and try and fix things, make sure to delete the go-ethereum directory before trying to make geth again (error help me!))now we make a new wallet for Ethereum:
build/bin/geth account new
(enter in a password 2x)
now we'll install ethminer
cd ~ sudo apt-get -y install language-pack-en-base sudo dpkg-reconfigure locales wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main"
sudo add-apt-repository ppa:ethereum/ethereum-qt sudo add-apt-repository ppa:ethereum/ethereum-dev sudo apt-get -y update sudo apt-get -y upgrade
sudo apt-get -y install build-essential git cmake libboost-all-dev libgmp-dev libleveldb-dev libminiupnpc-dev libreadline-dev libncurses5-dev libcurl4-openssl-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libargtable2-dev llvm-3.8-dev libedit-dev mesa-common-dev ocl-icd-libopencl1 opencl-headers libgoogle-perftools-dev qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libqt5webengine5-dev ocl-icd-dev libv8-dev
git clone https://github.com/ethereum/cpp-ethereum cd cpp-ethereum git checkout mastermkdir build cd build cmake .. -DGUI=0 -DETHASHCL=1 make -j2 sudo make installsudo apt-get install cpp-ethereum #(Can someone confirm that skipping to this step still works) cd ~ cd go-ethereum
cmake .. -DGUI=0 -DETHASHCL=1 -DEVMJIT=0
python ~/genfiles/mk_genesis_block.py --extradata 0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa > genesis_block.json ./build/bin/geth --genesis ~/genfiles/genesis_block.json
Sync with the Network & Benchmark:
at the command line type:
cd go-ethereum
build/bin/geth -rpc console
This will start syncing you up with the network. Once synced (you are only grabbing 1-2 blocks at a time) head back to the command line to benchmark. (Note: Personally I found the results of this benchmarking unreliable. Easier to just skip to the mining part):Ctrl + C
build/bin/geth --rpccorsdomain localhost 2>> geth.log & ethminer -G -M --opencl-device 0 tail -f geth.log
I initially had some trouble b/c I had an AMD embeded video card and an AMD GPU. Make sure you are targeting the right GPU card by changing the opencl-device # until you find the right card. Reference this list to see if you are targeting the right card.
Once your are done benchmarking, post your results here.
Note: benchmarking using the code above causes geth to run in the background and thus if you try mining or running geth again, you might get an errors. Easiest thing to do at this point is close the terminal and open a new one. Or just restart the computer for good measure. Then you should have no problem going on to the mining step.
Mining:
Now we're done installing and benchmarking, lets start freaking MINING! build/bin/geth --rpc console
I then open up a second terminal and type: ethminer -G --opencl-device X
Where X is the value given by your benchmarking results. Keep doing the "etheminer -G --opencl-device X", one time for each GPU you have. It will take a few minutes for rpc console to sync up and get ready as well as a few more minutes for the miner to start hashing so be patient.
If you skipped the benchmarking part, at this point you should have a good idea of how fast your machine is mining so go and post the results of your average hashing here.
If you're experiences errors eith Ethminer at this point check the reference posts below.
Additionally, some GPUs may required an additional typed at the regular command console (not the geth console):
export GPU_MAX_ALLOC_PERCENT=95
One last check after you start mining, make sure your coinbase account (the account where your mining rewards will be deposited) is set. You can check this by typing the following inside the geth javascript console:
web3.eth.coinbase
If this returns '0x0' that means you're mining rewards will get sent into a big black hole. Fix this by typing the following inside the geth java scrypt console:
web3.miner.setEtherbase(web3.eth.accounts[0])
That will set your mining account to your primary account.
Multi-GPU Mining:
You can mine with multiple cards. Plug them both into your board and turn on geth "build/bin/geth -rpc console". Let the chain sync.Then pop open a second terminal and type:
where X is the number of GPUs you have to mine on.
ethminer -G -t X
Cheers!
Updating:
Occasionally you will need to update your copy of geth and cpp by pulling down the latest release from github. You can perform this operation by: cd go-ethereum
git pull
make geth
cd ..
cd cpp-ethereum
git pull
After pulling the latest revision of Geth, make sure to rebuild it using "make geth" as shown above. If you don't rebuild it, it causes major long-term problems. On rare occasion, you will need to completely wipe your blockchain and re-download it. Perform that operation as follows cd go-ethereum
build/bin/geth removedb
References:
This post was put together by reading the following posts:Mining FAQs Live Update
Frontier GPU guide
Benchmark
Building on Ubuntu
Final Steps for Frontier
Code formatting brought to you by codeformatter.