gnark-crypto

gnark-crypto provides elliptic curve and pairing-based cryptography on BN, BLS12, BLS24 and BW6 curves. It also provides various algorithms (algebra, crypto) of particular interest to zero knowledge proof systems.

https://github.com/consensys/gnark-crypto

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 6 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary

Keywords

biginteger bls12-377 bls12-381 bn254 crypto cryptography ecc eddsa elliptic-curves finite-field-arithmetic fri go golang hash-to-curve mimc pairing snark zkp zksnark

Keywords from Contributors

polynomial flux mesh energy-system renewable-energy photovoltaics renewables the-human-brain finite-fields pairings
Last synced: 6 months ago · JSON representation ·

Repository

gnark-crypto provides elliptic curve and pairing-based cryptography on BN, BLS12, BLS24 and BW6 curves. It also provides various algorithms (algebra, crypto) of particular interest to zero knowledge proof systems.

Basic Info
  • Host: GitHub
  • Owner: Consensys
  • License: apache-2.0
  • Language: Go
  • Default Branch: master
  • Homepage:
  • Size: 38.3 MB
Statistics
  • Stars: 560
  • Watchers: 13
  • Forks: 214
  • Open Issues: 66
  • Releases: 24
Topics
biginteger bls12-377 bls12-381 bn254 crypto cryptography ecc eddsa elliptic-curves finite-field-arithmetic fri go golang hash-to-curve mimc pairing snark zkp zksnark
Created almost 6 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

gnark-crypto

Twitter URL License Go Report Card PkgGoDev DOI

gnark-crypto provides efficient cryptographic primitives, in Go:

gnark-crypto is actively developed and maintained by the team (gnark@consensys.net | HackMD) behind:

Warning

gnark-crypto is not fully audited and is provided as-is, use at your own risk. In particular, gnark-crypto makes no security guarantees such as constant time implementation or side-channel attack resistance.

To report a security bug, please refer to gnark Security Policy.

gnark-crypto packages are optimized for 64bits architectures (x86 amd64) and tested on Unix (Linux / macOS).

Audits

See list of audits for gnark and gnark-crypto

Getting started

Go version

gnark-crypto is tested with the last 2 major releases of Go (currently 1.19 and 1.20).

Install gnark-crypto

bash go get github.com/Consensys/gnark-crypto

Note that if you use go modules, in go.mod the module path is case sensitive (use consensys and not ConsenSys).

Development

Most (but not all) of the code is generated from the templates in internal/generator.

The generated code contains little to no interfaces and is strongly typed with a field (generated by the gnark-crypto/field package). The two main factors driving this design choice are:

  1. Performance: gnark-crypto algorithms manipulate millions (if not billions) of field elements. Interface indirection at this level, plus garbage collection indexing takes a heavy toll on perf.
  2. Need to derive (mostly) identical code for various moduli and curves, with consistent APIs. Generics introduce significant performance overhead and are not yet suited for high performance computing.

To regenerate the files, see internal/generator/main.go. Run:

bash go generate ./...

Benchmarks

Benchmarking pairing-friendly elliptic curves libraries

The libraries are implemented in different languages and some use more assembly code than others. Besides the different algorithmic and software optimizations used across, it should be noted also that some libraries target constant-time implementation for some operations making it de facto slower. However, it can be clear that consensys/gnark-crypto is one of the fastest pairing-friendly elliptic curve libraries to be used in zkp projects with different curves.

Citing

If you use gnark-crypto in your research a citation would be appreciated. Please use the following BibTeX to cite the most recent release.

