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.

122tests passing
15CLI commands
10protocols & codes
9core primitives
0hardware required

Why a simulator

01 · Orientation

The 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 layers
Layer one · primitives

Core

  • qubitdensity-matrix states and metrics
  • gateunitary gates and Pauli algebra
  • measurementprojective and POVM, with collapse
  • noisedepolarising, dephasing, damping
  • channellinks with distance attenuation
  • physicalfibre and hardware impairments
  • stabilizerClifford tableau for large circuits
  • schedulerasynchronous discrete-event core
  • ipc_nodeone process per node
Layer two · protocols

Protocols

  • bb84QKD with an intercept-resend eavesdropper
  • e91Ekert entanglement-based QKD
  • bellBell states and CHSH tests
  • teleportationa state moved over an EPR pair
  • superdensetwo classical bits through one qubit
  • swappingentanglement between distant nodes
  • distillationBBPSSW and Deutsch purification
  • memoryT1 relaxation, T2 dephasing
  • shor steane9-qubit and 7-qubit CSS codes
Layer three · topology

Topology

  • graphnodes, optical links, fidelity models
  • routingfidelity-constrained entanglement routing
  • scheduletime-aware distribution plans
  • visualizedependency-free ASCII output
  • ghostnetroute over a live mesh topology export

Protocols and codes

03 · Implemented
QKD

BB84

Single-qubit key distribution with basis reconciliation, QBER estimation and an intercept-resend eavesdropper to detect.

QKD

E91

Ekert's entanglement-based key distribution, security argued from Bell inequality violation.

Verification

Bell states and CHSH

The four Bell states, Bell measurement, and CHSH inequality tests as an entanglement witness.

Transfer

Teleportation

An unknown state moved with a shared EPR pair and two classical bits.

Capacity

Superdense coding

Two classical bits carried by one qubit through Bell-state encoding.

Repeaters

Entanglement swapping

A middle node performs a Bell measurement to entangle two nodes that never interacted.

Purity

Distillation

BBPSSW and Deutsch protocols: N weakly entangled pairs in, one high-purity pair out.

Storage

Quantum memory

Buffer dynamics with T1 relaxation and T2 dephasing, so waiting costs fidelity.

QEC

Shor 9-qubit

Encoding, syndrome measurement and recovery for the original nine-qubit code.

QEC

Steane 7-qubit

The seven-qubit CSS code, correcting both bit and phase flips.

Simulation

Stabilizer formalism

Clifford tableau simulation under the Gottesman–Knill theorem, for circuits too large to track as vectors.

Physics

Physical layer

Fibre attenuation and hardware metrics turned into an impairment budget.

Bridge to the mesh

04 · Discovery in, keys out

ghostnet.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 seconds

Python 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
RealModelled
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.