Explore quantum algorithms in your browser!
Create maximally entangled qubits and observe the mysterious quantum correlation!
A Bell state is one of four specific maximally entangled quantum states of two qubits. The most famous is called ฮฆ+ (Phi-plus), which we create in this experiment.
This notation means the two qubits exist in a superposition where they are simultaneously in states |00โฉ and |11โฉ with equal probability (50% each).
Entanglement is a quantum phenomenon where two or more particles become correlated in such a way that the quantum state of one particle cannot be described independently of the others, even when separated by large distances.
We create the Bell state using just two quantum gates:
After many measurements (shots), you should see:
Create qubits in multiple states simultaneously - quantum parallelism in action!
Superposition is one of the most fundamental principles in quantum mechanics. It means that a quantum system can exist in multiple states at the same time until it is measured.
For a single qubit, we can write its state as:
Where ฮฑ and ฮฒ are complex numbers (amplitudes) that determine the probability of measuring |0โฉ or |1โฉ. The probabilities are |ฮฑ|ยฒ and |ฮฒ|ยฒ, and they must sum to 1.
In this experiment, we create an equal superposition using the Hadamard gate:
This means: 50% probability of measuring 0, and 50% probability of measuring 1.
The real power comes when we have multiple qubits in superposition. With n qubits, we can represent 2n states simultaneously!
We apply the Hadamard gate (H) to each qubit:
After measurement, each of the 2n possible states should appear with approximately equal probability (1/2n or about 100/2n percent).
Try increasing the number of qubits and watch how the number of possible outcomes grows exponentially!
Search for an item with quantum speedup - demonstrating real quantum advantage!
Grover's algorithm, discovered by Lov Grover in 1996, is a quantum search algorithm that finds a specific item in an unsorted database. It provides a quadratic speedup over any classical algorithm.
See how the advantage grows with database size:
Imagine you have an unsorted database (like a phone book in random order) and you need to find one specific entry. Classically, you'd have to check entries one by one until you find it.
Grover's algorithm works through two main operations repeated in a loop:
A quantum circuit that "marks" the target item by flipping its phase. It doesn't tell us which item is the target, but it changes its quantum amplitude in a way we can exploit.
Where f(x) = 1 for the target item and 0 for all others.
This operation amplifies the amplitude of the marked item while reducing the amplitudes of all other items. It's like making the target "brighter" and the rest "dimmer" in the quantum superposition.
The optimal number of iterations is approximately ฯ/4 ร โN. Too few iterations and you won't find the target. Too many and the probability actually decreases!
The algorithm follows these steps:
After running the circuit, you should see the target item measured with very high probability (~90-100%), while all other items appear much less frequently.
The green bar in the chart highlights the target item you're searching for.
While โN speedup might not sound as impressive as the exponential speedups in some other quantum algorithms, it's actually provably optimal for unstructured search. No quantum algorithm can do better than Grover's!
Demonstrate how Grover's algorithm could theoretically attack hash functions!
A preimage attack on a hash function means finding an input that produces a specific hash output. This is "reversing" or "breaking" the hash.
Hash functions are designed to be one-way:
Grover's algorithm can speed up the search for preimages:
With a 2-bit hash, there are only 4 possible outputs (0, 1, 2, 3). Given target hash = 3:
Real SHA-256 has 256 bits of output:
Even with quantum speedup, 1038 operations is still:
| Hash Bits | Classical Tries | Grover Tries | Status |
|---|---|---|---|
| 2 | 2 | 1 | Trivial |
| 64 | 1018 | 4ร109 | Hard |
| 128 | 1037 | 1019 | Secure |
| 256 (SHA-256) | 1076 | 1038 | Very Secure |
This demonstration shows:
Analyze quantum threats to Bitcoin and see why addresses remain secure!
Private Key (256 bits, secret)
โ
[ECDSA Elliptic Curve Math]
โ
Public Key (512 bits, derived from private)
โ
[SHA-256 โ RIPEMD-160]
โ
Bitcoin Address (160 bits, public)
| Aspect | Grover's on Address | Shor's on Public Key |
|---|---|---|
| Target | Bitcoin Address (hash) | Public Key (ECDSA) |
| Speedup | Quadratic (โN) | Exponential |
| Security | 2^256 โ 2^128 (still secure) | ~2^128 โ BROKEN! |
| Qubits Needed | Billions | ~4,000 error-corrected |
| Threat Level | โ Low | โ CRITICAL |
| Key Size | Search Space | Qubits | Grover Iterations | Status |
|---|---|---|---|---|
| 4 bits | 16 | 4 | ~3 | โ TRIVIAL (this demo!) |
| 8 bits | 256 | 8 | ~12 | โ EASY (educational) |
| 16 bits | 65,536 | 16 | ~201 | โ ๏ธ POSSIBLE (2025 tech) |
| 32 bits | 4.3 billion | 32 | ~51,000 | โ ๏ธ THEORETICAL |
| 64 bits | 18 quintillion | 64 | ~3.4 billion | ๐ HARD |
| 128 bits | 3.4 ร 10ยณโธ | 128 | ~10ยนโน | ๐ QUANTUM SECURE |
| 256 bits | 1.16 ร 10โทโท | 256 | ~10ยณโธ | ๐ BITCOIN SECURE! |
Enter a Bitcoin address to analyze quantum attack feasibility (or use an example):
Find optimal multi-hop swap paths across decentralized exchanges using quantum optimization!
DeFi arbitrage is the practice of profiting from price differences across decentralized exchanges (DEXs). A trader might swap ETH โ USDC โ DAI โ WBTC โ ETH, ending with more ETH than they started with!
QAOA (Quantum Approximate Optimization Algorithm) is specifically designed for combinatorial optimization problems like finding the best arbitrage path.
Where H_C encodes profitability (Cost Hamiltonian) and H_M allows exploration (Mixer Hamiltonian)
| Institution | Application | Technology |
|---|---|---|
| BBVA (Bank) | Portfolio optimization | QAOA on AWS Braket |
| JPMorgan Chase | Portfolio risk analysis | Quantum annealing |
| Goldman Sachs | Options pricing | Quantum Monte Carlo |
| QAIT Platform | MEV & arbitrage optimization | D-Wave Advantage-2 |
Comparison: Bitcoin Breaking vs DeFi Optimization
| Problem Type | Bitcoin Breaking | DeFi Arbitrage |
|---|---|---|
| Problem Class | Unique search (needle in haystack) | โ Optimization (find best) |
| Quantum Algorithm | Grover's (limited speedup) | โ QAOA (polynomial advantage) |
| Qubits Needed | Millions (impractical) | โ 10-50 (available today!) |
| Works on Current Hardware? | โ No (needs FTQC ~2040) | โ Yes (working now!) |
| Real-World Use | โ Theoretical only | โ Banks using it today |
By 2028-2030, quantum-enhanced DeFi bots may:
Timeline Estimate: Quantum advantage for simple arbitrage is achievable with ~100 qubits (available by 2026). For complex multi-chain strategies, we'll need ~1000 qubits (estimated 2028-2030).
โน๏ธ Note: This demo uses mock DEX prices. In production, you'd fetch real-time prices from Uniswap, SushiSwap, Curve, etc.