{"id":19362664,"url":"https://github.com/imdea-software/legosnark","last_synced_at":"2025-07-07T04:02:07.477Z","repository":{"id":79163369,"uuid":"194847707","full_name":"imdea-software/legosnark","owner":"imdea-software","description":"C++ codebase for highly composable zkSNARKs with commit-and-prove capabilities.","archived":false,"fork":false,"pushed_at":"2020-10-08T20:35:29.000Z","size":57,"stargazers_count":39,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-27T10:05:36.334Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/imdea-software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-02T11:10:42.000Z","updated_at":"2025-04-29T07:05:42.000Z","dependencies_parsed_at":"2023-06-29T18:15:12.168Z","dependency_job_id":null,"html_url":"https://github.com/imdea-software/legosnark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imdea-software/legosnark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imdea-software%2Flegosnark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imdea-software%2Flegosnark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imdea-software%2Flegosnark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imdea-software%2Flegosnark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imdea-software","download_url":"https://codeload.github.com/imdea-software/legosnark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imdea-software%2Flegosnark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262235780,"owners_count":23279566,"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":[],"created_at":"2024-11-10T07:29:51.610Z","updated_at":"2025-06-27T10:06:57.199Z","avatar_url":"https://github.com/imdea-software.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eLegoSNARK\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003eComposable Commit-and-Prove zkSNARKs\u003c/strong\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n   :envelope:  + \u0026#x1F9F1; + :wrench:  \u0026#8594; \u003ccode\u003ezk\u003c/code\u003e\u0026#129416;\n\u003c/div\u003e\n\n\u003cdiv align=\"center\" \u003e\n   \u003csub\u003ecommitments, gadgets and a framework for commit-and-prove zkSNARKs\u003c/sub\u003e\n\u003c/div\u003e\n\n\n\n\u003cbr/\u003e\n\nThis codebase is part of the [LegoSNARK paper](https://eprint.iacr.org/2019/142.pdf).\n\n**What this codebase includes:** example and benchmark implementations in C++17 for some of the schemes in the LegoSNARK paper (plus others, e.g. multivariate polynomial commitments, algorithms for multilinear extensions, a product scheme from [eprint:2014/396](https://eprint.iacr.org/2014/396.pdf)).\n\n**What this codebase is not:** it is not for production use; it is not extensively tested; it is not a full-fledged API or EDSL* for commit-and-prove SNARKs.\n\n\u003csup\u003e(*We are still considering an EDSL for commit-and-prove but moved  our focus from C++  to Rust as an implementation language as we found the latter to be a superior match)\u003c/sup\u003e\n\n#### Looking for LegoGroth16?\nIf you are looking for LegoGroth16, the commit-and-prove version of Groth16, you can find a Rust implementation [here](https://github.com/kobigurk/legogro16).\n\n\n## Overview\n\nThis repo includes commit-and-prove gadgets for the following relations:\n- **matrix multiplication** (CPmmp in paper): \u003ccode\u003e[src/examples/matrixsc.cc](src/examples/matrixsc.cc)\u003c/code\u003e\n- **generalized sumcheck** (CPsc in paper): \u003ccode\u003e[src/gadgets/sumcheck.h](src/gadgets/sumcheck.h)\u003c/code\u003e\n- **\"Linking\" Pedersen commitments to vectors** in different bases, i.e. showing that they have the same opening (CPlink in paper): \u003ccode\u003e[src/examples/cplink.cc](src/examples/cplink.cc)\u003c/code\u003e\n- **Hadamard product** (CPhad in paper): \u003ccode\u003e[src/gadgets/hadamardsc.h](src/gadgets/hadamardsc.h)\u003c/code\u003e\n\u003c!-- - **general arithmetic circuits** --\u003e\n\nIt also includes code for:\n- **multivariate polynomial commitments** (CPpoly in paper, partly based on an implementation of the scheme in [vSQL](https://web.eecs.umich.edu/~genkin/papers/vsql.pdf)  by Yupeng Zhang): \u003ccode\u003e[src/gadgets/poly.h](src/gadgets/poly.h)\u003c/code\u003e\n- an **additional Hadamard product** based on the scheme in [Lipmaa's Commit-and-Prove paper](https://eprint.iacr.org/2014/396.pdf): \u003ccode\u003e[src/gadgets/lipmaa.h](src/gadgets/lipmaa.h)\u003c/code\u003e\n- an **R1CS for matrix multiplication**: \u003ccode\u003e[src/examples/legogrothmatrix.cc](src/examples/legogrothmatrix.cc)\u003c/code\u003e\n\n\n\n## Setup and Building Instructions\n\nFirst, install the libraries and utilities required by libsnark and legosnark (see [here](https://github.com/scipr-lab/libsnark) for more detailed requirements). On several Ubuntu systems this can be done directly through the following command:\n~~~~~~\nsudo apt-get install build-essential cmake git libgmp3-dev libprocps-dev python-markdown libboost-all-dev libssl-dev\n~~~~~~\n\n Clone the repo and set up submodules:\n~~~~~~\n git clone https://github.com/imdea-software/legosnark.git\n cd legosnark\n git submodule update --init --recursive\n~~~~~~\n\nBuild all dependencies:\n~~~~~\nmkdir -p build\ncd build\ncmake ..\ncd depends\nmake -j8\nsudo make -C libsnark install\n~~~~~\n\nTo build library and executables:\n~~~~~\ncd ../src # Assuming you were in build/depends from the steps above\nmake -j8\n~~~~~\n\nTo try an example, run e.g.:\n~~~~~\nexamples/cplink\n~~~~~\n\n\u003c!-- ### Using it as a library --\u003e\n\n## License\n\nThis code is licensed under either of the following licenses, at your discretion.\n\n * [Apache License Version 2.0](LICENSE-APACHE)\n * [MIT License](LICENSE-MIT)\n\nUnless you explicitly state otherwise, any contribution that you submit to this library shall be dual licensed as above (as defined in the Apache v2 License), without any additional terms or conditions.\n\n[legosnark]: https://eprint.iacr.org/2019/142.pdf\n\n## Reference paper\n\n[LegoSNARK: Modular Design and Composition of Succinct Zero-Knowledge Proofs][legosnark]     \n[Matteo Campanelli](https://www.github.com/matteocam), [Dario Fiore](https://github.com/dariofiore), [Ana\u0026#239;s Querol](https://github.com/querolita)\n\nCCS 2019\n\n## Acknowledgements\n\nThis work has been supported by the Spanish Government under projects Datamantium (ref. RTC-2016-4930-7), SCUM (ref. RTI2018-102043-B-I00), and CRYPTOEPIC (refs. ERC2018-092822, EUR2019-103816), by the Madrid Regional Government under project BLOQUES (ref. S2018/TCS-4339) and by Protocol Labs. The project that gave rise to these results received the support of a fellowship from “la Caixa” Foundation (ID 100010434). The fellowship code is LCF/BQ/ES18/11670018.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimdea-software%2Flegosnark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimdea-software%2Flegosnark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimdea-software%2Flegosnark/lists"}