Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/seans-diy-bitcoin-lottery/
Build your own lottery! Thingiverse Files: https://www.thingiverse.com/thing:2494568 Pi How-to: http://www.idlehandsproject.com/raspberry-pi-bitcoin-lottery/ Instructables: https://www.instructables.com/id/DIY-Bitcoin-Lottery-With-Raspberry-Pi/ Send me bitcoins if you want!
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.
For more information: https://www.bitcoinmining.com and https://www.weusecoins.com What is Bitcoin Mining? Have you ever wondered how Bitcoin is generated? This short video is an animated introduction to Bitcoin Mining. Credits: Voice – Chris Rice (www.ricevoice.com) Motion Graphics – Fabian Rühle (www.fabianruehle.de) Music/Sound Design – Christian Barth (www.akkord-arbeiter.de) Andrew Mottl (www.andrewmottl.com)
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!