Qnect š
Quantum computing in Rust: from Bell pairs to distributed quantum networks.
No config files. No magic. Just quantum.
Build quantum circuits, simulate massive systems, and create quantum networks - all with one powerful framework:
- š§® Quantum circuits (2 to 5000+ qubits)
- š Distributed quantum networks (multi-hop entanglement, teleportation)
- š Research-grade protocols (anonymous transmission, blind quantum computing)
- āļø Hardware-ready integration (NetQASM, MockQnpu, QASM import/export)
use ;
use ;
// Start simple...
let mut q = create.with_qubits.build?;
q.h.await?;
q.cnot.await?;
// ...or scale to 5000 qubits?
let mut q = create
.with_backend
.with_qubits
.build?;
// ...or build quantum networks!
let mut network = new_distributed;
network.add_node;
network.add_node;
// ...or use quantum hubs for routing!
let mut network = new
.with_topology
.add_hub
.add_endpoint
.add_endpoint
.build?;
// Distribute entanglement through the hub
let = network
.create_epr_pair_through_hub
.await?;
Features
- š Fast - 100,000 gates/second in pure Rust
- š Scalable - Same API from 2 to 5000+ qubits
- š Networked - Multi-hop entanglement, hub-based routing, NetQASM generation
- š¬ Research-grade - Anonymous protocols, blind computation, verified physics
- šÆ Zero config - No setup files, just
cargo run - š Realistic noise - Depolarizing and measurement errors for accurate simulation
Installation
[]
= "0.3.0"
= { = "1", = ["full"] }
Quick Start
Your First Bell Pair (The Quantum Hello World!)
use create;
async
Try It Now
# See quantum mechanics in action
Key Examples
Quantum Teleportation
use create;
use PI;
let mut q = create.with_qubits.build?;
// Alice's qubit to teleport
q.ry.await?;
// Shared Bell pair
q.h.await?;
q.cnot.await?;
// Teleportation protocol
q.cnot.await?;
q.h.await?;
let = ;
// Bob's corrections
if m1 == 1
if m0 == 1
// State transferred to qubit 2!
Scale to 5000 Qubits
use ;
// Switch backends, same API
let mut q = create
.with_backend
.with_qubits
.build?;
// Create massive GHZ state
q.h.await?;
for i in 1..5000
// |00000...ā© + |11111...ā© with only 12MB RAM!
Quantum Networks with Hub Routing
use ;
// Build a quantum data center in 3 lines
let mut network = new
.with_topology
.add_hub
.add_endpoint
.add_endpoint
.build?;
// Servers can share entanglement through the hub
let = network
.create_epr_pair_through_hub
.await?;
Quantum Repeaters for Long-Distance Networks
use QuantumNetwork;
use LinkType;
use BackendType;
// Build transcontinental quantum network with repeaters
let mut network = new_distributed;
// Add cities as endpoints
network.add_distributed_node?;
network.add_distributed_node?;
network.add_distributed_node?;
// Connect with quantum repeaters for long distances
network.add_quantum_link?;
network.add_quantum_link?;
// Establish end-to-end entanglement through repeater
let = network
.establish_end_to_end_entanglement
.await?;
// Entanglement swapping at Paris enables London ā Berlin connection!
Realistic Noise Modeling
use ;
// Add realistic quantum errors
let mut q = create
.with_backend
.with_qubits
.with_noise
.build?;
š Real-World Simulation Example: Quantum-Secured Chat
Build a quantum chat application with QKD (Quantum Key Distribution):
// Terminal 1: Start quantum service
let service = new.await?;
service.run.await?;
// Terminal 2: Run Paris repeater
let repeater = new.await?;
repeater.listen.await?;
// Terminal 3: Alice in London
let mut alice = new.await?;
alice.connect_to.await?;
let key = alice.run_bb84_alice.await?; // QKD protocol!
alice.run_chat.await?; // Quantum-secured chat
// Terminal 4: Bob in Berlin
let mut bob = new.await?;
bob.connect_to.await?;
let key = bob.run_bb84_bob.await?;
bob.run_chat.await?;
This creates a quantum network where:
- š Keys are distributed using BB84 quantum protocol
- š Paris acts as quantum repeater between London and Berlin
- š¬ Chat is encrypted with quantum-generated keys
- š”ļø Eavesdropping is detected by quantum mechanics
Anonymous Quantum Communication
Based on Christandl & Wehner 2004 - impossible classically!
use ;
// Create network with all participants
let participants = vec!;
let mut network = new_distributed;
// Add all nodes (works with either mode)
for p in &participants
// Create full mesh connectivity
network.add_multiparty_link?;
// Anonymous bit transmission
let parity = network
.anonymous_transmission
.await?;
// Everyone knows bit 1 was sent, but not that Alice sent it!
// Anonymous entanglement
let = network
.anonymous_entanglement
.await?;
// Alice and Bob share entanglement, untraceable by others
Blind Quantum Computing (UBQC)
// Client delegates computation without revealing data
let pattern = BlindComputationPattern ;
let results = network
.blind_computation_ubqc
.await?;
// Server performed computation but learned nothing!
Network Topologies
Build complex quantum networks with one line:
// Star - Quantum Data Centers
new.with_topology
// Ring - Metropolitan Networks
new.with_topology
// Mesh - Research Testbeds
new.with_topology
// Hierarchical - Internet Scale
new.with_topology
Architecture
// Unified backend trait - same for local and distributed
Available Backends:
StateVector- Exact simulation (ā¤30 qubits)Stabilizer- Clifford circuits (5000+ qubits, O(n²) memory)MockQnpu- Hardware API testingNoisy- Wraps any backend with realistic errors- Future: IBMQ, IonQ, QuTech
All Examples
# š Start Here
# š Learn Quantum
# š Quantum Networks
# š Production Ready
Performance
| Backend | Max Qubits | Memory | Speed | Use Case |
|---|---|---|---|---|
| StateVector | ~30 | O(2āæ) | Exact | Research, small circuits |
| Stabilizer | 5000+ | O(n²) | 135k gates/sec | Error correction, large circuits |
| Noisy | Same as wrapped | Same as wrapped | ~5% overhead | Error modeling, noisy simulation |
| MockQnpu | Hardware | Minimal | Network-limited | Hardware testing |
Why Qnect?
For Beginners:
- Start with 5 lines of code
- All the gates you need
- Clear error messages
- Visual circuit diagrams
- No configuration needed
For Researchers:
- Anonymous quantum protocols
- Blind computation (UBQC)
- Distributed GHZ states
- Hub-based routing
- NetQASM generation
- Realistic noise models
For Production:
- Type-safe Rust
- Async/await design
- Resource tracking
- Hardware-ready output
Roadmap
ā Released (v0.3.0)
- Quantum simulators (state vector, stabilizer)
- Realistic noise models
- Quantum networks with routing
- Hub-based quantum routing (New!)
- NetworkBuilder API (New!)
- 5 topology templates (New!)
- Anonymous protocols
- NetQASM SDK generation
- OpenQASM import and export
š§ In Progress
- Tensor network backend
- Real hardware adapters
- Python bindings
š® Planned
- GPU acceleration
- Quantum error correction
- Advanced routing protocols
Contributing
We welcome contributions! Key areas:
- š§® New backends (tensor networks, GPU)
- š§ Algorithms (Shor, VQE, QAOA)
- š Network protocols
- š Documentation
License
MIT OR Apache-2.0
In quantum computing, the hardest part shouldn't be the framework.