solana-qsim
Status: On devnet · open source · Group: Quantum infrastructure
Quantum circuits, simulated inside a Solana program.
A Solana program can't trust a quantum computer's result: a relayer just posts some numbers. solana-qsim lets the program run the same small circuit itself, exactly, and score the QPU's result against it.
| Qubits in one transaction | Qubits across transactions | Score a real GHZ-5 result |
|---|---|---|
| 11 | 20 | 26k CU |
What it is: a deterministic simulator built for Solana
- Fixed-point state vector.
no_std, no floats, deterministic. Amplitudes are Q1.30 complex numbers, 8 bytes each; rounding is about 2⁻³⁰, far below QPU noise. - The common OpenQASM gates. H, X, Y, Z, S, S†, T, T†, √X, RX, RY, RZ, phase and U; CX, CZ, SWAP, controlled phase and Toffoli. Angles are exact fractions of a turn.
- Scores QPU counts. Hellinger fidelity (what Qiskit reports), total variation distance and linear cross-entropy (XEB) against the ideal distribution.
- Bound to the receipt.
simulate_receiptfirst checks that the circuit hash and the counts hash equal the bb84 proof receipt's, then scores them.
Real QPU: Rigetti GHZ-5, scored on-chain
A five-qubit GHZ circuit, 1,024 shots on Rigetti Cepheus-1-108Q through Amazon Braket. The bb84 proof receipt was recorded, then simulate_receipt checked and scored the counts on devnet. Forged "better" counts were rejected on-chain (ResultMismatch).
| Counts | Fidelity | XEB |
|---|---|---|
| Ideal GHZ-5 | 1.00 | 15.0 |
| Rigetti Cepheus-1-108Q | 0.70 | 10.2 |
| Noisy local simulation (2% bit flips) | 0.89 | 13.3 |
| Random noise posing as a result | 0.07 | 0.1 |
Measured: one transaction, state on the heap
| Circuit | Qubits | Compute (CU) |
|---|---|---|
| Bell pair + score | 2 | 5,226 |
| GHZ | 8 | 23,228 |
| GHZ | 11 | 151,162 |
| Random layers, 92 gates | 8 | 818,445 |
Larger circuits keep the state in an account and spread gates over many transactions, with every gate hash-chained on-chain. Scoring a 20-qubit state takes 4,882 CU.
Why it matters
- Catch bad results. For small circuits a program can reject a result that doesn't fit: a lazy oracle, a simulator labelled "QPU", or a broken device.
- Powers the Gateway. The Quantum Gateway releases payment only when qsim's checks pass.
- Next experiments. Noise fingerprints per vendor, Solana-challenged random circuits, Bell and GHZ games, and a CPI helper for other programs.
Honest limits: what it does and doesn't prove
- A classical simulator is classical: anything Solana can simulate, a laptop can too. qsim checks small QPU results; it doesn't prove quantum advantage.
- Cost grows as 2ⁿ: about 11 qubits fit in one transaction, and 20 qubits across transactions with the state in an account.
- It proves the counts belong to the circuit and the receipt, not that they came from quantum hardware.
qsim is a classical check of quantum results. It is not quantum computing on Solana.
Program
| Program | Instructions | Devnet address | Mainnet address |
|---|---|---|---|
qsim | simulate, simulate_receipt, init_state, apply, apply_range, score | 6sHufVFfaMwxPuDKxBuV8qZqNot8bJNgtFKhZKXHdhSw | {{MAINNET_QSIM_ADDRESS}} |
Source: https://github.com/bb84sh/solana-qsim
Related
Updated about 1 hour ago
