Pages

Sunday, June 30, 2013



How a total n00b mined $700 in bitcoins

We take a Butterfly Labs Bitcoin miner, plug it in, and make it (virtually) rain.




Aurich Lawson

This is the second in a two-part series exploring Butterfly Labs and its lineup of dedicated Bitcoin-mining hardware. In part one, we looked at the company and the experiences customers have had with it. In part two, we share our experiences running a Bitcoin miner for a couple weeks.


There is a whirring, whining presence in my dining room. I notice it every time I walk through. Every day, it sucks down about one full kilowatt-hour of electricity. In a year, it will consume almost $100 worth of juice—and that's on top of the $274 it costs to buy the box in the first place. Oh, and it's hot, too. If I moved it into my office and could stand the noise, I could keep a cup of coffee comfortably warm on top of the thing. Why on earth would anyone want such a disagreeable little machine in their home?
The short answer: every day, that machine magically generates something like $20 in bitcoins.

The BFL miner: A video intro



Allow me to introduce you to the Butterfly Labs 5GH/s "Jalapeño" Bitcoin miner.

A newbie and his miner

Ars Senior Business Editor Cyrus Farivar tapped me on the shoulder a few weeks back with a proposition. "I've got a Butterfly Labs Bitcoin mining box," he explained. "There aren't that many in the wild right now. I'm working on a story about the company, but I'm about to go on vacation. Do you want to see if you can get the thing working while I'm out?"
I was intrigued. Bitcoin? That's the electronic currency that's quickly rocketed from lame nerd project to ludicrously valuable hot topic, right? I didn't know a lot about the world of Bitcoin other than the fact that "mining" them involved people building custom PCs with tons of video cards to handle the math. I certainly didn't know how to "mine" bitcoins myself or what to do with the things once I had them. I just knew that people eventually try to trade them in for cash somehow (but how to do that was also a total mystery).
And yet here was the opportunity to take a piece of hardware I'd never heard of and see if I could use it to magically create some money out of nowhere. I told Cyrus to send me the Butterfly Labs miner. As he trekked off to Peru for his vacation, I settled in with the little black box.
Butterfly Labs is a company that has drawn a fair amount of controversy for what the Bitcoin community at large perceives as a string of broken promises. The company sells ASIC-based Bitcoin miners—machines that are built around customized chips that do nothing except compute SHA-256 hashes very quickly. Its smallest miner (the one I had to get working) is codenamed "Jalapeño" and computes a bit over five billion hashes per second (or 5GH/s). The problem is that Butterfly Labs started selling the machines long before it actually had a product to sell. It began taking paid-in-full preorders back in mid-2012, and thousands of customers opened their wallets for Bitcoin miners ranging from the small 5GH/s miner at $274 all the way up to the large 500Gh/s miner, which costs $22,484.
Butterfly Labs promised certain performance targets to customers—it initially felt confident that its application-specific integrated circuit (ASIC) designs would deliver one billion hashes per second for every 1.1 watt of power consumed. This proved extremely optimistic. Hardware delivery slipped multiple times. Now, a full year later, the first few real live Butterfly Labs boxes are finally being shipped, though no small number (as many as 30) were sent to journalists to review rather than to paying customers.
B ut when the little black box showed up on my doorstep, I had no idea about the deep and extremely vocal Bitcoin community or the story behind Butterfly Labs. I didn't really even fully understand what the miner did. I simply knew that I wanted to get this thing working and make some money.

Out of the box

The 5GH/s Jalapeño miner is a black rounded cube with a brushed metal finish. The only connectors on the exterior of the device are on the back: a mini-USB port for data and a power plug. Near the power plug are a series of small red LEDs that the device uses to tell you its status, though there was no documentation in the box to explain what the LEDs meant. The front of the cube contains another red LED to indicate power.
There are two sets of vents, one low on the front and the other high on the rear. The device's internal 80 mm fan draws cooler air up from the front through the fins of the large heat sink mounted on the ASIC chip. It expels the now-warm air out through the top vents.
After I unboxed the thing and took some photos, I was sort of stuck. I had no idea what to do with the little rounded-off cube.
Before I consulted the Internet for documentation, I tried briefly—and in vain—to see if I could make it work on my own. "I am a geek, and I work at Ars Technica, which is a major technology website of some renown," I thought. "I have built Web servers. I use, like, Linux and stuff. How hard can this really be?"
Too hard, apparently. Connecting it via USB to any of the computers I had handy didn't really cause anything to happen. The device showed up on the USB bus and identified itself, but it didn't do anything. I naively wondered if there was some kind of application I needed to download to "log on" to the device to get it mining.


