Garaga Save

Efficient pairing library, written in Cairo 🐺.

Project README

GitHub Workflow Status Project license Pull Requests welcome

Exploration_Team

About

Efficient pairing library using polynomial representation of field elements, written in Cairo 🐺.

Garaga can enable efficient pairing operations in StarkNet, by using polynomial representation of field elements. This is a work in progress, and is not yet ready for production use.

Here are some interesting use cases enabled by Garaga:

  • SNARKs on StarkNet: Groth16 and Plonk (in the near future).
  • KZG cryptographic commitment scheme.
  • Identity-based encryption schemes.
  • Attribute-based encryption schemes.
  • BLS (Boneh–Lynn–Shacham) Digital Signature scheme.

Architecture overview

In progress.

Getting Started

To get started with Garaga, you'll need to have some tools and dependencies installed. Here's everything you need:

Prerequisites

Ensure you have the following installed:

  • Python 3.10 - The core language used for development.
  • Go - Required for profiling and testing.
  • pprof - A tool for visualization and analysis of profiling data.
  • graphviz - Necessary for generating graphical representations of profiling data.

Setup

Once you have the prerequisites installed, you can set up your development environment with the following steps:

make setup

At this point, you should have everything you need to start developing with Garaga. Before proceeding, make sure to activate the virtual environment by running source venv/bin/activate.

Compile & Run .cairo files (interactive script!)

make run

Benchmarks

OP Weight in steps
MULMOD 8
ADDMOD 4
ASSERT_EQ 2
RLC 28
POSEIDON BN254 14
POSEIDON BLS12_381 17
circuit MULMOD ADDMOD ASSERT_EQ POSEIDON RLC ~steps
Double Step BLS12_381 22 9 2 0 0 216
Double Step BN254 24 11 2 0 0 240
Fp6 SQUARE_TORUS 12 16 0 7 1 300
Double-and-Add Step BLS12_381 32 13 4 0 0 316
Triple Step 36 14 4 0 0 352
Double-and-Add Step BN254 36 17 4 0 0 364
Mul L by L 18 8 0 11 1 380
Fp12 SQUARE 25 11 0 13 1 480
Mul LL by L 26 13 0 13 1 496
Mul by L 28 15 0 13 1 520
Mul LL by LL 32 18 0 13 1 564
Mul by LL 34 20 0 13 1 588
Fp12 MUL 36 22 0 13 1 612
Fp6 MUL_TORUS 36 34 0 13 2 688
Miller n=1 BLS12_381 4934 3995 137 1580 131 86254
Miller n=1 BN254 5982 4801 177 1810 153 97038
Final Exp BN254 4686 6059 3 1931 317 97640
Final Exp BLS12_381 5128 7117 3 2333 384 119911
Miller n=2 BLS12_381 8026 6235 273 2276 199 133958
Miller n=2 BN254 10128 7855 353 2740 241 158258
Miller n=3 BLS12_381 11350 8707 409 3088 267 186418
MultiPairing n=1 BN254 10668 10860 180 3741 470 194678
MultiPairing n=1 BLS12_381 10062 11112 140 3913 515 206165
Miller n=3 BN254 14450 11085 529 3758 329 222822
BLS12FinalExp Fp12 Karabina No EXTF Trick 7774 43002 0 0 0 234200
MultiPairing n=2 BLS12_381 13154 13352 276 4609 583 253869
MultiPairing n=2 BN254 14814 13914 356 4671 558 255898
MultiPairing n=3 BLS12_381 16478 15824 412 5421 651 306329
MultiPairing n=3 BN254 19136 17144 532 5689 646 320462
Final Exp BN254 Final Exp BLS12_381 Miller n=1 BLS12_381 Miller n=1 BN254 Miller n=2 BLS12_381 Miller n=2 BN254 Miller n=3 BLS12_381 Miller n=3 BN254
EXTF_SQUARE 0 0 63 65 63 65 63 65
SQUARE_TORUS 189 315 0 0 0 0 0 0
MUL_TORUS 62 33 0 0 0 0 0 0
EXTF_MUL_DENSE 62 33 0 0 5 22 63 66
Double Step 0 0 58 44 116 88 174 132
Double-and-Add Step 0 0 4 21 8 42 12 63
Triple Step 0 0 1 0 2 0 3 0
MUL_L_BY_L 0 0 5 22 68 88 73 110
MUL_LL_BY_LL 0 0 0 0 5 22 5 23
MUL_LL_BY_L 0 0 0 0 0 0 58 44
MUL_BY_L 0 0 58 44 0 0 0 0
MUL_BY_LL 0 0 5 22 58 44 5 21

Support & How to Contribute

We warmly welcome contributions and support from the community! Here's how you can help Garaga grow and improve:

Reporting Issues & Requesting Features

  • Spot a bug? Have a feature request? Check out our issues page to see if it's already been reported or to open a new issue.

Contributing to Garaga

  • Interested in contributing? Please take a moment to read our contribution guidelines for details on how to get started. Your contributions make the open-source community an incredible place for learning, inspiration, and creation.

Showing Support

  • Love Garaga? Give us a star on GitHub to show your support.
  • Spread the word: Share your excitement about Garaga on social platforms like Twitter, Dev.to, Medium, or your personal blog.
  • Join the conversation: Connect with us and other Garaga enthusiasts on our Telegram group.

Every contribution, whether it's code, feedback, or spreading the word, greatly benefits everyone and is deeply appreciated. Thank you for being a part of Garaga's journey!

Security

Garaga follows good practices of security, but 100% security cannot be assured. Garaga is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

License

This project is licensed under the MIT license.

See LICENSE for more information.

Acknowledgements

Resources

Note: This list is not exhaustive, and is not intended to be.

Contributors

For a full list of all authors and contributors, see the contributors page.

Thanks goes to these wonderful people (emoji key):

Feltroid Prime
Feltroid Prime

💻
Abdel @ StarkWare
Abdel @ StarkWare

💻
Tarik K.
Tarik K.

💻
Bachir Arif
Bachir Arif

💻
Renaud Dubois
Renaud Dubois

💻
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

Open Source Agenda is not affiliated with "Garaga" Project. README Source: keep-starknet-strange/garaga

Open Source Agenda Badge

Open Source Agenda Rating