How to help secure the Ethereum network FAQ

StephanTualStephanTual London, EnglandPosts: 1,282Member, Moderator mod
edited July 2015 in Mining

Updated 13th July 2015 - RC2 'Olympic' Edition


Think this is the life? Then read on.



How will I be able to mine when Ethereum launches?

At Frontier, the first release of Ethereum, you'll just need a) a GPU and b) an Ethereum client, Geth. CPU mining will be possible but too inefficient to hold any value.

Codename Frontier, the initial live release of Ethereum consist of Geth, the Command Line Interface written in Go, and nothing else. At the moment, Geth only includes a CPU miner, and the team is testing a GPU miner branch, but this won't be part of Frontier.

The C++ implementation of Ethereum however does contains a GPU miner, both as part of Eth (its CLI), AlethZero (its GUI) and EthMiner (the standalone miner).

Mining, for the time being, is best left to Linux. We will likely be releasing Windows releases to provide the best support that we can... however we cannot guarantee it. If you must use Windows, using a workaround such as Virtualbox or Vmware is probably recommended for the time being, but this will not be an appropriate mining setup.


Which algorithm are you using?

Frontier does not make use of Scrypt or Sha256, but instead, it leverages of EtHash, a Hashimoto / Dagger hybrid: Here are the docs: https://github.com/ethereum/wiki/wiki/Ethash . Here is the code: https://github.com/ethereum/ethash/.

For the Serenity release we are planning to switch to PoS.


When can I mine 'real' Ether?

Mining 'real' Ether will not start until the Frontier release goes live. We've released Olympics - the Frontier pre-release - on May 9th, 2015. You can track the progress on the development of Frontier proper at https://github.com/ethereum/go-ethereum/milestones.

Before the project launches its live 'mainnet', we need to 'test' the network. The Ether mined on the testnet has no value whatsoever and the chain is sometimes reset randomly, which prevent test Ether from holding any value.

When the project goes live, it will of course be possible to select the 'testnet' or the 'mainnet' to mine on. A command line switch will allow you to chose the appropriate network.


What hardware do I need to mine?

Both GPUs and CPUs are supported. The GPU advantage over CPUs is roughly 100x. We're currently working on a Geth GPU implementation, which is experimental and won't be part of Frontier.

The algorithm is memory hard, you'll need at least 1+GB of RAM on each GPU. I say 1+ because the DAG, which is the set of data that's being pushed in and out of the GPU to make parallelisation costly, will start at 1GB and will continue growing indefinitely. 2GB should be a good approximation of what's needed to continue mining throughout the year.

You can benchmark your device, we encourage you to share your results here. This should also give you a good idea of which GPU is 'best bang for the buck'.

Mining prowess roughly scales proportionally to memory bandwidth. As our implementation is written in OpenCL, AMD GPUs will be 'faster' than similarly priced NVIDIA GPUs. Empiric evidence has already confirmed this, with R9 290x regularly topping benchmarks.

ASICs and FPGAs is be strongly discouraged by being rendered financially inefficient, which was confirmed in an independent audit. Don't expect to see them on the market, and if you do, proceed with extreme caution.


Enough FAQ! I want to mine NOW!

This guide an early guide exclusively for the experienced, advanced technical user. I assume you're using Ubuntu, the recommend platform for mining.

As it stands, there is no 'install and press a button' way to mine on Ethereum. Instructions (and results) heavily vary between platforms. Proceed at your own risk, as you could lose data.

We'll be using Geth (the Go command line) as a command and control center for multiple EthMiners (the standalone C++ client, one per GPU). The stability of the clients varies as bug fixes and features are added to the code, very often several times a day, sometimes several times per hour. For the purposes of Olympic, you should always use the development - not master - git branches, PPA and brew taps.

Do not proceed with this guide using a machine on which you do not feel comfortable losing data, or even hardware. You have been warned - this is EXPERIMENTAL.



How to install the clients is not covered in this guide, please see each wiki (Go/C++) for information.


Setting things up

For this guide, you'll need Ubuntu 14.04 or 15.04 and the fglrx graphics drivers.

If you're on 15.04, Go to "Software and Updates > Additional Drivers" and set it to "Using video drivers for the AMD graphics accelerator from fglrx". Once the drivers are installed and in use, you're all set, go to the next section!

