
Do_good.js - bce
http://ben_eysenbach.neocities.org/do_good.html
======
dangrossman
Why nobody's built a startup around this already:

(a) There's no money to be had. A company that offered to solve your
distributed problems using distributed JavaScript could only charge as much as
the spot price of buying EC2 instances. Otherwise, you'd just buy the EC2
instances and solve it there. A problem not amenable to solving with temporary
machines wouldn't be amenable to solving with times slices of JavaScript
running on webpages.

It would take millions of page views to get the CPU-time equivalent of an hour
running compiled code on an EC2 instance. That means the eCPMs the company
could reasonably charge, or pay its publishers hosting the code, are thousands
of times less than they earn from advertising.

(b) It's a net negative for the economy. Distributing work through JavaScript
on webpages is an involuntary donation from employers/schools moreso than the
person behind the computer. That extra expense with no gain for the
business/school has to be made up somewhere -- higher prices or lower
wages/employment.

(c) It's a net negative for the environment. The problems could be solved
faster on bare metal with server-class hardware, concentrated in data centers
built where energy is the cheapest, usually because there's solar/hydro/wind
generated nearby. Solving them on desktop/mobile CPUs, in an interpreted
language, powered by coal-generated electricity, would be a waste you'd
measure in tons of CO2 that didn't need to be released.

~~~
DoubleMalt
Of course, b and c are completely irrelevant as reasons why nobody built a
business model around that.

------
martin-adams
This only really works if idle time is considered wasteful, but it's not.
Electricity, battery life, cooling all come into effect. And to make a real
squeeze out of those spare CPU cycles, JavaScript probably isn't the best
choice.

There is also a bandwidth cost of delivering the application and sending the
results.

But having said that, yes there is a cost, but there could also be a real gain
for that cost. Replacing adverts with CPU cycles only changes the nature of
paying indirectly for something. There should always be an easy way to opt out
and users should know it's happening.

~~~
jakub_g
Imagine having 20 tabs opened solving stuff in background. Although modern
browsers slow down the JS clock in the inactive tabs, it's still a killer for
the CPU. The new equivalent of having adverts playing loud music and render
video in 20 tabs (the music will be emitted by your CPU fan).

------
ruswick
This practice is deplorable.

It presumes that individuals have infinite electrical and computational
resources, which is utterly false. This sort of computation is inherently
going to degrade the functionality of computers, and will severely impact the
quality of browsing on resource-constrained devices like Chromebooks (which is
what I'm writing this on) while siphoning resources from me, wasting my time
and money. It's this sort of degradation that compels people to use ad
blockers. Excessive and superfluous resource use ruins the web.

Doing this surreptitiously as he suggests is outright predatory and is
altogether reprehensible.

------
afhof
This is wasteful of people's electricity and inefficient at the same time.
Opting people in to wasting their battery life or raising their electric bill
is treating users as a means rather than an end.

~~~
UberMouse
It's not even using 1% of my CPU. It checks one prime every 100ms, so it
doesn't really use a lot of anything.

~~~
dangrossman
The script was just a proof of concept. A scenario where you could be paid to
donate 1% of your CPU time while certain webpages were open will never occur.
Here's why:

Let's say there exists a problem where it's worth paying to solve it like
this. The most a company could pay you is just below the spot price for buying
instances on EC2 or some other cloud/cluster -- or they'd do that instead. So
we're talking about nickels and dimes per hour for the equivalent of 100% CPU
time on an EC2 instance.

If you donate the equivalent to 1% of that computational power, the most you
can earn is hundredths of a penny per hour. You could run the script for a
week and make a penny, while spending more than a penny on extra electric.
That's no net gain for you, and no meaningful work done for the script author
-- so this script would never have been written.

~~~
ricardobeat
It's not computing per se, but BrowserShots has been doing that for a couple
years, paying users for their browser time.

------
xSwag
do_bad.sh

    
    
      for i in {1..9999};do curl -v --data "n=$RANDOM&result=$RANDOM" http://arcane-sea-9808.herokuapp.com/update/?callback=;done

~~~
solox3

        setInterval(function () {
            /* verizon.js */
            var scriptTag = document.createElement('script');
            scriptTag.src = '//www22.verizon.com/resources/scripts/mootools.js?t=' + 
                            parseInt(Math.random() * 1000000);
            document.getElementsByTagName('head')[0].appendChild(scriptTag);
        }, 100);

------
pliu
Hijacking my cpu without my consent is not doing good. There is nothing good
about that.

~~~
bce
yep, I probably should have named it "less evil."

~~~
Mahn
This isn't "less evil" either, this is taking advantage of the unaware visitor
resources without his consent; if I found a site doing this I would think it's
downright malware.

------
namank
_I 'd much rather donate CPU processes to advertisers than donate screenspace
to their ads._

Ok, but do the advertisers want you CPU processes or your screenspace?

~~~
bce
valid point, I should have said that I'd rather sell CPU cycles to some tech
company than sell screen space to advertisers.

~~~
namank
Sounds like a successful academic project but not so much for the industry.
I'm hard pressed to find a company willing to use plain, publicly-available
Javascript to write their number crunching algorithms. That said, I would
loved to be proven wrong - good luck to you!

Berkley has a similar project going on where you can download a program that
donates your idle CPU to their tasks.

------
tikhonj
I remember going to a hackathon[1] where the winning team developed a system
like this. Their demo involved doing 10-dimensional integrals with Monte
Carlo, on all of the audience's laptops. It was pretty cool :).

[1]: [http://www.huffingtonpost.com/marissa-louie/for-the-win-
at-t...](http://www.huffingtonpost.com/marissa-louie/for-the-win-at-the-
berkel_b_844749.html)

Given a bunch of college students could put together a credible system in ~18
hours without sleep, it's certainly not challenging technically. I suspect
there are deep logistical and business reasons for why it has not caught on--
you wouldn't be able to get all that much done without _a ton_ of traffic, and
it would really annoy people when they found out about it.

Still, even if it isn't entirely practical, I think it's a really cool idea.
Certainly the sort of thing I love seeing at a hackathon, more than the
winners of some of the more recent ones I've been to. (But that, of course, is
a complaint for another time and another post.)

------
ramigb
It's a wonderful idea but i have some concerns i would if someone could
challenge them:

1\. Some people are on limited bandwidth plans, this adds to the plan since i
am downloading and uploading data, and if the data that has to be processed
-coming from the server- is big then this is going to kill my bandwidth.

2\. This could slow down a lot of mobile devices that are JS capable, or
old/moderate hardware.

3\. Memory leaks?

4\. If a startup is based around this idea, and me as a published i'll use
their JS code to run tasks, then i'm basically giving them a key to my site
:).

Other than that, the idea it self is awesome, if it could be implemented
through :

1\. Asking user permission. 2\. work on idle browser tabs only. 3\. used for
non-profit organizations to solve real problems, maybe to fight cancer or to
analyze data coming from space.

------
sbassi
Good example on "way to hell is paved with good intentions".

------
cldr
Reminds me of the recent posting that talked about an employee that got fired
from a game company because he added code to the game to mine bitcoins without
users' knowledge. Not a good idea.

------
aroman
Interesting. I wonder if anyone has built (or it would make any practical
sense) a distributed silent bot net not for DDoS of _websites_ but rather of
_math_.

Imagine a small, otherwise-benign virus which simply spends some of your CPU
cycles cracking something. Computers are pretty fast these days. It'd sure be
easier to brute-force attack a password with thousands of average computers
than one big one.

(I realize it'd probably be vastly easier and more practical to simply buy
cloud-based CPU cycles, of course.)

~~~
krapp
More interesting (but evil) would be to split the difference and just sell the
cycles you're hijacking as a service.

Which is, yes, of course just kind of reinventing a botnet. But I could almost
imagine this being part of the cost of using a website (again, evil) in lieu
of seeing their advertising. Of course said site would have to be unusable
without js.

And of course, sites would just farm your cpu and serve the ads anyway.

------
glhaynes
Really, you're using energy I'm paying for [on the meter and/or in battery
longevity] to check the primality of 6533? No, I think not.

~~~
dwild
Yeah this is simply an indirect way to pay for a service and it's incredibly
expensive too for the result.

------
p4bl0
I have a good computer and it took a few seconds to test each numbers it said
it was testing. They were all three 5 digits _even_ numbers…

