My Journey from Crypto Mining to Deep Learning

Source: Deep Learning on Medium

I have Blockchain and Deep Learning in the title, one of these is usually enough to catch the readers attention, I have both! Relax, this isn’t a spoofing attempt, I’m going to share with you my journey through the past year and a half, starting with how I built my crypto mining machine, and how I ended up training my own deep neural nets with this miner instead.

Part I — Crypto Mining

Ok, it all starts back in December 2017. Bitcoin is the hottest topic and this graph tells you why tells you why:

My story, like many other blockchain stories, begins in the late fall of 2017. I decided that in order to best understand the technology I needed some stakes on the line. Instead of buying some crypto coins, I decided to build my own crypto-currency miner!

While there were options to buy pre-built crypto-miners like the ones from Bitmain, I opted-out to build my own for few reasons:

  • Bitmain miners were not your typical computer with extra powers. Instead, they were machines built for one purpose only…. Mining $$.
  • Bitmain miners were good at mining Bitcoin but were not designed to mine other types of crypto-currencies like Etherium (which requires GPU power instead of CPU). I didn’t want to bet on Bitcoin itself for the long-run, because of its many limitations (High transaction processing-times, high fees, …etc), instead I went to bet on new emerging coins that enhance and solve many of Bitcoin limitations.
  • I just love assembling powerful computers. And in the worse case scenario, I would have a powerful Fortnite machine (Didn’t know that yet).
4 out of 6 GPUs that are about to solve trillions of equations to support the blockchain

Amazon always delivers! Parts started to arrive. It wasn’t easy! The demand for GPUs sky rocketed. Distributors like New-egg were limiting the number of GPUs that can be purchased per household. I had to order my parts from different sources and at different times. Fun fact, if I sold all the parts one week after they arrived as “used” I would have made $1000 in profit.

Before wiring! Everything looks neater before wiring.
Operational, at night!


Putting it all together was straight forward. Though it had to be assembled using some non-traditional equipment. The most obvious is that you can’t use a normal PC case, nothing would fit. I had to use a special motherboard to accept my 6 GPUs, some PICe Risers to connect the GPUs. Some parts were 3D printed and were not mass produced, like the brackets for the cooling fans. My guess is that these parts alone generated a small business economy for some people.

It’s time to put it to work and make some $$. The idea is that you join the blockchain using this machine, try to solve math equations before other miners do, and when you succeed you get your reward. Think about it as a transaction(s) fee. Your machine helped run the transaction(s) and you get paid for your services. You are taking one role that banks usually take.

The income was very unpredictable, you never know when you would succeed. So few people gathered and joined forced to form what’s called a mining pool. I joined one of these pools. Basically, you lease your processing power to this group, which then uses the joined power to process the blockchain transactions and get paid. Everything is in an open book and everyone get paid based on their processing power contributed. This is not a new concept to me. Back when I didn’t have broadband internet in Syria I had to use internet via satellite and something similar was formed from different people around the world to join each other and form a super account. That’s a different topic for a different blog though.

One thing was very intersting in this mining pool. My contributed processing power using my 6 GeForce GTX 1080 was 320-360 MH/s which is the hashrate or the average number of “equations” that you solve per second. Because the mining pool was a democracy, everything was transparent, one menu showed you all the contributed power by other users. The top user had 150,000 MH/s. Doing quick math, this means this person/corporate had about 3000 GPUs in one place. This is what we used to call a mining farm. 3000 GeForce GTX 1080. WOW!

I started to generate about $50 per day, awesome! At this rate I could make back my invested money in 3 months. This felt like a great investment until the Great Crypto Crash happened.

Prices were smashed. While mining was getting even harder (more miners where joining the network). The investment wasn’t great anymore, no regrets, it was a lot of fun.

There is another reason that I wanted to shut down the mining operation. Electricity usage. This machine was using almost as much as the rest of my entire home. Even though it was generating $$ to easily cover the entire bill, it just didn’t feel like it’s environmentally responsible to keep it on. To minimize the damage, I turned of the heating in the lower section of my home where the miner was. Yes, it was generating enough heat for the entire 1000 sq. ft. basement level. Being in Upstate NY winter helped keeping my miner cool and operating efficiently. I shut it off before spring and summer, so I don’t know what would have happened during the warm season. This was the end of the mining operation. When I shut it off it was generating about $13 a day. It simply wasn’t worth the environmental cost.

Where does the story goes from here? Well, I was already in love with Deep Learning and ready to practice and experiment. What do deep learning scientist need you ask? A good GPU mining machine!

Part II — Deep Learning

Deep Learning is what we call a multi-layer Artificial Neural Network. A Neural Network consists of nodes which are a simple mathematical representation of a brain synapses. Don’t get nervous, this representation is as simple as: Y = WX + b.

Imagine if we connect millions of these Y = WX + b together, each will have a unique value for the weight W. How do we set the values of Ws? We start by training this network to find the best values for Ws by providing the training data. For example, if we are training the network to predict a house price given it’s size, location, number of bedrooms, …etc. We would pass these attributes as input X, then if we have the correct values for W, b we would get the correct house price Y. In training we give the network Y and X and tell it to find the best values for Ws. Now this set of Ws at the beginning will work only for this house. But after 100,000 of iterations feeding data collected of different houses, the network will successfully find these values which will work on all the data we have, we call these values the network’s weights. Now if we feed the network data Xs of a new house, the output of the network Y will be the predicted price of the house. Of course this works because the price of the house is related to it’s size, location, number of bedrooms, …etc. Sometimes it’s easy for us human to use these attributes and find patterns to predict the price. However, neural networks, in many application surpass humans abilities to detect these patterns. Specially when the data is large (Big Data) like social media data. In other cases, humans are still superior to deep neural nets, like driving a car in an uncontrolled environment.

I can go on and on about explaining Deep Learning, but many others have done a great job already. I want to share with you where I’m applying it instead.

A Neurologist friend approached me with a great idea to build an App to diagnose various eye-movement diseases using Deep Learning and AI. We ran few experiments and got very promising results.

Object detection using Deep Learning

We are developing our system, mobile and VR applications to make eye-diagnostics easy and accessible for all, even for those living in remote areas where it’s hard to find a trained neurologist. I’m going to write a separate blog dedicated on the product soon as we are finishing up development, but here is a teaser.

DancingEyes teaser

That’s all for now.