Last updated on October 14th, 2017 at 11:24 am
Coinhive is a Monero (XMR) miner that runs on users’ web browsers when they’re visiting certain sites (don’t worry, we don’t employ this on 99Bitcoins). Recently, The Pirate Bay and CBS’s Showtime were busted for running Coinhive on visitors’ browsers without their knowledge or consent.
Before we get into a discussion about how to use Coinhive to monetize your content, let’s first discuss why website owners might want to use it instead of the tried-and-true method of online revenue generation: ads.
The Rise of Ad Blocking
Software that blocks online advertisements—usually referred to as an ad blocker—is rapidly becoming the standard. According to PageFair, a company dedicated to analyzing and mitigating this trend, about 615 million devices were using ad blockers at the end of 2016. The total number of internet users in mid-2016 was estimated to be 3.4 billion. This means that around 20% of users employ ad blockers.
Because most ad blockers are free and easy to install, there are no immediate downsides—and plenty of upsides—for their users. The most popular ad blockers include Adblock Plus, AdBlock, and—my personal recommendation—uBlock Origin. Origin includes a filter for Coinhive to deny websites free access to your CPU’s mining power.
In addition to blocking ads and trackers via ad blocking methods, particularly proactive users may opt to go on the offensive with AdNauseam. This browser plug-in not only blocks ads but also spoofs clicks on them, generating false traffic to the detriment of advertisers’ conversion rates and thereby wasting their advertising budgets. The credibility and effectiveness of online advertising, in general, has been called into question lately by major companies such as Uber.
Because the current business model of the internet is largely based on advertising, ad blockers and the apparent decreasing impact of regular online advertising are forcing advertisers to adapt or go broke.
Cryptocurrency as the Solution
Because cryptocurrency is “the internet of money,” it will likely prove to be a better way to monetize the internet.
The Brave Browser is one attempt at a solution. Brave automatically blocks ads, or at least replaces them with privacy-respecting ads. Brave allows users to earn small amounts of bitcoin if they opt in to viewing these “good ads.” Brave also lets users fund participating websites by automatically allocating bitcoin donations based on the amount of time they spend on each site. Brave is improving quickly, and it will hopefully soon incorporate Lightning Network micropayments.
Coinhive presents a more straightforward approach to content monetization. The integration of the Coinhive script into a website gets the CPUs of cooperative visitors to mine Monero. All proceeds are split between the site’s chosen Monero address and the Coinhive creators, who receive 30%. This is a fairly large cut, but an open-source version known as Harvest, which will allow site operators to retain the full proceeds of mining, is likely coming soon.
Depending on the number of visitors a site receives and the time those visitors spend on the site (and the XMR price and mining difficulty), profits from Coinhive may allow a site to forego other monetization options such as ads, paywalls, donations, and subscriptions.
Coinhive web mining modes:
1) As a Proof-of-Work “Captcha” that performs a set number of hashes or as a continual process. Unlike a regular captcha, this mode is unable to distinguish humans from bots. However, it is effective at rate-limiting actions, and it represents a great DDoS or spam countermeasure. Provided the cost of the mining is higher than the reward for spamming, bots will have no economic incentive to target a website.
2) As an automatically redirecting Proof-of-Work shortlink using the cnhv.co prefix. The number of required hashes will determine the degree of delay before the shortlink redirects, although the time value will vary according to the CPU power of users.
Shortlinks are especially useful for sharing links over social media, particularly on Twitter due to its limited character space. Here’s an example, which redirects to the Wikipedia entry for Monero: https://cnhv.co/6bk.
Tip: The new Coinlink site allows anyone to earn XMR by creating and sharing a Coinhive shortlink.
3) As a continual mining process. This mode is optimal for sites on which users spend a lot of time doing things such as browsing content, reading articles, watching videos, or playing games. Here are some examples of sites that have implemented this method:
- Windscribe, a VPN service, uses Coinhive to let users earn account upgrades and bandwidth.
- The Defeating Aging site uses the web miner to generate charitable donations to the SENS Research Foundation.
- A college professor set up a simple web mining page for anyone who wants to contribute hashes to his Tesla fund.
- Faucets that pay out in Bitcoin and Monero based on XMR mined are available.
Coinhive’s flexible code allows for nearly unlimited creativity when it comes to implementation.
Web mining via user browsers
Continual mining, or web mining, is by far the most profitable approach. If a site is able to retain numerous miners’ time, it can expect to earn a decent amount of XMR. Approximately 0.3 XMR, or $30 per month, is estimated for between 10 and 20 steady miners.
Note that the level of CPU usage is customizable. CPU usage should be set at a reasonable level, or it will noticeably slow down users’ devices and cause them to abandon a site.
Coinhive web mining should also be announced to site visitors to prevent any backlash or malware accusations. Ideally, web mining should be an opt-in process. Laptop users may be particularly aggravated by a site that surreptitiously drains battery power through mining. Configuring the miner to halt on low battery power could avoid a lot of PR difficulty.
Tip: This utility allows hash rate to be determined in real time based on CPU usage and thread count. For testing purposes, monitor your system’s resource usage while this app runs to determine an optimum usage level, at least for that specific system.
Why Mine Monero?
If you’re wondering why there’s nothing similar for Bitcoin, it all comes down to Monero’s ASIC-resistant algorithm, CryptoNight. This algorithm ensures that, unlike Bitcoin and most other cryptocurrencies, Monero can be mined more or less profitably on the average desktop or laptop CPU. While mobile devices can also mine Monero (and run Coinhive), they’ll produce a very low hash rates.
Advantages of Coinhive
- It’s easy to implement and configure on most sites.
- It respects user privacy and allows sites to do away with tracker ads and the like.
- It is entirely unobtrusive and doesn’t interfere with the design or user experience of a site in any way.
- It achieves the best results when run over long periods of time, incentivizing sites to produce high-quality and engaging content rather than the clickbait model incentivized by ads.
- It is fairly transparent; compare the pool’s mining results to your data to verify the results.
- It will serve to introduce new users to cryptocurrency.
Disadvantages of web mining
- Unless a site is popular and enjoys high retention rates, it’s unlikely to earn much revenue from web mining.
- If not properly configured for older CPUs and mobile devices, web mining can slow down users’ devices.
- There’s a high potential for abuse by malware developers and unscrupulous operators.
Have you used a web miner on your site or encountered one as a site visitor? We would love to hear about it in the comment section below.