Sean’s DIY Bitcoin Lottery with a Raspberry Pi
After several explorations into the world of 3D printing, and fresh off the back of his $5 fidget spinner crowd funding campaign, Sean Hodgins brings us his latest project: a DIY Bitcoin Lottery!
What is Bitcoin mining?
According to the internet, Bitcoin mining is:
[A] record-keeping service. Miners keep the blockchain consistent, complete, and unalterable by repeatedly verifying and collecting newly broadcast transactions into a new group of transactions called a block. Each block contains a cryptographic hash of the previous block, using the SHA-256 hashing algorithm, which links it to the previous block, thus giving the blockchain its name.
If that makes no sense to you, welcome to the club. So here’s a handy video which explains it better.
Okay, now I get it.
Sean’s Bitcoin Lottery
As a retired Bitcoin miner, Sean understands how the system works and what is required for mining. And since news sources report that Bitcoin is currently valued at around $4000, Sean decided to use a Raspberry Pi to bring to life an idea he’d been thinking about for a little while.
He fitted the Raspberry Pi into a 3D-printed body, together with a small fan, a strip of NeoPixels, and a Block Eruptor ASIC which is the dedicated mining hardware. The Pi runs a Python script compatible with CGMiner, a mining software that needs far more explanation than I can offer in this short blog post.
The Neopixels take the first 6 characters of the 64-character-long number of the current block, and interpret it as a hex colour code. In this way, the block’s data is converted into colour, which, when you think about it, is kind of beautiful.
The device moves on to trying to solve a new block every 20 minutes. When it does, the NeoPixel LEDs play a flashing ‘Win’ or ‘Lose’ animation to let you know whether you were the one to solve the previous block.
Sean has done the maths to calculate the power consumption of the device. He says that the annual cost of running his Bitcoin Lottery is roughly what you would pay for two lottery scratch cards. Now, the odds of solving a block are much lower than those of buying a winning scratch card. However, since the mining device moves on to a new block every 20 minutes, the odds of being a winner with Bitcoin using Sean’s build are actually better than those of winning the lottery.
But even if you don’t win, Sean’s project is a fun experiment in Bitcoin mining and creating colour through code. And if you want to make your own, you can download the 3D-files here, find the code here, and view the step-by-step guide here on Instructables.
Good luck and happy mining!
Cool project and really nicely made. What’s the value in solving a block? How much is it worth financially? For a strictly fair comparison it should factor in return too and not just the likelihood of it occurring.
Hey, a block is 12.5 BTC. 1 x BTC is approx $6000. A block is worth $75k!
Reading this, I’ve just come up with a sure-fire way to make money from Bitcoin mining with a Pi.
Take Sean’s design, add a 2ft lever with hand grip, and make it coin operated (i.e. a Bitcoin One-Arm Bandit).
For just 50p a go, punters get the chance to win a Bitcoin while having the pleasure of watching the display flash for a full 20minutes!
I’d design it so you submit a coin and your public bitcoin address (via QR code reader or NFC tap, perhaps?). When the Pi solves a block, the bitcoin gets deposited to the most recently submitted address, so it’s a sort of race to be the most recent person.
Or, perhaps, include a screen displaying the three most recent submissions, and reward a half a bitcoin to the most recent person, a third to the person previous, and a sixth to the person before that (and perhaps encouraging a person to submit multiple coins to be eligible for multiple reward positions).
Sooo….any chance you can share the code? I’m a terrible programmer.
There’s a link to the code above.
So how has your bit mining winnings done after a year of running?
I second that question @ OP. How much have you made from mining on a Pi?
Running in a pool, it’s apparently around $0.20-$1.70 per year i believe. That’s why it’s now only worth mining smaller currencies.
Any recommended Block Erupter to use that is low cost?