Alex Waltz's "Quantum Random Number Generator" for Bitcoin Uses Radioactive Decay and a Raspberry Pi
Using an off-the-shelf radiation detector and some clever Python, Waltz has turned a broken smoke alarm into a bitcoin seed generator.
Cryptocurrency enthusiast Alex Waltz decided that the random numbers generated by his computer weren't reliable enough — so set about building his own quantum random number generator, powered by a Raspberry Pi 4 Model B.
"It uses radioactive decay to generate entropy for bitcoin seeds," Waltz explains of his gadget, which includes a small tin somewhat disconcertingly labelled with the radiation warning trefoil — but holding, thankfully, only a small sample of americium 241 take from an ionizing smoke detector.
"Entropy is what makes a bitcoin your bitcoin. Dices and [coin-tosses] are a good way to generate your own entropy, but they are not actually random. They are deterministic processes that are hard to measure. Is there anything random in the universe? Yes, radioactive decay."
The driving force behind Waltz's random number generator, then, is the decay of the americium — measured by a low-cost Geiger-Muller counter. Every time a particle hits the detecting tube, the sensor beeps. "Considering that the random part is the time between beeps," Waltz explains, "this is what we need for the entropy source.
"I connected the meter to the Pi and used the audio interface I use for my microphone to amplify this signal. I recorded them using Audacity. In order to get 1 bit of entropy, I take 4 particles and measure the time between p1 and p2 vs. p3 and p4. If the first time, T1 is bigger I add a 1 otherwise a 0. I f they are equal I ignore them."
"I wrote a Python script that does all of this for me and saves the processed data in a binary file," Waltz continues. "Then I wrote BIP39 implementation to use this random data and get a 24-word seed. I get around 6 particle decays / second -> 2.8 minutes for 1 BIP39 seed."
While a large sample of data taken from the generator proved random enough during testing, Waltz has warned of some potential bias. "At this moment I suspect my data is not the best and has some biases," he admits. "The Geiger tube has a dead time of ~150us [and] Audacity is losing data, as the Pi is too weak. [I] will correct this by running a VonNeumann [de-biasing] algorithm in the future."
More details on the project are available on Waltz's Twitter thread, and in this Reddit post.