{"id":29671295,"url":"https://github.com/anoma/vamp-ir","last_synced_at":"2025-07-22T20:07:28.474Z","repository":{"id":38191241,"uuid":"486719177","full_name":"anoma/vamp-ir","owner":"anoma","description":"Vamp-IR is a proof-system-agnostic language for writing arithmetic circuits","archived":false,"fork":false,"pushed_at":"2023-08-29T15:24:30.000Z","size":110419,"stargazers_count":160,"open_issues_count":48,"forks_count":50,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-02T06:17:44.107Z","etag":null,"topics":["blockchain","cryptography","zero-knowledge","zkp"],"latest_commit_sha":null,"homepage":"https://anoma.github.io/VampIR-Book/","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/anoma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-28T19:13:24.000Z","updated_at":"2025-01-25T19:52:55.000Z","dependencies_parsed_at":"2023-02-19T09:31:27.744Z","dependency_job_id":null,"html_url":"https://github.com/anoma/vamp-ir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anoma/vamp-ir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoma%2Fvamp-ir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoma%2Fvamp-ir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoma%2Fvamp-ir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoma%2Fvamp-ir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anoma","download_url":"https://codeload.github.com/anoma/vamp-ir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anoma%2Fvamp-ir/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266563915,"owners_count":23948689,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["blockchain","cryptography","zero-knowledge","zkp"],"created_at":"2025-07-22T20:07:27.946Z","updated_at":"2025-07-22T20:07:28.460Z","avatar_url":"https://github.com/anoma.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vamp-IR\n\nVamp-IR is a language for arithmetic circuits. The Vamp-IR compiler can transform an arithmetic circuit into a form that is compatible with any proving system backend.\n\n## Docs\n\n[Vamp-IR book (WIP)](https://github.com/anoma/VampIR-Book)\n\n## Trying Vamp-IR\n\n### Installation\n```\ngit clone git@github.com:anoma/vamp-ir\ncd vamp-ir\ncargo build\n```\n\n### Hello World!\n\nWe will build a circuit in Vamp-IR that checks if a pair $(x, y)$ is a point on a circle of a certain radius, $R$, which is given publicly.\n\nIn a file `pyth.pir` :\n```\n// declare R to be public\npub R;\n\n// define the Pythagorean relation we are checking\ndef pyth a b c = {\n  a^2 + b^2 = c^2\n};\n\n// appends constraint x^2 + y^2 = R^2 to the circuit\npyth x y R;\n```\n\n### Compile\nCompile source `pyth.pir` to a circuit that can be used in Halo2 and serialize it to the file `pyth.halo2`.\n\n```\nvamp-ir halo2 compile -s pyth.pir -o pyth.halo2\n```\n\n### Create a proof\n\nSuppose the target radius $R$ is $25$, and we come up with $(x, y) = (15, 20)$. We can use `vamp-ir` to create a Halo2 proof using these inputs.\n\nFirst create a file `pyth.inputs` in JSON format which contains our solution.\n\n```\n{\n  \"x\": \"15\",\n  \"y\": \"20\",\n  \"R\": \"25\"\n}\n```\nThen run the Halo2 prover using our compiled circuit and our inputs, outputting a Halo2 proof to `pyth.proof`.\n\n```\nvamp-ir halo2 prove -c pyth.halo2 -i pyth.inputs -o pyth.proof\n```\n\n### Verify the proof\n\nRun the Halo2 verifier using the compiled circuit and the proof.\n\n```\nvamp-ir halo2 verify -c pyth.halo2 -p pyth.proof\n```\n\n### \n\n## Benchmarks\nThese benchmarks are performed on a Lenovo ThinkPad X1 Carbon Gen 9 with 8.0 GiB RAM and \nan 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz × 8 unless stated otherwise\n### Halo2 backend\n\n#### SHA256 1 block message\n\n|         | `Compile`  | `Prove`    | `Verify` |\n|:--------|:-----------|:-----------|:---------|\n| Vamp-IR | `172.05 s` | `26.72 s`  | `0.61 s` |\n| Halo2   | //         | `161.05 s` | `1.06 s` |\n\n#### SHA256 2 block message\n\n|         | `Compile`  | `Prove`    | `Verify` |\n|:--------|:-----------|:-----------|:---------|\n| Vamp-IR | `353.76 s` | `46.91 s`  | `1.09 s` |\n| Halo2   | //         | `160.03 s` | `1.05 s` |\n\n#### SHA256 4 block message\n\n|         | `Compile`  | `Prove`         | `Verify` |\n|:--------|:-----------|:----------------|:---------|\n| Vamp-IR | `729.47 s` | Memory Failiure | X        |\n| Halo2   | //         | `160.36 s`      | `1.03 s` |\n\nWe re-run the with a device that has 128GB of RAM and these are the results:\n\n|         | `Compile` | `Prove`    | `Verify` |\n|:--------|:----------|:-----------|:---------|\n| Vamp-IR | `60 s`    | `81.983 s` | `0.6 s ` |\n\n### ZK-garage plonk backend\n\n#### Blake2s\n\n|           | `Compile` | `Prove`   | `Verify` |\n|:----------|:----------|:----------|:---------|\n| Vamp-IR   | `76.30 s` | `57.59 s` | `0.22 s` |\n| ZK-Garage | //        | `32.48 s` | `0.10 s` |\n\n#### Blake2s using only fan-in 2 gates\nTo have a more fair comparison between Vamp-IR and ZK-Garage, we can use only fan-in 2 gates in the Blake2s circuit.\nThis is because the current version of Vamp-IR does not uses fan-in 3 gates, as the ZK-Garage backend does, which in a \nspeed-up.\n\n|           | `Compile` | `Prove`    | `Verify` |\n|:----------|:----------|:-----------|:---------|\n| Vamp-IR   | `76.30 s` | `57.59 s`  | `0.22 s` |\n| ZK-Garage | //        | `360.48 s` | `0.81 s` |\n\nThe version of Blake2 used for the latter benchmark can be found here:\nhttps://github.com/heliaxdev/ark-plonk/blob/blake2s/examples/blake2s_circuit_fain2.rs\n\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   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### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanoma%2Fvamp-ir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanoma%2Fvamp-ir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanoma%2Fvamp-ir/lists"}