Skip to content

Introduction

ZigBolt is an ultra-low-latency, lock-free messaging system written in pure Zig for high-frequency trading systems. Zero GC pauses, zero JVM safepoints, zero runtime overhead.

Traditional HFT messaging systems are either:

  • Java-based (Aeron, LMAX Disruptor, Chronicle Queue) — subject to GC pauses, JVM safepoints, and large runtime overhead
  • C/C++-based (ZeroMQ, nanomsg) — complex build systems, memory safety issues, undefined behavior risks

ZigBolt combines the best of both worlds:

  • Zero overhead like C — no GC, no runtime, direct hardware access
  • Safety — comptime validation, bounds-checked handling of untrusted input (shared-memory headers, network datagrams), clear error handling
  • Simplicity — single file per module, no build system complexity, cross-compilation built in
  • Performance — designed for sub-200ns IPC and 100M+ msg/sec codec throughput (design targets — run the bundled benchmarks on your hardware)
  • 423 tests pass (zig build test), in both Debug and ReleaseFast builds.
  • zig build produces the C-ABI shared library, and all five language bindings (C, Rust, Python, Go, TypeScript) build and pass smoke tests against it.
  • The Raft consensus module is experimental: durable persistence (WAL, persisted vote/term, atomic snapshots, crash recovery) is wired in, but election timers and message transport are the embedder’s responsibility, and it has not yet been validated with multi-process fault injection.
  • Performance numbers are design targets, not measured results.

ZigBolt is organized into seven layers, each depending only on layers below it:

+================================================================+
| Application Layer |
| Transport, Publisher(T), Subscriber(T), AgentRunner |
+================================================================+
| Channel Layer |
| IpcChannel (shm) UdpChannel NetworkChannel (reliable) |
| CongestionControl FlowControl(Min/Max/Tagged) |
+================================================================+
| Protocol Layer |
| Reliability (NAK) Fragmenter/Reassembler NakController |
| DataHeaderFlyweight StatusMessageFlyweight NakFlyweight |
+================================================================+
| Codec Layer |
| WireCodec(T) SbeEncoder/SbeDecoder FIX Messages |
+================================================================+
| Core Layer |
| SpscRingBuffer MpscRingBuffer LogBuffer Sequencer |
| BroadcastBuffer (1-to-N) CounterSet GlobalCounters |
+================================================================+
| Cluster / Archive Layer |
| RaftNode Cluster WriteAheadLog SnapshotManager |
| Archive Catalog SparseIndex Compressor/Decompressor |
+================================================================+
| Platform Layer |
| config.zig (cache lines, timestamps) memory.zig (shm/mmap) |
+================================================================+
ModuleFileDescription
SpscRingBuffersrc/core/spsc.zigLock-free single-producer single-consumer ring buffer
MpscRingBuffersrc/core/mpsc.zigMulti-producer single-consumer with CAS
LogBuffersrc/core/log_buffer.zigAeron-style term rotation buffer
WireCodecsrc/codec/wire.zigComptime zero-copy codec for packed structs
SbeEncoder/Decodersrc/codec/sbe.zigSBE wire format engine
FIX Messagessrc/codec/fix_messages.zigFIX/SBE market data messages
IpcChannelsrc/channel/ipc.zigShared-memory IPC channel
UdpChannelsrc/channel/udp.zigUDP unicast/multicast
NetworkChannelsrc/channel/network.zigReliable ordered UDP
BroadcastBuffersrc/core/broadcast.zig1-to-N fan-out for market data
Archivesrc/archive/archive.zigSegment-based message recording/replay
RaftNodesrc/cluster/raft.zigRaft consensus: election, replication (experimental)
Sequencersrc/sequencer/sequencer.zigTotal-order sequence assignment
FFIsrc/ffi/exports.zigC-ABI exports used by the C, Rust, Python, Go, and TypeScript bindings