Enlarge / When connected via USB, the miner shows up as a "BitFORCE SHA256 SC," which is the ASIC identifier.
Lee Hutchinson
I admitted defeat and consulted the Internet. Unfortunately, as I was to quickly learn, I was coming at the miner with a certain set of false assumptions. The BFL miner is a pretty simple device; it doesn't have an "interface" or a console or anything like that at all. It talks via serial-over-USB, and you do need an application running on your computer to actually do anything with it.
In fact, you need several things: a mining application, a "wallet," and a "pool," though the pool is optional.


The prerequisites

The first thing I needed to do was to set up a wallet, or a place to keep my bitcoins. A wallet lets you engage in Bitcoin transactions—it lets you create Bitcoin addresses you can share and that people can send money to. In addition to being able to send and receive bitcoins to and from other Bitcoin users, you need a wallet so that you've got somewhere to keep the bitcoins you generate through mining. I wound up creating my wallet at Blockchain.info, though there are many alternatives.
Once you've got a wallet, you really ought to join a mining pool because Bitcoin mining is best done with shared labor. Nothing at all forbids you from striking out on your own, but the nature of the entire virtual currency system is such that by sharing the work required for "discovering" the currency, you share in the reward as well.
Understanding how bitcoins are brought into being requires understanding the network behind the currency. Briefly, the entire record of every Bitcoin transaction ever made stretching back to the currency's beginning is public. This is called the block chain. Bitcoin mining involves confirming those transactions by collecting several of them together into a group called a block and running specific cryptographic functions on it. The chain concept comes into play because every time a bitcoin is "spent," the spender appends a hash to the bitcoin derived from his or her own cryptographic private key, the previous transaction's hash, and the recipient's cryptographic public key. As each bit of data added to Bitcoin's history of transactions is cryptographically derived from previous data, altering earlier data would invalidate the entire chain.
When a collected block of transactions is confirmed by a Bitcoin miner—that is, when the SHA-256 hashing that the miners are doing on a transaction results in a very specific value that starts with a number of zeros—the block is said to have been "mined." The winning miner is allowed to reward itself with some number of bitcoins. That number is currently 25, and it decreases by 50 percent in intervals over time.
If you're mining in a pool, you split the reward with the other members of your pool based on the pool's specific rules. If you're mining by yourself, you keep the entire payout. The issue with mining by oneself is that it's very likely to take you much, much longer to confirm a block than it would with an entire pool's resources. Joining a pool is the way to faster payouts of bitcoins.

Mining!

Because I can never do anything the easy way, I wasn't content with getting the BFL box working under Windows, which is a well-documented and fairly straightforward process. No, I wanted to make it work under OS X. That required a bit of help.
I spent quite a bit of time talking with John O'Mara, creator of the MacMiner application for mining bitcoins on a Mac. MacMiner is a FOSS GUI wrapper that uses another FOSS application, bfgminer, to tell the mining hardware (be it video cards or separate ASIC-based boxes) what to do. In the end, the solution involved a lot of work on John's part and not really that much on mine, except for me running commands and reporting back their results.
Because Butterfly Labs miners are still relatively scarce in the wild, John didn't have one to test with. Still, using me as a (dumb) remote manipulator, we eventually got the BFL box correctly hooked up and mining. The release version of MacMiner supports the Butterfly Labs ASIC miners now, but since I had gotten it working first on the command line, that's what I stuck with.
In fact, once it worked, it was a little anticlimactic. I typed in the command and the bash prompt to kick the miner off. Rather than spitting out an error like it had been doing, the screen lit up in a deliciously cryptic display.


We are now mining. There are numbers happening.
Lee Hutchinson
Numbers. Lots of numbers everywhere. I stared at it for long seconds, watching the updates crawl upward from the bottom of the screen. Am I actually mining? I wondered. Is money happening? I envisioned my little MacBook Air lighting up like a slot machine if I found an actual block. Would sirens go off? Would money shoot out?
I quickly shared a screenshot with the rest of the Ars team in IRC. "IS THIS GOOD?!" I asked. No one really knew.
I kept staring at the numbers, not yet willing to glance at bfgminer's documentation to see what they meant. All I knew is that there were lots of counters and things on my screen, and I wanted them to be higher. I had a sudden flashback to my first job out of college in 2000, when I dragged 20 unused Pentium II PCs into a corner and rigged them all up with the SETI@Home client and briefly became an ET-searching superstar.

Performance, noise, heat

