paint-brush
A Cryptocurrency mining experimentby@tb.
854 reads
854 reads

A Cryptocurrency mining experiment

by Tahfimul LatifMay 18th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

My software engineering teacher had received grant money to teach a course on cyber-security. He utilized the money to replenish the aging machines through purchasing and building a set of computers for students. He built two extra machines with the left over money, to perform experiments with. Since I was intrigued by Bitcoin, but never understood its technicalities, I thought here is my golden opportunity!

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - A Cryptocurrency mining experiment
Tahfimul Latif HackerNoon profile picture

Let’s talk about how I mined Bitcoin in my high school for a learning experience.

The start

My software engineering teacher had received grant money to teach a course on cyber-security. He utilized the money to replenish the aging machines through purchasing and building a set of computers for students. He built two extra machines with the left over money, to perform experiments with. Since I was intrigued by Bitcoin, but never understood its technicalities, I thought here is my golden opportunity!

And off to research…

At the time, I only knew about the existence of the popular Cryptocurrency, Bitcoin. However, my research led me to deep dive on this subject than I expected.

What is Cryptocurrency?

  1. Cryptocurrency is a new concept of currency shaped around modern computer technology. The difference between this currency and conventional (Monetary) currency which we commonly use is that it is digitally stored. These stored digits (1s and 0s) are intangible values which are governed by the Blockhain technology. The inital objective of Blockchain technology implementation was to achieve a decentralized financial system.
  2. Because it’s an independent entity not controlled by a specific party or individual, transactions are made public via a “public ledger” (Blockchain).
  3. Cryptocurrencies, just as all other forms of currency are stored in a wallet. In the case of Cryptocurrency, “wallets” are virtual applications which come in various forms enabling, different levels of security and support for Cryptocurrencies and platform(s).

How can Cryptocurrency be mined?

In summary, mining software provide instructions to the processor (CPU, GPU, ASIC). These instructions tell the processor to solve math problems. Based on the amount of problems solved, the miner is rewarded an amount of Cryptocurrency. We will get into the technical stuff later when discussing algorithms.

This requires a combination of several components (Hardware/Software/Maintenance):

Hardware

  • Cryptomining in its early age could be achieved using low-end CPUs, such as those by ARM. However, as the mining network grew, so did the competition. This led to an increase in “difficulty level” for solving the problems, demanding greater processing power and leading to the adaptation of high-end GPUs.
  • Nowadays, mining is most efficient and profitable through ASIC (Application Specific Integrated Chip)s. These processors are designed for one purpose; Cryptomining.

Software

  • Mining software such as NiceHash Miner communicate mining instructions to processor.
  • Wallet software such as Electrum store the mined Cryptocurrency.

Maintenance

  • Heat is an issue which requires miners to be watchful of the operations, especially those who run Cryptomining farms. Often times, box fans are used to cool the machines in these situations. For the average miners who are not running a Cryptomining farm, cooling systems with addition to temperature monitoring software are used to stabilize heat generated by the workload of mining.
  • Adequate internet connection is another key factor when mining, since the mining software has to be able to communicate with the Blockchain/Pool, passing necessary data in order to determine the amount of currency which will be rewarded.

Mining software

Mining software have several tasks in hand. First it has to either connect to a pool or the blockchain (depending on user). Next, it chooses an algorithm (depending on mining software). There are miners which can dynamically switch between algorithms, such as NiceHash and those that mine using a particular algorithm (ideal in farms).

Pool vs. Solo mining

A pool consists of a group of miners, connected via a server who mine together. There are solo miners who mine themselves through directly connecting to the Blockchain network. Both methods have pros and cons; however, solo mining is for advanced miners who have experience with networking, routing, database and a host of other variables. Unlike mining on a pool, the rewards when solo mining is also inconsistent.

Algorithms

As mentioned, mining software work with algorithms which do the heavy task of interactions between the hardware and Blockchain/Pool.

Here is a pseudo code that describes a gist of how Cryptomining algorithms work:

P := The hash of the previously mined block

B := A block of transactions

H := A hash function

D := Difficulty Level

0 Retrieve P

1 Construct/Modify B

2 IF H(P, B, Some Random Number) produces a number > D END (Block is added to network)

