Hacker News new | past | comments | ask | show | jobs | submit login
Briefly profitable alt-coin mining on Amazon through better code (da-data.blogspot.com)
84 points by jterrace on Dec 11, 2013 | hide | past | favorite | 53 comments



I love the double standards on display at HN. In this whole thread, not a single mention of the opportunity cost of smart people wasting resources on things not productive to society or how it is an unfair market because someone is taking advantage of the other participants by being more sophisticated than them.

What would the discussion be like if the headline was "Briefly profitable HFT FX trading through better code"?


I think of research into virtual currencies as at least as beneficial as GIMPS, SETI, Folding@Home. All of these have progressed CS in significant, measurable ways. And if someday one of the many alt-coins or one of their descendants becomes well established, all of this research would be worth it.

Also, while I am still unsure of the benefits of HFTs despite trying really hard to understand how they bring liquidity by front-running etc., I still think the technology invented to make HFT possible is a net-good for humankind - GPUs that can perform trade in nanoseconds, processing happening on the same layer as network traffic, entire CPU/GPUs living an inch from the ethernet port. All of this stuff is really neat and even though the practice of HFT is morally questionable, the fact that it pushes our capabilities further is not something we can ignore.

The future world will be a much better place if I can wire $2k to my dad in India without going through multiple banks, wire-transfer fees, proof of citizenships etc. Better that we work for a world where money is not controlled by the powerful than make better shiny reports for sales and traffic analysis for mobile.


"I think of research into virtual currencies as at least as beneficial as GIMPS, SETI, Folding@Home."

LOL. The cognitive dissonance is strong with this one. Also, mining bitcoins or squeezing a few extra cycles out of a VM is not 'research into virtual currencies'. Look people, let's just call a spade a spade here - us nerds are quite happy with our new-found economic powers (not just BC, in general), and we're all too happy to flex it when new tech (like BC) gives us an early mover advantage. Yeah I'm bitter I'm no BC millionaire because I had other things on my hands 2 years ago than running some software, while I did run SETI@HOME on a largish network for a long time a decade ago for no gain at all; but 200 years ago I would have been a peasant, now I was catapulted into upper middle class just because I was born in the right decade and with that twist in my mind that makes me grok computers better than most people. That's just how it is, why do feel we need to make moral justifications about it (or worse, whack job 'I deserve it because I worked harder' delusions like in that article yesterday about the Google dude).


You speak as though the process of continually training/learning is not valuable to society. This is someone spending their free time learning optimization. You wouldn't criticize them if they wrote "I practiced code optimization methods in a Coursera class." This is someone's free time.

I don't spend 24/7 attempting to make your life better.

Source: Top comment on the blog

>This is apparently what happens when computer scientists spend four weeks sick and have to keep themselves from going stir crazy. +Emin Gün Sirer , I blame you for inspiring this, and I'll buy you a beverage at NSDI with some of the proceeds. Thanks for the fun! And thanks to my online-and-offline friends who put up with me babbling about bitcoin entirely too much recently. I'm done. I think. :-)


But the double standard remains, since the same could be said about high frequency trading, currency trading, etc.


But, Bit^H^H^Halt-coins!


I also used this brief window of opportunity as a fun experiment in learning Ansible. As a result, I've published a repo which automates setting up LTC mining on g2.2xlarge instances.

http://github.com/adammeghji/ansible-ltc-mining-on-ec2

If anybody's curious to spin up a GPU instance and dabble with this, this greatly facilitates downloading, compiling, and installing the CUDA drivers, and setting up the LTC miners. Amazon has a $100 credit available too, if the current spot instance prices are prohibitive.


I used your script to help me figure out how to dig for DogeCoin. Ultimately I wound up doing everything on Screen. Did 1, 3, 5, and finally 1 instances, a few hours at a time. I've stopped mining for now, going to wait until I set up my own rig and maybe create a new AltCoin. https://gist.github.com/benatkin/7868889


So: 1.5 weeks of work. $50-$75/mo/instance. x20-60 instances. Worked for 3-4 weeks.

If we assume the most optimistic parameters: $75 * 1mo * 60 instances = $4500 in profit for 1.5 weeks of work, or a rate of ~$156k/yr.

Edit: It looks like I misread his revenue numbers for profit. Oops! Even lower margins:

"My gross revenue was about $1000, and I paid Amazon $500 of that."

$500 for 1.5 weeks' work is only $17k/yr rate. Maybe flipping burgers pays better.