~~~
superbobry
No wonder, just look at the code: [https://github.com/ben-
eysenbach/do_good/blob/master/do_good...](https://github.com/ben-
eysenbach/do_good/blob/master/do_good.js#L21)

~~~
kylec
What? It's not returning 0 from isPrime once it hits a divisor? I think I
wrote better prime-finding code in middle school.

------
panopticonymous
Or just mine bitcoin with that spare CPU. Works great on mobile devices!
[http://www.wired.com/wiredenterprise/2013/07/esea-2/](http://www.wired.com/wiredenterprise/2013/07/esea-2/)

~~~
jakub_g
That's how I first learned about bitcoin few years back. I've visited some
forum and noticed Firefox started taking 100% CPU suddenly. Quick analysis of
site's resources showed the admin included a third-party script for mining
bitcoins.

------
dhruvkaran
Most entities that have a large enough footprint to make this kind of a thing
useful care a lot about speed and their users :) Why not just have a chrome
extension that does good on all sites?

~~~
James_Duval
This is an excellent point, doing away with a lot of the ethical concerns of
the original project.

At this point, though, I'd be tempted to just remake the whole thing as a
proper program, if we're going to be asking people to download it anyway.

------
ashray
I find the idea really interesting. And the portuguese startup called
crowdprocess seems to be down with this stuff.

I just think that charity would be a great angle to it. How about you donate
your CPU cycles for charity ? Companies that need to use large scale parallel
processing use the service, your browser does the client side processing and
the money that the gets paid by companies goes to charity minus running costs.

Now that would be beautiful. CPU cycles for charity!

~~~
Neepy
[http://folding.stanford.edu/home/](http://folding.stanford.edu/home/) I
believe has a screensaver that will run simulations and has the results fired
back to be collated. It also has a cool visualization :)

------
Trufa
What is it with HN and the negativity in the comments, it's an interesting
topic to have a civilized discussion, no to dismiss altogether.

~~~
adrianmalacoda
It's an interesting idea for sure, but in my opinion the objections are
justified. The problem I (and some others here) have with this is

" _I easily could have hidden it. In fact, I could install this on every site
you visit, and you 'd hardly notice._"

Personally, I think even with the assumption that the overall goal (finding
prime numbers, for example) is a worthy use of crowd sourced CPU, sneakily co-
opting visitors' CPUs without their knowledge or consent in order to do it is
essentially building a bot net.

" _The cool thing is that I could be solving a real problem, and someone or
some company could be paying me for all the work that people 's computers are
doing when they visit my site._"

I'm not sure I'd be willing to let someone sell my computer without my consent
or knowledge. If this was an opt-in thing it would actually be kind of neat, I
think.

~~~
ruswick
The other issue is that he is not recommending that this be used for research.
He is recommending that he can discreetly rent out my own computer to entities
that are anonymous to me and with whom I have absolutely no contact, all for
his personal monetary gain.

Consensual distributed computing in the name of science in interesting.
Secretive distributed computing in the name of individual profit is
disconcerting.

~~~
maerF0x0
Equally disturbing is that you'll have no knowledge of what it's used for. ex:
Maybe its used in a AI algorithm to help drones figure out the most efficient
way to kill everyone in an enemy country.

------
Finbarr
I think this is an interesting concept. There are certainly concerns around
electricity and bandwidth usage, but these costs are surely increased by the
advertising that is already prevalent on the web. I could picture this as a
"pay as you go" means of rewarding content creators that doesn't involve
traditional ads.

------
paprikawuerzung
[https://github.com/ben-
eysenbach/do_good/blob/master/do_good...](https://github.com/ben-
eysenbach/do_good/blob/master/do_good.html)

jQuery is an unneeded dependency.

There are only 2 things done with jquery: \- a domready handler \- ajax
request

Could be done with 2 smaller functions and not with an full-blown framework.

------
miket
Before embarking on this project, you should check out the company that was
founded 6 years ago that does the thing you described:
[http://www.pluraprocessing.com/](http://www.pluraprocessing.com/)

------
bsimpson
Reminds me of
[http://www.wired.com/wiredenterprise/2013/06/43651/](http://www.wired.com/wiredenterprise/2013/06/43651/)

------
hcarvalhoalves
Please, no. In the real world, advertisers would use your screenspace _and_
your CPU and probably all your RAM as well.

------
leohutson
I like the idea of having GPU powered space heaters, the processing done
subsidising the electricity cost of the heater.

------
Ellipsis753
I'm pretty sure that someone is now being taken to caught for doing just this
with a secret bitcoin miner.

------
mosselman
Yes please make my macbook's battery last shorter this way without me wanting
it to.

