23 Jun, 2011

BitCoin is a hip new currency using peer-to-peer networking to process transactions. You can either buy it from others, or mine it by solving math puzzles. Would it be possible to crowd source the mining process to visitors of your website?

~

### What’s BitCoin anyway?

BitCoin (BTC) is not distributed by a central bank, but is generated by its users. In order to mine BTC, your computer must solve math puzzles. When you solve the puzzle, you are awarded 50BTC. How difficult the puzzles are and how big the reward is, is all determined by the network itself - it cannot be influenced by a single entity or person.

So, let’s turn on that computer and start generating BitCoin! With a current exchange rate between $8 -$30 per BitCoin, gaining 50 BTC would be quite lucrative.

So, how long would it take to solve that math puzzle and score 50BTC, or $400 -$1500?

Given the current difficulty (how difficult is the puzzle to solve) of 877226 and a hash rate (the speed at which you’re trying to solve the puzzle) of 6 mHashes/s you can calculate how long it would take on average before you are rewarded 50BTC.

Using a calculator I can compute that with my current AMD Phenom II 1055T X6 (6 cores @ 2.8Ghz) it would take an average of about 20 years to generated those 50BTC. That’s 0.007 BTC a day, which translates to $0.056 -$0.21 a day. That doesn’t even cover the power bill for running your computer each day.

### Can we do better than a 6 core CPU?

Yes, we can! My system is also equipped with an ATI Radeon HD 6870 video card. I love playing games, you know ;-). The thing is, a video card is basically a very large and very fast calculator. It can perform simple operations, like the hashing required for BitCoin mining, very vast. It can do 1120 hashes at the same time. Yes, that is in parallel.

Where the CPU could do 6 mHashes/s my GPU can do about 270 mHashes/s. Yes, my GPU is about 45 times faster at calculating hashes than my CPU.

But, what does that mean for the time it takes to get those 50BTC? It will take 161.5 days on average. Yielding about $2.48 -$15.50 per day. That’s more like it! Still, not worth leaving your day job for.

It’s possible to rig up a machine that uses even faster video cards to squeeze more mHashes/s out of it. Also, a system is not even limited to one video card, you can add up to two or four in the same computer! Imagine having four ATI Radeon 6870’s. That’s a whopping 1080 mHashes/s.

### Team up!

It’s also possible to team up with others to mine BitCoin faster. It’s been done before and the most famous example would be Seti@Home.

Users run a program in the time their CPU is idle, contributing in the analysis of signals from space. If enough people contribute their spare CPU time, you’ll get the processing power of multiple time the fastest super-computer in the world.

Great, so let’s do that for BitCoin! In the BitCoin world these are called pools. You can join a pool and try to solve the math puzzle together. When that happens, every participant gets a proportional share of the 50BTC for their work done.

Imagine there are a hundred people with an ATI Radeon HD 6870 (thus doing equal amounts of work). This would result in 2.7 gHashes/s. 50 BTC would be mined in about 1 day and 14 hours. The result per day would be about the same as a single person mining on his own.

The big difference is that when mining in a pool you get BitCoins on your balance much faster. After just a day an a half you have 0.5 BTC sitting in your account, yours to spend. A single person would have to wait 162 days for that to happen.

### Use the Crowd, Luke!

Now, this got me thinking. What if you could harness the power of a thousands or hundreds of thousands of CPUs, even for a short period of time? How fast would mining be? Would it be profitable?

Then I noticed there is a website that offers a web miner. This is a Java applet that runs in the background of a web page. While a visitor is on your site, the applet will use spare CPU power from that users computer to generate hashes and effectively participate in a private pool.

I ran an experiment on Ariejan.net during june 2011. I have implemented the web miner and generated BitCoin for a month using my visitors as (mostly unknowingly) test subjects.

Ariejan.net gets between 55.000 - 65.000 page views each month. The average time per page is 40 seconds. This would yield me more than 700 hours of computing time each month.

Using the web miner I got between 60 and 100 mHashes/s for an entire month. Doing all the mining on my own it would take 1 year and 2 months to generate 50 BTC. That’s $0.75 -$2.84 per day on average.

Because that would be too long, I participated in another pool, contributing the immense power of my websites visitors. During june you generated 1.98 BTC. About $15.85 -$59.40 when exchanged right now.

In comparison, my ATI Radeon HD 6870 could have made between $75 and$280 in the same period of time.

This is a nice chunk in the monthly revenue stream generated by Ariejan.net, but it would not be enough to dedicate time on writing articles on a more regular basis.

Also, stealing a visitors CPU time is ethically debatable. Personally I think it would be okay to ask a visitor to opt-in. Running the miner secretly in the background as I did for this test would not be acceptable.

### Conclusion

If you’re in the business of mining BitCoin, crowd sourcing most likely is not an option for you. You probably don’t have a web site big enough to generate enough CPU power. Using commodity hardware would yield the same or better results.

I would be interested to see others continue this research. What would be the results:

• if you asked users to opt-in only
• if you asked users to opt-out only
• on a site with 1+ million visitors
• if a miner were integrated in a game or piece of software
• if Google put a JavaScript miner on google.com that performed only 10 hashes/view.

Got an opinion, feel free to leave it below.