You also don't need to sing in the shower. You can leave the shower earlier, hire a TaskRabbit to sing for you instead, and if you value your time correctly you should come out ahead.


Yeah, but I don't recommend singing in the shower for 1.5 weeks while your employer is paying you sick leave ;-).


I also definitely don't recommend you moonlight flipping burgers while your employer is paying you sick leave.


Well, if he just leaves this running, assuming the same level of profitability it is 17k a year of passive income...definitely worth keeping up if possible. as the exchange rate goes up it should become even more profitable.


The spot market prices have been going up non-stop. I finally pulled the plug today when my expected daily revenue was down to about $5. (There's some risk inherent in doing this, because a market crash could leave you saddled with a day of Amazon bills with nothing to show for it. So it becomes less attractive at low margins.)

I was only able to run 60 nodes for the first two days. After that, spot market prices in CA and Oregon went too high for profitability.

At this point, the spot market has gone insane. Mining with my code isn't profitable over about $0.130/hour with the current exchange rates, and the market is at, um, $6/hour in some places. I hypothesize that people are typo'ing in their EC2 spot bids and typing $6 when they mean $0.6, because otherwise it's completely irrational: You can get a normal instance for $0.65/hour. Not that people are rational, but...

It also requires some care and feeding. The $17k isn't really free passive income. The pools go awry, the exchanges go awry, ... At larger scale, you could amortize all of that management time and automate the majority of it, but at a few bucks here and there it's simply not worth it.


As others have pointed out, this is not remotely passive.


With enough automation it could become passive. Then again with enough automation everything becomes passive.


The problem is with cryptocoins, the window of opportunity is always small, short, and never comes again- you have to find an entirely new window.

Much like with most forms of arbitrage, and exploitable patterns in the stock market. You discovery the opportunity, you make a little $$, and the hole quickly closes as everyone else capitalizes on it too.


I don't think it would, actually. Enough people are willing to mine for a loss and the difficulty rises with availability of cheap hardware that it never becomes profitable. OP only made a (slight) profit because they could temporarily make renting a miner cheaper than the payout. This was temporary and now the market is back to status quo.

Maybe OP could automatically run his miners when such situations arrive, but I think it's unlikely to net anything like $17k/yr.

Edit: sliverstorm described this way better than I could.


the difficulty rises with time


I've been mining on my AMD 290x for the past few days - I brought it for gaming, so I don't need to get a return on the hardware, and the heat generated is useful too - it keeps my apartment a little warmer. Looking at a profit of around $8 per day at current difficulty, which is a pretty cheap heating solution!


That's how I looked at it. Buy a nice graphics card for gaming, use it for gaming and computational experiments, and have it mine while idling to regulate the heat in my apartment for cheap, or even at a small profit.


Might kill the GPU faster than gaming alone, unfortunately[0].

[0]: http://yarchive.net/comp/linux/cpu_reliability.html


I just bought 3 290x cards for this purpose. Right now they pay for themselves in 2 months.


It's certainly more risky when you are buying hardware only to mine - although I guess that is bounded by the fact that even if FPGA or ASIC miners were to make it unprofitable, the GPUs are still valuable and you can sell them.


Yes, there is risk in buying dedicated hardware but the risk is quite reasonable. The R9 290x GPUs are brand new and in high demand. If for some reason the altcoin market collapses I can sell them close to their original cost.


Do you mine on linux with cgminer? I'm having terrible reliability issues. I have to restart cgminer every hour or else it crashes. Even with this measure, it crashed yesterday night and I sadly lost mining time :)


Why not write a script to get called by cron to check up on things?


"I" meant "cron". The system does this on its own, but it's still a cheap hack. I'd like the crashes to be more predictable, but maybe this is the best I'll ever do. I've spent enough time setting this up already, other things to do!


I wonder how many people have custom improved mining software and using it as a competitive advantage.


It's a good question. In the case of these nvidia cards, it doesn't seem worthwhile: If you're seriously mining for money and buying hardware, you're still better off buying the AMD GPUs. I don't know if there's similar room for improvement on the OpenCL mining code, but it seems like it gets more attention.


Maybe it's not worthwhile for Bitcoins or Litecoins, but how about the smaller altcoins for which a competitive advantage early on can have a big impact?


I'm currently doing this right now with 30 instances. I'm currently operating at about 7 MH/s. At current rates, it's not exactly "profitable", but I'm using up some AWS credit that I have. I don't intend to sell the LTC until it hits about 40 or maybe 50, but in any case, it's still all profit for me, other than the fact that I lose out on the AWS credit for other uses.

Edit: I'm also not paying $6/hr... That would be absurd. I'm not unprofitable by much.


Everyone is using $100 ec2 credits for coin mining, that's why everyone is overpaying for spot price at the moment


I have much more than $100. Hence why I'm even bothering.


I'd been doing my own research on viability of mining on Amazon, and I posed a question on the AWS forums asking how it's possible the spot prices could be going so high. There's instances going anywhere from 5-20 times their On-Demand prices. At this time, no one's answered it, so if anyone here knows, I'd love to hear why someone would pay $10.00 per hour for an instance they can get On-Demand for $2.40.


I don't know, but I can speculate with the best of them: Someone posted on a bitcoin forum that they were doing this, showing how they were bidding on spot prices etc. A bunch of people raced to get in on some free money ASAP, of whom a significant proportion neither did the expected value calculation nor realised that it was possible to rent at a flat rate! Crowd mentality, in other words.


One pricing strategy I've heard of goes like so:

No rational person would bid above the on demand price, so the spot price will never rise above the on demand price. Therefore if I bid just above the on demand price I'll never be outbid, and I won't have to deal with automating the switch from spot to on demand instances.

Needless to say, this logic is wrong.


Funny you should mention that. There was a blog post I had read where they were discussing an unfortunate AWS customer who bid $999.00/hour for Spot instances thinking it would protect their running servers from shutting down. Little did this person realize, Amazon - unlike eBay - doesn't just accept the next highest bid, they accept THE highest bid. They were running a Spot instance for an entire month at $999/hour. Ouch.


That's not true - the price you set is the max price you're willing to pay. If your price is higher than the current spot price, you pay the current spot price. The blog post author must be mistaken somehow.


What do you suppose is displayed when there are no spot instances available, because all resources are being used for on demand instances or there's some problem with the spot market system?


One guess, maybe the spot price is controlled by some sort of predictive algorithm, and the algorithm got totally confused by the recent load? It might not be the case that people are actually paying that price.


That's what I assumed, but if you look at the history, the prices have been trending like this for over a month now.


It's possible that someone has found a way to speed up scrypt. We could solve for a lower bound on what that speedup must be.


AWS is adding an upper limit to spot price bids of 4X the on-demand cost, as of December 20:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spo...

This may be in response to some of the crazy bids we've seen on the spot market since people started using it for mining.


"With the increase in scrypt coin prices, the load on the mining pools increased, and most began experiencing frequent outages."

He should have used p2pool.


That's what I've been using.


Is it just a quirk of the GPU architecture that Nvidia can't mine as well as AMD or it a problem with their cards?


AFAICT, it's a result of their internal architectural decisions vs. the structure of some of these crypto operations. The simplest example is that AMD offers a hardware bit rotate instruction and NVidia doesn't. (The newer compute_35 devices have a funnel shifter that gets halfway there, but it requires using a 64 bit op, which is still slower).

But beyond that, for scrypt, AMD has an internal architecture that encourages using a internal 4-wide vector ops (the key being that threads in a stream can diverge and the scheduler handles them, but the vector ops are strictly locked). This seems to give them an advantage in several "stupidly parallel" workloads that consist of basic operations in huge parallel, whereas Nvidia's architecture regains ground when the control flow/etc., becomes a bit more complicated. But calculating 64k SHA-2 or scrypt hashes in parallel doesn't stress the thread scheduler or divergence handling at all. Also, scrypt internally does well when you parallelize it into groups of 4 uint32's - that's actually the key optimization I added to my version of the miner. Which, again, maps quite nicely to AMD's preferred optimization path.


See "Why are AMD GPUs faster than Nvidia GPUs?": https://en.bitcoin.it/wiki/Why_a_GPU_mines_faster_than_a_CPU...

Source: I wrote the above wiki section. I am a developer who wrote a Bitcoin miner in assembly (ATI CAL IL) back in 2010.


Graphics and HPC are mostly floating point but SHA and scrypt are all integer, so it's kind of an accident that any GPU does well on them. AMD GPUs have a a rotate instruction that's worth a lot in SHA and tend to have better integer performance in general.


So this explains why spot prices have been through the roof the past few months!


Only on the g2 instances though, I believe.


the other high cpu and gpu instances too




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

Search: