{"id":29113168,"url":"https://github.com/ConsenSys/gnark","last_synced_at":"2025-06-29T11:06:10.929Z","repository":{"id":37926162,"uuid":"242781085","full_name":"Consensys/gnark","owner":"Consensys","description":"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","archived":false,"fork":false,"pushed_at":"2025-06-19T18:12:32.000Z","size":30565,"stargazers_count":1566,"open_issues_count":133,"forks_count":442,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-06-19T19:33:28.116Z","etag":null,"topics":["gnark","golang","plonk","r1cs","zk-rollup","zk-snarks","zkevm","zkp","zksnark"],"latest_commit_sha":null,"homepage":"https://play.gnark.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Consensys.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":"audits/2022-10 - Kudelski - gnark-crypto.pdf","citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-02-24T16:08:21.000Z","updated_at":"2025-06-19T19:08:56.000Z","dependencies_parsed_at":"2023-09-26T03:34:31.483Z","dependency_job_id":"cc8a48bf-6c69-4d78-adcc-a444aa7b4dc8","html_url":"https://github.com/Consensys/gnark","commit_stats":{"total_commits":3012,"total_committers":45,"mean_commits":66.93333333333334,"dds":0.7314077025232404,"last_synced_commit":"f7b61b73a80ef3ce4cb0112eb272a4f16af172fb"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/Consensys/gnark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fgnark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fgnark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fgnark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fgnark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Consensys","download_url":"https://codeload.github.com/Consensys/gnark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fgnark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262581320,"owners_count":23331911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gnark","golang","plonk","r1cs","zk-rollup","zk-snarks","zkevm","zkp","zksnark"],"created_at":"2025-06-29T11:05:11.802Z","updated_at":"2025-06-29T11:06:10.904Z","avatar_url":"https://github.com/Consensys.png","language":"Go","funding_links":[],"categories":["Prover/Verifier Tools","SNARKs"],"sub_categories":["Try"],"readme":"# `gnark` zk-SNARK library\n\n[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/gnark_team.svg?style=social\u0026label=Follow%20%40gnark_team)](https://twitter.com/gnark_team) [![License](https://img.shields.io/badge/license-Apache%202-blue)](LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ConsenSys/gnark)](https://goreportcard.com/badge/github.com/ConsenSys/gnark)\n[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/consensys/gnark)](https://pkg.go.dev/mod/github.com/consensys/gnark)\n[![Documentation Status](https://readthedocs.com/projects/pegasys-gnark/badge/)][`gnark` User Documentation] [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5819104.svg)](https://doi.org/10.5281/zenodo.5819104)\n\n`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.\n\n`gnark` uses [`gnark-crypto`] for the finite-field arithmetic and out-circuit implementation of cryptographic algorithms.\n\n`gnark` powers [`Linea zk-rollup`](https://linea.build). Include your project in the [known users](docs/KNOWN_USERS.md) section by opening a PR.\n\n## Useful Links\n\n* [`gnark` User Documentation]\n* [`gnark` Playground]\n* [`gnark` Issues]\n* [`gnark` Benchmarks](https://docs.gnark.consensys.net/overview#gnark-is-fast) 🏁\n* [`gnark-announce`] - Announcement list for new releases and security patches\n\n\n## `gnark` Users\n\nTo get started with `gnark` and write your first circuit, follow [these instructions][`gnark` User Documentation].\n\nCheckout the [online playground][`gnark` Playground] to compile circuits and visualize constraint systems.\n\n\n## Security\n\n**`gnark` and [`gnark-crypto`] have been [extensively audited](#audits), but are provided as-is, we make no guarantees or warranties to their safety and reliability. In particular, `gnark` makes no security guarantees such as constant time implementation or side-channel attack resistance.**\n\n**To report a security bug, please refer to [`gnark` Security Policy](SECURITY.md).**\n\nRefer to [known security advisories](https://github.com/Consensys/gnark/security/advisories?state=published) for a list of known security issues.\n\n## Testing\n\n`gnark` employs the following testing procedures:\n* unit testing - we test the primitives in unit tests\n* circuit testing - we test the circuit implementation against several targets:\n  - test engine - instead of running the full prover and verifier stack, we run the computations only to ensure the completeness of the circuits\n  - proof engines - we compile the circuits, run the setup, prove and verify using native implementation\n  - Solidity verifier - in addition to the previous, we verify the proofs in Solidity verifier. See [`gnark-solidity-checker`]\n* regression testing - we have implemented [tests for reported issues](internal/regression_tests) to avoid regressions\n* constraint count testing - we have implemented [circuit size tests](internal/stats) to avoid regressions\n* serialization testing - we check that [serialization round-trip is complete](io/roundtrip.go)\n* side-effect testing - we check that circuit [compilation is deterministic](test/assert.go)\n* fuzz testing:\n  - circuit input fuzzing - we provide random inputs to the circuit to cause solver error\n  - native input fuzzing - we provide random inputs to various native methods to cause errors. We have also stored initial fuzzing corpus for regression tests.\n  - circuit definition fuzzing - we cooperate with Consensys Diligence to fuzz the circuit definitions to find bugs in the `gnark` circuit compiler.\n\nThe tests are automatically run during every PR and merge commit. We run full test suite only for the Linux on `amd64` target, but run short tests both for Windows target (`amd64`) and macOS target (`arm64`).\n\n## Performance\n\n`gnark` and `gnark-crypto` packages are optimized for 64bits architectures (x86 `amd64`) using assembly operations. We have a generic implementation of the same arithmetic algorithms for ARM backends (`arm64`). We do not implement vector operations.\n\n## Backwards compatibility\n\n`gnark` tries to be backwards compatible when possible, however we do not guarantee that serialized object formats are static over different versions of `gnark`. Particularly - we do not have versioning implemented in the serialized formats, so using files between different versions of gnark may lead to undefined behaviour or even crash the program.\n\n## Issues\n\n`gnark` issues are tracked [in the GitHub issues tab][`gnark` Issues].\n\n**To report a security bug, please refer to [`gnark` Security Policy](SECURITY.md).**\n\nIf you have any questions, queries or comments, [GitHub discussions] is the place to find us.\n\nYou can also get in touch directly: gnark@consensys.net\n\n## Release Notes\n\n[Release Notes](CHANGELOG.md)\n\n## Audits\n\n* [Kudelski Security - October 2022 - gnark-crypto (contracted by Algorand Foundation)](audits/2022-10%20-%20Kudelski%20-%20gnark-crypto.pdf)\n* [Sigma Prime - May 2023 - gnark-crypto KZG (contracted by Ethereum Foundation)](audits/2024-05%20-%20Sigma%20Prime%20-%20kzg.pdf)\n* [Consensys Diligence - June 2023 - gnark PLONK Solidity verifier](https://consensys.io/diligence/audits/2023/06/linea-plonk-verifier/)\n* [LeastAuthority - August 2023 - gnark Groth16 Solidity verifier template (contracted by Worldcoin)](https://leastauthority.com/wp-content/uploads/2023/08/Worldcoin_Groth16_Verifier_in_EVM_Smart_Contract_Final_Audit_Report.pdf)\n* [OpenZeppelin - November 2023 - gnark PLONK Solidity verifier template](https://blog.openzeppelin.com/linea-verifier-audit-1)\n* [ZKSecurity.xyz - May 2024 - gnark standard library](audits/2024-05%20-%20zksecurity%20-%20gnark%20std.pdf)\n* [OpenZeppelin - June 2024 - gnark PLONK prover and verifier](https://blog.openzeppelin.com/linea-prover-audit)\n* [LeastAuthority - September 2024 - gnark general and GKR](audits/2024-09%20-%20Least%20Authority%20-%20arithm%20and%20GKR.pdf)\n* [LeastAuthority - November 2024 - Linea zkEVM](audits/2024-11%20-%20Least%20Authority%20-%20Linea%20zkEVM.pdf)\n\n## Proving schemes and curves\n\nRefer to [Proving schemes and curves] for more details.\n\n`gnark` support the following zk-SNARKs:\n\n- [x] [Groth16](https://eprint.iacr.org/2016/260)\n- [x] [PlonK](https://eprint.iacr.org/2019/953)\n\nwhich can be instantiated with the following curves\n\n- [x] BN254\n- [x] BLS12-381\n- [x] BLS12-377\n- [x] BW6-761\n- [x] BLS24-315\n- [x] BW6-633\n- [x] BLS24-317\n\n### Example\n\nRefer to the [`gnark` User Documentation]\n\nHere is what `x**3 + x + 5 = y` looks like\n\n```golang\npackage main\n\nimport (\n\t\"github.com/consensys/gnark-crypto/ecc\"\n\t\"github.com/consensys/gnark/backend/groth16\"\n\t\"github.com/consensys/gnark/frontend\"\n\t\"github.com/consensys/gnark/frontend/cs/r1cs\"\n)\n\n// CubicCircuit defines a simple circuit\n// x**3 + x + 5 == y\ntype CubicCircuit struct {\n\t// struct tags on a variable is optional\n\t// default uses variable name and secret visibility.\n\tX frontend.Variable `gnark:\"x\"`\n\tY frontend.Variable `gnark:\",public\"`\n}\n\n// Define declares the circuit constraints\n// x**3 + x + 5 == y\nfunc (circuit *CubicCircuit) Define(api frontend.API) error {\n\tx3 := api.Mul(circuit.X, circuit.X, circuit.X)\n\tapi.AssertIsEqual(circuit.Y, api.Add(x3, circuit.X, 5))\n\treturn nil\n}\n\nfunc main() {\n\t// compiles our circuit into a R1CS\n\tvar circuit CubicCircuit\n\tccs, _ := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, \u0026circuit)\n\n\t// groth16 zkSNARK: Setup\n\tpk, vk, _ := groth16.Setup(ccs)\n\n\t// witness definition\n\tassignment := CubicCircuit{X: 3, Y: 35}\n\twitness, _ := frontend.NewWitness(\u0026assignment, ecc.BN254.ScalarField())\n\tpublicWitness, _ := witness.Public()\n\n\t// groth16: Prove \u0026 Verify\n\tproof, _ := groth16.Prove(ccs, pk, witness)\n\tgroth16.Verify(proof, vk, publicWitness)\n}\n\n```\n\n### GPU Support\n\n#### ICICLE Library\n\nThe following schemes and curves support experimental use of Ingonyama's ICICLE GPU library for low level zk-SNARK primitives such as MSM, NTT, and polynomial operations:\n\n- [x] [Groth16](https://eprint.iacr.org/2016/260)\n\ninstantiated with the following curve(s)\n\n- [x] BN254\n\nTo use GPUs, add the `icicle` buildtag to your build/run commands, e.g. `go run -tags=icicle main.go`.\n\nYou can then toggle on or off icicle acceleration by providing the `WithIcicleAcceleration` backend ProverOption:\n\n```go\n    // toggle on\n    proofIci, err := groth16.Prove(ccs, pk, secretWitness, backend.WithIcicleAcceleration())\n    \n    // toggle off\n    proof, err := groth16.Prove(ccs, pk, secretWitness)\n```\n\nFor more information about prerequisites see the [ICICLE repo](https://github.com/ingonyama-zk/icicle-gnark).\n\n## Citing\n\nIf you use `gnark` in your research a citation would be appreciated.\nPlease use the following BibTeX to cite the most recent release.\n\n```bib\n@software{gnark-v0.13.0,\n  author       = {Gautam Botrel and\n                  Thomas Piellard and\n                  Youssef El Housni and\n                  Ivo Kubjas and\n                  Arya Tabaie},\n  title        = {Consensys/gnark: v0.13.0},\n  month        = jun,\n  year         = 2025,\n  publisher    = {Zenodo},\n  version      = {v0.13.0},\n  doi          = {10.5281/zenodo.5819104},\n  url          = {https://doi.org/10.5281/zenodo.5819104}\n}\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our [code of conduct](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Consensys/gnark/tags).\n\n## License\n\nThis project is licensed under the Apache 2 License - see the [LICENSE](LICENSE) file for details\n\n[`gnark` Issues]: https://github.com/Consensys/gnark/issues\n[`gnark` Playground]: https://play.gnark.io\n[`gnark` User Documentation]: https://docs.gnark.consensys.net/\n[GitHub discussions]: https://github.com/Consensys/gnark/discussions\n[Proving schemes and curves]: https://docs.gnark.consensys.net/Concepts/schemes_curves\n[`gnark-announce`]: https://groups.google.com/g/gnark-announce\n[@gnark_team]: https://twitter.com/gnark_team\n[`gnark-crypto`]: https://github.com/Consensys/gnark-crypto\n[`gnark-solidity-checker`]: https://github.com/Consensys/gnark-solidity-checker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConsenSys%2Fgnark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FConsenSys%2Fgnark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConsenSys%2Fgnark/lists"}