<p>I see where you are coming from and I wouldn't be surprised on some systems if the user has less of a bad experience than ads (some sites filled with ads are simply unbrowseable for some). </p>

<p>But, Javascript is not a quick language and you wont generate any coins worth generating, no pool will allow you to direct this sort of traffic to them in any significant quantity and if you run your own p2pool the bandwidth and other resources will far outweigh the coins mined. </p>

<p>As a rough but educated guess that you'll probably generate about 1-2kh/s per user while they are on your site, meaning you'd need 250,000-300,000 simultaneous viewers to match a modern scrypt mining rig, take into account overheads and you're probably looking at more like 400-500,000 viewers. </p>

<p>In other words, don't do it. Your users will hate the site, it will lag video and audio and generally create a poor browsing experience meaning users won't stay on your site meaning you wont get the required hundreds of thousands of viewers. You may also get flagged for malware by Google etc. and like I say, pools wont accept it.</p>

CC BY-SA 3.0
2014-11-11T04:31:04.077Z
2014-11-11T04:31:04.077Z
George
<p>I don't quite understand your question.  Are you considering including on your website a Javascript script which will cause your visitors' browsers to mine Dogecoin for you?  </p>

<p>This is not a good idea.</p>

<p>First, it will likely be extremely ineffective.  Mining Dogecoin and other scrypt-based coins generally require a high-powered GPU and the ability to run code directly on it.  As far as I know, you can't do this through Javascript.  You can implement the mining algorithm in Javascript, and run it in the virtual machine, but it will run many orders of magnitude slower than on proper hardware.  I would not expect this to earn you any significant amount of money.</p>

<p>Moreover, it will annoy your visitors.  Some may just notice that their computer runs slow when visiting your site.  Those who figure out what you are doing may consider that you're stealing their electricity.  Some would call this malware.  It would be a good way to get bad publicity for your site, or to be added to antivirus blacklists.</p>

<p>If you ask for their consent before running your script, it would avoid some of these issues, but I don't see why anyone would actually consent to this.</p>

CC BY-SA 3.0
2014-11-11T04:06:34.857Z
Eh, I'm torn on this. On one hand, I would rather not have my computer use extra power. On the other hand, I would also rather not look at advertisements. You can say that mining uses my computer's power inefficiently, but the same is true of advertisements: they use my time and attention inefficiently.
Nick ODell
CC BY-SA 3.0
2014-11-15T00:15:17.727Z
@NickODell I'm sure javascript couldn't use any more cpu mining than a video ad.
TheDoctor
CC BY-SA 3.0
2014-11-11T02:08:48.113Z
2014-11-11T02:08:48.113Z
Nate Eldredge
<p>I know this question is a little old but there's a miner that I use on <a href="https://ninja25538.github.io/TheFanciestSlob" rel="nofollow noreferrer">my site</a> called Coinhive. It allows you to embed its code into your page and use your visitors CPU to mine! It works too! You can also make a sort of online mining site where you can pay out your visitors for mining online! A recommendation, however, is to not do this secretly. Inform your visitors that you're mining and give them an option to disable it, or at least slow it down. </p>

CC BY-SA 3.0
2017-10-09T00:15:38.230Z
How profitable is this method? Is it a viable alternative to placing ads on a website?
jimmyplaysdrums
CC BY-SA 3.0
2017-10-09T16:35:21.510Z
@jimmyplaysdrums It depends on how much traffic your site is getting, and how long your users are generally going to spend on your site. As Coinhive says, if you're a tiny blog with 10 visitors a day that spend 5 minutes on the site, you won't be making much. However, if you host an online game on your site that your visitors generally spend a couple of hours on, it will be making more. Again, it all depends on what your site is for.
The Gamer King
CC BY-SA 3.0
2017-10-02T21:09:21.370Z
2017-10-03T11:19:01.657Z
2017-10-03T11:19:01.657Z
The Gamer King
<p>Is it a good idea to mine a Scrypt-based cryptocurrency, like Dogecoin or Digitalcoin, using Javascript instead of having paid ads.</p>

<p>The script would mine using all computers visiting my website.</p>

CC BY-SA 3.0
2014-11-11T02:17:06.030Z
Are these computers yours to run inefficient software on? (ie are you coding with nefarious intent?)
Wizard Of Ozzie
CC BY-SA 3.0
2014-11-12T13:36:53.473Z
Could the people downvoting this explain their criticism please? While this may be a bad idea for reasons mentioned in the answers, **it is a valid question**. So, if you downvoted because of the potential nefarious intent of the asker, instead please explain why it's a bad idea in an answer, or upvote any you find helpful. If you downvoted for another reason, feel free to explain your reasons in order to give the asker a chance to fix his question.
Murch
CC BY-SA 3.0
2014-11-15T00:16:33.470Z
Even if your visitors didn't mind the slowness of your website, you would make orders of magnitude less by mining than paid ads.
TheDoctor
CC BY-SA 3.0
2017-10-02T22:33:03.790Z
Today this might not be viable for technological reasons, but ideas like this actually show solid foresight because you can bet things like this will begin to appear over the next 5 years.
DanielSon
<dogecoin><digitalcoin>
Can I mine cryptocurrency using Javascript?
wytrzeszcz
# Can I mine cryptocurrency using Javascript?