The BFL miner does precisely one thing: compute SHA-256 hashes as fast as it can. So from a benchmarking perspective, the main question to answer is whether or not it hits its rated target of five billion hashes per second.
When hashing, the BFL miner actually hovers at between 5.4-5.6GH/sec, delivering a bit more than its rated amount of hashes per second. The device pulled about 30 watts of power when idle and 50 watts of power when actively hashing. It reported internal temperatures as high as 80C.
Some back-of-the-napkin math based on my Kill-a-Watt meter's readings show that the device would consume a bit under $100 per year in electricity. However, at current Bitcoin mining difficulty levels, it produces about 0.1 BTC about every 12 hours. It's impossible to speculate on BTC-to-dollar rates in the future since they're so volatile. But at the exchange rates that were current as I was piecing this article together, the miner had repaid its purchase price within ten days. If the value and difficulty of BTC holds, an ASIC-based miner like this could generate thousands of dollars of revenue per year.

Cashing out

After a couple of days tinkering with the box to actually get it mining, it was kind of a letdown. The box made noise and consumed a bit of electricity; every 12 hours or so I would get a notice in e-mail from Blockchain.info, letting me know that another ~0.1BTC had been deposited into my account thanks to the combined efforts of me and the rest of the pool I'd joined. It definitely worked. It was not a scam. It was a legitimate 5GH/s miner.
The Ars editorial team had resolved even before I plugged in the device that we'd be donating any monies it generated to the EFF. So after I'd gotten a representative sample of bitcoins, I was ready to stop and donate. However, there was still one major aspect of Bitcoin mining that wasn't terribly clear to me. How, exactly, does one cash out?
Before I donated the fruits of the miner's labor, I resolved to actually take the bitcoin generation through to the end I'd been wondering about. At this point, which was the last week in May, the little BFL box had generated precisely 2.90220929 BTC. I would take those bitcoins and turn them into cold, hard cash.
I quickly learned that transforming BTC into USD wasn't a single-step process. There's no "cash out" button; rather, you must either arrange a transaction yourself with a private party or sell your BTC through an exchange. I started with the list of exchanges on the Bitcoin wiki to get a feel for my options.
The most famous exchange is MtGox, but looking at its options for withdrawing funds quickly turned me away. Most exchanges allow you to sell your BTC for US dollars, but few provide a way to retrieve your dollars that I felt comfortable using. Many allow you to transfer dollars to a PayPal account, but I don't use PayPal. Others let you pull money directly into a personal checking account via ACH or wire transfer, but I wasn't willing to share my bank account details or open a new throwaway checking account. Some exchanges, including MtGox, allow you to withdraw dollars using Dwolla (no thanks) or Liberty Reserve (too late).
Finally, a little way down the list, I noticed one exchange with the option to withdraw funds in the form of USPS money orders: Camp BX.
I popped over to its site and established an account, then I generated an address to receive the bitcoins. Back over at my Blockchain.info wallet, I clicked the "Send Money" option, entered the address I'd generated for my Camp BX account, selected my entire store of 2.90220929 bitcoins, and hit "Send Payment."
The transaction went through. I'd just created some work for the legions of other Bitcoin miners to verify. Several minutes later, the balance showed up in my Camp BX account. Somewhere else, a new block of 25 bitcoins was awarded and spread around as incentive for helping validate my transaction. The cycle continued.
I was far more concerned at this point with actually getting some money out of the infernal machine. Without being too terribly sure what I was doing, I clicked "TRADE NOW" and then initiated a "Quick Sell" order. The ticker at the top of the screen informed me that the current bid price for bitcoins was $129.52 per, and it recommended that I sell my BTC at that rate. So I gamely typed in my maximum amount of BTC, entered the suggested rate of $129.52, and previewed the order.


Enlarge / Is money happening? I think money is about to be happening.
"You are about to execute a Quick Sell order," the site informed me, showing me the details I'd entered on the previous screen. Feeling every bit the Internet tycoon, I clicked "EXECUTE SELL."
The next screen informed me that my sell order had gone through immediately. Camp BX kept a bit over $2 in commission, and I suddenly had $374 in my Camp BX account.


Enlarge / Money has kind of happened! I think I just got paid... somehow!
Next, I clicked "TRANSFER" and initiated the withdrawal process. There's a $20 fee for pulling out funds in the form of a USPS money order, as well as a maximum daily withdrawal of $1,000. I didn't mind giving up $20 of what was essentially free money anyway if it meant I didn't have to give out my checking account information. I punched in my information and requested the withdrawal.


