Coinhive Javascript Monero Miner

Today I want to tell you about a neat thing: Coinhive implemented a Monero miner in JavaScript. It allows you to integrate it in your websites and also to create short links and captchas which take a bit of the user’s CPU power to calculate some hashes.

To test this out a little, I created an account on Coinhive and shamelessly installed the Simple Monero Miner WordPress plugin in this blog. I might remove it again though because I don’t want to annoy my visitors too much 🙂

(Update: I’ve disabled the plugin – site visitors have calculated a whopping 9 379 840 hashes, worth 0.00136453 XMR – that’s about $0.12 at the time of writing!)

There are various way to run the miner. For instance, it can simply be run “headless” by calling a JavaScript function like this:

<script src=""></script>
var miner = new CoinHive.Anonymous('YOUR_SITE_KEY');

Simple as that. The miner can be throttled so it doesn’t hog 100% of the user’s CPU power.

If you want to mine some Monero for me now, you can also follow this link to a dedicated miner page on Thanks in advance!

But isn’t it too slow?

Looking at how other cryptocurrencies like Bitcoin, Litecoin or Ethereum are mined today, you might wonder how mining on a CPU with JavaScript might be effective at all. Those currencies are mined using GPUs or specially made ASICs.

Monero, however, uses the Cryptonight algorithm. It is very compute heavy and is designed to run well on consumer CPUs. Of course, running this in JavaScript isn’t exactly efficient, but thanks to modern JS engines it reaches about 65% of the speed of a native miner according to Coinhive’s claims.

I hope you found this remotely interesting and wish you a nice day!

One Reply to “Coinhive Javascript Monero Miner”

  1. I’ve had an optional miner on my site for CoinHive since Halloween. At peak so far, I hit 460 Hashes per second, average around 250 hashes per second. I added it as an option for those who couldn’t donate, ALSO I reward users with in-game currency for the game my site supports and that I am developing. I’ll eventually implement it into the game as well. I removed all ads as well

    As of this second, Nov 16, 2017 at 7:35PM, Monero is at $121 per coin. As of right now, my site has generated 229.25 Million hashes for a total of 0.0344 XMR. That’s $4.16.

    I believe this is the new, better way to go about all the ads on sites and such… give an opt out for ads via cpu mining.

Comments are closed.