9 ms·
Javascript Bitcoin Miner
- rgbrgb 15y agoVery interested to see if this could actually be an alternative to ad revenue.
- Shamiq 15y agoAs they point out -- you would need a visitor to remain on any given page for a relatively long period of time. Works well for long-form content, but breaks down in shorter chunks. One thing I'm particularly interested in would be embedding this in a frame similar to stumbleupons web interface and allowing for revenue sharing with the user.
- gibybo 15y agoI don't think the fundamentals are sound here. Advertising spurs commerce, which creates value. This wastes electricity, slows down users' computers, and does no valuable computation. It seems closer to stealing from your users (with enormous inefficiency) than something that creates any real value.
- meric 15y agoBy your logic gold mining is overrated, too.
- HardyLeung 15y agoNot according to cost/benefit analysis.
- meric 15y agoWhat does that mean? You can do the same with bitcoin.
- vrotaru 15y agoA better analogy would have been a store owner mining gold in his background and asking customers to take out the waste away. Something like: - Since you're going out, anyway...
- justatdotin 15y agowell I believe it is :{)}
- HardyLeung 15y agoAmen. You spend, on average, say $1-$10 to acquire a customer, but you lose them in a dramatic, angry, disgusted fashion by trying to steal $0.000001 from them.
- zbanks 15y agoUsing http://www.alloscomp.com/bitcoin/calculator.php http://www.alloscomp.com/bitcoin/calculator.php : On my computer (netbook running Chrome in Ubuntu), bitp.it clocks at 2.2khash/sec. Using this, I'll give 2000hash/sec/user as a conservative estimate. If you had 1M daily visits, averaging about 1 minute of interaction (high, but assuming you have long-form content), you'd have 12000Mhash/day, or about 2.77Mhash/sec. Plugging this in with current rates, this ends up being $0.08/day. For 1M views. This is about 3 orders of magnitude lower than just AdWords.
- HardyLeung 15y agoAnd you get tons of angry visitors.
- deleted 15y ago[deleted]
- csomar 15y agoThanks for making the math, now if we consider that JS is slower by a factor of 1000 than regular GPU (http://news.ycombinator.com/item?id=2566442 http://news.ycombinator.com/item?id=2566442), and browsers are soon to implement WebGL, then it becomes $80/day. And if it is a game and users stay on average for 10 minutes playing, that's $800 and you don't lose any resources on the server side, since it's a WebGL game. It starts to getting interesting. I would be more interested in a game that consume my GPU in the dark than a one that wants me to click an ad and bother me with it.
- cjg 15y agoPerhaps this means that bitcoin is currently undervalued by three orders of magnitude.
- rmc 15y agoOr that AdWords is three times as good as bitcoin for revenue generation.
- esrauch 15y agoAnyone care to calculate the actual expected revenue you could get from this?
- mtogo 15y agoIf you have an average consumer box and leave this running during the day, a few USD a year at current exchange rates.
- vabole 15y agoNot even that much. On my old laptop I get a little more than 1000 hash. Assuming that average computer is twice as fast as mine we get 2 khash/s. Inserting it in the calculator [1] shows that it would take 6068212 days on average to calculate one block of 50 bitcoins. That is 332.5 years per bitcoin. At current rate it means $0.02 per year. [1] http://www.alloscomp.com/bitcoin/old_calculator.php http://www.alloscomp.com/bitcoin/old_calculator.php
- mtogo 15y agoI stand corrected, thanks.
- ck2 15y agoYou need a year's worth of 3ghz dual core cpu power to make 50 bitcoins. This is some impressive code but not practical. And I don't think visitors are going to like you maxing out their cpu.
- seanalltogether 15y agoI know plenty of women who spends hours a day playing casual games, if you embedded a bitcoin miner into a free facebook game you might be able to generate some decent revenue while they play.
- rudiger 15y agoWhy not embed a Bitcoin miner in a regular, installable MMO game and use their GPU? A single gamer's GPU could be worth more than thousands of casual gamers' browsers. Also, MMO gamers can be just as "dedicated". Bonus points for using Bitcoins as an in-game currency.
- Groxx 15y agoNow that is an idea. Make it a casual game, though, so the GPU use of the game is minimal, maximizing the mining GPU cycles. MMO & other often-graphics-heavy gamers tend to be a bit fussy about framerates.
- regularfry 15y agoUnfortunately, the people who are going to spend a lot of time playing casual games and the people with chunky GPUs are (in my opinion) not likely to overlap very much.
- Groxx 15y agoGood point. Though even cheap modern cards have a decent amount of horsepower - the main cost-cutting is shared memory, which doesn't play much of a role in mining. I can mine close to 1/10th of a coin (on Slush's pool) overnight on my laptop; multiply that by a few thousand, accounting for only gaming time, and it's a not-insignificant source of income without even getting very large. 1 block / 50 coins are worth a few hundred US$ right now, and it's entirely passive on the receiving end.
- HardyLeung 15y agoJavascript is way too slow compared to GPU, by at least a factor of 1000 or more. If you have 1M daily unique visitor and you manage to "steal" 10 CPU seconds from each of them, the amount of work would be equivalent to 1e6 * 10 / 1000 = 10000 seconds which is about 2.8 hours of one dedicated GPU-based mining machine.
- trickjarrett 15y agoAgreed, it is far from the future of super computing. But it provides an interesting first iteration for a potential future model of income off of websites.
- milkshakes 15y agofor now. webcl support is not far off, and that's when this could get quite interesting
- scrod 15y agoWebCL makes about as much sense as AwkOS.
- deleted 15y ago[deleted]
- regularfry 15y agoSlightly relevant: http://awk.info/?awk4ai http://awk.info/?awk4ai
- doublec 15y agoit's here now if you don't mind using a plugin: http://webcl.nokiaresearch.com/ http://webcl.nokiaresearch.com/
- rudiger 15y agoActually, regular CPU miners are nearly 1,000 times slower than GPU miners. I wouldn't be surprised if a JavaScript miner was several orders of magnitude slower than that (ie. a million times slower than GPU miners). What about using gamers' excess GPU to mine Bitcoins in an installable massively-multiplayer game? Is anyone trying this?
- cookiecaper 15y agoIt is bad to use a bunch of the user's CPU without any notice. They will probably notice that your site makes their computer slow and never come back again. Also, once they find out you've been using their CPU power/electricity/battery life surreptitiously for private, unshared gain, you will probably have some angry customers. Additionally, does this automatically hook in to slush's pool or something? Bitcoin mining is practically useless on CPU; even the fastest CPUs out get way, way less than 10mhash. The average length of time to find a block at 9999khash and current difficulty is 1200+ days, so even that estimate is over-optimistic, so this isn't worth anything if your users don't sit on your site for 5 years+, unless it's hooked into a pool or some other contraption to pay on shares instead of blocks.
- endian 15y agoway, way less than 10mhash s/mhash/Mhash/
- Groxx 15y agothat's a bit pedantic, ya know... the number only means something to people who know the system even a little bit, and they'll immediately translate to the proper unit because 10 milli-hashes per second makes no sense. Unless you're mining by hand. It's like ranting that people talk about "10mb" files. Or "100gb" or "100GB" drives. When they're technically "93.1GiB" drives ("gibibyte" [1],[2], or [3]). [1]: http://en.wikipedia.org/wiki/Hard_disk_drive#Capacity_measurements http://en.wikipedia.org/wiki/Hard_disk_drive#Capacity_measur... [2]: http://en.wikipedia.org/wiki/Mebibyte http://en.wikipedia.org/wiki/Mebibyte [3]: http://en.wikipedia.org/wiki/Binary_prefix http://en.wikipedia.org/wiki/Binary_prefix
- ghshephard 15y agoIronically - your example speaks against itself. 100GB Drive is a very precise and agreed upon way of referring to a drive - it means 1x10^11 bytes. 93.1 GiB drive is unusual - we don't typically use powers of 2 when referring to drive length - so if you really mean 93.1 GiB, then it's important you call it out as such, or people (storage admins, driver manufacturers, and operating system developers) will understand you to mean 1X10^11 bytes when you say 100 Gigabytes. Precision has it's place.
- ccarpenterg 15y agoIdea: Screensavers with a bitcoin miner. Like SETI@home. Bitcoin@home!
- kes 15y agoBut who would get the coin?
- ccarpenterg 15y agoLet's say you earn a percentage for running the screensaver.
- Groxx 15y agoI'd imagine a particularly good screensaver would be profit-sharing, but everyone else would run a free one and get all the mining income. Solo-mining is not really an option any more, and it'd be easy to cheat (detect wins & claim for yourself), so it'd have to be pool-based to be useful.
- code_duck 15y agoA charity. Everyone would love that.
- aw3c2 15y agoThere ain't many things more annoying than screensavers that make my fans spin up.
- Klonoar 15y agoNeat! Distributed computing with JS is an awesome tech trick, some friends and I did something similar back during Node Knockout (MapRejuice: https://github.com/ryanmcgrath/maprejuice https://github.com/ryanmcgrath/maprejuice). Curious to see what you guys think of the ethical side of it though - do you let this run on mobile, etc? This will almost definitely cause extra battery drain on mobile devices, you think it's fine to have this happen without user consent? ;)
- dave1010uk 15y agoBitCoin mining could replace banner ads. I have Flash on my mobile, which often uses lots of CPU usage for ads. You could argue this is the same.
- blendergasket 15y agoI was going to say the same thing. Seems like an annoying flash ad uses a ton of CPU as well.
- Klonoar 15y agoYeah, you could argue this... and then we could just point out that Jobs & co are right, and Flash has been a battery hog since the dawn of time. This is a reason why the iPhone can be so performant; you're arguing that it's perfectly acceptable to degrade the otherwise shockingly good performance of a mobile device when it can be avoided entirely. Flash needs to stay out of this argument, as at the end of the day it's still a real ethical question - how much CPU are you realistically allowed to take and continually use from a user visiting your page?
- deleted 15y ago[deleted]
- paulirish 15y agoThe source of their miner: http://dpaste.com/hold/544515/ http://dpaste.com/hold/544515/ It actually starts up a web worker with the exact same file and communicates with itself back and forth, the browser version to the worker version. Not the first time this technique has been used but it's still pretty new.
- peteretep 15y agoThis is a neat-trick, and I ♥ Javascript, so even better. In terms of ramping this up to actually be a viable revenue source... I guess you'd need a browser plugin which was hard-core about making sure you agreed to usage, and verified to the server that you were actually doing the mining you'd agreed to - and that could tap in to the GPU. But then, if Bitcoins become worth something meaningful, wouldn't we all be using our GPU most of the time to be generating them anyway? In which case, the website starts asking you for the opportunity cost of using your GPU instead, and you know how much that's worth, and boom, micropayments.
- vegai 15y agoGreat. So now we will have to start blocking Javascript code from sites we don't trust.
- wladimir 15y agoI've been doing this for a long time with the Ghostery firefox plugin. It blocks all kinds of trackers and other dubious stuff.
- zyfo 15y agoI hope this doesn't catch on. BItcoin got many merits against current currencies. This wouldn't be one of them. That said, it's a nice proof-of-concept. Is there anyway to block this type of use of CPU without blocking JS?
- sbierwagen 15y agoSure. Set noscript to block-by-default, and don't allow script execution from malicious domains.
- blahpro 15y agoWeb Workers?
- binarymax 15y agoYou could write a browser add-on that only blocks the bitcoin script.
- josephholsten 15y agoI'm one of the developers of bitp.it. We're still working on an opt-out cookie, but for now we encourage you to use adblock. I'll be throwing a howto up later this afternoon.
- naughtysriram 15y agoJust used google's closure compiler http://closure-compiler.appspot.com/home http://closure-compiler.appspot.com/home on http://bitp.it/jsMiner.js http://bitp.it/jsMiner.js and it saved some 4.11%. While compiling on advanced mode i get lot of warnings.
- gibybo 15y agoIf you take the output of the Closure compiler and run it through the compiler again, it will almost always be smaller the second time. However, the second will also likely produce javascript that doesn't work because it renames things that shouldn't have been renamed (and only the original source contains the information necessary to determine what shouldn't be renamed). The 4.11% reduction you experienced is likely gained at the expense of invalidating the code.
- josephholsten 15y agoThat's pretty interesting! We'll give it a look and see how much it improves things.
- dave1010uk 15y agoSomeone could make a URL shortening service that frames sites, including the mining JS. Users could sign up and get a % from the mined coins on links that they share. As many people are pointing out that GPUs are faster for mining that CPUs, would you be able to make use of a GPU with WebGL (or GPU-accelerated Flash)? I guess the GPU computations don't fall in the spec of WebGL though.
- VMG 15y agoI think a bitcoin browser plugin would be the sanest choice
- josephholsten 15y agoWe thought so too! But then we realized that if you're going to download and install a miner, you probably want one that's actually fast. Browser plugins, which are almost all javascript these days, are basically the worst of both worlds from that perspective: slow and require manual installation.
- josephholsten 15y agoWe thought about how much people would hate us if we did some digg-bar thing like that. We'll leave the being debatably evil to google. As for the GPU-accelerated JS, check out WebCL: http://webcl.nokiaresearch.com/ http://webcl.nokiaresearch.com/
- naughtysriram 15y agowhat if a virus or malware or an adware installs a bitcoin miner and starts mining on zombie machines? wouldn't that be productive?
- naughtysriram 15y agoa botnet for bitcoin having millions of bitbots :P
- rakkhi 15y agoControl every PS3 on earth and use them to mine bitcoins :)
- pygy_ 15y agoIt is technically the biggest threat against Bitcoin. The mining process validates the transactions. Transactions are grouped in blocks. The blocks are chained in one big sequence and the miners validate the block chain. Even if a rogue miner validates a block that steals coins, his fork of the block chain will not be validated by honest miners. As long as the computing power of the honest miners is above the one of an attacker, the block chain is safe. A dishonest, big enough botnet could overpower the honest miners, fork the block chain and wreak havoc in the system. -- The biggest threat to bitcoin is not technical, though, it is financial. The bitcoin market cap is currently of ~ $50M. If people with deep pockets and trading experience figure that bitcoin is a threat to their deadline, they can easily manipulate the market and crash it.
- vabole 15y agoWhat would a scenario of such financial attack look like? Suppose I had $100M - twice the bitcoin market cap. What would I be able to do to destroy the bitcoin? I can think of ways to manipulate bitcoin market with large sums of money, but nothing that would make bitcoin unusable.
- wmf 15y agoYou'd buy as many BTC as you can (probably slowly over time), then sell them all at once for a very low price. Momentum traders would help you by also selling their BTC when the price starts dropping.
- aarlo 15y agoSo why does the bitcoin economy reward spending processing power? I guess our economy does too (quant finance)
- caf 15y agoAt heart, it's because honest nodes spending CPU power to notarise transactions in a distributed manner is what maintains the system's integrity. I suggest reading the original bitcoin whitepaper - even if you find the economics a bit dubious, as I do, the tech is certainly interesting.
- wcoenen 15y agoBecause you need some way to inject new coins into the system initially. Bitcoin chose to do this by allowing early users to "mine" the currency. The traditional approach is to have a central bank which does the minting and printing, and then the regular banks can borrow that money. Those banks then lend that money to their customers, possibly creating more virtual currency by fractional reserve banking. Bitcoin obviously can't do that because it is a decentralized system. The traditional approach also has the disadvantage that all currency in circulation is ultimately borrowed, so there is always more debt than money unless you allow banks to default. That can only work as long as the economy is growing fast enough. I think there are even better alternatives, by modeling currency after trust and social capital: http://ripple-project.org/decentralizedcurrency.pdf http://ripple-project.org/decentralizedcurrency.pdf
- josephholsten 15y agoYou should know that people have been trying reputation-style digital currencies since at least the early nineties. They require a ton of bootstrapping to get anywhere. That's because you end up with a trading system that's looks like a foreign exchange market with 7 billion different floating currencies. And that's assuming only individuals have them, excluding corporations. You'll notice old cypherpunks have a lot of skepticism toward the fiat-currency arguments against bitcoin. We've been trying to make fiat-currencies work. Keeping the rep net up to date is at least as expensive as mining bitcoins, but with none of the hard-crypto backing to the algorithms. And it's way more opaque. That's ideal if you're trying to soften shocks across a national economy. It's less ideal if you've got more self-serving interests than eyes. Bitcoin isn't perfect. But we can test it, and if it breaks, we'll see quickly. Broken rep-net economies are like building markets on pyramid schemes: people have an incentive to pretend it still works until the damage is orders of magnitude larger than the economy proper. And I encourage you to investigate what fractional reserve banking looked like in the days of specie-backed-currency. Banks still made loans and kept less than the entire value of their demand accounts on hand. It'll be weird, but there will be an M2 and an M1 in bitcoin, we aren't technically limited to an M0 money supply.
- yatsyk 15y agoIdea for browser extension: display warning icon if tab uses all cpu.
- pbhjpbhj 15y agoSo what you're saying is that my FF has being doing this for the last 7 years ...
- deleted 15y ago[deleted]
- jhuckestein 15y agoA few thoughts on this: 1. Although slower than using your own GPU(s), this scales with your visitors. Your own hardware does not do that. 2. Most visitors don't spend a long time on your website. If you efficiently distribute work amongst workers, you can probably even leverage the shortest of visits. 3. I built something like this called MapRejuice (CPU instead of eyeballs) for a hackathon once. It ran MapReduce jobs pretty quickly (we embedded it into a relatively popular Twitter widget ... heh). One of the biggest obstacles to commercial application was security (not a lack of processing power though!). If bitcoin takes off, people will just take the "free money" their machine is creating for themselves. I'll be the first to make a browser plugin that mines bitcoin miners :) In any case, great effort. I definitely think there is merit to the idea of using all the idle processing power in the world instead of building huge new datacenters. Bitcoin is probably not the best application for it though (research stuff like DNA folding seems more appropriate)
- pygy_ 15y agoGoing meta: I've seen in the last few weeks apparently relevant and polite posts that had been flagged dead[1]. One of these was a post by jashkenas in a CoffeeScrit thread. This one could hardly have been more on topic. Is there a new moderation policy, or is it a bot with a happy trigger? [1] In this thread, http://news.ycombinator.com/item?id=2566826 http://news.ycombinator.com/item?id=2566826 , a post by jhuckestein, and http://news.ycombinator.com/item?id=2566797 http://news.ycombinator.com/item?id=2566797 by csomar.
- trotsky 15y agoI'd be curious to know the answer to this too - I've seen an increase of "one off" seemingly acceptable posts being flagged dead, and browsing their post history it wasn't cases where they were set to auto-dead.
- kristiandupont 15y agoRegarding angry visitors, I think it is completely fair if you just inform them of what is going on. In a way, this is the perfect internet model: I offer my content for free but visitors pay me with cpu cycles. It's superior to the ad-model because it pays according to time spent on the page regardless of who the audience is. It's too bad that it's infeasible because of the very low rate.
- nodata 15y agoWhy does time spent on the page matter?
- whatusername 15y agoIt corelates to value derived from the page. SO the people I deliver the most value to, I extract the most value from. // WIth an added bonus that I recieve more value from the people with more expensive computers (aka the wealthier viewers)
- nodata 15y agoI don't see how the time spent on a page correlates to value for the reader. If I read faster or slower than someone else and spend less or more time on the page, it doesn't change the value provided to me by the article.
- mtinkerhess 15y agoOn the other hand, if a site provides more value to a visitor, they are more likely to keep spending more time on the site.
- nicpottier 15y agoYes, I'm glad someone actually picked up on this. I'm watching Bitcoin with a curious eye, but this really nails a pretty novel and interesting aspect of it. That yes, you are paying the site owner for viewing their site, in a way that is (mostly) transparent to you and with billing already captured by your power company. I haven't actually run it so I don't know just how badly it thrashes my machine, but assuming that can be worked out, this particular idea is the KillerApp(tm) of Bitcoing as I see it. Actually, now that I'm thinking of it, one giant achilles heal: If this really takes off and the mass of the internet uses it, then that means the entire mass of the internet can only be monetized at the set rate that Bitcoins are made. Which isn't much money. But I still think there is something interesting here.. hrmm.
- tlrobinson 15y agoCute, but this is hardly worthwhile unless you have a massive number of users, in which case you probably don't want to piss them off by wasting their CPUs. I'm getting about 13K hashes/sec with this JavaScript miner. For comparison, my GPU gives me 100M hashes/sec, and even my 12 CPU cores give me 10M hashes/sec with the official Bitcoin client. So you'd need about 1000 concurrent users at all times to match a single machine. EngineYard SHA1 contestants who used this approach had the same problem. Now, if Native Client was widely deployed, or you could somehow rig up WebGL...
- omarchowdhury 15y agoWhich GPU do you have?
- bitcoin 15y agoJust don't end up like this guy who lost $50k USD in Bitcoin earlier today. http://helpingmarak.net http://helpingmarak.net
- motters 15y agoIf there is a Bitcoin bubble you can be sure that there will be people doing things like this, regardless of whether it's ethical or not. From the site visitor's point of view they're not getting a cut of the mined coins, so their high CPU usage is purely a waste and annoyance. If widely deployed, this sort of browser based CPU wasting enterprise could bring Bitcoin into disrepute and be an excuse for governments to treat it as a cyber-threat.
- AffableSpatula 15y agobanner ads are also, on the whole, a waste and annoyance; so not much of a change there It is probably fair to say most people don't care all that much provided their user experience is not noticeably impacted, but it looks like this work is failing to deliver in that respect. If they manage to throttle CPU usage effectively then this is at least a semi-feasible alternative to "monetizing" traffic.. I find that quite interesting conceptually, even if it doesn't work in practice at the moment.
- motters 15y agoI suppose it's a question of degree. If not too much CPU resource is consumed then perhaps it is an acceptable way to monetize web sites - although this would only work for high traffic sites, and would become less lucrative over time. There is a bit of a moral hazard though, in that it would be in the interest of the host to consume as much client CPU resource as possible, without rendering their browsing experience too unpleasant.
- tobylane 15y agoHow long till Adblock adds a bitcoin-block? Can't be soon enough imo.
- josephholsten 15y agoWe're looking into the best way to let adblock users turn us off, as well as a cookie based opt-out.
- BCM43 15y agoIf this gets more people to install noscirpt, I'll consider it a good thing.
- josephholsten 15y agoI hadn't heard of that! I'll be sure to mention it on our opt-out page, along with adblock.
- mikegagnon 15y agoPluraProcessing.com pays site owners to farm out computations to their clients. According to PP, site owners can make about $2.60/month/user. The major catch is that the system only works well when visitors have long visit durations (e.g. web-based video games). I presume PP necessitates long visit-durations because short visits won't yield enough computational resources to make computations economical.
- peterbraden 15y agoon the ethics of this thing - most people seem to think that using a users cpu without permission is unethical. My browser is often brought to it's knees by badly written flash ads - is there a difference?
- jpr 15y agoThere is no difference. That's why people who want to retain their sanity disallow Flash. And it's really fucking close that I don't disable all JS too.
- magicseth 15y agoOn my machine with chrome, I had to open it up in 4 separate tabs in order to peg all of my cores. It got pretty warm pretty quickly.
- anonymous 15y agoBored with bitcoin. One technical flaw and your 'currency' vanishes.
- josephholsten 15y agoFortunately, that's not actually true. If the community agrees when the last valid block is, all the transactions before that will be accepted as trustworthy. The DHT (now moving to freenet) ensures that this transaction history is reliable up to the date of the exploit. Then it's just a social problem of converting into a less flawed system. But social problems tend not to end up as near the worst case as is often feared. What you're describing is like saying that if we break the crypto underlying git repositories, you can trick the world into thinking you are the original author of linux. Obviously, no one would fall for that. But every git commit after the exploit, or from sources lacking a large consensus, would be of suspect authorship. It's a big problem, but not exactly the way you imply.