<!-- Canonical: https://docs.linea.build/protocol/architecture/prover/gnark -->

> For the complete Linea documentation index, see [llms.txt](/llms.txt).
> Agents can fetch this page as Markdown at [https://docs.linea.build/protocol/architecture/prover/gnark.md](https://docs.linea.build/protocol/architecture/prover/gnark.md).

# gnark

gnark is part of the [Lineth](/protocol/reference/zero-knowledge-glossary#lineth)**Lineth** (Formerly the Linea Stack) The open-source ZK-rollup stack, codebase, and technical protocol that's the foundation of Linea Mainnet. Operators can deploy this stack to launch their own Ethereum-compatible L2 or L3 networks. [prover](/protocol/architecture/prover). It's a Go library for building and proving cryptographic circuits, used standalone in other projects as well as in Lineth.

gnark completes the second stage of the proving system: after [Corset](/protocol/architecture/prover/corset) expands traces, gnark produces the proof submitted at finalization.

## How it works

The prover first checks the expanded traces from [Corset](/protocol/architecture/prover/corset) against the arithmetization, using its own proving framework. The result is an _inner proof_: it establishes that execution was correct, but it's too large to verify onchain.

gnark wraps that inner proof with an _outer proof_ that a contract can check. Its [frontend API](https://pkg.go.dev/github.com/consensys/gnark/frontend) defines the circuits, including circuits whose job is to verify a proof from an earlier stage, and its [backend API](https://pkg.go.dev/github.com/consensys/gnark/backend) runs those circuits at proving time to produce a proof at each stage.

Because each stage proves the verification of the stage before it, the proof gets smaller and cheaper to verify as it moves toward the finalization layer. Aggregation circuits then combine the proofs for several blobs into the single proof the coordinator submits, a [zk-SNARK](/protocol/reference/zero-knowledge-glossary#zk-snark)**zk-SNARK** (Zero-Knowledge Succinct Non-interactive Argument of Knowledge) A type of ZK proof where the prover and verifier don't have to interact. With zk-SNARKs, you can verify 1 transaction or 1 billion transactions in the same amount of time. that a verifier contract can check cheaply.

The prover writes the finished proof back for the [coordinator](/protocol/reference/zero-knowledge-glossary#coordinator)**Coordinator** Lineth's coordination module for batching, proof generation, and finality submission. The coordinator monitors block production, manages conflation deadlines, batches blocks, combines batches into blobs, orchestrates execution, compression, and aggregation proofs, and submits proofs and data to the finalization layer. to pick up and submit.

## See also

-   See [Corset](/protocol/architecture/prover/corset) for the first part of the proving system that produces gnark's input.
-   See the [gnark documentation](https://docs.gnark.consensys.com/), the [gnark repository](/protocol/reference/repos#gnark), and the [prover source code](https://github.com/LFDT-Lineth/lineth-monorepo/tree/main/prover) in the `lineth-monorepo`.
