{"id":13450650,"url":"https://github.com/arnaucube/protogalaxy-poc","last_synced_at":"2025-04-13T03:32:25.593Z","repository":{"id":184325977,"uuid":"671680711","full_name":"arnaucube/protogalaxy-poc","owner":"arnaucube","description":"ProtoGalaxy folding scheme PoC implementation https://eprint.iacr.org/2023/1106.pdf","archived":false,"fork":false,"pushed_at":"2023-09-14T08:15:47.000Z","size":50,"stargazers_count":40,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-26T21:38:22.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arnaucube.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-27T22:23:40.000Z","updated_at":"2025-02-05T20:52:05.000Z","dependencies_parsed_at":"2024-07-31T07:12:22.850Z","dependency_job_id":null,"html_url":"https://github.com/arnaucube/protogalaxy-poc","commit_stats":null,"previous_names":["arnaucube/protogalaxy-poc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaucube%2Fprotogalaxy-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaucube%2Fprotogalaxy-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaucube%2Fprotogalaxy-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaucube%2Fprotogalaxy-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnaucube","download_url":"https://codeload.github.com/arnaucube/protogalaxy-poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248659716,"owners_count":21141164,"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-07-31T07:00:36.978Z","updated_at":"2025-04-13T03:32:25.349Z","avatar_url":"https://github.com/arnaucube.png","language":"Rust","funding_links":[],"categories":["Nova extensions","Code (software repositories)"],"sub_categories":["Teaching / experimental implementations"],"readme":"# protogalaxy-poc [![Test](https://github.com/arnaucube/protogalaxy-poc/workflows/Test/badge.svg)](https://github.com/arnaucube/protogalaxy-poc/actions?query=workflow%3ATest)\n\nProof of concept implementation of ProtoGalaxy (https://eprint.iacr.org/2023/1106.pdf) using [arkworks](https://github.com/arkworks-rs).\n\n\u003e Experimental code, do not use in production.\n\nThanks to [Liam Eagen](https://twitter.com/LiamEagen) and [Ariel Gabizon](https://twitter.com/rel_zeta_tech) for their kind explanations.\n\nThis code has been done in the context of the research on folding schemes in [0xPARC](https://0xparc.org).\n\n![protogalaxy img from Wikipedia](https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Stellar_Fireworks_Finale.jpg/303px-Stellar_Fireworks_Finale.jpg)\n\n(img: protogalaxies colliding, [from Wikipedia](https://en.wikipedia.org/wiki/File:Stellar_Fireworks_Finale.jpg))\n\n## Details\nImplementation of ProtoGalaxy's scheme described in section 4 of the paper.\n\nCurrent version implements the folding on prover \u0026 verifier and it works for k-to-1 instances and with multiple iterations, but it is not optimized.\nNext steps in terms of implementation include: F(X) O(n) construction following Claim 4.4, compute K(X) in O(kd log(kd)M + ndkC) as described in Claim 4.5, add tests folding in multiple iterations and also in a tree approach, add the decider and integrate with some existing R1CS tooling for the R1CS \u0026 witness generation.\n\n### Usage\n\nExample of folding k+1 instances:\n```rust\n// assume we have:\n// an R1CS instance 'r1cs'\n// a valid witness 'w' from our running instance\n// k valid 'witnesses' to be fold\n\n// compute the committed instance for our running witness\nlet phi = Pedersen::\u003cG1Projective\u003e::commit(\u0026pedersen_params, \u0026witness.w, \u0026witness.r_w);\nlet instance = CommittedInstance::\u003cG1Projective\u003e {\n    phi,\n    betas: betas.clone(),\n    e: Fr::zero(),\n};\n\n// compute the k committed instances to be fold\nlet mut instances: Vec\u003cCommittedInstance\u003cG1Projective\u003e\u003e = Vec::new();\nfor i in 0..k {\n    let phi_i =\n\tPedersen::\u003cG1Projective\u003e::commit(\u0026pedersen_params, \u0026witnesses[i].w, \u0026witnesses[i].r_w);\n    let instance_i = CommittedInstance::\u003cG1Projective\u003e {\n\tphi: phi_i,\n\tbetas: betas.clone(),\n\te: Fr::zero(),\n    };\n    instances.push(instance_i);\n}\n\n// set the initial random betas\nlet beta = Fr::rand(\u0026mut rng);\nlet betas = powers_of_beta(beta, t);\n\n// Prover folds the instances and witnesses\nlet (F_coeffs, K_coeffs, folded_instance, folded_witness) = Folding::\u003cG1Projective\u003e::prover(\n    \u0026mut transcript_p,\n    \u0026r1cs,\n    // running instance\n    instance.clone(),\n    witness,\n    // incomming instances\n    instances.clone(),\n    witnesses,\n);\n\n// verifier folds the instances\nlet folded_instance_v = Folding::\u003cG1Projective\u003e::verifier(\n    \u0026mut transcript_v,\n    \u0026r1cs,\n    instance, // running instance\n    instances, // incomming instances\n    F_coeffs,\n    K_coeffs,\n);\n\n// check that the folded instance satisfies the relation\nassert!(check_instance(\u0026r2cs, folded_instance, folded_witness));\n\n// now, the folded instance \u0026 witness can be folded again with k other instances.\n```\n(see the actual code for more details)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaucube%2Fprotogalaxy-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnaucube%2Fprotogalaxy-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaucube%2Fprotogalaxy-poc/lists"}