# The MoonMath Manual: building zk-SNARKs with pen and paper

> A TeX-written textbook that teaches zero-knowledge proofs by having you compute the cryptographic machinery yourself, by hand, with no computer, until you can construct a working SNARK on paper. It is aimed at readers with minimal cryptography background and no prior blockchain knowledge.

**LeastAuthority/moonmath-manual** — A resource for anyone interested in understanding and unlocking the potential of zk-SNARKs, from beginners to experts.

- Repository: https://github.com/LeastAuthority/moonmath-manual
- Stars: 730 · Forks: 124
- Language: TeX
- License: NOASSERTION
- Published: 2026-10-21 · Updated: 2026-10-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/leastauthority-moonmath-manual

## The problem is that SNARKs are taught as magic

The manual opens by naming the acronym: zk-SNARK stands for Zero-Knowledge Succinct Non-Interactive Argument of Knowledge, and refers to a cryptographic technique where one can prove correct execution of computation and possession of certain information without revealing the information itself. Zk-SNARKs, a type of zero-knowledge proof, offer a new paradigm for privacy, and have been used to enable private blockchain transactions. They also have the potential to securely scale blockchain-based solutions.

The stated problem is pedagogical. Most explanations struggle to clarify how and why they work, so zk-SNARKs remain somewhat magical and elusive, deterring developers from exploring or utilizing them in projects. Resources are scattered across blog posts and GitHub libraries, which results in a high barrier to entry and slows adoption of zk-SNARKs and associated privacy-enhancing technologies. And the worst part: implementing zk-SNARKs without understanding the fundamentals of how they work increases the potential for security issues.

That last sentence is the reason this book exists in engineering terms. A SNARK system that is used without being understood is a system where a mistake in the circuit or in the trusted setup is invisible until it matters. The manual's argument is that understanding the internals is a safety property, not just an educational nicety.

So the audience is stated as anyone interested in understanding and unlocking the potential of zk-SNARKs, from beginners to experts, and the manual is designed for an audience with only minimal experience in cryptography and programming.

## Pen and paper means you compute the whole stack yourself

What is particularly unique about the MoonMath Manual is that it is designed to enable users to construct zk-SNARKs using simple pen-and-paper computations. Throughout the manual, users are encouraged to complete exercises that ensure they engage with the foundational building blocks of zk-SNARKs. While doing that, readers build the smallest possible, but fully functional, cryptographic stack to compute zk-SNARK internals without the need of a computer.

That is the design decision everything else follows from. Most introductions to zero-knowledge proofs either stay at the level of analogy or hand you a library and a circuit. This one has you do the modular arithmetic yourself, over and over, until the structure of a SNARK is something you have literally computed rather than something you have read about.

The cost is real, and the manual is honest about the shape of it. This is a book with many exercises, and the exercises are not optional decoration. A reader who skips them gets prose; a reader who does them ends up with a mental model.

The second benefit is scope. As users go through the manual, they will grasp mathematical concepts that are not only used in SNARKs, but also in other zero-knowledge proofs and cryptography more generally. The elliptic curve arithmetic, the finite field operations and the polynomial commitments that a SNARK is built from are the same objects that appear in other proof systems, so the work transfers rather than being SNARK-specific.

This is a book, then, not a library. Nothing here is a dependency you add to a project.

## Building the PDF needs LaTeX, Docker and a specific SageMath

The manual is distributed as a PDF, and the source is a LaTeX project with a chapter directory, figures, a bibliography and a small amount of custom TeX styling. The build is documented as a numbered sequence.

The prerequisites are a LaTeX distribution installed, Latexmk installed, and Docker installed. The steps are:

```bash
git clone https://github.com/LeastAuthority/moonmath-manual.git
cd moonmath-manual
./install_sagetex_sty.sh
pdflatex main-moonmath.tex
./generate_sagetex_files.sh
latexmk -pdf main-moonmath.tex
```

The order matters and it is not obvious. The pdflatex pass creates SageMath files from the document, so the document is not self-contained LaTeX. The SageMath computation happens next, in a script that runs SageMath 9.3 on the output files, and only then does the final latexmk pass produce main-moonmath.pdf. The install_sagetex_sty.sh step installs sagetex.sty, the style package that lets LaTeX talk to the SageMath session at all.