Enlarge / Wait. OK, money hasn't happened yet. I mean, it has—sort of. Now I just need to get the money to me.
A few days later, I received a hand-addressed envelope via certified mail. Inside, sure enough, was a hand-written USPS money order for $354.00 from "BulBul Investments LLC." I drove it down to my credit union, and they cashed it without complaint.


Enlarge / You guys. We are so close to having turned bitcoins into actual real money.
Lee Hutchinson
After a quick trip to the bank, you can call me THE RAINMAKER.
Lee Hutchinson
I had done it. I had legitimately mined bitcoins and transmuted raw electricity into dollars, through the power of mathematics. Truly, my skill knew no bounds!
But the story doesn't quite end there.

Catastrophe!

You might wonder, dear reader, why I stopped at 2.90220929 bitcoins. It's rather an odd number. Why not three? Why not four or five?
After I filmed the video at the beginning of this piece, I resituated the little BFL miner back into its corner of the dining room to resume its work while I edited. As I walked away, I heard the whirring of the BFL miner take on a decidedly angry tone. I approached it and knelt, thinking that the fan bearing might have started to go bad, because that's certainly what it sounded like. I tapped with one finger on the top of the device.
"RRRRRRRRRRRRRRRRRR—WHOCK," it said, before going totally silent.
I pulled the power cord and disassembled the machine to take a peek. One of the fan blades had snapped off, catching itself in the aluminum fins of the heat sink.


Enlarge / Ruh-roh, Shaggy.
Lee Hutchinson
Clearly, the BFL 5GH/s miner's mining days were done—and at an odd number of BTC mined, too.

A new challenger appears

I contacted Butterfly Labs and let them know that the fan had broken, and they immediately offered to send a replacement miner. At first I demurred, but on reflection I decided to take them up on their offer. The power numbers mentioned in my initial quick post didn't jive with the numbers of some other BFL miners in the wild. I was curious to see if a replacement unit's stats would vary that much. Plus, with one BLF miner down after only two weeks of mining, I wanted a second sample. Was there a quality issue? Or did I just happen to get one with a bad fan?
Butterfly Labs quickly shipped the replacement, and the very next morning a friendly FedEx driver dropped it off at my front door. Superficially, it looked identical, but on plugging it in I was quite surprised at the difference.
I noticed immediately that the noise was lower; I didn't measure the decibel level of either box scientifically, but to my ear the new one was markedly quieter than the old. Power consumption was also far lower. While crunching numbers, the new box drew just 30 watts—roughly the same amount of power that the first miner drew while idling.
The reduced amount of power consumed was reflected in the temperatures too. After being left to run all night, the thermal sensor reported about 37C—about half of the first box's temperatures under load.
Half the noise, half the heat, and almost half the power draw? What was going on in that little box?
I reached out to Jeff Ownby of Butterfly Labs and asked about the variances. "The [ASIC] chips each have a potential of 4.2GH/s," he explained. "So the theoretical max of a Jalapeño with two chips is 8.4GH/s. However, we use the lower graded chips in the Jalapeño and the higher grade chips in our other products, so the maximum performance in a Jalapeño is something less, which is what you're seeing."
Butterfly Labs has its share of troubles with its ASIC suppliers—in fact, most of the long delay between preorder taking and delivery appear to be related directly or indirectly to the actual design and manufacturing of the ASIC itself. These problems appear to have been somewhat solved and the company is actually shipping miners. It seems that all efforts are going to filling the 5GH/s Jalapeño orders first. The second unit I got was apparently a higher-graded chip that might have been fit for duty in a higher-spec miner (though in an e-mail sent after I'd turned in my first draft of this piece, Jeff Ownby let me know that Butterfly Labs is now shipping models other than the low-end Jalapeño).
Obvious question: if there's headroom, can I overclock the miner? I dashed off another e-mail to the Butterfly Labs folks. "We'd prefer to leave the question of overclocking officially unanswered, but we don't mind you throwing that possibility out there for curious minds."
Aha. Unfortunately, I wouldn't even know where to begin. The miner accepts commands via serial-over-USB, and I don't know if it's possible to pass it any commands over that interface to alter its clock speed. I don't have a command reference for Butterfly Labs' ASIC, so reverse-engineering is a difficult prospect. It's entirely possible, if Butterfly Labs is doing voltage regulation and clock speed multiplication in the software, that there might be some magic commands you could issue to up the juice to a cool-running miner.
Speaking of reverse-engineering, there's also this:


Enlarge / If you've got the tools and the talent, there's a JTAG here that you can go crazy with.
Lee Hutchinson
There's a JTAG connector clearly visible. I don't have the equipment to actually utilize the connector, but in a group as technically minded as the Bitcoin mining community, I'm sure there will be someone out there who will be poking at the miner through this interface to see what they can learn (if it hasn't already been done).
Additionally, Butterfly Labs has published the source code for their board firmware programming tools in a Github repo. "This code has the mining logic and directs the nonces to the appropriate engine and collects the results and sends them back out to the world," explained Ownby when I asked him what was contained in the files. Developers with an interest in seeing what the Butterfly Labs miner can do and in possibly extending its capabilities can use this code as a starting place.

