Skip to content

lauraevz6y70/gnark-crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gnark-crypto

gnark-crypto-cmd — Interactive CLI for Consensys gnark-crypto library featuring elliptic curve cryptography (BN254, BLS12-381, BLS24, BW6), zero-knowledge proof primitives, FFT/KZG/MiMC/EdDSA operations, Go code generation, benchmarks, and BibTeX citation export

  ______   _______    ______    ______   __    __   ______   __
 /      \ /       \  /      \  /      \ /  |  /  | /      \ /  |
/$$$$$$  |$$$$$$$  | $$$$$$  |/$$$$$$  |$$ |  $$ |/$$$$$$  |$$ |
$$ |  $$ |$$ |  $$ | /    $$ |$$ |  $$/ $$ |  $$ |$$ |  $$ |$$ |
$$ \__$$ |$$ |  $$ |/$$$$$$$ |$$ |      $$ \__$$ |$$ |__$$ |$$ |
$$    $$ |$$ |  $$ |$$    $$ |$$ |      $$    $$ |$$    $$/ $$ |
 $$$$$$$ |$$/   $$/  $$$$$$$/ $$/        $$$$$$$ |$$$$$$$/  $$/

gnark-crypto-cmd

Interactive CLI for Consensys gnark-crypto — elliptic curve & pairing-based cryptography in Go

License Python Go gnark-crypto

Manage dependencies, settings, benchmarks, and citations — all from one terminal.

FeaturesGetting StartedConfigurationUsageFAQ


Official Links

Resource URL
gnark-crypto https://github.com/Consensys/gnark-crypto
gnark (ZK framework) https://github.com/Consensys/gnark
Consensys https://consensys.io
Documentation https://docs.gnark.consensys.io
pkg.go.dev https://pkg.go.dev/github.com/consensys/gnark-crypto
Benchmarks (HackMD) https://hackmd.io/@gnark/eccbench
Security Policy https://github.com/Consensys/gnark/blob/master/SECURITY.md

Features

Feature Status
Install gnark-crypto via go get
Settings & configuration viewer
About & project info
Generate code from templates
Benchmark information
BibTeX citation export
Feature Status
Version info display
Security notice & warnings
Rich terminal UI (panels, tables)
Cross-platform (Windows/Linux/macOS)
Virtual env auto-setup (run.bat)
Curves: BN254, BLS12-381, BLS24, BW6

Getting Started

Prerequisites

Requirement Version Notes
Python 3.8+ For CLI runtime
Go 1.19+ For gnark-crypto operations
rich ≥13.0.0 Terminal formatting

Install

# Clone or navigate to the project
cd gnark-crypto-cmd

# Install Python dependencies
pip install -r requirements.txt

# (Optional) Create virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# Unix:
source venv/bin/activate

# Run the CLI
python main.py

Windows users: Use run.bat — it creates a venv and installs deps automatically.


Configuration

The CLI reads no external config file. Settings are displayed in-app. Key values:

Setting Value Description
GNARK_MODULE github.com/Consensys/gnark-crypto Go module path (case-sensitive: use Consensys)
Go Version 1.19+ Tested with last 2 major releases
Architecture x86 amd64 Optimized for 64-bit
Platform Unix (Linux/macOS) Primary testing target

Example go.mod snippet (for projects using gnark-crypto):

module your-project

go 1.21

require github.com/Consensys/gnark-crypto v0.15.0

Supported curves: bn254, bls12-381, bls24-317, bls12-377/bw6-761, bls24-315/bw6-633


Usage

┌─────────────────────────────────────────────────────────────┐
│                         Menu                                 │
├─────┬───────────────────────────────────────────────────────┤
│  1  │ Install Dependencies                                   │
│  2  │ Settings                                               │
│  3  │ About                                                  │
│  4  │ Generate Code                                          │
│  5  │ Benchmark Info                                         │
│  6  │ Citing (BibTeX)                                        │
│  7  │ Version Info                                           │
│  8  │ Security Notice                                        │
│  0  │ Exit                                                   │
└─────┴───────────────────────────────────────────────────────┘

Select option [0]: 1
Option Action
1 Runs go get github.com/Consensys/gnark-crypto
2 Shows configuration table and supported curves
3 Displays project description and hashtags
4 Runs go generate ./... from gnark-crypto root
5 Shows benchmark info (pairing-friendly curve libs)
6 Prints BibTeX citation for research papers
7 Shows SemVer info and security reporting link
8 Displays security disclaimer
0 Exit

Project Structure

gnark-crypto-cmd/
├── main.py              # CLI entry point
├── run.bat              # Windows launcher (venv + pip + run)
├── requirements.txt     # Python deps (rich)
├── README.md
├── tags.txt
└── about/
    ├── project.txt      # Project hashtags
    └── hashtags.txt     # Extended topic tags

FAQ

Why use this CLI instead of running Go commands directly?

The CLI provides a single entry point for common gnark-crypto tasks: installing the library, viewing settings, generating code, and accessing benchmark/citation info. Useful for newcomers or when you want a quick reference without leaving the terminal.

Does this CLI modify gnark-crypto source code?

No. It only invokes standard Go commands (go get, go generate). Option 4 runs go generate ./... from the parent gnark-crypto directory — ensure you run the CLI from within the gnark-crypto repo layout for that to work.

What is gnark-crypto used for?

gnark-crypto provides elliptic curve and pairing-based cryptography on BN254, BLS12-381, BLS24, and BW6 curves. It powers zero-knowledge proof systems (zk-SNARKs) via gnark and other ZKP projects. Includes FFT, FRI, KZG, MiMC, EdDSA, and more.

Is gnark-crypto audited?

gnark-crypto has been partially audited (e.g., Kudelski 2022 for bn254 and bls12-381). It is not fully audited and is provided as-is. See the audits list for details.

Why does go.mod require "Consensys" (exact casing)?

Go module paths are case-sensitive. The canonical path is github.com/Consensys/gnark-crypto — using ConsenSys or other variants will cause resolution errors.

Can I use this on Windows?

Yes. Use run.bat for automatic venv creation and dependency installation. The CLI works on Windows, Linux, and macOS. gnark-crypto itself is primarily tested on Unix.

How do I cite gnark-crypto in a paper?

Use option 6 (Citing) to display the BibTeX entry. The current citation is for v0.15.0 (Zenodo DOI: 10.5281/zenodo.5815453).


Disclaimer

This project is for educational and research purposes. gnark-crypto is not fully audited and makes no guarantees regarding constant-time implementation or side-channel resistance. Use at your own risk. For production ZK systems, conduct your own security review and follow gnark Security Policy for vulnerability reporting.


If this tool helped you, consider starring the repo.

ETH donations: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1

About

gnark-crypto-cmd — Interactive CLI for Consensys gnark-crypto library featuring elliptic curve cryptography (BN254, BLS12-381, BLS24, BW6), zero-knowledge proof primitives, FFT/KZG/MiMC/EdDSA operations, Go code generation, benchmarks, and BibTeX citation export

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors