README.md

March 18, 2026 Β· View on GitHub

Garaga


Report a Bug - Request a Feature - Ask a Question

CI Status Project license Pull Requests welcome

Exploration_Team

About

State-of-the-art Elliptic Curve tooling and SNARKS verification for Cairo & Starknet 🐺.

Garaga enables efficient elliptic curve operations on Starknet. It achieves state of the art performance by

  • using a dedicated builtin made by Starkware for emulated modular arithmetic
  • using a suite of non-deterministic techniques for extension field multiplication, pairings, and multi scalar multiplication to reduce the number of steps to verify results.

Garaga currently supports:

  • Scalar & Multi-scalar multiplication for any Weirstrass curve, including BN254, BLS12_381, SECP256/R1, and ED25519. You can add the one you need by specifying the curve parameters.
  • Pairing operations for BN254 and BLS12_381.
  • Groth16 smart contract verifiers generators for BN254 and BLS12_381.
  • Noir smart contract verifiers generators for ultra keccak honk flavour.

Architecture overview

Architecture Overview

Garaga consists of a Pythonic backend with Rust bindings and CairoZero / Cairo libraries.

  • The Pythonic backend is here to define emulated modular arithmetic circuits that can be compiled to Cairo or Cairo1 code. It also handles witnesses generation for the non-deterministic computations, smart contract contract generation for a given proof system and elliptic curve, and calldata generation from a given proof.
  • The CairoZero / Starknet interfaces are responsible for composing and calling the circuits, as well as adding all the extra logic needed to make the algorithms work (Fiat-Shamir heuristic, SNARKS verifiers algorithms, etc).

Quickstart : deploying a SNARK verifier on Starknet

Currently, only Groth16 on BN254 and BLS12_381 is supported with automatic support for json files coming from SnarkJS and Gnark.

  1. Create a new directory for you project, and bring the jsons files for verification key, proof file and public inputs inside it.

  2. Install the garaga pip package with pip install garaga. Python 3.10+ is required and a virtual environment is recommended. Enter garaga in your terminal to get started.

  3. Run the garaga gen command in your terminal to generate the code for the SNARK verifier given your verification key.

  4. Edit the generated smart contract to fit the needs of your dapp.

  5. Create an environment file .secrets following the .secrets.template file in the root of this repository, containing the Starkner RPC url, your account address, and the private key.

  6. Run the garaga declare command in your terminal to declare the smart contract on Starknet and obtain its class hash. Note that this is an expensive operation.

  7. Run the garaga deploy command in your terminal using the class hash obtained in the previous step to get the contract address.

  8. Run the garaga verify-onchain command in your terminal using the contract address, the verification key, the proof and the public inputs to verify the proof against the SNARK verifier contract.

For more details, please refer to the documentation.

Developer setup

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:

  • Rust - Required for building the garaga_rs extension.
  • Scarb 2.16.1 - The Cairo package manager. Comes with Cairo inside.

Python 3.10-3.14 is used for development but does not need to be installed manually β€” make setup will auto-install it via uv if it's not already available. Make sure you have GMP installed for the fastecdsa python package. See here for linux and here for macos.

Optionally :
  • pprof - A tool for visualization and analysis of profiling data. Requires Go.
  • graphviz - Necessary for generating graphical representations of profiling data.

Setup

Clone the repository and run the setup command from the root:

make setup

This will automatically:

  • Install uv if not present
  • Install Python 3.14 via uv if no compatible version (3.10-3.14) is found
  • Create a virtual environment and install all dependencies
  • Build the Rust extension

The setup is idempotent β€” running it again will update dependencies without recreating the virtual environment.

Before proceeding, activate the virtual environment by running source venv/bin/activate.

Cairo Benchmarks

πŸ“Š Click on any section below to expand and view detailed benchmark tables with test performance metrics.

Note: Click on the test name to view the profiling image. Resources shown in the table for contracts include extra costs due to the foundry logic. Check the profile file for more details.

