Learning about cryptocurrency mining

As a long-term investor in crypto, I want to deeply understand as many aspects of the space as possible. Having started to follow traders and miners like @notsofast, I decided that mining was one such area.

While I’m definitely not someone who’d likely be able to setup a “mining rig”, I did manage to do some mining, and wanted to document what I learned. Also, since there was so much digging around involved in actually getting started, I wanted to pull together the details into the article I wish I’d had available.

So in this post, I’m going to talk about my experience with cloud-based CPU mining, and my experience with cloud-based rental of mining rigs. But first, let’s introduce a couple of key concepts.


For starters, mining is a computational activity in which you calculate hashes in an effort to validate blocks of transactions on the chain of whatever coin you’re trying to mine. The calculation of a hash is performed according to a particular cryptographic hashing algorithm, of which there are several. In the case of bitcoin, the algorithm is called SHA-256.

A hashing algorithm takes any size input, and produces a fixed-length output, from which the input can not be determined. That’s why hashing algorithms are referred to as one-way functions. The process of mining, at least in bitcoin (I haven’t checked if it’s precisely the same for others), involves calculating the hash of a block of transactions, the hash of the block header, hashing those together and looking at the output for something called a “nonce”, which verifies that we’ve found a block.

The miner then broadcasts those hashes to the network, which can verify their work and assign them the reward.


Whether I’m using my laptop computer or a full-bore rig to mine, I only get a reward when I find a block. And that can take a long time. For that reason, mining pools were formed, that aggregate the hashing power of multiple contributors. Whenever the pool discovers a block, the rewards are distributed pro-rata to the pool contributors.

From what I can tell, most mining nowadays is done in pools.


Bitcoin was originally mineable with CPUs on desktop and laptop computers. People later discovered that GPUs (graphics processors) are much better at computing hashes, at which point it became economically uninteresting to mine with CPUs. Finally, task-specific processors called ASICS were produced, which are optimized for the computation of hashes.

There seems to be an order of magnitude in capability between these technologies, with hash power discussed in units of KH/s, MH/s and GH/s, respectively.

As you can imagine, there’s also a cost difference between these technologies. Getting up and running with a GPU “rig” is more expensive than mining on your laptop, and only those willing to make a major investing in mining are using ASICS.

Interestingly, some projects, like Ravencoin, wish to preserve a broader community of miners—i.e. less consolidation of hash power—and design their hashing algorithms to be ASIC-resistant.

Cloud-based CPU mining

Given that I can’t setup a mining rig, my first option for experimenting with mining was to deploy cloud servers (VPSs) at places like DigitalOcean and Scaleway (which even I can do in a few clicks), and then hopefully find some Unix-based CPU mining software.

Fortunately, some Unix-based CPU mining software does exist, and is even designed to allow you to mine a variety of coins, using a variety of hashing algorithms. It’s called cpuminer-multi.

Below are the CLI commands I pieced together to get the software installed and running. This assumes you’ve created a server running Ubuntu 16.04 (the default OS at DigitalOcean, and offered by almost all cloud-server providers) and are logged in as root (and be sure to answer “Y” to any prompts):

Here’s the first command (not sure what it’s doing):

apt-get update

Now we make sure the git version control software is installed:

apt-get install git

Now we install a bunch of stuff that’s going to let us build the cpuminer software on our server:

apt-get install automake autoconf pkg-config libcurl4-openssl-dev libjansson-dev libssl-dev libgmp-dev make g++

Now we download the cpuminer software:

git clone https://github.com/tpruvot/cpuminer-multi

Now we switch into the cpuminer directory:

cd cpuminer-multi

…and we build the software:


We’re going to launch the cpuminer software inside a screen manager (called “tmux”) so that we can then close our login session if we want:


Finally, it’s time to issue the command to start our miner! As you’ll see, we’re going to be passing in some information (parameters), including the pool where we’re going to mine and how we’ll be identified there.

