Raft-KV Lab

A replicated key-value store built on Raft consensus, compiled to WebAssembly. Everything below is the same Go code the server runs, stepped tick by tick. Break it and see if it holds.

Loading the Raft engine (WebAssembly)…
leadercandidatefollowercrashed ·RequestVoteAppendEntriesInstallSnapshotresponse

Click a node to crash, restart or isolate it. Messages travel as dots and can be dropped, duplicated or delayed.

Replicated logs — colour = term, solid = committed, outline = not yet committed

Deterministic core

The Raft node is a pure state machine: no goroutines, clocks or sockets. It receives ticks and messages, and returns messages to send and entries to apply. That is why the same code runs here, in the tests and in the HTTP server.

Simulated chaos

A seeded simulator owns time and the network. It drops, duplicates, reorders and delays messages, crashes nodes, cuts partitions and compacts logs into snapshots. Any failure replays exactly from its seed.

Proven, not assumed

Safety invariants are checked on every tick (one leader per term, identical entries at each index), and client histories are verified linearizable with Porcupine across 1,000 random chaos seeds.