If you're on 14.04, go to "Software and Updates > Additional Drivers" and set it to "Using video drivers for the AMD graphics accelerator from fglrx". Unfortunately, for some of you this will not work due to a known bug in Ubuntu 14.04.02 preventing you from switching to the proprietary graphics drivers required to GPU mine.

So, if you encounter this bug, and before you do anything else, go to "Software and updates > Updates" and select "Pre-released updates trusty proposed". Then, go back to "Software and Updates > Additional Drivers" and set it to "Using video drivers for the AMD graphics accelerator from fglrx"). Reboot.

Once rebooted, it's well worth having a check that the drivers have now indeed been installed correctly.

Whatever you do, if you are on 14.04.02 do not alter the drivers or the drivers configuration once set. For example, the usage of aticonfig --initial can and likely will 'break' your setup. If you accidentally alter their configuration, you'll need to de-install the drivers, reboot, reinstall the drivers, reboot, then rebuild ethminer.


Installing Geth

First, install the Go code, which contains Geth. You'll need a version of Geth on the devel branch that a) compiles well b) works well. While the build server does wonders and guarantees a successful compile to the PPA users, here it's best to manually compile Geth if you want to play in the big leagues.

Always make sure you run the latest version of Geth. Regularly run git pull in your git cloned directory and make geth to update, ideally daily - the purpose of Olympic is to test things after all!

To check that it works well, start Geth with the command:

geth console

... and insure the chain starts downloading, the network functions, etc. You'll definitely need to create an account (a set of public and private keys) - you can read a guide to the Geth console at http://ethereum.gitbooks.io/frontier-guide/content/creating_accounts.html.

A quick note here, starting Geth usinggeth console 2>>geth.log then monitoring its log using tail -f geth.log will save you a lot of heartache as Geth is quite verbose - and trying to type instruction at the console while information scrolls by can be tricky.

It's recommended you let Geth run until it caught up to the latest block. Be patient: note that bootstrapping for the first time can take a few minutes, and that downloading the current testnet chain takes north of 9 hours on a core I7. If you are on the Tesnet, feel free to use this experimental chain download, at your own risk of course.

A very common issue you might encounter here is UPnP not functioning, and not being able to acquire peers. If this happens, the first thing you should do is enable UPnP on your router and failing that, manually forward port 30303.

You can check on the status of the chain download by simply looking at the command line: you'll see Geth acquire blocks by chunks of 256 (the first chunk can take up to 10 minutes to appear, depending on your location), and once it's fully caught up with the chain, it will start acquiring block one at a time. Once this is the case, CTRL+c to exit Geth.

This a very good idea to back up your chain at this point. To do so, while in your user folder, simply do cp -a .ethereum/ .ethereum2. Yes, it's a bit hamfisted, but it works, and exporting and reimporting the chain is currently too slow to be useful, when swapping folders in place works well and is very fast.

The above also backs up your keys, which are in the /keystore subfolder. If you lose your keys, you lose access to the account and its ether balance, permanently. Private keys cannot be generated from public ones (obviously) and the password you're asked for when creating the account is just a means to encrypt the private key, not regenerate it.


Installing EthMiner

We had to wait for the chain to download first because not doing so can create a few issues. You now are ready to mine, but as I mentioned earlier, Geth does not include a GPU miner (ye), so it needs a bit of help from EthMiner, the standalone C++ miner.

EthMiner is bundled with the C++ code. Again here, you'll need a version that works well for your machine, and updates are coming hard and fast. Go and install C++ Ethereum now.

An important note: we'll be using ethminer here, not Eth (the C++ CLI). If you decide to want to use Eth in the future, be aware that Geth and Eth configurations folders (~/.ethereum) do clash (see this link for more info). If you start Eth without an alternative ---db-path switch, even just once, even by accident, while Geth is installed, you'll have to recover from your chain backup. Ethminer doesn't have this problem - because it doesn't concern itself with the status of the chain - so we'll just move ahead.

I'm going to assume you have an ATI GPU here, as they tend to be more popular than Nvidia's for mining purposes. We're going to start by testing your GPU, and benchmark it. Once C++ Ethereum is installed:

ethminer -M -G

... will benchmark your GPU. There are a couple of problems you could encounter here.

First potential problem, maybe you are encountering the dreaded 'nothing is happening' bug where well, nothing is happening. Insure your fglrx graphics drivers are installed as mentioned in the "Setting things up" section above. If this does not solve the problem, you will likely want to compile an older, but working version from source, but by now it's time to remove the PPA training wheels anyway.

