{"id":37081876,"url":"https://github.com/merricx/zksnake","last_synced_at":"2026-01-14T09:58:36.274Z","repository":{"id":247588300,"uuid":"781031621","full_name":"Merricx/zksnake","owner":"Merricx","description":"zk-SNARKs in Python","archived":false,"fork":false,"pushed_at":"2025-10-06T17:08:23.000Z","size":1058,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-29T08:52:30.067Z","etag":null,"topics":["cryptography","python","r1cs","zero-knowledge","zk-snarks","zkp"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Merricx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-02T16:12:13.000Z","updated_at":"2025-11-09T12:49:44.000Z","dependencies_parsed_at":"2024-11-17T03:22:54.467Z","dependency_job_id":"0ada29ae-43f6-4ef4-bc3e-64a04afa2c91","html_url":"https://github.com/Merricx/zksnake","commit_stats":null,"previous_names":["merricx/zksnake"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Merricx/zksnake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merricx%2Fzksnake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merricx%2Fzksnake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merricx%2Fzksnake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merricx%2Fzksnake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Merricx","download_url":"https://codeload.github.com/Merricx/zksnake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merricx%2Fzksnake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","python","r1cs","zero-knowledge","zk-snarks","zkp"],"created_at":"2026-01-14T09:58:35.585Z","updated_at":"2026-01-14T09:58:36.268Z","avatar_url":"https://github.com/Merricx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zksnake\n\nPython implementation of zk-SNARKs (Zero Knowledge Succint Non-interactive ARgument of Knowledge) using simple symbolic expression.\n\n\u003c!-- prettier-ignore-start --\u003e\n\u003e [!WARNING] \n**This library is intended to be used as proof of concept, prototyping, and educational purpose only. It is still unstable and not fully tested!**\n\u003c!-- prettier-ignore-end --\u003e\n\n## Proving schemes and curves\n\nzksnake currently only supports [**Groth16**](https://eprint.iacr.org/2016/260.pdf) and [**PlonK**](https://eprint.iacr.org/2019/953.pdf) (original version) along with `BN254` and `BLS12-381` as supported curves. More proving schemes will be implemented in the future (hopefully).\n\n## Usage\n\n### Build constraints\n\n```python\nfrom zksnake.arithmetization import Var, ConstraintSystem, R1CS\nfrom zksnake.constant import BN254_SCALAR_FIELD\n\nx = Var('x')\ny = Var('y')\nv1 = Var('v1')\n\n# prove the solution of y == x**3 + x + 5\n# with x as input and y as output\ncs = ConstraintSystem(['x'], ['y'], BN254_SCALAR_FIELD)\ncs.add_constraint(v1 == x * x)\ncs.add_constraint(y - 5 - x == v1 * x)\ncs.set_public(y)\n\nr1cs = R1CS(cs)\nr1cs.compile()\n```\n\nAlternatively, you can import the constraints from [Circom](https://github.com/iden3/circom):\n\n```python\nfrom zksnake.arithmetization import R1CS\n\nr1cs = R1CS.from_file(\"circuit.r1cs\", \"circuit.sym\")\nr1cs.compile()\n```\n\nNote that some constraints that are complex or expensive (require off-circuit computation) cannot be imported directly and require you to add \"hint\" function to pre-define the variable value (see [Example](./examples/example_bitify_circom.py)).\n\n### Prove and verify proof\n\n```python\nfrom zksnake.groth16 import Groth16\n\n# trusted setup\nproof_system = Groth16(r1cs)\nproof_system.setup()\n\n# solve the constraint system\nsolution = r1cs.solve({'x': 3})\npublic_witness, private_witness = r1cs.generate_witness(solution)\n\n# proving\nproof = proof_system.prove(public_witness, private_witness)\n\n# verification\nassert proof_system.verify(proof, public_witness)\n```\n\n## Development\n\nRequirements:\n\n- python3 \u003e= 3.9\n- rust \u003e= 1.77\n\nInstall maturin:\n\n```\npip install maturin\n```\n\nSetup virtual environment:\n\n```\npython3 -m venv .venv\nsource .venv/bin/activate\n```\n\nCompile and install the editable module into venv:\n\n```\nmaturin develop -r -E dev\n```\n\nTest the script:\n\n```\npython3 -m pytest tests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerricx%2Fzksnake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerricx%2Fzksnake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerricx%2Fzksnake/lists"}