Mining Ethereum

Short Tutorial on how to mine ETH on a Linux Machine

Recently, because of all the buzz around cryptocurrency, I thought of getting my hands dirty with crypto mining.

I already own a capable Linux machine running Pop! OS with an AMD Ryzen 3950X and Nvidia RTX 2080Ti. Here are the steps I followed to start mining

System Updates

Ensure you have the latest NVIDIA proprietary drivers running on your system.

sudo apt update && sudo apt upgrade -y

Nvidia CUDA Toolkit

System76 and Pop! OS makes it really easy to set up the latest Nvidia CUDA packages on the system.

sudo apt install system76-cuda-latest

If you are running Ubuntu or any other flavor of Linux, you will have to look for instructions on setting up CUDA for your Linux version somewhere else. However, there are quite a few articles available for practically every version out there.

Setting up snap (Optional)

Snap is just another package manager for Ubuntu distros. In case you don’t have snap installed, please do the following.

sudo apt install snapd
sudo systemctl enable snapd
sudo systemctl start snapd
sudo snap install coin

However, it comes pre-installed in Ubuntu; however, it may not be available in other Debian versions out of the box.

Setting up a Crypto wallet (Optional)

For this, I used Coin wallet. It’s available on the snap store.

sudo snap install coin

There are tons of crypto wallets available. Of course, you may choose any other wallet as well.

Create your wallet

  1. Open the Coin Wallet.
  2. First time, it will ask if you have wanted to open a new wallet. Follow the instructions and generate a passphrase.
  3. Note down the Passphrase. If you lose it, there is no way to recover the wallet.
  4. Select the currency as Ethereum
  5. You are done. Goto Receive, and there you will see your wallet address. We will need that in the following steps.

Install the Ethereum Packages

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt update
sudo apt install ethereum

Installing T-Rex Miner

There are many more miners available. Like Ethminer, Claymore, however, I found T-Rex to be most reliable. They charge 1% as a developer fee but support many algorithms, a watchdog to ensure the process restarts if the connection dies and a browser-based dashboard for monitoring.

Download the tar and untar

mkdir t-rex
cd t-rex
curl -O -J 'https://trex-miner.com/download/t-rex-0.20.4-linux.tar.gz'
tar -xvf t-rex-0.20.4-linux.tar.gz

Setup the configuration file

t-rex supports a nice JSON configuration file which you can setup once and forget about long and arduous commandline parameters which you may have to use in other case.

Make a copy of the configuration file

cp config_example myconfig.json 

Customize the JSON configuration

Here are the sections I modified

I chose ethermine.org as my pool. There are many more available like

  1. 2miners
  2. nanopool
  3. woolypooly

Etc. You may visit their websites, figure out the URL, port and fill it below.

{
  "pools": [
    {
      "user": "<ADD YOUR WALLET ADDRESS HERE>",
      "url": "stratum+tcp://asia1.ethermine.org:4444",
      "pass": "",
      "worker": "%HOSTNAME%_rig0"
    }
  ]
}

Fill in your coin name.

{
 "coin":"eth"
}

Fill in your algorithm

{
 "algo":"ethash"
}

I did not modify any other section.

Begin Mining

t-rex -c myconfig.json

You will see a bunch of blocks getting printed now, which means the mining has begun. You may view the progress on a webconsole as well.

As you continue to mine, you will start earning ETH, and the respective pools make a payment once your earnings reach a certain threshold.

Happy Mining!

See also