To mine Ravencoin, I created an account at the Suprnova pool, then created a “worker”, specifying an arbitrary worker name and password. Also, in your Suprnova account, you have to specify a payout address where you want your earnings sent.

So here’s the format of the command you issue inside tmux to start mining Ravencoin at Suprnova:

./cpuminer -a x16r -o stratum+tcp://rvn.suprnova.cc:6666 -u <user_name>.<worker_name> -p <worker_password>

You can see that the algorithm we’re going to be using is Ravencoin’s “x16r”, which is an algorithm that rotates between 16 algorithms, in an effort to be ASIC-resistant.

There are other pools that don’t require creating an account at all. You simply pass your receiving address in the miner launch command, like this:

./cpuminer -a x16r -o stratum+tcp://ravenminer.com:3636 -u <your_Ravencoin_address>

Couple of things before moving on:

  • To escape from tmux, type control-b followed by d. Don’t worry, though, your miner is still running, but it’s safe now to logout of the server if you like. To kill the miner, run top, which will show your miner process at the top, quit out of top with q, and then kill your miner with kill <miner_process_id>.

  • I understand that at Suprnova, you should create a different “worker” for each machine that’s going to be mining in your account. At the pools where you don’t create an account, however, you can mine with multiple machines on the same receive address.

  • Finally, the pools and crypto projects could really help noobs like me by specifying the whole command to start mining. Some just say things “Stratum on port 3636”, and assume you know the rest.

How were the results?

In a word, awful, but that was expected. Using a 16-core “optimized” droplet at DigitalOcean ($320/month or $0.476/hr), I was able to generate 850 KH/s (kilohash per second). Interestingly, with a Scaleway 8-core “bare metal” server ($20/month), I was only able to generate about 65 KH/s. I’m not sure why there’s a 10x difference, given a doubling of cores, but I wasn’t bothered to look into that.

Economically, at DigitalOcean, I was getting about 2.65 H/s/$ (hash per second per dollar), while Scaleway was about 3.25 H/s/$. So one would do slightly better to deploy 13 servers at Scaleway, but, of course, that adds some overhead. (And, as we’ll see below, this is a moot issue anyway.)

Using the DigitalOcean machine, I was mining about 1.74 Ravencoin per hour. With a server cost of $0.476/h, that means I was paying about $0.27 for each Ravencoin.

At the same time, in the #trading channel in Ravencoin’s Discord chat, OTC trades were happening at about 500 Satoshis, or about $0.06 per coin—i.e. 4.5 times cheaper than I was paying through mining. (And those 500 Satoshies represented a 500% price increase with respect to the previous 48 hours, given the news that Overstock had invested in the project!)

