Skip to Content
⚠️ This documentation is AI-generated, for personal use only, and is not supported or endorsed by Google.
Get Started

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 --recursive

If 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}/install

Build

cmake --build clang-build-release -j
ctest --test-dir clang-build-release

Your 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:

Working through that file top-to-bottom teaches you:

  1. Choosing a field. The test uses Fp256Base (P-256 base field) — a realistic starting point for attestation-shaped statements. See Prime Fields.
  2. Authoring the circuit. The test instantiates Logic<Fp256Base, CompilerBackend> and writes a small gadget. See Circuits / Logic.
  3. Compiling. The CompilerBackend emits a QuadCircuit via the Compiler.
  4. Building a witness. The test fills a Dense<Fp256Base> with the prover’s private inputs. See Arrays.
  5. 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.
Last updated on