012 Secret Key With Qubits
SimulatorAlice and Bob build a shared key from qubits. Turn the eavesdropper on and watch the error rate jump to about 25%.
Simulator running in your browser. Real hardware: coming soon (planned provider: IBM Quantum).
What's happening?
Simulate BB84 quantum key distribution: Alice sends random qubits, Bob reads them in random ways, they keep the matching ones, and an eavesdropper switch shows the error rate jump to about 25%. Simulator only.
You will learn: How measuring a qubit disturbs it, and how that lets two people detect an eavesdropper.
The protocol
Alice picks a random bit and a random way (up-down, or sideways) for each qubit. An up-down qubit is Heads or Tails. A sideways qubit is the same bit written after a Spin the coin step. Bob reads each qubit in a random way: up-down means look straight away, sideways means Spin the coin first and then look. When his way matches Alice's he gets her bit. When it does not, his result is a fair coin flip. This is the BB84 protocol of Bennett and Brassard (1984).
Why an eavesdropper shows up
Eve has to read each qubit to learn the bit, and she does not know Alice's way. Half the time she guesses wrong, which disturbs the qubit. When Alice's and Bob's ways then match, Bob gets the wrong bit half of the time Eve guessed wrong, so about one quarter of the kept bits are wrong. With no eavesdropper and a perfect channel the error rate is about zero. This is the same measurement rule you saw in the coin flip: looking changes the qubit.
Honest notes
- It detects an eavesdropper, it does not stop one. If errors are high, Alice and Bob throw the key away.
- Real systems also need error correction and privacy amplification, an authenticated classical channel, special photon hardware, and either short distances or trusted relays. The error limit used in security proofs is roughly 11% (Shor and Preskill, 2000). This page uses a simple attack and a perfect channel.
- The NSA and UK NCSC prefer post-quantum cryptography to QKD for most uses. See QKD vs Post-Quantum Cryptography and Quantum Key Distribution (QKD) Explained vs Post-Quantum Cryptography.
- Nothing here protects QUANTUM (QNT) or a Solana wallet. Wallet keys are not exchanged this way, see Can a quantum computer break my wallet?.
Why quantum networks matter
A quantum network lets distant devices share quantum states, which is the basis for key distribution today and for linking quantum computers later. See Satellite QKD for what has been demonstrated.
Run on real hardware: coming soon. The planned provider is IBM Quantum. It is not connected yet. Every result on this page comes from a simulator running in your browser, not from a quantum computer.
How it works: the simulator keeps the exact quantum state of the qubits as a list of complex numbers, applies each gate to it, and draws random samples from the resulting probabilities. The random numbers are ordinary pseudo random numbers from your browser, and a real device would add noise. No QNT, wallet or account is needed.
Sources
- Shor and Preskill (2000): Simple proof of security of the BB84 quantum key distribution protocol (arXiv:quant-ph/0003004)
- Wikipedia: BB84
This is an educational simulator, not financial advice. QUANTUM (QNT) is an independent community token on Solana and does not perform quantum computation.