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

<ol>
<li><p>Network hash rate is 800 000 terahashes per second as of 2016-01-18 <a href="http://bitcoincharts.com/bitcoin/" rel="noreferrer">[source]</a>.<br>
Remember that currently 25 BTC are rewarded every 10 minutes.</p></li>
<li><p>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 <a href="https://software.intel.com/en-us/articles/intel-sha-extensions" rel="noreferrer">Intel SHA Extensions</a> instructions.)</p></li>
<li><p>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.</p></li>
<li><p>One visitor donating 5 minutes of full-CPU time gives 9 gigahashes.<br>
Multiplied by 2 million visitors per day gives 18 petahashes per day.</p></li>
<li><p>Meanwhile the rest of the Bitcoin network has produced 70 000 000 petahashes in a day and mined 3600 BTC.</p></li>
<li><p>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.</p></li>
</ol>

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

CC BY-SA 3.0
2018-04-19T22:18:24.573Z
you should update those numbers :P
Tobi
CC BY-SA 3.0
2016-01-18T01:52:18.283Z
2016-01-18T02:08:32.463Z
2016-01-18T02:08:32.463Z
Nayuki
<p>First off, without the visitor's consent it would be unethical. </p>

<p>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.</p>

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

<p>Also <a href="https://bitcoin.stackexchange.com/questions/10320/how-useful-is-a-javascript-miner?rq=1">this</a> might be of help.</p>

CC BY-SA 3.0
2016-01-18T12:39:09.040Z
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
CC BY-SA 3.0
2016-01-18T13:11:49.030Z
@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
CC BY-SA 3.0
2016-01-18T15:30:40.547Z
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
CC BY-SA 3.0
2016-01-18T17:14:32.203Z
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
CC BY-SA 3.0
2016-01-18T17:38:29.950Z
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
CC BY-SA 3.0
2016-01-18T18:39:25.723Z
If I go to a site and they tell me that my computer is now used for mining it is indeed similar to having ads in the site. In both cases I have the choice of not visiting again. However, I was always saying "without the visitor's consent" or "behind the scenes leeching the CPU" or " 'hidden' mining" which I thought made it quite clear that I mean without the visitor's knowledge. The unethical part has nothing to do with the revenue sharing, just the fact that you _can_ do mining without the knowledge of the visitor. You cannot show ads without the knowledge of the visitor.
karask
CC BY-SA 3.0
2016-01-18T20:11:43.543Z
Gotcha -- there's a big difference between *consent* and *knowledge* (unless the argument is that knowledge and visiting is implicit consent). I agree that stealing massive amounts of CPU without the visitors knowledge is unethical.
JJ Geewax
CC BY-SA 3.0
2016-01-12T16:17:38.050Z
2016-01-12T16:17:38.050Z
2017-04-13T12:47:33.283Z
karask
<p>I think there are some great answers here, hopefully this isn't too repetitive...</p>

<p>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).</p>

<p>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.</p>

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

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

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

<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2016-01-18T13:13:42.897Z
2016-01-18T13:13:42.897Z
JJ Geewax
<p>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?</p>

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

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

CC BY-SA 3.0
2017-10-31T08:56:12.007Z
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-don't-feed-the-AI
CC BY-SA 4.0
2022-01-14T18:17:08.907Z
Please give us your URL so I can blacklist it right now...
Shadoweb
<mining-profitability><javascript><webminer>
Javascript Bitcoin miner is it even worth it?
ant
# Javascript Bitcoin miner is it even worth it?

(Asked by: username_0 on 2016-01-12)

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?

**Tags:** mining-profitability, javascript, webminer

> **Comments:**
> **username_1**: 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.  
> **username_2**: Please give us your URL so I can blacklist it right now...  

---

## 3 answers

### Answer by username_3 on 2016-01-18. Score: 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]](http://bitcoincharts.com/bitcoin/).  
   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](https://software.intel.com/en-us/articles/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?

> **Comments:**
> **username_4**: you should update those numbers :P  

---

### Answer by username_5 on 2016-01-12. Score: 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](https://bitcoin.stackexchange.com/questions/10320/how-useful-is-a-javascript-miner?rq=1) might be of help.

> **Comments:**
> **username_6**: 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...  
> **username_5**: @username_6 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.  
> **username_6**: 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.  
> **username_5**: 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.  
> **username_6**: 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.  
> **username_5**: If I go to a site and they tell me that my computer is now used for mining it is indeed similar to having ads in the site. In both cases I have the choice of not visiting again. However, I was always saying "without the visitor's consent" or "behind the scenes leeching the CPU" or " 'hidden' mining" which I thought made it quite clear that I mean without the visitor's knowledge. The unethical part has nothing to do with the revenue sharing, just the fact that you _can_ do mining without the knowledge of the visitor. You cannot show ads without the knowledge of the visitor.  
> **username_6**: Gotcha -- there's a big difference between *consent* and *knowledge* (unless the argument is that knowledge and visiting is implicit consent). I agree that stealing massive amounts of CPU without the visitors knowledge is unethical.  

---

### Answer by username_6 on 2016-01-18. Score: 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 @username_3'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.


---