bib @software{gnark-crypto-v0.15, author = {Gautam Botrel and Thomas Piellard and Youssef El Housni and Arya Tabaie and Gus Gutoski and Ivo Kubjas}, title = {Consensys/gnark-crypto: v0.15.0}, month = jan, year = 2025, publisher = {Zenodo}, version = {v0.15.0}, doi = {10.5281/zenodo.5815453}, url = {https://doi.org/10.5281/zenodo.5815453} }

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache 2 License - see the LICENSE file for details.

Owner

  • Name: Consensys
  • Login: Consensys
  • Kind: organization
  • Email: info@consensys.net
  • Location: The Blockchain

Consensys is the software engineering leader of the blockchain space. Our full-stack Ethereum products help developers build next-generation networks.

Citation (CITATION.bib)

@software{gnark-crypto-v0.15,
  author       = {Gautam Botrel and
                  Thomas Piellard and
                  Youssef El Housni and
                  Arya Tabaie and
                  Gus Gutoski and
                  Ivo Kubjas},
  title        = {Consensys/gnark-crypto: v0.15.0},
  month        = jan,
  year         = 2025,
  publisher    = {Zenodo},
  version      = {v0.15.0},
  doi          = {10.5281/zenodo.5815453},
  url          = {https://doi.org/10.5281/zenodo.5815453}
}

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 2,063
  • Total Committers: 30
  • Avg Commits per committer: 68.767
  • Development Distribution Score (DDS): 0.722
Past Year
  • Commits: 170
  • Committers: 18
  • Avg Commits per committer: 9.444
  • Development Distribution Score (DDS): 0.759
Top Committers
Name Email Commits
Gautam Botrel g****l@g****m 573
Arya Tabaie a****e@g****m 479
Youssef El Housni y****1@g****m 417
Thomas Piellard t****d@c****t 374
Gus Gutoski g****i@p****m 99
Ivo Kubjas i****s@c****t 57
AlexandreBelling a****8@g****m 17
Ignacio Hagopian j****y@g****m 12
Justin Traglia 9****a 8
dependabot[bot] 4****] 3
SherLzp l****r@g****m 2
Ömer Faruk IRMAK o****k@g****m 2
zhiqiangxu 6****0@q****m 2
Hussein Ait-Lahcen h****n@g****m 2
omahs 7****s 1
leopardracer 1****r 1
leo l****6@g****m 1
feltroid Prime 9****e 1
drawdrop c****s@i****m 1
cuibuwei 1****i 1
ZhengXingRu z****u@y****t 1
Romashka c****7@g****m 1
Ragnar r****k@g****m 1
Ocenka t****1@g****m 1
Mehmet Berat Öztürk 7****1 1
Gavin 3****U 1
Devkuni 1****a 1
Ahmet Yasin Alp 1****p 1
Anshul Yadav 5****u 1
Antonio Sanso a****o@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 81
  • Total pull requests: 426
  • Average time to close issues: 7 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 29
  • Total pull request authors: 68
  • Average comments per issue: 1.22
  • Average comments per pull request: 0.74
  • Merged pull requests: 267
  • Bot issues: 0
  • Bot pull requests: 4
Past Year
  • Issues: 18
  • Pull requests: 275
  • Average time to close issues: 5 days
  • Average time to close pull requests: 7 days
  • Issue authors: 9
  • Pull request authors: 52
  • Average comments per issue: 0.83
  • Average comments per pull request: 0.67
  • Merged pull requests: 151
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • gbotrel (20)
  • ivokub (9)
  • ThomasPiellard (9)
  • yelhousni (9)
  • hussein-aitlahcen (3)
  • Tabaie (3)
  • omerfirmak (2)
  • weikengchen (2)
  • Teja2045 (2)
  • MariusVanDerWijden (2)
  • holiman (2)
  • jbsv (1)
  • jannotti (1)
  • Soleimani193 (1)
  • Nidacoke (1)
Pull Request Authors
  • gbotrel (105)
  • yelhousni (73)
  • Tabaie (54)
  • ThomasPiellard (33)
  • ivokub (33)
  • AlexandreBelling (13)
  • VolodymyrBg (12)
  • crStiv (7)
  • jtraglia (7)
  • YaoJGalteland (6)
  • Pricstas (4)
  • Bilogweb3 (4)
  • Olexandr88 (4)
  • hussein-aitlahcen (3)
  • dependabot[bot] (3)
Top Labels
Issue Labels
perf (19) consolidate (15) zk-evm (8) bug (7) good first issue (6) cleanup (5) new feature (4) sec (3) question (2) P1: High (1) P3: Low (1) typo (1)
Pull Request Labels
perf (36) typo (31) cleanup (22) new feature (22) consolidate (22) bug (19) zk-evm (11) not-accepted (8) geth (4) P1: High (3) dependencies (3) P2: Medium (2) go (1)

Packages

  • Total packages: 4
  • Total downloads: unknown
  • Total docker downloads: 346,591,426
  • Total dependent packages: 2,360
    (may contain duplicates)
  • Total dependent repositories: 2,623
    (may contain duplicates)
  • Total versions: 152
  • Total advisories: 1
proxy.golang.org: github.com/consensys/gnark-crypto
  • Versions: 38
  • Dependent Packages: 2,360
  • Dependent Repositories: 2,623
  • Docker Downloads: 346,591,426
Rankings
Dependent packages count: 0.1%
Dependent repos count: 0.2%
Docker downloads count: 0.2%
Average: 1.3%
Forks count: 2.8%
Stargazers count: 3.2%
Last synced: 6 months ago
proxy.golang.org: github.com/ConsenSys/gnark-crypto
  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 2.1%
Stargazers count: 2.2%
Average: 5.2%
Dependent packages count: 7.0%
Dependent repos count: 9.3%
Last synced: 6 months ago
proxy.golang.org: github.com/consensys/gnark-CRYPTO
  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.9%
Average: 6.1%
Dependent repos count: 6.3%
Last synced: 6 months ago
proxy.golang.org: github.com/consenSys/gnark-crypto
  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 6 months ago

Dependencies

go.mod go
  • github.com/consensys/bavard v0.1.12
  • github.com/davecgh/go-spew v1.1.1
  • github.com/inconshreveable/mousetrap v1.0.0
  • github.com/leanovate/gopter v0.2.9
  • github.com/mmcloughlin/addchain v0.4.0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/spf13/cobra v1.4.0
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/testify v1.7.1
  • golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064
  • golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
  • gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
  • rsc.io/tmplfunc v0.0.3
go.sum go
  • github.com/consensys/bavard v0.1.12
  • github.com/cpuguy83/go-md2man/v2 v2.0.1
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/google/subcommands v1.2.0
  • github.com/inconshreveable/mousetrap v1.0.0
  • github.com/leanovate/gopter v0.2.9
  • github.com/mmcloughlin/addchain v0.4.0
  • github.com/mmcloughlin/profile v0.1.1
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/spf13/cobra v1.4.0
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/testify v1.7.1
  • golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064
  • golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2
  • golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
  • golang.org/x/sys v0.0.0-20210423082822-04245dca01da
  • golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
  • golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8
  • golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
  • golang.org/x/text v0.3.6
  • golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v2 v2.4.0
  • gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
  • gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
  • rsc.io/tmplfunc v0.0.3
.github/workflows/pr.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v4 composite
  • golangci/golangci-lint-action v3 composite
  • gotesttools/gotestfmt-action v2 composite
  • slackapi/slack-github-action v1.24.0 composite
  • thollander/actions-comment-pull-request v2 composite
.github/workflows/push.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v4 composite
  • golangci/golangci-lint-action v3 composite
  • gotesttools/gotestfmt-action v2 composite
  • slackapi/slack-github-action v1.24.0 composite