{"id":18339300,"url":"https://github.com/adria0/a0kzg","last_synced_at":"2025-04-06T05:32:01.241Z","repository":{"id":57478764,"uuid":"397218018","full_name":"adria0/a0kzg","owner":"adria0","description":"Kate-Zaverucha-Goldberg  polynomial commitments in rust playground","archived":false,"fork":false,"pushed_at":"2021-08-18T11:40:25.000Z","size":22,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T18:07:48.422Z","etag":null,"topics":["cryptography","kzg-proofs","rust","zero-knowledge-proofs"],"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/adria0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-17T10:56:16.000Z","updated_at":"2024-10-23T19:00:54.000Z","dependencies_parsed_at":"2022-09-17T04:21:40.795Z","dependency_job_id":null,"html_url":"https://github.com/adria0/a0kzg","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adria0%2Fa0kzg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adria0%2Fa0kzg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adria0%2Fa0kzg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adria0%2Fa0kzg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adria0","download_url":"https://codeload.github.com/adria0/a0kzg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247440394,"owners_count":20939220,"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":["cryptography","kzg-proofs","rust","zero-knowledge-proofs"],"created_at":"2024-11-05T20:17:10.206Z","updated_at":"2025-04-06T05:32:00.924Z","avatar_url":"https://github.com/adria0.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# learning-kate\n[![CI](https://github.com/adria0/a0kzg/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/adria0/a0kzg/actions/workflows/ci.yml)\n[![Crates.io](https://img.shields.io/crates/v/a0kzg.svg)](https://crates.io/crates/a0kzg)\n[![docs.rs](https://img.shields.io/docsrs/a0kzg)](https://docs.rs/a0kzg)\n\nKate-Zaverucha-Goldberg polynomial commitments in rust playground\n\nThis is just-for-learning, so **do not use in production** of KZG commitments in rust, the\nidea is to extend it with other functions like plonk or verkle trees.\n\nIt uses the fantastic [bls12_381 crate](https://github.com/zkcrypto/bls12_381) \n\n## KZG Example\n\n```rust\nuse a0kzg::{Scalar, Kzg};\n// Create a trustd setup that allows maximum 4 points (degree+1)\nlet kzg = Kzg::trusted_setup(5);\n\n// define the set of points (the \"population\"), and create a polinomial\n// for them, as well its polinomial commitment, see the polinomial commitment\n// like the \"hash\" of the polinomial\nlet set = vec![\n  (Scalar::from(1), Scalar::from(2)),\n  (Scalar::from(2), Scalar::from(3)),\n  (Scalar::from(3), Scalar::from(4)),\n  (Scalar::from(4), Scalar::from(57)),\n];\nlet (p, c) = kzg.poly_commitment_from_set(\u0026set);\n\n// generate a proof that (1,2) and (2,3) are in the set\nlet proof01 = kzg.prove(\u0026p, \u0026vec![set[0].clone(), set[1].clone()]);\n\n// prove that (1,2) and (2,3) are in the set\nassert!(kzg.verify(\u0026c, \u0026vec![set[0].clone(), set[1].clone()], \u0026proof01));\n// other proofs will fail since the proof only works for exactly (1,2) AND (2,3)\nassert!(!kzg.verify(\u0026c, \u0026vec![set[0].clone()], \u0026proof01));\nassert!(!kzg.verify(\u0026c, \u0026vec![set[0].clone(), set[2].clone()], \u0026proof01));\n\n// prove and verify that the whole set exists in the whole set\nlet proof0123 = kzg.prove(\u0026p, \u0026set);\nassert!(kzg.verify(\u0026c, \u0026set, \u0026proof0123));\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadria0%2Fa0kzg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadria0%2Fa0kzg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadria0%2Fa0kzg/lists"}