SimulaQron Programming Examples

SimulaQron offers three ways to write quantum network programs, from highest-level to lowest-level:

  1. New SDK (examples/new-sdk/) — The recommended approach for simple quantum apps using the NetQASM SDK. Programs use NetQASMConnection and EPRSocket for quantum operations, and SimulaQronClassicalClient/SimulaQronClassicalServer for classical messaging. Start here if you are new to SimulaQron.

  2. Event-based (examples/event-based/) — Builds on the new SDK by adding a state-machine pattern for classical messaging. Each node defines states, message handlers, and a dispatch table. This is the recommended pattern for protocols that interleave classical negotiation with quantum operations.

  3. Native mode (examples/native-mode/) — The low-level Twisted interface that talks directly to SimulaQron’s virtual quantum nodes. This is Python-specific and more verbose, but gives full control over the simulation backend.

How to get the examples

The code of the examples can be found in SimulaQron GitHub repository. Clone this repository using git:

git clone https://github.com/SoftwareQuTech/SimulaQron.git

All the examples can be found in the examples folder.

When running one of the examples mentioned below, we assume that you have already made your way through Getting Started and you have the virtual node servers up and running.

New SDK examples

  • Overview — Key concepts: NetQASMConnection, EPRSocket, flush(), file structure

  • Template — Getting started: single-node and client-server templates

  • CorrRNG — EPR pairs between two nodes, correlated measurement

  • Teleport — Quantum teleportation with classical correction messages

  • ExtendGHZ — Three-party entanglement, multiple EPR sockets

  • MidCircuitLogic — Multiple flush() calls for mid-circuit classical decisions

Event-based examples

Native mode examples

  • Template — Template for programming in native (Twisted) mode

  • CorrRNG — Correlated randomness using native mode

  • Teleport — Teleportation using native mode

  • GraphState — Distributing a graph state across four nodes