Ethan and I happened upon this idea independently through completely different means. Coming to Hack the North, I had just uninstalled a sketchy bitcoin mining virus on my computer, and I was contemplating making my own bot-net. Ethan was inspired by Stanford's Folding@Home project, which sparked ideas in him about crowdsourced computing for a good cause. When we came together as a team, we knew we wanted to apply Bitcoin technology, and this idea for a distributed computing project for charitable causes came about.

What it does

Cryptocause uses WebWorkers to mine bitcoins inside of the browser without any miner install. This allows for both a more accessible way for individuals and charities to experiment with Bitcoin, but also for a larger potential pool of users contributing to the mining effort. These funds are funneled and held in Cryptocause's wallet through Coinbase, which we monitor with a Node backend to distribute a threshold of Bitcoin using Coinbase's API's to a charity selected from a database of charities with known Bitcoin addresses. Because Coinbase allows for users to receive Bitcoin without having created an address on the Bitcoin network, charities can also receive the funds by email notification, through which they can get paid directly to their bank account.

How we built it

The mining script uses HTTP long-polling and RPC on the server to connect to a decentralized, peer-to-peer mining pool that pays out to our Coinbase address. The script itself takes advantage of WebWorkers and multithreading to maximize the computing power we can derive from the browser. We then provided real-time analytics with Epoch, D3.js, and WebSockets connected to our Node backend to give neat insights into the hash rates of the client, the total clients connected, and the pool itself over time. Our stack is hosted on Linode, which also runs bitcoind and P2Pool to manage payouts and statistics. The Node itself is currently using Coinbase's sandbox development environment, but could easily be changed to production should our project attract enough visitors to generate a significant amount of Bitcoin.

Challenges we faced

One of our primary challenges was forking Hamiyoca, which provided a starting place for being able to mine Bitcoin from the browser. Being an unmaintained repository, we had to go through the repo and fix bugs in the backend that were related to now-deprecated browser technologies (we plan on submitting a good amount of pull requests in the near future). Another challenge we faced was finding an initial mining pool that supported an older mining protocol called getblocktemplate, as we did not have the time to implement Stratum-based browser mining during the 36 hours.

What's next for Cryptocause

For the future, we're planning on maximizing the efficiency of a browser-based Bitcoin miner with Chrome's Native Client in order to be able to tap into lower-level technologies like GPU shaders. We also want to find a better way to integrate charity payments so that we can reach both charities with and without bitcoin wallets.

+ 6 more
Share this project: