{"id":13632378,"url":"https://github.com/0xPolygonZero/plonky2","last_synced_at":"2025-04-18T02:32:49.122Z","repository":{"id":37051660,"uuid":"339874055","full_name":"0xPolygonZero/plonky2","owner":"0xPolygonZero","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-11T18:15:32.000Z","size":16001,"stargazers_count":685,"open_issues_count":30,"forks_count":232,"subscribers_count":28,"default_branch":"main","last_synced_at":"2024-04-13T01:12:09.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/0xPolygonZero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":"audits/Least Authority - Polygon Zero Plonky2 Final Audit Report.pdf","citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-02-17T22:36:59.000Z","updated_at":"2024-04-15T15:03:44.510Z","dependencies_parsed_at":"2024-04-15T15:13:36.063Z","dependency_job_id":null,"html_url":"https://github.com/0xPolygonZero/plonky2","commit_stats":{"total_commits":3869,"total_committers":44,"mean_commits":87.93181818181819,"dds":0.7138795554406823,"last_synced_commit":"d682769b2e223070ff194d6c62f0c4f37f42437e"},"previous_names":["0xpolygonzero/plonky2","mir-protocol/plonky2"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygonZero%2Fplonky2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygonZero%2Fplonky2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygonZero%2Fplonky2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xPolygonZero%2Fplonky2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xPolygonZero","download_url":"https://codeload.github.com/0xPolygonZero/plonky2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223772184,"owners_count":17199969,"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-08-01T22:03:01.848Z","updated_at":"2025-04-18T02:32:49.098Z","avatar_url":"https://github.com/0xPolygonZero.png","language":"Rust","funding_links":[],"categories":["Rust","Layer 2","Web3 and ZKP Framework"],"sub_categories":["Polygon"],"readme":"# Plonky2 \u0026 more\n[![Discord](https://img.shields.io/discord/743511677072572486?logo=discord)](https://discord.gg/QZKRUpqCJ6)\n\nThis repository was originally for Plonky2, a SNARK implementation based on techniques from PLONK and FRI. It has since expanded to include tools such as Starky, a highly performant STARK implementation.\n\n\n## Documentation\n\nFor more details about the Plonky2 argument system, see this [writeup](plonky2/plonky2.pdf).\n\nPolymer Labs has written up a helpful tutorial [here](https://polymerlabs.medium.com/a-tutorial-on-writing-zk-proofs-with-plonky2-part-i-be5812f6b798)!\n\n\n## Examples\n\nA good starting point for how to use Plonky2 for simple applications is the included examples:\n\n* [`factorial`](plonky2/examples/factorial.rs): Proving knowledge of 100!\n* [`fibonacci`](plonky2/examples/fibonacci.rs): Proving knowledge of the hundredth Fibonacci number\n* [`range_check`](plonky2/examples/range_check.rs): Proving that a field element is in a given range\n* [`square_root`](plonky2/examples/square_root.rs): Proving knowledge of the square root of a given field element\n\nTo run an example, use\n\n```sh\ncargo run --example \u003cexample_name\u003e\n```\n\n\n## Building\n\nPlonky2 requires a recent nightly toolchain, although we plan to transition to stable in the future.\n\nTo use a nightly toolchain for Plonky2 by default, you can run\n```\nrustup override set nightly\n```\nin the Plonky2 directory.\n\n\n## Running\n\nTo see recursion performance, one can run this bench, which generates a chain of three recursion proofs:\n\n```sh\nRUSTFLAGS=-Ctarget-cpu=native cargo run --release --example bench_recursion -- -vv\n```\n\n## Jemalloc\n\nPlonky2 prefers the [Jemalloc](http://jemalloc.net) memory allocator due to its superior performance. To use it, include `jemallocator = \"0.5.0\"` in your `Cargo.toml` and add the following lines\nto your `main.rs`:\n\n```rust\nuse jemallocator::Jemalloc;\n\n#[global_allocator]\nstatic GLOBAL: Jemalloc = Jemalloc;\n```\n\nJemalloc is known to cause crashes when a binary compiled for x86 is run on an Apple silicon-based Mac under [Rosetta 2](https://support.apple.com/en-us/HT211861). If you are experiencing crashes on your Apple silicon Mac, run `rustc --print target-libdir`. The output should contain `aarch64-apple-darwin`. If the output contains `x86_64-apple-darwin`, then you are running the Rust toolchain for x86; we recommend switching to the native ARM version.\n\n## Documentation\n\nGenerate documentation locally:\n\n```sh\ncargo doc --no-deps --open\n```\n\n## Contributing guidelines\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## Licenses\n\nAll crates of this monorepo are licensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n\n## Security\n\nThis code has been audited prior to the `v1.0.0` release. The audits reports and findings are available in the [audits](./audits/) folder of this repository.\nAn audited codebase isn't necessarily free of bugs and security exploits, hence we recommend care when using `plonky2` in production settings.\n\nIf you find a security issue in the codebase, please refer to our [Security guidelines](./SECURITY.md) for private disclosure.\n\nWhile Plonky2 is configurable, its defaults generally target 100 bits of security. The default FRI configuration targets 100 bits of *conjectured* security based on the conjecture in [ethSTARK](https://eprint.iacr.org/2021/582).\n\nPlonky2's default hash function is Poseidon, configured with 8 full rounds, 22 partial rounds, a width of 12 field elements (each ~64 bits), and an S-box of `x^7`. [BBLP22](https://tosc.iacr.org/index.php/ToSC/article/view/9850) suggests that this configuration may have around 95 bits of security, falling a bit short of our 100 bit target.\n\n\n## Links\n\n- [Polygon Zero's zkEVM](https://github.com/0xPolygonZero/zk_evm), an efficient Type 1 zkEVM built on top of Starky and plonky2\n- [System Zero](https://github.com/0xPolygonZero/system-zero), a zkVM built on top of Starky\n- [Waksman](https://github.com/0xPolygonZero/plonky2-waksman), Plonky2 gadgets for permutation checking using Waksman networks\n- [Insertion](https://github.com/0xPolygonZero/plonky2-insertion), Plonky2 gadgets for insertion into a list\n- [u32](https://github.com/0xPolygonZero/plonky2-u32), Plonky2 gadgets for u32 arithmetic\n- [ECDSA](https://github.com/0xPolygonZero/plonky2-ecdsa), Plonky2 gadgets for the ECDSA algorithm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xPolygonZero%2Fplonky2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xPolygonZero%2Fplonky2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xPolygonZero%2Fplonky2/lists"}