What is Ethereum and How Do You Mine It?
Today we will look at ways of mining Ethereum – an open-source blockchain based distributed system for decentralized applications.
Although similar to Bitcoin, it’s different in a number of ways that we’ll discuss here. Let’s get started.
What is Ethereum and how is it different from Bitcoin?
In simple terms, Ethereum is to applications (apps) what Bitcoin is to money. Ethereum provides the platform and infrastructure where programmers can create apps that are governed by “smart contracts”.
They are decentralized in nature with no central server or controlling authority. If you remember our last article, the concept is strikingly similar to Bitcoins. Ethereum is generic in the sense that it can be used to decentralize anything, and Bitcoin is a special case of decentralized currency.
How does Ethereum work?
Ethereum’s code is written as a smart contract in specific programming languages. It is then converted to an intermediate form known as bytecode. This is understood and executed by an Ethereum Virtual Machine (EVM).
The blockchain nodes store the state of the application as “accounts”. Every time an app is used, the state changes and the network processes it to calculate the new one and add it to the blockchain. This mathematical puzzle-based processing takes time.
The goal of miners is to solve the puzzle and whoever does it first gets the reward which is Ether tokens – the currency of the Ethereum world.
Practical uses of Ethereum
Why do we need decentralized apps? Well, in most cases we don’t, but, to prevent abuse, the Ethereum platform has been specifically designed in a way that it would not be economically feasible to write systems that don’t add much value.
This is because every line of program execution or storage requires Ether - which costs money. For the same reason, Ether is also called the system’s “Gas”. The Ethereum platform is useful for special scenarios where decentralization makes sense and where trust is important.
Let’s consider the case of online gambling sites. Suppose you register and play a Roulette game. You put your money on the wheel showing an even number. But the wheel stops on an odd number and you lose.
Unlike the physical Roulette machine, the web version can be easily rigged. The server knows what you bet on so manipulating the result is easy. It’s just a program after all and you don’t know the source code. How can you trust the system?
If the site was re-designed in Ethereum, it would be impossible for anyone to cheat because the logic would sit publicly in every chain’s nodes. The smart contract would contain instructions to transfer tokens or money as soon as certain conditions are met - in this case, depending on whether the player was right or wrong.
This is just one of Ethereum’s useful applications - the possibilities are endless.
How to mine Ethereum
Mining Ethereum isn’t very difficult and could be profitable.
You’ll need to decide before you start whether you want to do it on your computer or on the cloud. We’ll look at both approaches but the difference lies in the cost of your electricity bills while using your hardware compared to that of cloud time.
Some people also mine just for educational purposes or as a hobby.
Mining on your computer
Before you start, if you want to make money from mining, you’ll need cheap electricity and specialist hardware. If you use a regular computer, the electricity costs might eat up any earnings you make.
This is also true for any cryptocurrency or Blockchain-based technology and the competition is tough.
Here’s what you need to set-up a mining infrastructure at your home or office.
- Select the hardware. Use a dedicated computer for mining. You’ll need a GPU rather than a CPU as it gives a better hash-rate and a better chance of solving the mathematical puzzle.
Comparisons are available online to help you select the right one. You can also combine multiple GPUs together in a single unit to form a mining-rig. Unlike Bitcoin, specialized hardware like ASIC (Application Specific Integrated Circuits) is not available for Ethereum. - Install the Ethereum client. After the hardware has been set-up, you need client software to connect to the Ethereum network. Use Geth – a CLI program that uses GO programming language. It is available for most platforms like Windows, Linux, MacOS and as source code.
- Install the mining software. This will earn you the real ‘Ether’. Use Ethminer along with geth you installed earlier to start the mining process. Get the exact commands from the official website: https://www.ethereum.org/ether
Joining a mining pool
Instead of tackling it solo, consider becoming part of a collective that pools their hardware resources for mining. When the group achieves success, the profit is shared among the members in accordance with the hardware resources each has contributed. Since these mining communities fluctuate frequently, it's advisable to research which ones are currently the most active.
Mining on the cloud
If you don’t want to set up and configure the hardware, you may want to mine in the cloud. Most cloud companies charge for the resources you use rather than at a flat rate. You’ll need to calculate how profitable mining would be with a particular host.
Many providers have a free trial you can use to get a feel for the setup and configure a mine shop. We’ll discuss setting up a major cloud services provider – Amazon AWS - here, but the steps will be similar for any other provider.
Mining on Amazon cloud (AWS)
- Go to the console and select US East Zone (N. Virginia). This one has the cheapest rates for our purposes. There is also an AMI (Amazon Machine Image) community where the mining libraries are pre-installed.
- Under instances, select Spot Instances. You will see a page as shown below. Click “Request Spot Instance”.
- Select the option for – Request for spot instance. Then, search for ami-cb384fdd in the AMI section.
- Next, select the instance type as 8xlarge. We selected spot instance because you can limit your bill to what you can afford. The spot instances are spare CPU resources; this is why they are cheap. If you are on the free trial, the same AMI can be selected from the Create Instance in the EC2 section.
- Click on “Review and Launch”. Make sure you create the key-pair file or you won’t be able to SSH into the instance later. Your instance should be up and running now.
- The next step is to join a mining pool, but get an Ethereum wallet ready first. There are many online providers where you can register if you don’t already have one.
- At the end of the process, you’ll have a wallet address (public key) and a private key. DO remember to never share your private key with anyone.
There are many mining pools available. For this demo, I have selected https://dwarfpool.com/eth
Now, to start mining, SSH into your AWS instance using a shell client like Putty - you may need the private key to authenticate. This is the file you downloaded while creating the AMI instance.
Other information like the hostname etc. can be found on your AWS EC2 instance page. Please note that the username for our AMI is – ubuntu.
After logging into the SSH, run these below:
> tmux
> ethminer -G -F http://eth-eu.dwarfpool.com/{WALLET ADDRESS}/{any_name} --cl-local-work 256 --cl-global-work 16384
With the tmux command, the mining will continue even if you have logged out of the SSH session. The command below that starts the mining process. After some time, you can also start checking the mining status with this link:
https://dwarfpool.com/eth/address?wallet={your_wallet_address}
If the pool is successful in mining Ether, it will be distributed amongst the members and you will get your share transferred in the wallet address you specified.
Is Ethereum mining profitable?
Similar to any other Blockchain technology, Ethereum was highly profitable in the beginning. As it’s become more successful, it became more difficult and profits have fallen.
Profitability now depends entirely on what hardware you use and how much you pay for your electricity. The graph below shows how Ethereum mining is increasingly difficult:
One more thing to remember, Ethereum developers are planning to move from a proof-of-work concept to a proof-of-stake one. This would mean that no block reward will be given to miners, only the transaction fees.
Nevertheless, Ethereum has always remained a high-interest topic for businesses and hobbyists alike.