Testing Coin Hive Crowd Source Monero Mining

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)
laptopdesktopphone
per second258012
per minute15004800720
per hour9000028800043200

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!”

24 thoughts on “Testing Coin Hive Crowd Source Monero Mining”

  1. Hi there,

    thanks for the info. Can you please tell me what is split of your traffic between mobile and desktop? I am asking that cause I am trying to understand if this can work on my blog.

    Thanks,

    Francesco

    1. Hi Michael, thank you! I’m working on releasing it as a WordPress plugin! I’ll announce it all around and on this blog when I’ve got it done! 😀

    1. Thanks for asking! It wouldn’t be too hard to just run it as a JavaScript snippet to be honest, I’ll get to it this weekend!

    1. For the first day it wasn’t capped at a specific hash amount, so the session duration has more of an influence than visitor count.

  2. Hmm. At the current rate, you’d have to mine about 70M hashes in order to make about 70 cents. Your average user would have to stay on the page for nearly an hour for you to make 70 cents per 1k users.

    That seems a little excessive. Your blog is great, but I’m not sure about 1 hour per session great.

    1. True! I’m auto-starting the miner and stopping at 2048 hashes, so it’s not really making any money, but it doesn’t occupy a lot of screen real estate

  3. My anti-virus blocks coinhive saying Js:Miner-A
    On internet I have read it is a dangerous trojan.
    Is it or is it not?
    If faucethub and moonbitcoin have this miner…take them the risk to lose members?
    I propose the miner as well on my site.
    I’m not sure I do well
    could you please tell more about?

  4. Hi Jonathan, i’m trying to get around the math of the issue. Please do correct me if you spot an error!
    Lets do an example like your website. Right now according to SimilarWeb you are getting 78.1K average visits per month, with an average time of 55 seconds on your site. Bounce rate is low at 57%.
    But lets stick to the direct numbers that you report because they are the real thing, say for example 1000 visitors a day. Lets say they stay on site for 60 seconds each, and their hashpower is exactly 30h/s each.
    Your site would generate 1.8M hashes a day (1000 x 60 x 30) so if this was something like a mining rig then your effective hashrate per second would be 1,800,000 (total hashes) /86400 (number of seconds in a day) = 20.83 h/s
    So then something is amiss, most probably SimilarWeb is underestimating the time visitors spend on your site, but at the same time has double the unique daily visitors (most probably sporadic connections, page refreshes, misc errors)
    Perhaps look for a better website analysis tool?

  5. Great info you are sharing here. I am looking to implement Coinhive as an alternative monetization solution instead of displaying ads. I will give it a try for sure. Also bear in mind that XMR’s price is rising!

    Any news about the WordPress widget? Did you manage to release the plugin?

  6. Dear friends,

    I did some tests also. With 61 online users (google analytics and 63%mobile and 37% deskotp and throttle: 0.5 and remaining visitors time 40 seconds) i have 58H/s. But we have to cosnider that some of these visitors dosn’t run the miner coz ad blockers blocks that.

    So everything that i read about that 1 normal pc gives about is 30H/s is totaly wrong number.
    Also Coinhive estimate that a user with a mid-range laptop would have a hashrate of 30 h/s ( Totaly Wrong)

    Also with a very fast calculation:

    Let’s say that every user gives: 2H/S * 60 (1 minute remaining time on site) * 100.000 (total visits on website per month) = 12.000.000M Hashes

    If Coinhive pays out 0.00015 XMR per million hashes, then 0.00015 x 12.000.000 = 1.8XMR Per month.

    I believe that if you using ad networks you will earn much more money from this. Ofcourse this is an alternative way to earn money, you can combine it with all your ads.

    So if you don’t have to pay facebook and other similar services to bring traffic to your website is a good option to have.

    Also i tried web mining with adfly and some websites with traffic exchange but it doens’t work for me at all. No hash rate is recorded at the coin hive back end.

Leave a Reply

Your email address will not be published. Required fields are marked *