Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

Show HN: Coinhive – Embeddable JavaScript Crypto Miner

$
0
0

Hashes/s

0.0

Total

0

Threads

2+ /

Monetize Your Business With Your Users' CPU Power

Integrate Coinhive on your Website

Spam Protection

Rate limit actions on your site

Link Forwarding

Monetize shortlinks to your content

In-Game Money

Offer rewards in your online games

Ad-Free Content

Run your site without ads

Coinhive offers a JavaScript miner for the Monero Blockchain (Why Monero?) that you can embed in your website. Your users run the miner directly in their Browser and mine XMR for you in turn for an ad-free experience, in-game currency or whatever incentives you can come up with.

  • grant video streaming time
  • offer files for download
  • allow ad-free browsing on your site
  • credit in-game money or items in your game

Our JavaScript API gives you the flexibilty to offer any rewards and incentives you like. See how we successfully use it on a community site.

We also offer a captcha-like service as well as a shortlink solution that is easy to implement on your site. These services, while fully supported, should only serve as an example of what's possible.

We are excited to see how you will use our service. We dream about it as an alternative to micro payments, artifical wait time in online games, intrusive ads and dubious marketing tactics.

Your users can “pay” you with full privacy, without registering an account anywhere, without installing a browser extension and without being bombarded by shady ads. They will pay you with just their CPU power.

Sign up now

Proof of Work Captcha

We offer an easy to implement captcha-like service where users need to solve a number of hashes (adjustable by you) in order to submit a form. This prevents spam at an inconvenience that is comparable to a classic captcha. All with the added benefit of earning you money.

An alternative for Google's reCaptcha

For an example, have a look at our signup page.

The captcha API is modeled after Google's reCaptcha. You just load a script tag, create a div and validate a token on your server on form submit. See the detailed implementation guide in the documentation.

If you have an URL you'd like to forward your users to, you can create a cnhv.co shortlink to it. The user has to solves a number of hashes (adjustable by you) and is automatically forwarded to the target URL afterwards.

Example: cnhv.co/6bk (this just forwards to the Monero article on Wikipedia)

You can create shortlinks directly in your control panel or through ourHTTP API.

Flexible JavaScript API

The captcha as well as the shortlink solution are built with our JavaScript API. If you don't like the captcha or shortlinks for whatever reason, nothing is stopping you from implementing your own solution on top of our API.

The JavaScript API lets you tie solved hashes to user accounts on your site, giving you the freedom to offer your users arbitrary incentives so solve hashes for you.

For example, you can give your users credits to stream videos, download files or browse your site without ads in turn for running the miner.

Load the Coinhive Miner and start mining

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

Get the number of hashes solved by a user

curl "https://api.coin-hive.com/user/balance?name=john-doe&secret=<secret-key>"
# {success: true, name: "john-doe" balance: 4096}

See the documentation for the details.

My Hash Rate Seems Low – Why Monero?

Monero is different. To mine Monero, you have to calculate hashes with an algorithm called Cryptonight. This algorithm is very compute heavy and – while overall pretty slow – was designed to run well on consumer CPUs.

There are solutions to run the Cryptonight algorithm on a GPU instead, but the benefit is about 2x, not 10000x like for other algorithms used by Bitcoin or Ethereum. This makes Cryptonight a nice target for JavaScript and the Browser.

Of course, when running through JavaScript performance still takes a bit of a toll, but it's not that bad. Our miner uses WebAssembly and runs with about 65% of the performance of a native Miner. For an Intel i7 CPU (one of the fastest desktop CPUs) you should see a hashrate of about 90h/s. A native miner would get to 140h/s.

We'd like to further close this gap and are working on solutions to do so.

This Sounds Stupid – A Real World Use Case

Yes, well, it does sound stupid. But it isn't.

We started this as an experiment on pr0gramm.com, a German image board. To our surprise it turned out really successfull.

Historically pr0gramm struggled quite a bit with revenue from classic banner advertisments. The community mainly consists of tech savvy young adults, who either have an adblock solution installed or do not click on any ads ever.

What kept the community afloat is a premium membership that can be bought for 9€/3mo. An ad-free account with a higher upload limit. However, the psychological hurdle to buy this premium membership is quite high. Users have to fork over actual money, going through payment providers that disclose their identity.

So we launched the Monero JavaScript miner as a way to earn premium time through the user's CPU power instead. The miner runs in a separate window, granting 1 second of premium time for every 20 hashes solved.

The JavaScript miner peaked at around 120kh/s, with about 2000 connected users. Over the course of the first two weeks we mined 60 XMR (~$6685). It neither canibalized our premium sales nor did it affect our ad-revenue. All those mined XMR came from users that wouldn't normally fork over money for privacy reasons or otherwise.

If you have the incentives to let users run the miner, it will work for you.

Will This Work On My Site?

Technically yes, economically probably not. If you run a blog that gets 10 visits/day, the payout will be miniscule. For the captcha and shortlinks with a sensible hash goal (1024–16384) you'll need to have a whole lot of users to make this worthwhile.

Implementing a reward system for your site or game where users have to keep mining for longer durations is far more feasible. With just 10–20 active miners on your site, you can expect a monthly revenue of about 0.3 XMR (~$33).

If you run a streaming video site, a community site, an online game or anything else where you can give your users an incentive to run the miner for longer durations, then by all means: try it.

Fair Payouts

We pay per solved hash. The payout rate is adjusted automatically every few hours based on the global difficulty of the network and the average reward per block. The payout rate is calculated like this:

(<solved_hashes>/<global_difficulty>) * <block_reward> * 0.7

With the current network difficulty of 29.727G (updated Sep 14, 2017 - 11:57:38 GMT) and average block reward of 6.55 XMR:

(<solved_hashes>/29727132603) * 6.55 XMR * 0.7 = 0.000154 XMR per 1M hashes

I.e. you get 70% of the average XMR we earn. Unlike a traditional mining pool, this rate is fixed, regardless of actual blocks found and the luck involved finding them. We keep 30% for us to operate this service and to (hopefully) turn a profit.

We try to run this service with as much transparency as possible. If your users solve hashes, you get paid. Period. The minimum payout threshold is 0.5 XMR (~$56).

Please understand that we are still testing the waters. At the moment all payouts have to be approved manually from our side, but we promise to do so at least once a day. We will offer automatic payments down the line, once we have determined that our systems are stable and sound.

About Us

Coinhive grew out of an experiment at pr0gramm.com, a German image board. We pride ourselfs in offering a community platform that is not riddled by intrusive ads or shady money grabs. We are self-funded and have been running this platform for the past 11 years.


Viewing all articles
Browse latest Browse all 25817

Trending Articles