The second potential problem is that EthMiner cannot guess which opencl device Linux thinks your GPU is. So if you see the benchmark fail with a message stating 'segfault' - it's probably trying to benchmark what appears to be your CPU. You need to specify the location of your GPU to Eth. To do this:

ethminer -M -G --opencl-device 0

I've used 0 here, but your device could be anywhere. Mine is on 0. You'll know it's benchmarking correctly because you will see the family of your GPU displayed in the logs (R9s are for example codenamed 'Hawaii', here's a list).

If the benchmark worked, it would be kind of you to post your results here, so other users can benefit.


Mining proper

Once everything is nice and compiled, single or multi-GPU mining is almost disarmingly simple. First, start Geth and its RPC console:

geth --rpc console

This makes Geth available to distribute work packages to the Ethminer workers.

Now start an ethminer per device. If you have more than one GPU, you'll have to run the command multiple time, increasing the ID of the opencl-device by 1 each time:
ethminer -G --opencl-device 0
ethminer -G --opencl-device 1
ethminer -G --opencl-device 2
... etc.

EthMiners will automatically find the Geth RPC server, and start processing the workloads it distributes.

One hiccup you might see is an error from Ethminer stating something about 'GPU fragmentation'. Assuming your benchmarks have successfully run, this is likely due to a bug where Ethminer doesn't wait for the DAG to be fully generated before trying to do some work. Wait for the DAG to be fully loaded, and if you still get the message, kill and restart Ethminer. I had to reboot on one occasion to clear one such particularly recalcitrant message.

Another hiccup could be 'Bus Error' - this can sometime happens if you try to spawn too many ethminer processes in one go. Instead, start Geth, wait for the blockchain to be up to date, start one ethminer, wait for the DAG to be generated and mining started, then start the next ethminer, etc.

If it all worked out, you should be able to nab a few blocks or uncles here and there, even on a single card. Congratulations!

This is probably a very good time to add yourself to our beautiful stats dashboard. It's optional, but fun, and helps the community. Here are the instructions. Note that unfortunately your newfound hashrate will not be displayed accurately on https://stats.ethdev.com/ when using worker threads, this is a known issue that will be resolved in the future.

Here's what a few mined block look like in Geth (note the little hammers).



And here's a diligent EthMiner at work:



The static block reward in Olympic is currently 500 Finneys, or roughly 0.5 Ether. This will change in the livenet. For the exact block reward mechanism, and more information on uncles, please see the yellow paper: http://gavwood.com/Paper.pdf, or for a quick TL;DR see this forum post.

Have fun!



If you like this post, please press 'like' in the bar below :smile:
Post edited by StephanTual on

Comments

  • StephanTualStephanTual London, EnglandPosts: 1,282Member, Moderator mod
    edited June 2015

    A note on multi-GPU setups

    Mining on a single GPU should be no problem assuming you do not skimp on cooling. But if, like me, you love watching the photos of 'ghetto rig setups' with cables hanging everywhere (including my rather amusing-looking creation pictured above), please be aware there is a surprisingly high chance you will permanently damage the hardware you're using when attempting to shoehorn 3+ GPUs in one machine. You could also be endangering yourself or others, and there has been multiple instances of fire in the enthusiast mining community.

    Seriously - a lot of the 'crazy pictures' of rigs you find online are of machines that will function for a few days, maybe weeks at most, before failing in some fashion, and losing their owners thousands of dollars. If you do not know without having to Google it what a '12v rail' is, stop now and start by mining with a single GPU.

    OK! Patronizing warning over :)

    Post edited by StephanTual on
  • StephanTualStephanTual London, EnglandPosts: 1,282Member, Moderator mod
    edited July 2015
    Update history
    10 May 2015: updated for Olympics
    11 May 2015: minor changes re: GPU miner availability
    14 May 2015: added references to GPU mining
    15 May 2015: updated GPU information further
    16 May 2015: added practical instructions for mining in Olympic
    17 May 2015: corrected typos, improved instructions
    19 May 2015: re-wrote guide to be 118% simpler.
    20 May 2015: added workaround for 'bus error'
    21 May 2015: added note not altering graphic drivers post installation
    24 May 2015: minor updates
    03 June 2015: minor updates
    23 June 2015: minor updates
    13 July 2015: minor updates for RC2
    Post edited by StephanTual on
This discussion has been closed.