<p>It would not at all be useful for Bitcoin mining. However, it <em>may</em> be useful for other digital cryptocurrencies, such as Litecoin or PPCoin.</p>

CC BY-SA 3.0
2017-12-01T18:42:04.580Z
Monero seems to be the currency of choice here in 2017.  It has become epidemic. https://gizmodo.com/how-to-stop-pirate-bay-and-other-sites-from-hijacking-y-1818549856  Coinhive is not shy about it.  They offer two versions.  One asks for permission and the other does not.  https://coinhive.com/  Here is a review:  https://medium.com/@MaxenceCornet/coinhive-review-embeddable-javascript-crypto-miner-806f7024cde8
SDsolar
CC BY-SA 4.0
2019-10-10T14:47:13.080Z
It seems especially useful if you place these in a site and run them from millions of machines as a distributed effort. https://en.bitcoin.it/wiki/Distributed_miner
scape
CC BY-SA 3.0
2013-04-27T17:59:53.177Z
2013-04-27T17:59:53.177Z
Colin Dean
<p>Not practical at all. Most probably the users would be just pissed of. Right now it is not even practical to mine with GPU-s, not to mention CPU-s and for sure JS.</p>

<p>Regarding the question: 
"if I put the user in as part of a mining pool, ..."</p>

<p>No, it is not important that he would find a hash. It is working this way. Your all workers are calculating hashes (does not matter if you find the right one or no). If a miner mined something at that time, the miner calculates how much work you have done and gives you the amount of bitcoins. So if you contributed 5% - you will get 5% of 25BTC and in case of some pulls fees. If pull mined nothing, you get nothing.</p>

<p>So in total, if you do not want to piss of users, do not do this.</p>

CC BY-SA 3.0
2013-04-27T17:53:19.653Z
`if you do not want to piss of users, do not do this.` Ads annoy me; paywalls alienate your community; and making content isn't free. If you want to make content and put it on the web, what are you supposed to do?
Nick ODell
CC BY-SA 3.0
2013-04-27T18:03:04.267Z
There are plenty of websites making great and expensive content that can easily exist with a business model solely based on advertisement.
Steven Roose
CC BY-SA 3.0
2013-04-27T20:20:44.473Z
@NickODell The thing is that you need to be clear for a user that you are using part of his computational power for something. People already used to ads, so it does not bother them too much. This is completely different. How would you feel if you get a program for viewing video, but somewhere silently it is used to generate hashes? You have no idea about this behavior and how would you feel when you read this on some forum? So I think that your -1 is absolutely inappropriate. I just mentioned to the OP what might happen.
Salvador Dali
CC BY-SA 3.0
2013-06-14T22:25:46.060Z
As long as you're up-front clear with your site visitors, and your javascript has a governor of some kind so it doesn't suck more than, say, 25% of the GPU's processing power, I don't see why this would be unethical. It could be thought of as a form of hassle-free micro-payments, where you put free (and ad-free) content yet still manage to make ends meet!!
Joe Pineda
CC BY-SA 3.0
2016-01-04T03:03:05.990Z
While not practical, in a scenario with only browser and a gpu would work. Think in a way to mine remotely with no software install at all. Last time i've tested Javascrip mine I face lot of problems too :V
m3nda
CC BY-SA 3.0
2013-04-27T17:37:53.440Z
2013-04-27T17:37:53.440Z
Salvador Dali
<p>Javascript has access to OpenGL ES, including shaders, so it has access to <em>programmable</em> parts of the GPU at nearly native speeds. I think that a smart kid might be able to build a <em>fragment shader</em> that does SHA256 hashing, which outputs to the stencil buffer, so that Javascript has a 2-way communication channel with the GPU.</p>

<p>So yeah, you could probably use javascript to mine at really nice speeds. Maybe 70% or 80% of what an OpenCL GPU miner does?</p>

<p>[Edit] <a href="https://bitcointalk.org/index.php?topic=4618.msg191488#msg191488">oh look, someone already built a fragment shader that does that</a><br>
[Edit 2] <a href="https://bitcointalk.org/index.php?topic=27056.0">and an actual JS/WebGL application</a></p>

CC BY-SA 3.0
2013-04-27T22:43:22.513Z
Is it actually working for you? Because in chrome it shuts down the tab.
Salvador Dali
CC BY-SA 3.0
2013-04-27T23:11:56.040Z
It's the fact that it once did work that counts, as it proves it can be done again.
Tom van der Woerdt
CC BY-SA 3.0
2016-01-04T02:57:42.153Z
@SalvadorDali Ensure you have Hardware Acceleration enabled. Take a look here http://www.webupd8.org/2014/01/enable-hardware-acceleration-in-chrome.html
m3nda
CC BY-SA 3.0
2013-04-27T21:43:34.703Z
2013-04-27T21:50:02.713Z
2013-04-27T21:50:02.713Z
Tom van der Woerdt
<p>I don't have a great understanding of how bitcoin mining works, but how useful would a JavaScript miner be for collecting revenue from visitors? Stupid question, but if I put the user in as part of a mining pool, must their computer actually find a hash in order for me to make revenue? Is this at all practical?</p>

