Gnark
gnark is a fast zk-SNARK library that offers a high-level API to design circuits. The library is open source and developed under the Apache 2.0 license
Install / Use
/learn @Consensys/GnarkREADME
gnark zk-SNARK library
High-performance zk-SNARKs in Go.
gnark provides a high-level API to define circuits, then compile, prove, and verify with production-grade proving systems. It is open-source under Apache 2.0 and uses gnark-crypto for field arithmetic and cryptographic primitives.
gnark powers Linea zk-rollup. Include your project in known users by opening a PR.
Why gnark
- Circuit development in idiomatic Go
- Fast proving and verification backends
- Reusable standard gadgets in
std/ - Active security and regression testing culture
Useful Links
gnarkUser DocumentationgnarkPlaygroundgnarkIssuesgnarkBenchmarks 🏁gnark-announce- release and security announcements
Quick Start
Requirements
- Go
1.25+(module target:go 1.25.6)
Install
go get github.com/consensys/gnark@latest
Run an example
go run ./examples/cubic
To design your first circuit, follow the tutorial in gnark User Documentation.
Supported Proving Systems and Curves
gnark currently supports:
- Groth16
- PLONK
on the following curves:
- BN254
- BLS12-381
- BLS12-377
- BW6-761
Notes:
- Solidity verifier export support is curve-dependent (BN254 is the primary target).
- Serialized formats are not guaranteed to be stable across versions.
GPU Acceleration (Experimental)
gnark includes experimental GPU acceleration through Ingonyama's ICICLE backend for Groth16 on:
- BN254
- BLS12-377
- BLS12-381
- BW6-761
See accelerated backend documentation and the ICICLE repository.
Example Circuit
The circuit below encodes x**3 + x + 5 == y.
package main
import (
"github.com/consensys/gnark-crypto/ecc"
"github.com/consensys/gnark/backend/groth16"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/frontend/cs/r1cs"
)
// CubicCircuit defines a simple circuit.
// x**3 + x + 5 == y
type CubicCircuit struct {
X frontend.Variable `gnark:"x"`
Y frontend.Variable `gnark:",public"`
}
// Define declares the circuit constraints.
func (circuit *CubicCircuit) Define(api frontend.API) error {
x3 := api.Mul(circuit.X, circuit.X, circuit.X)
api.AssertIsEqual(circuit.Y, api.Add(x3, circuit.X, 5))
return nil
}
func main() {
var circuit CubicCircuit
ccs, _ := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, &circuit)
pk, vk, _ := groth16.Setup(ccs)
assignment := CubicCircuit{X: 3, Y: 35}
witness, _ := frontend.NewWitness(&assignment, ecc.BN254.ScalarField())
publicWitness, _ := witness.Public()
proof, _ := groth16.Prove(ccs, pk, witness)
_ = groth16.Verify(proof, vk, publicWitness)
}
Security
gnark and gnark-crypto have been extensively audited, but are provided as-is with no guarantees or warranties. In particular, gnark does not guarantee constant-time implementations or side-channel resistance.
Report vulnerabilities via Security Policy. Do not open public issues for security reports.
Published advisories are listed here.
Testing
CI runs formatting, generated-file, lint, and test checks on pull requests and pushes.
Common local commands:
go test -short ./...
go test -tags=release_checks,solccheck .
go test -tags=prover_checks ./test/... ./examples/...
go test -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils
go generate ./...
Audits
- Kudelski Security - October 2022 - gnark-crypto (contracted by Algorand Foundation)
- Sigma Prime - May 2024 - gnark-crypto KZG (contracted by Ethereum Foundation)
- Consensys Diligence - June 2023 - gnark PLONK Solidity verifier
- LeastAuthority - August 2023 - gnark Groth16 Solidity verifier template (contracted by Worldcoin)
- OpenZeppelin - November 2023 - gnark PLONK Solidity verifier template
- ZKSecurity.xyz - May 2024 - gnark standard library
- OpenZeppelin - June 2024 - gnark PLONK prover and verifier
- LeastAuthority - September 2024 - gnark general and GKR
- LeastAuthority - November 2024 - Linea zkEVM
Release Notes
See CHANGELOG.md.
Citing
If you use gnark in research, please cite the latest release:
@software{gnark-v0.14.0,
author = {Gautam Botrel and
Thomas Piellard and
Youssef El Housni and
Ivo Kubjas and
Arya Tabaie},
title = {Consensys/gnark: v0.14.0},
month = jun,
year = 2025,
publisher = {Zenodo},
version = {v0.14.0},
doi = {10.5281/zenodo.5819104},
url = {https://doi.org/10.5281/zenodo.5819104}
}
Contributing
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Versioning
gnark follows SemVer. Available versions are in tags.
License
Licensed under Apache 2.0 (see LICENSE).
Related Skills
xurl
334.9kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
diffs
334.9kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
kubeshark
11.8kCluster-wide network observability for Kubernetes. Captures L4 packets, L7 API calls, and decrypted TLS traffic using eBPF, with full Kubernetes context. Available to AI agents via MCP and human operators via dashboard.
openpencil
1.6kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