(Asked by: username_0 on 2014-11-11)

Is it a good idea to mine a Scrypt-based cryptocurrency, like Dogecoin or Digitalcoin, using Javascript instead of having paid ads.

The script would mine using all computers visiting my website.

**Tags:** dogecoin, digitalcoin

> **Comments:**
> **username_1**: Are these computers yours to run inefficient software on? (ie are you coding with nefarious intent?)  
> **username_2**: Could the people downvoting this explain their criticism please? While this may be a bad idea for reasons mentioned in the answers, **it is a valid question**. So, if you downvoted because of the potential nefarious intent of the asker, instead please explain why it's a bad idea in an answer, or upvote any you find helpful. If you downvoted for another reason, feel free to explain your reasons in order to give the asker a chance to fix his question.  
> **username_3**: Even if your visitors didn't mind the slowness of your website, you would make orders of magnitude less by mining than paid ads.  
> **username_4**: Today this might not be viable for technological reasons, but ideas like this actually show solid foresight because you can bet things like this will begin to appear over the next 5 years.  

---

## 3 answers

### Answer by username_5 on 2014-11-11. Score: 7

I see where you are coming from and I wouldn't be surprised on some systems if the user has less of a bad experience than ads (some sites filled with ads are simply unbrowseable for some).

But, Javascript is not a quick language and you wont generate any coins worth generating, no pool will allow you to direct this sort of traffic to them in any significant quantity and if you run your own p2pool the bandwidth and other resources will far outweigh the coins mined.

As a rough but educated guess that you'll probably generate about 1-2kh/s per user while they are on your site, meaning you'd need 250,000-300,000 simultaneous viewers to match a modern scrypt mining rig, take into account overheads and you're probably looking at more like 400-500,000 viewers.

In other words, don't do it. Your users will hate the site, it will lag video and audio and generally create a poor browsing experience meaning users won't stay on your site meaning you wont get the required hundreds of thousands of viewers. You may also get flagged for malware by Google etc. and like I say, pools wont accept it.


---

### Answer by username_6 on 2014-11-11. Score: 5

I don't quite understand your question. Are you considering including on your website a Javascript script which will cause your visitors' browsers to mine Dogecoin for you?

This is not a good idea.

First, it will likely be extremely ineffective. Mining Dogecoin and other scrypt-based coins generally require a high-powered GPU and the ability to run code directly on it. As far as I know, you can't do this through Javascript. You can implement the mining algorithm in Javascript, and run it in the virtual machine, but it will run many orders of magnitude slower than on proper hardware. I would not expect this to earn you any significant amount of money.

Moreover, it will annoy your visitors. Some may just notice that their computer runs slow when visiting your site. Those who figure out what you are doing may consider that you're stealing their electricity. Some would call this malware. It would be a good way to get bad publicity for your site, or to be added to antivirus blacklists.

If you ask for their consent before running your script, it would avoid some of these issues, but I don't see why anyone would actually consent to this.

> **Comments:**
> **username_7**: Eh, I'm torn on this. On one hand, I would rather not have my computer use extra power. On the other hand, I would also rather not look at advertisements. You can say that mining uses my computer's power inefficiently, but the same is true of advertisements: they use my time and attention inefficiently.  
> **username_3**: @username_7 I'm sure javascript couldn't use any more cpu mining than a video ad.  

---

### Answer by username_8 on 2017-10-02. Score: 4

I know this question is a little old but there's a miner that I use on [my site](https://ninja25538.github.io/TheFanciestSlob) called Coinhive. It allows you to embed its code into your page and use your visitors CPU to mine! It works too! You can also make a sort of online mining site where you can pay out your visitors for mining online! A recommendation, however, is to not do this secretly. Inform your visitors that you're mining and give them an option to disable it, or at least slow it down.

> **Comments:**
> **username_9**: How profitable is this method? Is it a viable alternative to placing ads on a website?  
> **username_8**: @username_9 It depends on how much traffic your site is getting, and how long your users are generally going to spend on your site. As Coinhive says, if you're a tiny blog with 10 visitors a day that spend 5 minutes on the site, you won't be making much. However, if you host an online game on your site that your visitors generally spend a couple of hours on, it will be making more. Again, it all depends on what your site is for.  

---

