Quantum networking · simulation stack
Quantum
Entanglement
Link
A quantum link fails quietly. Fidelity leaks away through noise, distance and the time spent waiting in memory, and a route that looks short can arrive too degraded to extract a key from. QEL simulates the whole path — density-matrix states, noise channels, swapping, memory decay — and reports the fidelity that survives it.
Why a simulator
01 · OrientationThe problem
A classical mesh asks which path a packet takes. A quantum one has to answer a harder question before anything moves: where do the repeaters go, and what fidelity is left when the entanglement arrives? Entanglement cannot be copied or held indefinitely, so every hop and every second of waiting spends it.
Hardware cannot answer that question cheaply. A simulator can, and it can answer it for a thousand topologies before anyone books lab time.
How it works
States are density matrices, so decoherence is modelled directly: depolarising, dephasing and amplitude-damping channels, links that attenuate with distance, memories that relax on T1 and lose phase on T2. Weak entanglement is distilled back to something usable before a key is extracted.
The topology layer then treats a route as a budget. Every Bell-state swap and every memory hold has a fidelity cost, and the route is only usable if the arithmetic at the end still clears the threshold.
Entanglement cannot be copied, so every link has to be created, spent and replaced.
The stack
02 · Three layersCore
qubitdensity-matrix states and metricsgateunitary gates and Pauli algebrameasurementprojective and POVM, with collapsenoisedepolarising, dephasing, dampingchannellinks with distance attenuationphysicalfibre and hardware impairmentsstabilizerClifford tableau for large circuitsschedulerasynchronous discrete-event coreipc_nodeone process per node
Protocols
bb84QKD with an intercept-resend eavesdroppere91Ekert entanglement-based QKDbellBell states and CHSH teststeleportationa state moved over an EPR pairsuperdensetwo classical bits through one qubitswappingentanglement between distant nodesdistillationBBPSSW and Deutsch purificationmemoryT1 relaxation, T2 dephasingshorsteane9-qubit and 7-qubit CSS codes
Topology
graphnodes, optical links, fidelity modelsroutingfidelity-constrained entanglement routingscheduletime-aware distribution plansvisualizedependency-free ASCII outputghostnetroute over a live mesh topology export
Protocols and codes
03 · ImplementedBB84
Single-qubit key distribution with basis reconciliation, QBER estimation and an intercept-resend eavesdropper to detect.
E91
Ekert's entanglement-based key distribution, security argued from Bell inequality violation.
Bell states and CHSH
The four Bell states, Bell measurement, and CHSH inequality tests as an entanglement witness.
Teleportation
An unknown state moved with a shared EPR pair and two classical bits.
Superdense coding
Two classical bits carried by one qubit through Bell-state encoding.
Entanglement swapping
A middle node performs a Bell measurement to entangle two nodes that never interacted.
Distillation
BBPSSW and Deutsch protocols: N weakly entangled pairs in, one high-purity pair out.
Quantum memory
Buffer dynamics with T1 relaxation and T2 dephasing, so waiting costs fidelity.
Shor 9-qubit
Encoding, syndrome measurement and recovery for the original nine-qubit code.
Steane 7-qubit
The seven-qubit CSS code, correcting both bit and phase flips.
Stabilizer formalism
Clifford tableau simulation under the Gottesman–Knill theorem, for circuits too large to track as vectors.
Physical layer
Fibre attenuation and hardware metrics turned into an impairment budget.
Bridge to the mesh
04 · Discovery in, keys outghostnet.py imports a live topology export from Global Ghost Net and routes entanglement across exactly the nodes it describes. The same map that carries packets decides where quantum links could exist.
A route's end-to-end fidelity is the scheduled value once every swap and every memory decay on the path is accounted for. If that is too low for QKD to extract a key, the route is distilled — BBPSSW rounds over 256 pairs — until it is. Then a real BB84 exchange runs at the route's own noise level and produces key material.
# route entanglement over a live mesh export py -m quantumnet ghost-net --topology mesh.json # derive key material at an explicit fidelity py -m quantumnet qkd-derive --fidelity 0.94 --out key.bin # build, route and visualise a topology py -m quantumnet topology --nodes 12 --route 0 11
Run it
05 · Sixty secondsPython 3.11 or newer. The only runtime dependency is NumPy.
git clone https://github.com/KELLERBABG/QEL cd QEL py -m pip install -e ".[dev]" py -m pytest -q # 122 tests, about 80 seconds py -m quantumnet all # every protocol demo
| Real | Modelled |
|---|---|
| The quantum mechanics: states, gates, measurement collapse, noise channels, the stabilizer formalism, the error-correcting codes, distillation, and the fidelity arithmetic. | The hardware and the network. There are no photons, no fibre and no sockets; ipc_node uses real processes, and the links between them are modelled. |
| Scope. These are simulator results and do not predict what physical hardware would achieve. | |