3 If output of Step 2 is false, GOTO step 1

Step 0 — Retrieve the hash of the previous block from the network.

Step 1 — Gather a list of potential transactions known as a “block”. This list of transactions comes from the peer-to-peer bitcoin network [within the Blockchain].

Step 2 — Calculate a hash for a block of potential transactions along with a random number.

Step 3 — If the hash is more than the currently set difficulty level, then you have mined that block. If not, start over from Step 1. Any additions to the list of transactions from step 1 along with change in the random number from Step 2 mean that there’s a chance that the criterion will be met in the next go around.

Source: Stack Exchange

The actual experiment

I began by first creating a Bitcoin wallet using Electrum. Next, I choose the very first Bitcoin mining software which Google search brought up and was easy to install called Bitcoin Miner. Thirdly, I linked the wallet address to the miner so that all earnings were sent to the wallet.

Bitcoin Miner

While it’s easy to set up, I came to find out that this software was highly ineffective at generating profit (if any). It was mining at a rate of few thousand Satoshis/hour (a.k.a mBitcoin). To put it dollar amount, it’s a few cents per day, making the miner disadvantageous.

NiceHash Miner

A few days later, I came accross NiceHash Miner. It is a mining software that contains a list of algorithms which it can switch between based upon a few factors:

a. Demand of buyers

b. Profitability from algorithm

c. Efficiency of algorithm

d. Minimum earning amount set by user

More on NiceHash: https://www.nicehash.com/sell

It took a few trial and error to get this miner to work. But once working, the results were drastically different. The earning rate went up to $0.33/hr from just $0.01/hr. That’s an increase of 3,330%!

$0.33 may seem like a minuscule amount to you and the question becomes why? Didn’t I mention about purchasing and building high-performance rigs? Well, I also mentioned earlier, the relationship between “difficulty level” for solving math problems to competition. As more miners mine, the difficulty of solving the math problems increase. Another pointer is the market itself. Since this form of currency is noncommercial, its market therefore is volatile. For example, if a Cryptocurrency is sold more than purchased, the value of the currency may drastically go down in terms of monetary value. For this reason, skeptics label investing in this financial system to be a gamble since no one can predict the outcome after investing.

Temperature control

Initially, I was not keen in monitoring the heat caused by the mining process. I believed that the temperature control settings by default should take care of it. I realized that the temperature control software was not configured for mining after my software engineering teacher had let me know. He actively monitored the operation whenever he had the chance. He configured the fan settings in the temperature control software. Once configured, the experiment ran smooth for a few months until NiceHash Miner could no longer connect to the pool server.

Connection issue

My judgement was that Department Of Education (D.O.E.) have discovered this activity and blocked any connection to the NiceHash pool and any of its other services. To my conscience, I opened a browser to the NiceHash website and sure enough the page was blacklisted.

Eager to keep my experiment going, I installed a VPN service. This free service lasted a few weeks until it too failed to connect. At this point, I evaluated on whether it’s worth it to devote any more of my time into the experiment.

And I felt that I should keep going…

On my quest to finding other reliable and free VPN services, I felt satisfied with the results and decided not to further proceed. Often times, free VPN services only allot a limited amount of data usage per month. The allotted amount is not sufficient for the amount of data usage which mining requires. It wasn’t ideal to uninstall expired services and replace them with other VPN services. Nevertheless, Cryptomining was an one of a kind experiment that taught me a lot about the future as well as the capabilities of current computer technology.

Cryptomining Stack

From my learning experience, I jotted a “Cryptomining Stack” which helps visually picture the general aspect of mining.

Note to returning readers:

On my last story I mentioned about continuing my Java series, I will try my best to get the next segment out, but I can’t guarantee that unfortunately!

Sources

  1. https://www.youtube.com/watch?v=JyxRH18YlpA
  2. https://www.nicehash.com/sell
  3. https://bitcoin.stackexchange.com/a/12733
  4. https://www.digitaltrends.com/computing/how-to-mine-bitcoin/
  5. https://www.youtube.com/watch?v=6QpgP7XIzxk
  6. https://99bitcoins.com/bitcoin-mining-profitable-beginners-explanation/