28

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?

  • 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. – user3284699 Jan 27 '16 at 19:38
  • This was a question well ahead of its time. See COINHIVE and MONERO! – PGCodeRider Jul 24 '18 at 19:41
  • @PGCodeRider Thanks! I was just in high school 😂 – Jack Jul 25 '18 at 16:36
32

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

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.

  • 2
    In 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. – user25249 Apr 28 '15 at 0:34
  • Monero seems to be the currency of choice here in 2017. It has become epidemic. gizmodo.com/… Coinhive is not shy about it. They offer two versions. One asks for permission and the other does not. coinhive.com Here is a review: medium.com/@MaxenceCornet/… – SDsolar Dec 1 '17 at 18:42
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.

  • 4
    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 Apr 27 '13 at 17:53
  • 1
    There are plenty of websites making great and expensive content that can easily exist with a business model solely based on advertisement. – Steven Roose Apr 27 '13 at 18:03
  • @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 Apr 27 '13 at 20:20
  • 2
    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 Jun 14 '13 at 22:25
  • 1
    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 – erm3nda Jan 4 '16 at 3:03

protected by Community Jul 27 '17 at 21:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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