How I Learned to Mine Eth (Ether) on Ethereum using Geth

What does it take, to go from not knowing a thing about crypto-currencies, to being able to mine a coin from the internet? ... I'll tell you.

It begins with curiosity,
You first need to ask questions and be interested in what these internet coins are, you need to care about where they come from, what they're worth and what it means for the future of the world. At this point, if you're not asking these questions, you're not participating in the world, the New World, and you're missing out on something incredible. 

This, is the convergence of some independently deep learning paths one might follow, but multiplied across many and then combined, like the cross product of math, computer science, programming, finance, statistics, economics, psychology and design all rolled into one nice, neat little word. Coin. For centuries of civilizations before us, coins have represented worth and value, were trade-able and exchangeable liquid as cash - depending on whose face or logo was on it though. As ruling power changed coins too have risen and fallen with time. 



BitCoin started around January 2009, I had heard what was going on, and like others, had also heard it was an crypto-currency that employed some type of decentralized block-chain technology most commonly used by people looking to achieve nefarious results via the internet. Probably some onion layer kind of stuff, everyone knew what happened on silkroad... Anyway; I didn't think much of it, I had no need for this currency of trolls. What's next a meme economy? Hah, yah right.
BitCoin Historical Price Chart

A few years later, stories of people who had made vast sums of money with BitCoin began to appear in the mainstream. Someone bought pizzas, another bought a Porsche, then a house and the demand price for BTC exploded! Suddenly there was a major influx of financial wizards wanting to get in on the early money, speculation ran rampant, and then it happened. The bottom fell out. The price of BTC crashed harder than ever before around the end of 2013. Everyone and their uncle stood around with their hands in their pockets looking at floor tiles uttering "I told you that internet coins were a scam". 

But now, more people had heard about it, and a few more people seemed to be getting in on the non-financially motivated side of the concept. The blockchain, decentralized secure and anonymous, this ticked boxes for all kinds of programmers who saw potential in the idea beyond just the fiscal construct. The idea that all users keep a copy of the records and not one user is more trust-worthy then the other means there will always be a consensus on the correct history of records. It means, freedom. There can be disagreement though, this creates a fork in the chain, hard or soft it just means there has been a divergence that is now persisting, a spin-off if you will.

Blockchain is all about consensus among the peers and records, so when a DAO (Decentralized Autonomous Organization) does an ICO crowdsale (Initial Coin Offering) a buy-in period is opened, people contribute money/coins to give it power to launch and run it's applications/contracts, but these are not like equity shares, they're more like voting/control shares. A problem, or risk, can arise when a contract tries to move a large amount of money around, this is where the vulnerability comes in, it was exactly this process that resulted in the redirection of ~ 3.6 million ether to a child DAO in June 2016, causing the price of ETH to fall 35% from $20 to $13. People scrambled in an attempt to split the original DAO to stop the draining but they couldn't build a consensus quickly enough. The risk was putting all the money on one address in the first place, makes it an easy desirable target for thieves especially after a crowdsale when the public knows about how much money there would be. Apparently, that hack stopped on its own once news of the hard fork came to light, which also means it could continue at any time technically. Speculation suggests the hacker wasn't actually after the coins themselves, because any attempt to extract the coins or cash them would trigger investigations. Instead it is suggested that the hacker made money by short selling ETH during that time. Clever.



Given that it takes 51% of the consensus to agree to force changes in the chain, around June 17, the Ethereum Foundation (Vitalik Buterin)  proposed a soft-fork solution which would permanently seal those coins into the DAO and it's child for ever. Allegedly the hacker put out his own notice, asking people to oppose this fork and preserve his right to claim his ether as the original smart contract did technically allow for, offering to share one million ether + 100 BTC to all who participated in the opposition. (this could've be the start of a civil war inside Ethereum almost). So a hard fork was proposed to back pedal the chain and undo the draining of the DAO account. People cried out that this would violate the trust of the Ethereum network, so the whole situation remains in limbo, while the blockchain has split into 2 separate entities, the hard-fork DAO which still mines ETH, and the now new, but original ETC - Ethereum Classic Coin.