So a build is a three-stage pipeline across three tools, and Docker is there so that the SageMath version is the right one without you managing it. The tree contains both scripts, install_sagetex_sty.sh and generate_sagetex_files.sh, alongside main-moonmath.tex, the chapters directory, the figures, moonmath.bib for the bibliography, moonmath-links.md, and a polydiv.sty style file. There is also a tmp directory, which is where the intermediate SageMath output lands.

If you only want to read the manual, the project publishes the compiled PDF directly, and the download link points at the latest release asset rather than requiring a build.

## What the repository does not contain

It is worth being explicit about the boundaries, because the repository name suggests more than it holds.

There is no code to install and no package to depend on. The primary language is TeX, and the tree is documentation: chapters, figures, styling files, a bibliography and two build scripts. If you are looking for a zk-SNARK library, a circuit framework, a prover or a verifier implementation, none of that is here.

There is also no test suite in the usual sense, and no CI configuration is visible in the tree beyond the .github directory. The correctness of the manual is therefore a matter of review and of the exercises themselves rather than of an automated check.

What is present instead is the material you need to build the knowledge the manual is trying to teach. The manual asks the reader to construct the smallest possible fully functional cryptographic stack, so the reader does the constructing. A companion figure set and a colour file exist for the graphics, and the tmp directory suggests the build is expected to leave intermediate files behind.

The donation section is also worth a brief mention because it tells you something about the project's shape. Support for the continuous production of content like this is invited through Bitcoin, Ethereum, ZCash and PayPal, with a note to contact Least Authority for additional solutions. That last clause is the giveaway: Least Authority is a consultancy, and the manual is one of its open-source outputs rather than a product with a support contract behind it.

The licence is a custom one that GitHub cannot classify, with the terms in the LICENSE file, which in this repository is an .adoc file rather than a plain text one.

## The release cadence and what it says about the project

The repository is not archived. The last push was on 2026-05-11, and the most recent release is v1.1.7, published on the same day. Before that came v1.1.6 on 2026-01-27, and before that v1.1.5 on 2024-06-11.

So the release sequence is v1.1.5, then a gap of about nineteen months, then v1.1.6, then about three and a half months, then v1.1.7. The project is alive but the pace is that of a long-form document rather than a library.

That is the right frame for evaluating it. A manual of this kind is not going to change your build; it is going to change how you reason about a class of construction. Whether that is worth a few days of your time depends on whether you are going to work on this kind of cryptography at all.

There is also a version-number signal. The project is at 1.1.x after several years, which suggests the authors treat a minor version bump as a meaningful editorial event rather than a routine change, and it means the PDF you have may be behind the source by a generation or two of revision. If you are following the project, the releases page is where to watch, and the download link in the readme points at the latest release asset so you get the published PDF rather than whatever is currently on the branch.

The project home page is the GitHub releases download link, and the readme links the document itself, so there is no separate website to cross-reference for contents.

## When a textbook is the wrong investment

There are situations where reading this manual is the wrong call, and being clear about them saves a lot of time.

The first is a deadline. If you need a working circuit and a prover in a sprint, this is the slowest possible route to that. The exercises are the point, and the point is the point. A team with a working understanding of finite fields who needs to ship will get there faster from a reference implementation and a specification.

The second is if your interest is in a specific proof system rather than in zero-knowledge proofs generally. The manual is about zk-SNARKs, and it teaches the mathematics that SNARKs are built from, but if your work is in a different proof system then much of the arithmetic is transferable and the SNARK-specific structure is not what you need.

The third is the toolchain. Building the source requires a LaTeX distribution, Latexmk, Docker, and a SageMath 9.3 environment that the build script drives. If you want to read it, the PDF is published and there is nothing to install. If you want to change a chapter, correct a proof, or build a fork with your own exercises, you need all three tools working and you need to accept a build pipeline that runs a computer algebra system between two LaTeX passes.

