Get Started
This page gets you from a fresh clone to a running prover and verifier. It has two parts: setting up Longfellow locally, and walking through a minimal “hello circuit” that proves knowledge of a witness to a trivial statement. The goal is to see the full pipeline — circuit authoring → compiling → proving → verifying — once, end-to-end, so the rest of the site has something concrete to refer back to.
Longfellow itself is a C++ library. This documentation site does not build or ship Longfellow; it only reads from it. You will build Longfellow locally to run the examples.
Prerequisites
You will need a C++ toolchain, CMake, OpenSSL, zstd, and zlib. Longfellow’s upstream README has the exact package names per platform — see github.com/google/longfellow-zk .
Building Longfellow
Clone and initialize the submodule
This docs site vendors Longfellow’s source as a git submodule for reference. If you are working from a clone of this docs repo:
git submodule update --init --recursiveIf you are working from a clone of Longfellow itself, you can skip this step.
Configure with CMake
From the directory that contains Longfellow’s lib/:
CXX=clang++ cmake -D CMAKE_BUILD_TYPE=Release -S lib -B clang-build-release --install-prefix ${PWD}/installBuild
cmake --build clang-build-release -jRun the test suite (optional but recommended)
ctest --test-dir clang-build-releaseYour first circuit
The most compact end-to-end example in the Longfellow tree is the top-level ZK test — it builds a small circuit, runs the prover, and runs the verifier. Read it as the canonical “hello circuit” walkthrough:
- Source:
longfellow-zk/lib/zk/zk_test.cc
Working through that file top-to-bottom teaches you:
- Choosing a field. The test uses
Fp256Base(P-256 base field) — a realistic starting point for attestation-shaped statements. See Prime Fields. - Authoring the circuit. The test instantiates
Logic<Fp256Base, CompilerBackend>and writes a small gadget. See Circuits / Logic. - Compiling. The
CompilerBackendemits aQuadCircuitvia the Compiler. - Building a witness. The test fills a
Dense<Fp256Base>with the prover’s private inputs. See Arrays. - Proving and verifying. The test hands the circuit and witness to the
zk/top-level prover, and checks the proof with the matching verifier. See Proof System / ZK.
Where to go next
- If you are new to Longfellow’s protocol, read the Protocol Primer next.
- If you already understand the protocol and want composition patterns, jump into the Guides.
- If you want to look up one specific module, start at the Reference.