So clearly, I’d be better off buying Ravencoin, than mining it. (I noted that almost everybody in the #mining channel were using GPU rigs, and getting MH/s performance.)

The conclusion here is that CPU mining generally makes little economical sense, but it is a convenient way to actually try out and learn about mining.

Before leaving the topic of cloud CPU mining, it should be noted that most cloud-server providers prohibit mining, since most VPSs (virtual private servers) use shared infrastructure, such that your miner software’s consumption of 100% of the CPU, 100% of the time, unfairly impacts other VPS users. At DigitalOcean, for example, they only allow mining on their “optimized” droplets, which use dedicated CPUs, and at Scaleway, you can only mine on the bare metal servers.

(Some providers actually offer GPU cloud-servers. I didn’t experiment with those as their costs are upwards of $1,000 per month, and don’t seem to be available on a per-hour basis. I was actually prepared to try one, but I couldn’t find an answer to the question of whether the software would auto-detect and use the GPU. Since its name is “cpuminer”, my guess was “no”, and I didn’t want to drop $1,000 to find out.)

Renting real mining rigs

The next stop on my mining journey was NiceHash.com which offers a marketplace where you can actually rent time on someone else’s mining rig.

At NiceHash, after setting up an account and depositing some bitcoin, you create one or more pool configurations where you want to mine. For this experiment, I chose the IPBC coin that I’d seen @notsofast mention he liked.

Next, you access the “marketplace” under the “For buyers” menu. This screen seemed to be an order-book of offers to rent hash power.

The documentation recommendeds that beginners create “Fixed” offers, as compared to “Standard”, since there’s only two variables under your control—hash power limit, and total cost.

(After entering those two variables, the order window updates with an estimation of how long your mining will last. I think the maximum time allowed is a few days.)

I set the hash power to 0.2 MH/s, and the amount of BTC I wanted to spend on the experiment, and clicked “Place Order”. On my first attempt, the system responded that there were no matching offers. Adjusting the values slightly, though, my offer was accepted and a graph appeared immediately, showing the state of my mining!

I then switched over to the IPBC pool’s website, did a lookup on my IPBC address, and saw that, sure enough, I was contributing about 200 KH/s of mining hash power to the pool! And then I waited.

Each time the pool found an IPBC block, the website would report a proportional payment to me—based on the number of “work shares” I’d contributed—and those payments soon appeared in the IPBC wallet that was running on my Mac.

How were the results?

Better than with CPU mining, for sure, but still not economically interesting. Using NiceHash, I was paying about $0.60 per IPBC coin, while they were selling on the Livecoin exchange for about $0.40.

According to some users on reddit, the people who profit from using services like NiceHash are those who closely monitor the short-term windows when the rental cost movements lag the price movements of coins. (Perhaps that explains why maximum rental duration is specified in units of days, instead of, say, months or years.)

Renting can also make sense for people who want to speculatively mine a brand new coin that’s not listed on an exchange.

Update: After writing this article, I posted another article about how to calculate the breakeven cost of mining a coin, so that you can determine whether or not it’s economically worthwhile to mine with rented hashpower.


I’m really happy to have spent the time and effort to actually do some cryptocurrency mining. In the process, I learned about how mining actually works, I learned about the role of hashing algorithms, and I learned about the economic realities of cloud-based CPU mining, and GPU rental mining.

Hopefully, getting my hands dirty in the trenches will help me to become a better long-term investor in this space. That’s my objective, in any case.

Next stop on the journey, staking and masternodes. Stay tuned!

Does rebalancing an allocation of cryptocurrencies make sense?

One of the features offered by the Prism exchange is the ability to “rebalance” your basket of currencies back to its original allocation. Given an investment vehicle in which you create an allocation, it might seem natural to offer a rebalance feature. But does this make sense?

In Markowitz Portfolio Theory, a portfolio is constructed of multiple, uncorrelated asset classes (in the real world, that means stocks, bonds, precious metals, etc. which, as we know, are not perfectly uncorrelated.) The allocation of the asset classes determines the risk level of the portfolio. For example, 90% stocks and 10% bonds is much riskier than 10% stocks and 90% bonds. It’s assumed that one investor will have different appetite, need and capacity for risk than another, such that there’s no one-size-fits-all allocation.

Over time, as a portfolio deviates from its original allocation, it implicitly deviates from its risk profile. To return it to its risk profile (assuming the characteristics of the asset classes haven’t changed), we can rebalance it. And doing this systematically over time has been shown to also add value, since we’re systematically selling asset classes when they are high, to buy those which have dropped. Many call this the only free lunch in investing.

The extent to which rebalancing makes sense and works, however, is a function of the extent to which the underlying asset classes are uncorrelated, and have a tendency to revert to the mean. So it’s critically important that when one zigs, the other zags. (Interestingly, the accessibility of the modern Exchange Traded Fund (ETF) has increased correlation of a number of asset classes like commodities, with equities and bonds, such that many experts wonder how long rebalancing will continue to be a free lunch.)

And this is why rebalancing doesn’t really make sense in the context of a basket of cryptocurrencies. Although it’s still early, and things can change, currently, as anyone who watches CoinMarketCap will attest, cryptocurrencies appear to be almost perfectly correlated! When you’re selling Bitcoin low, you’re likely going to be buying Ethereum low as well.

So be careful out there—we have to be very careful when blindly applying traditional investing concepts to emerging spaces like crypto. (In that regard, next on my radar is thinking about whether it makes sense to track a marketcap-weighted index of crypto.)


Usability in the crypto world (or my experience as an ICO participant)

Today, for the very first time, I decided to participate in an ICO. Taylor is an app that promises to help normal people, as well as seasoned traders, profit from crypto trading, through automation. Looks like a very interesting project, about which several in the community I respect are excited, so I decided to dip my toes into the world of ICO investing.

To participate in the Taylor ICO, you have to:

  1. Register.
  2. Inform them of the Ethereum address from which you will purchase your TAY tokens.
  3. Verify your identity through their KYC/AML process.

For the uninitiated, the above step 2 could be the first roadblock. You see, most ICO tokens actually live on the Ethereum network, as an Ethereum-compatible token created according to the “ERC20” standard. So to receive your ERC20 token (“TAY” in this case), you need an Ethereum wallet that provides a user interface to manage ERC20 tokens.

My two wallets, a Nano S hardware wallet and the Exodus desktop wallet for Mac, didn’t seem to support manually adding ERC20 tokens. I did find one, though, “Edge” for iOS, which does.

OK, using Edge, I need to add the TAY token to its Ethereum wallet. To do that, you need some information:

  1. The token name
  2. The token symbol
  3. The token’s “contract address” on the Ethereum network
  4. The number of decimal places (for whatever reason)

Unfortunately, the Taylor people didn’t expect folks on the website to need this information. Fortunately, they did expect that people on Twitter would.

So, after adding the TAY coin to the Ethereum wallet in Edge, I’m ready to purchase some TAY (YAY!). But just above the QR code that you scan to send off some Ether, there’s this ominous warning:


This is where some significant knowledge and technical assumptions are being made (you need to understand what gas price is, and have the ability to manage it), and a very narrow gate is being put up for your everyday Ethereum user. The “gas price” relates to the fee that is going to be added to your transaction to incentivize Ethereum miners to process the transaction. It’s also something 99% of all Ethereum users don’t think about when sending transactions.

Fortunately, my Edge wallet has a “Change Mining Fee” action item, in which we find three options: High, Standard and Low.

Well, I tried all three, and all three transactions were rejected with a “ran out of gas” error. Ran. Out. Of. Gas. WTF?

Fortunately, again, the Edge wallet also provides a “Set Custom Mining Fee” button, and so I set off to create a new transactions with the price bumped up close to the warned limit of 50 Gwei (whatever a Gwei is).

So here’s what the Set Custom Mining Fee screen looks like:


See any problem here? THERE ARE NO UNITS DISPLAYED!

Well, since the good people at Taylor said not to exceed a price of 50 “Gwei”, I’m assuming that Gwei must be the standard unit, and so I type in “40” (just to be on the safe side) as the Gas Price, and fire off my transaction.

Waiting a few minutes, I go to Etherscan, to check on the status of my transaction, and see that it’s expected to be processed…

“In a very long time…” Sigh.

And on that same transaction status screen, I see that the fee I set on the transaction was 0.00000004 Gwei, or about $0.000001. So as it turns out, the price unit in Edge is “Wei”, and a “Gwei” is 109 Weis—that’s nine zeros!—which means that instead of typing “40” into Edge, I should have typed the very-error-prone number, “40000000000”.

Heavy, heavy sigh.

OK. So I configure another transaction—the fifth of the day!—carefully typing in all those zeros, and sent it off. I then waited a while, checked the transaction, and see this error:

“There is an earlier pending transaction in the network, that must process first before this one.”


So before my correctly configured transaction can process, my near-zero-fee transaction has to process first, which is expected to complete in…that’s right, “A Very Long Time”.

Head off to Google. “Can I cancel an Ethereum transaction?”

Turns out you can not. What you can do though, is re-broadcast a new transaction using the same “nonce” (whatever that is), with a higher fee. The miners will see both, and pickup the higher-fee transaction, discarding the other.

So that’s a solution, but unfortunately the Edge wallet doesn’t provide the UI necessary to modify the “nonce” of a transaction.

I could ask Taylor to whitelist a new Ethereum address, so I could start over from a new wallet. But the problem there is that eventually these two pending transactions will/might get processed from an address perhaps no longer associated to me. And if I do nothing, by the time these transactions process, the ICO might be over.

So I guess I’m screwed. But here’s the point of all this…

If you’re reading this, and actually understand what happened, chances are you’re (a) more technically involved in this space than me, and (b) snickering because this is something that’d never happen to you.

But here’s the thing. you probably are more technically involved than me. But, I know enough to have developed a Ruby-based software application that does my trading over APIs, which makes me more technically involved than 99{ad274ad889bc1e297d0fa7a0471c34c41541cb748ff9f79b10160b1d4544149a} of the mainstream out there who we need involved in this space if this industry is going to grow and prosper.

And for that to happen, things like empathy, usability and user experience design have to become priorities of those early creators in this space, such as wallet makers like Edge (who, to be honest, have created an overall really nice UI/UX), builders of applications, as well organizations running ICOs.

If you agree with that, then help sound the trumpet for usability whenever you can!

(By the way, if you’ve done your diligence, are interested in the Smart Taylor ICO and feel some sympathy for me 🙂 you might signup using my referral link.)


The CEO of Taylor contacted me, and let me know that with MyCrypto or MyEtherWallet, I could access the Edge wallet (using its seed), and then create an offline transaction with the same nonce, and broadcast it. The details are documented here. I used MyCrypto to try it, and it worked!

Prism-based crypto investing

In a previous article, I noted some initial thoughts about the currently-in-beta, smart-contracts-based Prism investing platform. In this article, I’m going to discuss some of the ideas that are forming around how I will use it when it’s launched.

While crypocurrency is broadly considered an emerging asset class on its own, I like to further consider use-case based sub-classes, for example:

  • Value
  • Utility
  • Privacy
  • Distributed Exchanges
  • Prediction Markets

With Prism, investors will be able to conveniently implement use-case or sub-class-based investment strategies. For example, I might define:

  • Value — Bitcoin (60%), Bitcoin Cash (20%), and Litecoin (20%)
  • Utility — Ethereum (60%), Ethereum Classic (20%), and Stellar (20%)
  • Privacy — Dash (30%), Monero (30%), Zcash (30%) and Pivx (10%)
  • Distributed Exchanges — EOS (40%) and 0x (60%)
  • Prediction Markets — Augur (50%) and Gnosis (50%)

So rather than trying to predict the individual winners in these use-case categories, I could instead create and invest in diversified “Prisms” built around each, leaving me only with the task of identifying the most promising technologies/protocols in each class, regardless of how many there are, and allocating according to the success probabilities I would assign to the constituents.

And at the highest level, I would fund these categories in proportion to the relative values I assign those use cases long-term. For example:

  • Value — 40%
  • Utility — 40%
  • Privacy — 10%
  • Distributed Exchanges — 5%
  • Prediction Markets — 5%

Acquiring and holding all of these currencies would be quite inconvenient, and possibly insecure, but implementing the above strategy could be done in a few clicks and half an hour on the Prism platform!

Thoughts on the Prism portfolios product

The makers of ShapeShift have a new product in beta, called Prism, that sets out to address a number of challenges to investing in a diversified portfolio of cryptocurrencies. Such challenges include:

  • Acquiring the coins you want to you may require creating accounts on several exchanges, and going through the tedious KYC/AML processes for each.

  • Given that it’s a bad idea to leave your coins on exchanges as part of a long-term hold strategy, self-custody of your coins, especially obscure ones, can present technical difficulties around identifying and installing multiple wallets, and securing them.

  • Most of the services that offer investible indexed or managed baskets of cryptocurrencies require SEC accreditation for access, or are geographically restricted. These include Grayscale, Bitwise, MetaStable and Iconomi.

Prism solves the problems in the following way: The product (when launched) will be accessible to anyone holding Ethereum. Users of the platform will be able to create portfolios of cryptocurrencies—i.e. a list of currencies and the percentage allocation to each—and then fund those portfolios with a deposit of Ethereum, which is then used as collateral to back the contract.

(Interesting, ShapeShift will initially take on the risk of matching your collateral, although they plan to make collateral matching its own investment opportunity for liquidity providers in the future.)

Upon funding of the contract, Prism will deploy a smart contract on the Ethereum network that tracks the performance of the coins and allocation defined in the contract. At any time, the contract owner can “rebalance” the portfolio and/or cancel it. Upon cancellation, the contract owner will have their Ethereum collateral returned, plus or minus the gains or losses that the portfolio realized with respect to Ethereum, minus a fee charged by the Prism platform for providing the service (currently anticipated to be around 2.5%.)

This is a fascinating and exciting product, and following are some random thoughts having read the announcements (but not yet having received access to the beta):

Convenience. The Prism product makes it extremely convenient to invest in a basket of currencies. No more having to install wallets like Monero, that require downloading and syncing the entire blockchain.

Security. It seems there are both pros and cons here. On the one hand, there’s less for the individual user to secure. Instead of securing coins held in local wallets (hardware or software), you only need to secure access to your Prism account and the source wallet of the funding Ethereum, which is where Ethereum would be returned upon contract cancellation. On the other hand, you’re at the risk of the quality of contract implementation and the security of the Ethereum network. As we discovered in the DAO hacking, this is a real concern.

Ethereum denomination. One should keep in mind that the portfolio performance is referenced to Ethereum, and not USD. If the portfolio increases in value with respect to USD, but not Ethereum, you’ll receive back less Ethereum than you provided in funding. That’s to be expected, of course, but might come as a surprise to people who think of everything in terms of USD.

Taxation. If tax authorities (at least in the United States) are already behind in terms of clarifying issues around crypto taxation, who known when it would become clear how participating in something like a Prism will be taxed. Will funding a Prism contract be considered a taxable event, i.e. as if you sold Ether for USD and then virtually purchased the underlying coins? Will rebalancing of a Prism be taxable, i.e. the selling of certain coins in the portfolio to buy others? Or will the taxable event simply be the gain or loss of Ether when terminating a contract?

In my experience, first movers in a space like this often bear a disproportional amount of the pain when it comes to frontier taxation issues. The cost of having a tax advisor figure out how something should best be declared, and then potentially having to defend that position to the IRS can easily consumer any gains that one earns.

Having said that, though, I’m sure I’ll anyway give it a try when getting access to the product, as I always do. You later movers can thank my sacrifice in paving the way. 🙂

Social opportunities. Given that Prism already publishes a leaderboard, one can easily imagine a future when it will be possible to “follow” the portfolio managed by another user, such that anyone in the world, based only on their merits, can become a successful “fund manager”.

Tokenization of all securities. Looking further out, one can imagine a day when through a platform like Prism, it will be possible to invest in portfolios constructed of both crypto assets, and traditional assets like stocks, bonds, ETFs, real estate and precious metals. That would certainly be disruptive to the brokerage and financial industries.

Regulation. This is another in a long-line of frontier products created by ShapeShift founder and libertarian advocate Erik Voorhees, and he’s no stranger to having to deal with behind-the-times regulators after-the-fact. It’s hard to imagine a platform like Prism growing too much before catching the attention of the SEC, and it’s hard to imagine them not wanting to regulate the service somehow in the interest of investor protection. It will be interesting to see how that plays out. I would guess at minimum we might expect to see KYC/AML processes for user accounts.

So those are my initial thoughts about Prism, and I’m really looking forward to giving it try, and will post a review as soon as I have direct experience.