This new look at blockchain technology gave rise to other uses for it, and new coins based on blockchains with differing sets of rules and algorithms. We are seeing an ever growing list of companies implementing blockchain technology from banks and insurance companies to ride sharing services, and now Smart Contracts. These are contracts that can be carried out without the need for human approval, they cannot be changed either.

By 2025, it is estimated that 10% of the worlds GDP will reside on blockchain technology. 

So, what makes the blockchain work?

Doing Work does exactly that! Mining to be more precise, BitCoin mining. The blockchain is designed to reward whichever machine is willing to do the work of solving the math problems required to keep the network secure and running smoothly. Since every transaction is recorded on the chain, and every machine has a copy of the transaction, and validates it against other machine records as transactions occur.  So a miner validates transactions, and is rewarded with the creation of BitCoin in doing so, when the transaction is successfully added to the block chain by solving the proof of work problem. 

What is the Proof of Work Problem?

The proof of work problem is a construct designed to find a hash below some target value before the block of transactions can be added to the blockchain. The target value is tied to the mining difficulty which is a function of how many people are currently mining. The more people who are mining, the quicker the blocks will come out, so the difficulty will increase to keep it nearer equilibrium.

As the miners mined, the various coins began to proliferate, BitCoin, LiteCoin, DogeCoin, TitCoin and on and on and everyone had a coin, and they were all being traded on open markets like real currency. This lead to exchange frenzies as miners began hopping back and forth between various coins and trading for which ever coins were making them the most money at that moment. High frequency trading on coin exchanges is now also occurring. Free markets and competition are great, but what makes the USD so powerful in the real world is that it's accepted everywhere, like Gold once was - remember when the USD was on the Gold Standard? Pepperidge farm remembers...  


All of these coins felt pretty much the same, and even with all the BitCoin magic happening and windfalls of people being suddenly wealthy as BitCoin soars to 10x and 100x it's values, I still wasn't interested in buying any coins, nor mining. That's because when I looked at the concepts of how a few people who started mining BTC now own a huge portion of wealth, and everyone who starts mining late in the game missed all the early, easy blocks, well it doesn't feel worth it, and actually, it isn't. The price on BTC has gone so high that most people will not waste electricity mining it anymore, as it floats atop the speculation bubble, just above "worth mining".

But then a new type of coin emerged, that had people talking about "something different", it was doing something differently. Ethereum. Or, ETH for short. Ether is like a fuel, consumed in exchange for executing operations. It was designed to make sure that anyone writing code for this network, writes it in the most efficient way possible to consume less fuel. The rules are 5 ethers are created for every block to the miner of that block, and if someone else happened to also find a solution for that block but it wasn't used, then they get 2 or 3 ethers, these are known as uncles. Rewards are given in proportion to computational machine power. Ether generation is capped at 18 million ether per year, which also has a stacking effect over time that controls relative inflation. This might change in the future though.
Anyone can write an app or program to run on the Ethereum network using a language called Solidity, and by the nature of the network, this means that whatever task your program is executing, the result is going to have to be worth the value of ether that it will cost you to execute it. Anyone running a program on the Ethereum blockchain or exercising a smart contract will need to use ether as fuel to get that done, and this, is precisely why I chose to start mining Ether above any other coin. This one small detail is everything, it is the reason ETH value could eclipse the BTC value, because it has a point! There is a real purpose to ETH, it will get things done, it isn't arbitrary, and it will most importantly, do them in ways that are so efficient, the likes of which we've never seen before in any of our markets, ever. This is potentially a disruptive technology.

So, once you've decided you want to mine Ether, and you've learned all about it, and are finally convinced it's not a scam, you can start learning how to mine ether yourself. In the beginning it was worth it to mine using your CPU, but now everything is GPU mining, using your computers' video card's memory to compute these hashes and earn ether. The more memory bandwidth your video card has, the more  mining power you have, inherently as the implementation is based on OpenCL, AMD video cards tend to be more effective than NVidia cards, but they can also consume more power.

