Inspiration

A lot of “random” numbers in software come from a formula and a seed. If you know the seed, you know every number it will ever give you. People have actually used this to cheat slot machines and break SSL keys and Bitcoin wallets. A qubit doesn’t have a seed, so we wanted to build something that shows that difference instead of just explaining it.

What it does

QuantumFair is a slot machine with two modes. In classical mode it uses a normal PRNG with a 4-digit seed, and you can replay the seed to get the exact same spin again. In quantum mode the bits come from measuring qubits with the Quantum Rings SDK, and replaying doesn’t work. There’s also an attacker. It sees half of your spin, tries all 10,000 seeds, and guesses the other half. It gets the classical one 100% right and the quantum one about 50% right, which is basically guessing. You can also move a slider to change the qubit’s angle and watch the randomness go away when there’s no superposition.

How we built it

We used Flask for the backend and plain HTML, CSS and JavaScript for the frontend. The quantum side puts each qubit through a Hadamard gate and measures it. The classical side uses Python’s random to create a "random" number using a seed. We split the work across four people and branches (classical, quantum, visualizer and deployment) and agreed on the API early so everything would fit together. The site is hosted on Vultr.

Challenges we ran into

None of us had worked with quantum computing before, so we had to learn how qubits, superposition, and measurement work, along with the math behind them. After that, we had to figure out how to build the mechanics in Python with the Quantum Rings SDK. Building the slot machine demo was also tricky, since we wanted every spin, replay, and attack on the page to match what the code actually does.

Accomplishments that we're proud of

We got a working live demo where you can actually watch the classical generator get cracked while the quantum one holds up. Along with a interactive website explain how everything works. we also were able to learn a lot about how quantum computing works and how we can apply it to the real world

What we learned

Passing randomness tests doesn’t mean something is safe. Our weak PRNG passes the NIST tests(randomness test) and still gets cracked instantly. We also learned how quantum computers work in practice, how to use the Quantum Rings SDK, and how to deploy a real server.

What's next for QuantumFair

Applying what we have created and learned to the real world whether that be in different areas like security, finance and quantum computing.

Built With

  • claud
  • quantumrings
  • vultr
Share this project:

Updates

Submission history