The final tallies

In the end, the two miners together consumed a total of 28.30 kWh of electricity. According to my latest utility bill, I'm paying $0.13 per kWh, so my Bitcoin mining experiment cost me $3.68 in real electricity (without accounting for taxes and fees and whatever else the power company pads my bill with). The tally is obviously complicated by the two different miners consuming different amounts of juice. Even at the higher electricity rate of the first miner, it's clear that—at current exchange rates and difficulty—Bitcoin mining with one of these boxes is a profitable endeavor.
In fact, if it's so profitable, why on earth is Butterfly Labs selling these devices? Why not rent a warehouse, fill it with miners, and make infinity bitcoins?
The answer is two-fold. First, BFL required a great deal of capital in order to design and manufacture the ASICs that power its boxes and then to assemble the miners themselves. This capital was provided in no small part by pre-selling the miners; hanging onto them to do some BTC mining with them is sketchy at best and at worst illegal. Plus, there are practical considerations: a giant BTC warehouse adds overhead costs, and I can't even begin to take a guess at the bookkeeping implications of warehousing capital like that.
However, the second reason is far more practical: bitcoins, for all their current value, are still speculative. A large amount of US dollars is a large amount of US dollars no matter which way you cut it. It can be readily exchanged for goods and services. Bitcoins themselves don't necessarily hold value, and it's difficult to exchange them in large quantities for an equivalent amount of dollars. So selling Bitcoin miners for dollars guarantees a certain number of dollars; investing capital into mining a truly large number of bitcoins might work well as a short-term hedge, but the value of the trade is utterly impossible to predict.
This, I suppose, is part of the nature of high-risk investments. But in this case, Butterfly Labs can simply charge whatever it wants for its gear in order to make whatever margin it deems is sufficient. Why bet on the future of a relatively new virtual currency that may go up or down when you can simply get a bunch of real US dollars?
Obviously, the value of those US dollars may—will!—also go up and down, but it's also extremely easy to extract value from a dollar. I can't—at least yet—pay my mortgage in BTC, or buy a car in BTC, or really even buy everyday necessities (I don't live anywhere near any random merchants who have decided to begin accepting BTC). A dollar, at least today, has far greater utility and far greater immediate value.

Bitcoin’s not for me—but it might be for you

I ran the replacement miner for an equal amount of time as the first one ran before breaking; it held up without complaints and churned out an additional three bitcoins. Both our cash from the first miner and our bitcoins from the second have been turned over to the EFF, and our second Butterfly Labs miner has been returned to its manufacturer. I am once again a normal person who traffics in normal-person money. I'd actually gotten used to walking past the dining room in the morning and hearing the whirrrrrr of the miner in the corner, and now the house seems weirdly quiet.
The biggest takeaway from my time working with the Butterfly Labs "Jalapeño" miner is that you don't really have to know a damn thing about how bitcoins work to mine them. As complex as the underlying cryptography is to a layman like me, the only reason why I couldn't pull this thing out of the box and start mining after reading a couple of wiki articles was that I wanted to get it working on OS X. John O'Mara's help was priceless, and once we had the application side figured out, it was smooth sailing.
So should you don your prospecting gear, buy a Butterfly Labs miner this very instant, and start making money? You could, but there are a couple of issues. The first is that Butterfly Labs has only recently started shipping products, and its first priority is to its year-long backlog of preorder customers. If you're buying a unit today, you're going to be way, way down the list. There are tons of other high-speed ASIC-based miners, though—sites like The Genesis Block keep tabs on what's available and what's worth buying.
The other issue is a bit sticker: the Bitcoin system adjusts its overall difficulty as mining speed increases in an attempt to limit the speed of Bitcoin production. A few years ago, a 5GH/s miner like the Jalapeño would have produced a veritable torrent of bitcoins in a day; a few years from now, specialized hardware will be required to mine even tiny fractions of BTC.
If you're going to buy an ASIC-based miner, it might be best to get one, as they say, while the gettin' is still good.

No comments:

Post a Comment