With the MSI GeForce 980 GTX Gaming 4G Twin Frozr that I had, I decided to give it a shot. Step one was downloading a copy of the Geth installer, version 1.6.5. Running Geth through command line to first create a new account, password, and then geth --rpc --fast --cache=32768, for 32 GB of ram. This command begins the process of downloading and updating the blockchain, the essential first step in mining is connecting to the network and having a copy of every single record the same as everyone else on the network.

Then, you need to download MIST Ethereum Wallet, version 8.10. This can run simultaneously as your blockchain downloads, which can take many hours if its your first connection.
ETH Ethereum Blockchain Sync Synchronisation Downloading

Once your blockchain is done synchronizing your wallet will also be synced, you can tell this by checking ethstats.org, or similar, to determine what is the latest block # and which block you are currently importing.

With the chain chugging along, you will now need a miner. I used Genoil's Ethminer 1.1.7, as it seemed to be the best reviewed, this or Claymores, I might try Claymores' miner later because it offers dual mining of ETH and Sia, - Sia is yet another alt-coin with some sort of value because it is encrypted I suppose. Once unpackaged on the system, I used the following commands in a bat file to get the miner running.

setx GPU_FORCE_64BIT_PTR 0
setx GPU_MAX_HEAP_SIZE 100
setx GPU_USE_SYNC_OBJECTS 1
setx GPU_SINGLE_ALLOC_PERCENT 100
setx GPU_MAX_ALLOC_PERCENT 100
ethminer.exe -F http://us-East1.nanopool.org:8888/##################.WorkerName -G --farm-recheck 200 --cl-local-work 256 --cl-global-work 4096 --cuda-grid-size 4096 --cuda-block-size 128 --cuda-streams 4

Setting up and Using an Ethereum Mining Pool

The first lines of "setx" are telling the program how to use the GPU, then it runs ethminer.exe and is contributing to Nanopool. What is Nanopool? Nanopool is a community of users who have collectively decided to all work more closely in hashing so that their collective computing power can do more work and the rewards are split up into shares of earned ETH.
Nanopool Ethereum Mining Stats Reporting

The first time I successfully ran Ethminer, my hashrate in command line was showing as 4 Mega Hashes per second. Which I now know isn't very good. After doing more research I learned that the driver version I was using on my nvidia card wasn't the best for mining, so I rolled back to Geforce driver 347.52 and finally started hitting 19 MH/s, as you can see in the chart above, it took a few days to really get a grip on mining.
Genoil Ethminer Mining Ethereum Hashrate Running

One issue I ran into was a full disk drive which prevented more block chain from coming in. So I deleted the blockchain files in appdata/roaming which was a poor choice also, because it just meant I had to re-download them all again. The fix is to change the repository directory both in the MIST wallet (by re-installing) and in Geth. This should fix the issue of filling up my OS-SSD by offloading the files to a hard drive instead. Unfortunately this never actually worked for me, and my small M.2 SSD filled up and my miner stopped for a while.



While reading more QnA from forums and asking questions on Reddit, I finally realized that I don't need to be syncing the blockchain at all, there is no point in running Geth manually, nor syncing the chain when mining to a pool, the pool does all that for you. There's also no reason to run the wallet while mining either, it doesn't do anything. What I've realized now, is that once you're up and running, you really only need to run the Genoil Bat file, and so long as you're pointed to a pool, everything else is inherently running inside and syncing itself. Wow. Impressively easy.

Now, it's time to scale.
With one GPU running 24/7 I can make so many ETH, luckily we can add in more GPUs and increase the hashing power, note that adding in more GPUs will NOT be using SLI mode, SLI is for gaming whereas when mining the cards are each used discretely. The reason we want to collect as much ETH as we can now and hold onto it, is because even though it might not be worth mining directly today, there is a belief that the value will increase down the road. So the coins you mine today, could be exponentially more valuable with time, a lot more valuable, as you saw happen with BTC. Especially when Ethereum moves from proof of work to proof of stake. That could change everything. 

Comments