The fourth is if you are looking for a reference to consult rather than a curriculum to follow. The design deliberately withholds the answers, because the exercises are where the understanding comes from. A book that will not hand you the result is a poor lookup reference.

And the fifth is if you expected an implementation. Nothing here can be deployed, audited as code, or used to verify a production system.

## Against blog posts and libraries, and against a cryptography textbook

Two comparisons explain what this manual is for.

The first is against the scattered resources the readme complains about, blog posts and GitHub libraries. The difference in approach is that those materials are written to be consumed once, quickly, for one purpose. A blog post can explain that a SNARK proves knowledge of a witness without revealing it, and that is genuinely useful until you need to know why. The manual is structured as a build sequence instead. Each concept is introduced because the previous exercise needed it, and the reader's own arithmetic is the thing that makes the next concept necessary. That is a different relationship with the reader, and it costs more and gives more.

The second is against a conventional cryptography textbook. A textbook on cryptography covers the field, in a curriculum order, with proofs and exercises. The manual covers one construction and the mathematics underneath it, in the order the construction needs. The distinction shows in the audience. The manual is written for an audience with only minimal experience in cryptography and programming, and it does not assume you have met elliptic curves before. It also does not pretend to be general. The claim in the readme is that the concepts you grasp are not only used in SNARKs but in other zero-knowledge proofs and cryptography more generally, which is a claim about transferability rather than about coverage.

So the honest summary is this. If you are going to design, review or debug a zero-knowledge system, the manual buys you the ability to reason about the failure modes rather than pattern matching against a known list. If you are going to use a library, it is a slow way to learn a language you could read.

## Conclusion

Adopt the MoonMath Manual if you are a developer who wants to reason about zk-SNARKs rather than call a library and hope, since the exercises build the stack from arithmetic upward and the payoff is that the primitives stop being magic. Skip it if you need to ship a circuit this quarter, because the route through it is a book with many exercises, not a quickstart. Verify first that your LaTeX, Latexmk, Docker and SageMath 9.3 environment can run the build, and plan for the fact that the source is a TeX project rather than a package you consume.

## FAQ

### What is the MoonMath Manual and who is it for?

It is a resource for anyone interested in understanding and unlocking the potential of zk-SNARKs, from beginners to experts, designed for an audience with only minimal experience in cryptography and programming. The goal is to remove the barrier that keeps SNARKs feeling magical and elusive.

### How do I build the MoonMath Manual PDF from source?

Clone the repository, change into the folder, run ./install_sagetex_sty.sh to install sagetex.sty, run pdflatex main-moonmath.tex to create the SageMath files, run ./generate_sagetex_files.sh to execute SageMath 9.3 on them, then run latexmk -pdf main-moonmath.tex. A LaTeX distribution, Latexmk and Docker are required.

### Can I read the MoonMath Manual without building it?

Yes. The project publishes the compiled PDF as a release asset, and the readme links the latest release download directly. Building from source is only needed if you want to change the text or the exercises.

### Does the MoonMath Manual contain runnable zk-SNARK code?

No. The repository is a TeX document with chapters, figures and two build scripts, and the primary language is TeX. The cryptographic stack is something the reader constructs by hand in the exercises rather than something the repository provides as code.

### What is the approach of the MoonMath Manual to teaching zero-knowledge proofs?

It has readers construct zk-SNARKs using simple pen-and-paper computations, completing exercises that engage with the foundational building blocks, and in the process build the smallest possible but fully functional cryptographic stack to compute zk-SNARK internals without a computer.

### How often is the MoonMath Manual released?

Irregularly, on the pace of a long document. The recent releases are v1.1.7 on 2026-05-11, v1.1.6 on 2026-01-27 and v1.1.5 on 2024-06-11. The repository is not archived and the last push was on 2026-05-11.

## Sources

- [Issues](https://github.com/LeastAuthority/moonmath-manual/issues)
- [LeastAuthority/moonmath-manual on GitHub](https://github.com/LeastAuthority/moonmath-manual)
- [README](https://github.com/LeastAuthority/moonmath-manual/blob/main/README.md)
- [Releases](https://github.com/LeastAuthority/moonmath-manual/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/leastauthority-moonmath-manual
