How useful is a JavaScript miner?

28

15

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?

Jack Humphries

Posted 2013-04-27T17:28:56.653

Reputation: 437

1You 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 2016-01-27T19:38:30.283

This was a question well ahead of its time. See COINHIVE and MONERO!PGSystemTester 2018-07-24T19:41:42.377

@PGCodeRider Thanks! I was just in high schoolJack Humphries 2018-07-25T16:36:59.107

Answers

33

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
[Edit 2] and an actual JS/WebGL application

Tom van der Woerdt

Posted 2013-04-27T17:28:56.653

Reputation: 2 397

1Is it actually working for you? Because in chrome it shuts down the tab.Salvador Dali 2013-04-27T22:43:22.513

2It's the fact that it once did work that counts, as it proves it can be done again.Tom van der Woerdt 2013-04-27T23:11:56.040

1

@SalvadorDali Ensure you have Hardware Acceleration enabled. Take a look here http://www.webupd8.org/2014/01/enable-hardware-acceleration-in-chrome.html

m3nda 2016-01-04T02:57:42.153

1This really is an excellent answer. Thanks! :)Will 2016-01-14T06:38:53.187

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.

Colin Dean

Posted 2013-04-27T17:28:56.653

Reputation: 6 559

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 2019-10-10T14:47:13.080

2In the header you should put (For consideration), "You are now mining Cyptocurrency for funding the website and the owner. This is recommended if you would like to help but can't donate. [Turn Off]" The turn off function is needed so people wont be mad with you. – None – 2015-04-28T00:34:37.487

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 2017-12-01T18:42:04.580

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.

Salvador Dali

Posted 2013-04-27T17:28:56.653

Reputation: 3 050

4if 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 2013-04-27T17:53:19.653

1There are plenty of websites making great and expensive content that can easily exist with a business model solely based on advertisement.Steven Roose 2013-04-27T18:03:04.267

@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 2013-04-27T20:20:44.473

2As 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 2013-06-14T22:25:46.060

1While 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 :Vm3nda 2016-01-04T03:03:05.990