Yesterday I found a tweet about a monetisation possibility that enables cryptocurrency mining through JavaScript. More precisely it lets you mine XMR or Monero, a cryptocurrency not unlike Bitcoin, through users of your websites. The JavaScript miner and mining pool is provided by Coin Hive.

Monero currently trades at around 88$ per XMR (the Monero currency code) and Coin Hive takes a 30% cut for everything mined through their infrastructure.

Unfortunately the script has been blocked by the most significant adblock plugins already, since a lot of sites have enabled the miner without any opt-in dialogue, as did I for 24 hours (for screens larger than 1200px). I realise that in bird culture that’s considered a dick move, look I needed a number to benchmark on 😉

Update: I have re-activated the miner as a sidebar-widget and it gives everybody the option to opt out and it stops after 1024 hashes (about 20 seconds of CPU on an average desktop computer) and it does not even start on smartphones. WordPress plugin coming up 😉

For my site it breaks about even compared to the ads I usually use, but the possibility of giving users a choice if they want to spend some CPU time while they’re on my blog seems much more tempting than showing them pictures of stuff they’ll not buy in a hundred years.

Installing Coin Hive Monero Miner in WordPress

This step is literally as simple as installing Google Analytics. Somebody also already has created a coin-hive WordPress plugin on the official repository.

Alternatively you can obviously just inject the following code into your WordPress theme:

<script src="https://coin-hive.com/lib/coinhive.min.js"></script> <script> var miner = new CoinHive.Anonymous('<site-key>'); miner.start(); </script>

Obviously that’s pretty sneaky and it will suck everbodies laptop battery DRY when they spend more than a couple of minutes on your site, so please implement this with a dialoge (not unlike a cookie popup) and ask for permission to highjack utilise their CPU.

You can read the full documentation and throttling possibilities on the coin hive documentation.

CPU JavaScript Mining vs Ad Revenue

After 24 hours of mining the value at 1000 sessions (according to Google Analytics, so probably a couple more) is at around .70 USD / 0.01157 XMR and one comment complaining about the miner, which isn’t too bad considering that usually Ads take a lot of screen real estate.

What are the Hashrates of Monero with Coin Hive?

I’ve done preliminary tests with three devices, that probably resemble pretty well what people use out there, both a desktop and laptop that are a couple of years old and a next-to flagship smartphone.

Devices tested on:

Mac Book Air (between 20 and 30 H/s)

Generic Desktop Machine (between 60 and 90 H/s)

OnePlus 3t (around 12 H/s)

laptop desktop phone per second 25 80 12 per minute 1500 4800 720 per hour 90000 288000 43200

So obviously, having your users mine for you makes most sense if they’re on a desktop device of whatever kind. Even though the frequencies and amount of cores are comparable between smartphones and PCs, the performance of a desktop CPU still beats laptops and smartphones.

Summary

A conversation I saw on twitter pointed out that compared to ads, that will just be displayed once, a client side miner gains value when a user remains on the page for a longer while, which counters the click bait trend a lot.

For my format of content, in depth tutorials or at times opinion pieces and reviews, that fits perfectly. The next steps for me will be to implement the miner with a consent click for users, like a cookie bar when they enter the page. Also a progress bar like on kickstarter, including stretch goals could be a fun way to show: “Hey user, thanks for stopping by! Wanna say thanks? Look at this bar: More bar, more time / incentive for me to blog!”