The Ethereum network is kept running by computers all over the world. In order to reward the computational costs of both processing the contracts and securing the network, there is a reward that is given to the computer that was able to create the latest block on the chain. Every 15 seconds, on average, a new block is added to the blockchain with the latest transactions processed by the network and the computer that generated this block will be awarded 3 ether. Due to the nature of the algorithm for block generation, this process (generating a proof of work) is guaranteed to be random and rewards are given in proportion to the computational power of each machine.
This process is usually called mining in the crypto-currency lingo.
CPU MINING USING THE COMMAND LINE
If you are on a private network (and if you just want to test the technology for free, you should) then any normal computer with a normal CPU will be able to run the network and earn test ether (ether that is only redeemable on the test network where it was generated) through mining. This is the best choice for small-scale network or testing privately, as it’s less resource intensive. On the real (or live test) network a normal desktop (or laptop) computer might take a very long time to successfully mine a block and receive ether.
Before you do any mining, you need to set which address will receive your earnings (called “etherbase”). You only need to do this once. Here’s how to set your etherbase and then start mining:
Before you can find any blocks, however, your computer needs to go through a process called “building a DAG”. This DAG (short for “Directed Acyclic Graph”) is a large data structure (~1GB) required for mining, intended to prevent ASIC machines (“Application Specific Integrated Circuits”) from being mass manufactured for mining ether. Its goal is to protect miners like yourself so that you will only ever need your home computer to remain competitive. The DAG should take about 10 minutes to generate and as soon as it finishes, Geth will start mining automatically.
If you have successfully mined a block you will see a message like this among the logs:
🔨 Mined block #123456
To check your earnings, you can display your balance with:
GPU MINING USING THE COMMAND LINE
If you are serious about mining on the live ethereum network and getting real ether rewards, then you should use a dedicated computer with very powerful graphics cards in order to run the network.
Instructions for Eth:
If you are using Eth then GPU mining comes out of the box. Simply quit the console (press control+C multiple times and then enter) and then start it with the –GPU option turned on:
eth -b –genesis path/to/genesis.json -i -m on -G
Once you started, just follow the same instructions as normal CPU mining.
Instructions for Geth
There are currently two options for GPU mining in Geth available. You can read a more detailed description of how to install it on this mining post.
C++ Etherminer. This is a version for the pro miners. To install it, follow the guide to install the whole C++ ethereum code.
Go experimental GPU branch. It’s experimental so you need to build go from source to get it. This version is focused on hobbyists and developers. To install it, clone geth from source and then switch to the GPU Miner branch.
MORE INFORMATION ON MINING
Ethereum’s proof of work algorithm does not make use of Scrypt or Sha256, instead, it leverages EtHash, a Hashimoto / Dagger hybrid. You can read all about the theory behind this and its design in the Ethereum gitBook, mining chapter. Note that for Serenity (a future release, a major milestone on the Ethereum development roadmap) we are planning to switch to Proof of Stake (PoS).
The Ethash proof of work 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.
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. Empirical evidence has already confirmed this, with R9 290x regularly topping benchmarks.
ASICs and FPGAs are 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.