contracts
└── groth16_example_bls12_381_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96PoseidonAdd ModMul ModSierra Gas
test_verify_groth16_proof_bls12_381353,52710,97290,2805867,50610,86849,754,798
└── groth16_example_bn254_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96PoseidonAdd ModMul ModSierra Gas
test_verify_groth16_proof_bn254228,5579,78567,1495095,4018,75434,080,559
└── noir_ultra_keccak_honk_example_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96BitwisePoseidonAdd ModMul ModSierra Gas
test_verify_ultra_keccak_honk_proof1,213,03165,539412,6563,18046145,75643,585187,929,077
└── noir_ultra_keccak_zk_honk_example_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96BitwisePoseidonAdd ModMul ModSierra Gas
test_verify_ultra_keccak_zk_honk_proof1,306,04970,398451,6513,47646149,91447,993203,546,067
└── noir_ultra_starknet_honk_example_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96PoseidonAdd ModMul ModSierra Gas
test_verify_ultra_starknet_honk_proof1,127,87161,433412,52299245,74243,569177,512,050
└── noir_ultra_starknet_zk_honk_example_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96PoseidonAdd ModMul ModSierra Gas
test_verify_ultra_starknet_zk_honk_proof1,221,36066,173451,5761,04449,91147,987193,032,648
└── risc0_verifier_bn254_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96BitwisePoseidonAdd ModMul ModSierra Gas
test_verify_r0_groth16_proof_bn254264,54512,06974,8966,6985096,3039,54142,860,813
└── sp1_verifier_bn254_integrationtest::test_contract
Test NameStepsRange CheckRange Check 96BitwisePoseidonAdd ModMul ModSierra Gas
test_verify_sp1_groth16_proof_bn254244,68011,12775,0272,2305096,3149,55538,221,851
garaga
└── apps
β”‚ └── drand::tests
Test NameStepsRange CheckRange Check 96BitwiseAdd ModMul ModSierra Gas
test_decrypt_at_round289,4473,919385,79014,50657,32028,87189,901,952
test_hash_to_curve26,5269714,55912,28942260210,601,029
test_hash_to_two_bls_felts23,5579007412,289289,592,623
test_drand_quicknet_public_key12,8616814,86401,4901,6743,477,040
test_isogeny1,84458878051111316,402
test_map_to_curve647112640639105,190
β”‚ └── noir
β”‚ β”‚ └── honk_transcript::tests
Test NameStepsRange CheckBitwisePoseidonSierra Gas
test_transcript_keccak71,0845,0353,18019,315,281
test_transcript_starknet19,7581,10305322,314,222
β”‚ β”‚ └── zk_honk_transcript::tests
Test NameStepsRange CheckBitwisePoseidonSierra Gas
test_zk_transcript_keccak73,3925,2413,47619,733,069
test_zk_transcript_starknet21,1731,18505842,486,994
β”‚ └── risc0::risc0_utils_tests
Test NameStepsRange CheckBitwiseSierra Gas
test_receipt_claim11,1174335,5914,401,563
test_output_digest4,4241712,2301,754,460
β”‚ └── sp1::tests
Test NameStepsRange CheckSierra Gas
test_convert_u32_to_u1285836,010
└── crypto::mmr::tests
Test NameStepsRange CheckSierra Gas
test_trailing_ones4415147,670
└── ec::ec_ops_g2::tests
Test NameStepsRange CheckRange Check 96Add ModMul ModSierra Gas
test_ec_mul_g2105,0601,07487,6648,5519,75523,349,114
└── hashes::poseidon_bn254::tests
Test NameStepsRange CheckRange Check 96Add ModMul ModSierra Gas
test_run_poseidon_grumpkin_circuit_19,9133276,3933539192,008,464
└── tests
β”‚ └── autogenerated
β”‚ β”‚ └── ecdsa_tests
Test NameStepsRange CheckRange Check 96Add ModMul ModSierra Gas
test_ecdsa_SECP256R114,0991,07220,0222,3672,1844,469,718
test_ecdsa_SECP256K118,7232,08215,6291,8101,5924,271,132
β”‚ β”‚ └── eddsa_tests
Test NameStepsRange CheckRange Check 96BitwiseAdd ModMul ModSierra Gas
test_eddsa_32_64B88,02513,78620,7623,2882,4122,27614,776,560
test_eddsa_16_32B52,3917,64320,8401,6562,4182,2849,842,274
test_eddsa_0_0B51,8147,54920,8651,6562,4192,2869,780,832
β”‚ β”‚ └── msm_tests
Test NameStepsRange CheckRange Check 96Add ModMul ModSierra Gas
test_msm_SECP256R1_3P20,1151,57629,8353,5463,2526,572,368
test_msm_SECP256K1_3P26,9543,08723,1942,7072,3596,257,800
test_msm_SECP256R1_2P13,4651,05319,8652,3632,1664,384,404
test_msm_SECP256K1_2P17,9192,06115,3691,7991,5644,155,260
test_msm_SECP256R1_1P6,9915309,9451,1821,0842,219,716
test_msm_SECP256K1_1P9,2211,0377,6979007832,105,654
β”‚ β”‚ └── pairing_tests
Test NameStepsRange CheckRange Check 96PoseidonAdd ModMul ModSierra Gas
test_BN254_mpcheck_3P_2F_with_extra_miller_loop_result59,91647259,0085094,4697,92215,391,765
test_BLS12_381_mpcheck_3P_2F_with_extra_miller_loop_result54,31635644,8855863,4825,79112,556,430
test_BN254_mpcheck_2P_2F47,93039333,0474601,7314,66510,112,792
test_BLS12_381_mpcheck_2P_2F45,13230825,2505441,4203,3408,559,824
β”‚ β”‚ └── schnorr_tests
Test NameStepsRange CheckRange Check 96Add ModMul ModSierra Gas
test_schnorr_SECP256K118,3212,08215,5121,8081,5804,216,672
β”‚ β”‚ └── tower_pairing_tests
Test NameStepsRange CheckRange Check 96Add ModMul ModSierra Gas
test_tower_pairing_BN254_3P268,869474626,25594,55550,514114,248,466
test_tower_pairing_BLS12_381_3P248,951556538,32186,18737,84997,763,802
test_tower_pairing_BN254_2P219,367398486,54873,49438,66189,466,112
test_tower_pairing_BLS12_381_2P207,121493422,51667,91128,92677,498,340
test_tower_pairing_BN254_1P169,865322346,84152,43326,80864,683,758
test_tower_pairing_BLS12_381_1P165,291430306,71149,63520,00357,232,878
test_tower_final_exp_BN254120,363246207,13431,37214,95539,901,404
test_tower_final_exp_BLS12_381123,509367190,90631,35911,08036,972,216
β”‚ └── calldata_tests
Test NameStepsRange CheckSierra Gas
test_deserialize_full_proof_with_hints_bls12_38122,2724,7142,557,180
β”‚ └── sha512_tests
Test NameStepsRange CheckBitwiseSierra Gas
test_sha512_lorem_ipsum102,85618,1694,90414,416,462
test_size_zero37,5796,4041,6405,162,300
test_sha512_size_one37,5646,4031,6405,160,730
└── utils::neg_3::tests
Test NameStepsRange CheckSierra Gas
test_scalar_to_epns6,103928675,260
test_scalar_to_epns_single1,940297214,790

πŸ”„ To regenerate these benchmarks: Run make profile-test from the project root.

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

πŸ’»
Rodrigo Ferreira
Rodrigo Ferreira

πŸ’»
Luiz Vasconcelos JΓΊnior
Luiz Vasconcelos JΓΊnior

πŸ’»
Shramee Srivastav
Shramee Srivastav

πŸ’»
Andrija Novakovic
Andrija Novakovic

πŸ’»
Liam Eagen
Liam Eagen

πŸ’»
Paul Etscheit
Paul Etscheit

πŸ’»
stefanMadzharov
stefanMadzharov

πŸ’»
Add your contributions

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