CC BY-SA 3.0
2016-01-27T19:38:30.283Z
You will have to explain to the revenue service why you make this income in bitcoins. Using the website visitors' electrical energy for mining bitcoins could be seen as theft.
user3284699
CC BY-SA 4.0
2018-07-24T19:41:42.377Z
This was a question well ahead of its time. See COINHIVE and MONERO!
pgSystemTester
CC BY-SA 4.0
2018-07-25T16:36:59.107Z
@PGCodeRider Thanks! I was just in high school 
Jack Humphries
<cpu-mining><javascript><gpu-mining>
How useful is a JavaScript miner?
Jack Humphries
# How useful is a JavaScript miner?

(Asked by: username_0 on 2013-04-27)

I don't have a great understanding of how bitcoin mining works, but how useful would a JavaScript miner be for collecting revenue from visitors? Stupid question, but if I put the user in as part of a mining pool, must their computer actually find a hash in order for me to make revenue? Is this at all practical?

**Tags:** cpu-mining, javascript, gpu-mining

> **Comments:**
> **username_1**: You will have to explain to the revenue service why you make this income in bitcoins. Using the website visitors' electrical energy for mining bitcoins could be seen as theft.  
> **username_2**: This was a question well ahead of its time. See COINHIVE and MONERO!  
> **username_0**: @PGCodeRider Thanks! I was just in high school   

---

## 3 answers

### Answer by username_11 on 2013-04-27. Score: 33 | Accepted answer

Javascript has access to OpenGL ES, including shaders, so it has access to *programmable* parts of the GPU at nearly native speeds. I think that a smart kid might be able to build a *fragment shader* that does SHA256 hashing, which outputs to the stencil buffer, so that Javascript has a 2-way communication channel with the GPU.

So yeah, you could probably use javascript to mine at really nice speeds. Maybe 70% or 80% of what an OpenCL GPU miner does?

[Edit] [oh look, someone already built a fragment shader that does that](https://bitcointalk.org/index.php?topic=4618.msg191488#msg191488)  
[Edit 2] [and an actual JS/WebGL application](https://bitcointalk.org/index.php?topic=27056.0)

> **Comments:**
> **username_6**: Is it actually working for you? Because in chrome it shuts down the tab.  
> **username_11**: It's the fact that it once did work that counts, as it proves it can be done again.  
> **username_10**: @username_6 Ensure you have Hardware Acceleration enabled. Take a look here http://www.webupd8.org/2014/01/enable-hardware-acceleration-in-chrome.html  

---

### Answer by username_3 on 2013-04-27. Score: 7

It would not at all be useful for Bitcoin mining. However, it *may* be useful for other digital cryptocurrencies, such as Litecoin or PPCoin.

> **Comments:**
> **username_4**: Monero seems to be the currency of choice here in 2017.  It has become epidemic. https://gizmodo.com/how-to-stop-pirate-bay-and-other-sites-from-hijacking-y-1818549856  Coinhive is not shy about it.  They offer two versions.  One asks for permission and the other does not.  https://coinhive.com/  Here is a review:  https://medium.com/@MaxenceCornet/coinhive-review-embeddable-javascript-crypto-miner-806f7024cde8  
> **username_5**: It seems especially useful if you place these in a site and run them from millions of machines as a distributed effort. https://en.bitcoin.it/wiki/Distributed_miner  

---

### Answer by username_6 on 2013-04-27. Score: 2

Not practical at all. Most probably the users would be just pissed of. Right now it is not even practical to mine with GPU-s, not to mention CPU-s and for sure JS.

Regarding the question:
"if I put the user in as part of a mining pool, ..."

No, it is not important that he would find a hash. It is working this way. Your all workers are calculating hashes (does not matter if you find the right one or no). If a miner mined something at that time, the miner calculates how much work you have done and gives you the amount of bitcoins. So if you contributed 5% - you will get 5% of 25BTC and in case of some pulls fees. If pull mined nothing, you get nothing.

So in total, if you do not want to piss of users, do not do this.

> **Comments:**
> **username_7**: `if you do not want to piss of users, do not do this.` Ads annoy me; paywalls alienate your community; and making content isn't free. If you want to make content and put it on the web, what are you supposed to do?  
> **username_8**: There are plenty of websites making great and expensive content that can easily exist with a business model solely based on advertisement.  
> **username_6**: @username_7 The thing is that you need to be clear for a user that you are using part of his computational power for something. People already used to ads, so it does not bother them too much. This is completely different. How would you feel if you get a program for viewing video, but somewhere silently it is used to generate hashes? You have no idea about this behavior and how would you feel when you read this on some forum? So I think that your -1 is absolutely inappropriate. I just mentioned to the OP what might happen.  
> **username_9**: As long as you're up-front clear with your site visitors, and your javascript has a governor of some kind so it doesn't suck more than, say, 25% of the GPU's processing power, I don't see why this would be unethical. It could be thought of as a form of hassle-free micro-payments, where you put free (and ad-free) content yet still manage to make ends meet!!  
> **username_10**: While not practical, in a scenario with only browser and a gpu would work. Think in a way to mine remotely with no software install at all. Last time i've tested Javascrip mine I face lot of problems too :V  

---

