11

I know that mining bitcoins via JavaScript is just pointless at this point in time, but is there any other altcoin that is worthwhile mining via a GPU/CPU via a JavaScript embedded into a web page?

Our website gets over 2 million unique visitors per day, with an average time of 5 minutes on site.

Is there anything we could do to get them to mine something in order to get even $0.005 per visitor? or is it basically impossible?

2
  • 2
    This sounds like a good way to save money by bringing traffic down as soon as people find out you're essentially parasitizing their CPUs to line your pockets.
    – Shadur
    Oct 31, 2017 at 8:56
  • Please give us your URL so I can blacklist it right now...
    – Shadoweb
    Jan 14, 2022 at 18:17

3 Answers 3

12

It is true that mining Bitcoins like this is impossible. (I can't speak for altcoins though.)
Let us run through a back-of-envelope calculation based on some facts and assumptions.

  1. Network hash rate is 800 000 terahashes per second as of 2016-01-18 [source].
    Remember that currently 25 BTC are rewarded every 10 minutes.

  2. A modern consumer-grade CPU has 4 cores, and can calculate about 400 MB/s of SHA-256 per core in C. (More generous than JavaScript, but ignoring the upcoming Intel SHA Extensions instructions.)

  3. One Bitcoin hash trial uses 2 blocks of the SHA-256 compression function (each block is 64 bytes), so this translates to 8 million hashes per second per core, and 30 million hashes per second per CPU.

  4. One visitor donating 5 minutes of full-CPU time gives 9 gigahashes.
    Multiplied by 2 million visitors per day gives 18 petahashes per day.

  5. Meanwhile the rest of the Bitcoin network has produced 70 000 000 petahashes in a day and mined 3600 BTC.

  6. The current price is 1 BTC = $400 USD. Your 18 PH out of 70 000 000 PH is 0.000026%, so this yields 0.0009 BTC reward, equaling $0.37 USD per day in total. But divided among everyone, this equals $0.0000002 per visitor.

With 2 million visitors a day though, why not optimize the ad revenue, user retention, conversion funnels, and other traditional online business techniques?

1
  • 1
    you should update those numbers :P
    – Toby
    Apr 19, 2018 at 22:18
5

First off, without the visitor's consent it would be unethical.

Besides that, no it is not impossible. In the past there were sites doing that getting a fee for the service and providing the profits to visitors.

Having said that it would provide way less than $0.005 per visitor. But with so many visitors it might still worth it.

Also this might be of help.

7
  • 1
    Just to be fair to the ethical concerns: ads are somewhat similar. If I had the choice between trying to run N hashes or see an ad that runs flash and potentially downloads a lot of data (maybe even some of it malware?), I'd choose the hashing option...
    – JJ Geewax
    Jan 18, 2016 at 12:39
  • @JJGeewax if it was made explicit to the user and he was getting the actual profits (minus a fee) I might also prefer it to ads. :-) The ads are obvious and the user can choose if he re-visits the site or not. The CPU-intensive hashing could happen behind the scenes leeching the CPU. So, all I meant is that the visitor needs to be aware that the site is doing mining, let you know if you are getting anything (ie. ask for your bitcoin address) and/or his fee and let you choose if you want to re-visit the site or not.
    – karask
    Jan 18, 2016 at 13:11
  • 1
    I hear what you're saying, and agree that CPU-intensive stuff (like mining) seems like the kind of thing that would merit permission. I think it's reasonable to compare this to ads though, where sites don't ask permission to use your CPU (less than mining) and your bandwidth (sometimes a lot for mobile devices). Despite using these things, it's not general practice to share the ad revenue with users. Overall -- seems like a grey area given the state of online advertising today. Luckily it's unlikely to become a real debate due to ads being more profitable.
    – JJ Geewax
    Jan 18, 2016 at 15:30
  • 1
    I don't like ads either but my main point was that you cannot miss ads. Their goal is for you to see them. You can think of them as part of the content of the site. If the content is not to your liking you don't visit that page again. They might take some CPU/bandwidth but so does bad written Javascript. The scenario with 'hidden' mining is literally and purposefully stealing CPU-cycles.
    – karask
    Jan 18, 2016 at 17:14
  • I think you're saying that it shouldn't be "secretly" stealing CPU-cycles -- seems fair. That's different than revenue sharing though. Ads are: eyeballs + some CPU + some bandwidth -> money. This idea is: lots of CPU + some bandwidth -> money (and less of it). If you don't like ads, move onto another site or get an ad-blocker. If you don't like stolen CPU cycles, move onto another site, or get a mining-blocker. I don't think it's fair to say that forcing users to pay with more CPU in exchange for no annoying images is any more unethical than forcibly showing unwanted ads as we do today.
    – JJ Geewax
    Jan 18, 2016 at 17:38
2

I think there are some great answers here, hopefully this isn't too repetitive...

First, the metric you gave (2m daily unique visitors) is a great number, but it's not the right one when you're talking about proof-of-work mining. In that world, the relevant metric is more like the number of CPU-seconds you have available to you (a "cycles per second" number).

To be more specific, your number doesn't really cover what's going on, because one unique user could leave their browser open all day (and therefore hashing for you all day), while another could close it in one second. Those two users would do vastly different amounts of hashing work, so you need an idea of the number of concurrent tabs open.

Using the awesome numbers from @Nayuki's answer, we can get a bit further:

(Note, I'm using the "Hz" unit here with one "hash" being one cycle.)

  • each open tab to your site could generate about 30 MHz (per the calculations above)
  • the BTC network is doing 800 PHz (800,000,000,000 Mhz)
  • A big mining pool (ghash.io) is doing about 7.5 PHz (7,500,000,000 MHz)
  • 7.5 THz / 30 MHz per concurrent open tab = 250,000,000 concurrent open tabs

This is... actually not all that ridiculous of a number. It basically means that to hash as much as a large mining pool, you need all of the US on your site all day every day. This is really tough for a single site, but a global ad-network serving ads that just do hashing could potentially do this, as I suspect there are at least 250m tabs open at any given time if you're looking at the whole world.

That said, you'd almost certainly earn more money per user relying on advertising, so I don't expect to see ad networks go this route anytime soon.

Not the answer you're looking for? Browse other questions tagged or ask your own question.