gnark
gnark is part of the LinethLineth (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. 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 expands traces, gnark produces the proof submitted at finalization.
How it works
The prover first checks the expanded traces from 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 defines the circuits, including circuits whose job is to verify a proof from an earlier stage, and its backend API 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-SNARKzk-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 coordinatorCoordinator 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 for the first part of the proving system that produces gnark's input.
- See the gnark documentation, the gnark repository, and the
prover source code in the
lineth-monorepo.