zkdefi · notes

A 52-file Go re-implementation of Swiss Post's e-voting protocol

The Swiss Post e-voting system is the rare bird of public-sector cryptography: actually used, by an actual electorate, for actual binding elections. The Swiss federal authorities decided about a decade ago to commit to a fully end-to-end verifiable internet voting protocol, with all four properties — individual verifiability, universal verifiability, cast-as-intended, recorded-as-cast — and to release the full source code under public scrutiny. They followed through. Anyone can read the reference implementation.

Reading it is a different matter. The production system is 14 Java repositories, 500,000+ lines of code, ~50 GB of RAM required to run an election dry-run. Most of it is operational concerns — message queues, audit logging, ballot box infrastructure, election lifecycle orchestration. The cryptographic core is in there, but you have to dig.

swisspost-evoting-go-poc is what came out of doing that dig and writing the cryptography down as a single Go binary. 52 Go files. 2 external dependencies. End-to-end election lifecycle.

The full pipeline:

Each of those building blocks is small and self-contained in the PoC. The ElGamal layer is one file. The verifiable-shuffle proof generation is another. The Bayer-Groth verifier is its own file. The end-to-end test reproduces a synthetic election and asserts that the universal-verifiability proof checks out.

The reason for writing this is the same reason most PoC implementations of major protocols get written: the production code base is too large to read. It's not too large to use — it's a perfectly engineered piece of software — but reading it as an exercise in understanding the protocol is hopeless without something thinner alongside. This is the thinner alongside.

What becomes possible: anyone who wants to understand how a real, deployed, end-to-end verifiable election runs can read 52 files instead of 14 repositories.

#e-voting #cryptography #swiss-post #end-to-end-verifiable #zero-knowledge #mix-net