{"id":22499584,"url":"https://github.com/cleanpegasus/kzg-commitment","last_synced_at":"2025-03-27T22:25:20.837Z","repository":{"id":247642900,"uuid":"826302761","full_name":"CleanPegasus/kzg-commitment","owner":"CleanPegasus","description":"A blazing fast implementation of KZG polynomial commitment scheme in rust","archived":false,"fork":false,"pushed_at":"2024-07-17T16:53:12.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T00:41:18.394Z","etag":null,"topics":["blockchain","polynomial-commitments","web3","zero-knowledge","zkp"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleanPegasus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2024-07-09T12:51:25.000Z","updated_at":"2025-01-03T04:07:46.000Z","dependencies_parsed_at":"2025-02-02T00:41:22.002Z","dependency_job_id":"1c6070db-71e1-4360-b317-b3278fcf2cae","html_url":"https://github.com/CleanPegasus/kzg-commitment","commit_stats":null,"previous_names":["cleanpegasus/kzg-commitment-rust","cleanpegasus/kzg-commitment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanPegasus%2Fkzg-commitment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanPegasus%2Fkzg-commitment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanPegasus%2Fkzg-commitment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanPegasus%2Fkzg-commitment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleanPegasus","download_url":"https://codeload.github.com/CleanPegasus/kzg-commitment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245933169,"owners_count":20696184,"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":["blockchain","polynomial-commitments","web3","zero-knowledge","zkp"],"created_at":"2024-12-06T22:14:33.568Z","updated_at":"2025-03-27T22:25:20.821Z","avatar_url":"https://github.com/CleanPegasus.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KZG Commitment Library\n\nThis repository contains a Rust implementation of KZG Commitments, a cryptographic primitive used for polynomial commitments. The library provides functionality to generate, commit, and verify polynomial commitments.\n\nBlog post on implementing [KZG commitment scheme](https://cleanpegasus.medium.com/implementing-kzg-commitment-scheme-a18bf8ec057a)\nYou can find the python version of this code [here](https://github.com/CleanPegasus/kzg-commitment-python)\n\n## Features\n- Vector to Polynomial: Convert a vector of elements to polynomial form.\n- Polynomial Commitment: Commit to a polynomial\n- Proof Generation: Generate a proof for a given set of points from the vector.\n- Proof Verification: Verify the correctness of the proofs generated.\n\n## Installation\nTo use this library, add the following to your `Cargo.toml`\n```toml\nkzg-commitment = \"0.1.3\"\n```\n\n## Usage\nHere is a basic example of how to use the library:\n\n```rust\n\nuse kzg_commitment::KZGCommitment;\nuse ark_bls12_381::{Fr as F};\n\nfn main() {\n    let kzg = KZGCommitment::new(50);\n    let vector = vec![F::from(120), F::from(-15), F::from(60), F::from(80)];\n    let polynomial = KZGCommitment::vector_to_polynomial(\u0026vector);\n    let commitment = kzg.commit_polynomial(\u0026polynomial);\n    let points = vec![(F::from(0), F::from(120)), (F::from(1), F::from(-15))];\n    let proof = kzg.generate_proof(\u0026polynomial, \u0026random_points).unwrap();\n    let verification = kzg.verify_proof(\u0026commitment, \u0026random_points, \u0026proof);\n\n    assert!(verification, \"Verification failed\");\n}\n```\n\n### Testing\nTo run the tests, use the following command:\n```bash\ncargo test\n```\n\n### Example Tests\n- `test_vec_to_poly`: Tests the conversion of a vector to a polynomial and evaluates it at random points.\n- `test_verify_proof_valid`: Tests the generation and verification of a valid proof.\n- `test_invalid_proof_generation`: Tests the generation of an invalid proof and ensures the correct error is returned.\n- `test_invalid_proof_verification`: Tests the verification of an invalid proof and ensures the correct error is returned.\n\n### TODO\n- [x] Use Finite Field for vectors instead of i32\n- [ ] Add support for precomputed powers_of_tau (trusted_setup)\n- [ ] Add more tests for invalid proof verification\n- [ ] Add benchmarks\n\n\n### Contributing\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Acknowledgements\nKZG Commitments - More information about KZG Commitments.\n\nThis project was inspired by Dankrad Feist's blog post on [KZG Commitments](https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleanpegasus%2Fkzg-commitment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleanpegasus%2Fkzg-commitment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleanpegasus%2Fkzg-commitment/lists"}