Bitcoin php script

A few weeks ago, friends of mine were joking about my recent interests and how they don’t understand the point of them. I asked if they would like to hear more about the awesomeness of 8-bit videogame consoles or about the awesomeness of the bitcoin php script details behind bitcoin mining. One of them joked that they wanted to hear about how to mine bitcoins on an 8-bit game console.

A brilliantly useless project such as this cannot be ignored. While the all the buzz in bitcoin mining is about dedicated ASIC silicon, I was going take inspiration from the Mushroom Kingdom. A few late nights later, this is what I put together. While the challenge is to ‘mine bitcoins on an 8-bit game console’, lets break that down a bit. Bitcoin mining is a process of getting recent bitcoin transaction data from the global bitcoin p2p network, concatenating a random nonce value, SHA256 hashing it twice, checking to see if the resultant hash has a more than a particular number of leading zeros, and relaying positive results back out to the bitcoin network. I’m using bitcoind to do the network communication. This is pretty standard for bitcoin mining, the mining software focuses on doing the hashing and lets bitcoind do the p2p network stuff.

There’s a few standard protocols for those two pieces to communicate with varying levels of efficiency, but I’m using the most basic ‘getwork’ protocol because, heh, this isn’t going to be the bottleneck in this operation. For the portions of computing that do not happen on the NES, I’ve got a raspberry pi housed in a Makerbot Replicator2 3D printed case. I believe I am now fully 2013 Hack Project compliant. Raspian’s repos were serving some crusty version of arm bitcoind, so I compiled my own from the latest source. I’m sure there’s a more elegant cross-compilation environment available, but adding a 2GB swap and letting it crank all night worked for me. There are a couple pieces involved in getting data into the NES, many of which I’m just pasting together from other people’s code.