{"id":50433363,"url":"https://github.com/sanjay-sol/zkvm","last_synced_at":"2026-05-31T15:31:01.363Z","repository":{"id":342876205,"uuid":"1171903700","full_name":"sanjay-sol/zkvm","owner":"sanjay-sol","description":"A Minimal STARK based zkVM. ","archived":false,"fork":false,"pushed_at":"2026-03-07T23:13:28.000Z","size":60,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-08T01:04:00.409Z","etag":null,"topics":["air","execution-trace","field-elements","fri","goldilocks","memory","merkle-tree","registers","zkvm"],"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/sanjay-sol.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-03T18:28:33.000Z","updated_at":"2026-03-07T23:32:07.000Z","dependencies_parsed_at":"2026-03-08T01:04:02.016Z","dependency_job_id":null,"html_url":"https://github.com/sanjay-sol/zkvm","commit_stats":null,"previous_names":["sanjay-sol/zkvm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sanjay-sol/zkvm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjay-sol%2Fzkvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjay-sol%2Fzkvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjay-sol%2Fzkvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjay-sol%2Fzkvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanjay-sol","download_url":"https://codeload.github.com/sanjay-sol/zkvm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanjay-sol%2Fzkvm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33737692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["air","execution-trace","field-elements","fri","goldilocks","memory","merkle-tree","registers","zkvm"],"created_at":"2026-05-31T15:31:01.257Z","updated_at":"2026-05-31T15:31:01.350Z","avatar_url":"https://github.com/sanjay-sol.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zkVM — Minimal Zero-Knowledge Virtual Machine\n\nA fully working STARK-based zkVM in Rust. No trusted setup. Pure hash-based cryptography. Runs on stable Rust.\n\n---\n\n## Quick Start\n\n```bash\n# Build\ncargo build --release\n\n# Run fibonacci(10) — prove and verify\ncargo run --release -- run fibonacci 10\n\n# Run 5!\ncargo run --release -- run factorial 5\n\n# Run sum(1..50)\ncargo run --release -- run sum 50\n\n# Run all built-in examples\ncargo run --release -- run-all\n\n# Benchmark\ncargo run --release -- bench\n\n# Show system parameters\ncargo run --release -- info\n\n# Run ALL tests (51 unit tests)\ncargo test\n```\n\n---\n\n## Example Output\n\n### fibonacci(10)\n\n```\nProgram : fibonacci(10)\n\n[ 1/4 ] Executing VM ... done in 30.42us\n         Steps       : 66\n         Trace rows  : 128 (padded to power of 2)\n         r0 (result) : 55\n         Expected    : 55\n\n[ 2/4 ] Checking constraints ... ALL SATISFIED\n\n[ 3/4 ] Generating STARK proof ... done in 11.29ms\n         FRI layers  : 6\n         FRI queries : 30\n         Trace cols  : 11\n         OOD evals   : 22\n         Proof size  : ~71 KB (rough estimate)\n\n[ 4/4 ] Verifying proof ... VALID  (1.49ms)\n\n Proof generation: 11.29ms\n Proof verification: 1.50ms\n Total: 13.06ms\n```\n\n### factorial(5)\n\n```\nProgram : 5!\n\n[ 1/4 ] Executing VM ... done in 15.50us\n         Steps       : 25\n         Trace rows  : 32 (padded to power of 2)\n         r0 (result) : 120\n         Expected    : 120\n\n[ 2/4 ] Checking constraints ... ALL SATISFIED\n\n[ 3/4 ] Generating STARK proof ... done in 3.91ms\n         FRI layers  : 4\n         FRI queries : 30\n         Trace cols  : 11\n         OOD evals   : 22\n         Proof size  : ~69 KB (rough estimate)\n\n[ 4/4 ] Verifying proof ... VALID  (2.02ms)\n\n Proof generation: 3.91ms\n Proof verification: 2.02ms\n Total: 6.04ms\n```\n\n---\n\n## Benchmarks\n\nAll benchmarks run on release builds (`cargo run --release -- bench`).\n\n| Program | Trace Length | Prove | Verify | Ratio |\n|---------|-------------|-------|--------|-------|\n| fibonacci(5) | 64 | 4,432 us | 1,384 us | 3.2x |\n| fibonacci(10) | 128 | 18,396 us | 2,694 us | 6.8x |\n| fibonacci(15) | 128 | 15,785 us | 2,418 us | 6.5x |\n| factorial(5) | 32 | 3,231 us | 1,293 us | 2.5x |\n| factorial(7) | 64 | 6,135 us | 1,618 us | 3.8x |\n| sum(20) | 128 | 11,194 us | 1,615 us | 6.9x |\n| sum(50) | 256 | 20,885 us | 1,870 us | 11.2x |\n\nVerification is consistently 3-11x faster than proving. Proof generation scales roughly linearly with trace length.\n\n---\n\n## Run-All Results\n\nAll 10 built-in programs prove and verify successfully:\n\n```\nfibonacci(0)        PASS\nfibonacci(1)        PASS\nfibonacci(10)       PASS\nfibonacci(15)       PASS\nfactorial(1)        PASS\nfactorial(5)        PASS\nfactorial(7)        PASS\nsum(10)             PASS\nsum(50)             PASS\nmemory roundtrip    PASS\n\nResults: 10 passed, 0 failed\n```\n\n---\n\n## Test Suite\n\n51 unit tests covering every module. All passing.\n\n```\ncargo test\n\nrunning 51 tests\ntest channel::tests::test_absorb_resets_squeeze           ... ok\ntest channel::tests::test_absorb_changes_output           ... ok\ntest channel::tests::test_deterministic                   ... ok\ntest channel::tests::test_different_input_different_output ... ok\ntest channel::tests::test_sequential_squeezings_differ    ... ok\ntest constraints::tests::test_boundary_initial_state      ... ok\ntest constraints::tests::test_factorial_constraints       ... ok\ntest constraints::tests::test_fibonacci_constraints       ... ok\ntest constraints::tests::test_sum_constraints             ... ok\ntest field::tests::test_add_wrap                          ... ok\ntest field::tests::test_field_laws                        ... ok\ntest field::tests::test_half                              ... ok\ntest field::tests::test_inv                               ... ok\ntest field::tests::test_mul_2_32                          ... ok\ntest field::tests::test_mul_basic                         ... ok\ntest field::tests::test_pow                               ... ok\ntest field::tests::test_reduce_known                      ... ok\ntest field::tests::test_root_of_unity                     ... ok\ntest field::tests::test_root_of_unity_order               ... ok\ntest field::tests::test_sub_wrap                          ... ok\ntest fri::tests::test_fold_correctness                    ... ok\ntest fri::tests::test_fold_domain_consistency             ... ok\ntest fri::tests::test_fri_commit_verify_low_degree        ... ok\ntest fri::tests::test_fri_multiple_polys                  ... ok\ntest merkle::tests::test_large_tree                       ... ok\ntest merkle::tests::test_open_and_verify_all_leaves       ... ok\ntest merkle::tests::test_root_changes_with_leaf           ... ok\ntest merkle::tests::test_root_deterministic               ... ok\ntest merkle::tests::test_wrong_leaf_fails                 ... ok\ntest poly::tests::test_divide_by_vanishing                ... ok\ntest poly::tests::test_domain_powers                      ... ok\ntest poly::tests::test_eval_poly                          ... ok\ntest poly::tests::test_interpolate_eval_consistency       ... ok\ntest poly::tests::test_lde_consistent_with_poly           ... ok\ntest poly::tests::test_mul_poly                           ... ok\ntest poly::tests::test_ntt_intt_roundtrip                 ... ok\ntest poly::tests::test_ntt_known_values                   ... ok\ntest prover::tests::test_prover_runs_without_panic        ... ok\ntest trace::tests::test_column_extraction                 ... ok\ntest trace::tests::test_trace_length_power_of_two         ... ok\ntest trace::tests::test_trace_selector_column             ... ok\ntest verifier::tests::test_verify_factorial_5             ... ok\ntest verifier::tests::test_verify_fibonacci_5             ... ok\ntest verifier::tests::test_verify_fibonacci_10            ... ok\ntest verifier::tests::test_verify_sum_10                  ... ok\ntest vm::tests::test_factorial                            ... ok\ntest vm::tests::test_fibonacci                            ... ok\ntest vm::tests::test_jnz                                  ... ok\ntest vm::tests::test_mem_roundtrip                        ... ok\ntest vm::tests::test_sum                                  ... ok\n\ntest result: ok. 51 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out\n```\n\n---\n\n## What This Implements\n\n```\nProgram (assembly)\n        |\n        v\n+-------------------------------------------------------+\n|  VM Execution  (vm.rs)                                |\n|  8 registers x Felt,  11 opcodes,  linear memory      |\n|  Records every state transition                        |\n+------------------------+------------------------------+\n                         | Execution Trace  (trace.rs)\n                         v\n         +----------------------------------+\n         |  Trace Matrix  T[row][col]        |  n x 11\n         |  Padded to next power of 2        |\n         +--------------+-------------------+\n                        | NTT interpolation  (poly.rs)\n                        v\n         +----------------------------------+\n         |  Trace polynomials  T_j(x)       |  deg n-1\n         +--------------+-------------------+\n                        | LDE x4  (poly.rs)\n                        v\n         +----------------------------------+\n         |  LDE evaluations + Merkle trees  |  (merkle.rs)\n         |  Committed via Blake3            |\n         +--------------+-------------------+\n                        | AIR  (constraints.rs)\n                        v\n         +----------------------------------+\n         |  Constraint polynomial  C(x)     |\n         |  Quotient  Q(x) = C(x)/Z(x)     |\n         +--------------+-------------------+\n                        | DEEP-ALI  (prover.rs)\n                        v\n         +----------------------------------+\n         |  Composition polynomial          |\n         |  FRI low-degree proof  (fri.rs)  |\n         +--------------+-------------------+\n                        |\n                        v\n                    StarkProof\n                        |\n                        v\n         +----------------------------------+\n         |  Verifier  (verifier.rs)         |\n         |  Replays transcript              |\n         |  Checks Merkle + FRI             |\n         +----------------------------------+\n```\n\n---\n\n## File Structure\n\n```\nzkvm/\n├── Cargo.toml\n├── src/\n│   ├── lib.rs           re-exports all modules\n│   ├── main.rs          CLI (cargo run -- run fibonacci 10)\n│   ├── field.rs         Goldilocks field  (p = 2^64 - 2^32 + 1)\n│   ├── vm.rs            ISA + execution engine\n│   ├── trace.rs         Execution trace recording + padding\n│   ├── constraints.rs   AIR constraint system\n│   ├── poly.rs          NTT, iNTT, LDE, polynomial evaluation\n│   ├── merkle.rs        Binary Merkle tree + proof\n│   ├── channel.rs       Fiat-Shamir transcript (Blake3)\n│   ├── fri.rs           FRI commit + verify\n│   ├── prover.rs        Full STARK prover\n│   └── verifier.rs      Full STARK verifier\n└── examples/\n    ├── fibonacci.zkasm\n    ├── factorial.zkasm\n    └── sum.zkasm\n```\n\n---\n\n## Instruction Set\n\n| Opcode | Semantics |\n|--------|-----------|\n| `CONST rd, imm` | `rd = imm` |\n| `ADD rd, rs1, rs2` | `rd = rs1 + rs2` |\n| `SUB rd, rs1, rs2` | `rd = rs1 - rs2` |\n| `MUL rd, rs1, rs2` | `rd = rs1 * rs2` |\n| `JMP addr` | `pc = addr` |\n| `JZ rs, addr` | `if rs == 0: pc = addr` |\n| `JNZ rs, addr` | `if rs != 0: pc = addr` |\n| `COPY rd, rs` | `rd = rs` |\n| `LOAD rd, addr` | `rd = mem[addr]` |\n| `STORE rs, addr` | `mem[addr] = rs` |\n| `HALT` | stop |\n\nAll values live in `F_p` (Goldilocks field, `p = 2^64 - 2^32 + 1`).\n\n---\n\n## Proof System Parameters\n\n| Parameter | Value | Notes |\n|-----------|-------|-------|\n| Field | Goldilocks | `p = 2^64 - 2^32 + 1` |\n| Hash | Blake3 | 256-bit, no trusted setup |\n| LDE blowup | 4x | `fri.rs: BLOWUP_FACTOR` |\n| FRI queries | 30 | `fri.rs: NUM_QUERIES` |\n| Trace width | 11 | 8 regs + pc + sel + opcode |\n| Post-quantum | Yes | hash-based only, no elliptic curves |\n| Trusted setup | None | transparent |\n| Security | ~30 bits | increase `NUM_QUERIES` for production |\n\n---\n\n## Running Tests\n\n```bash\ncargo test                          # all 51 tests\ncargo test test_field               # only field arithmetic tests\ncargo test test_fri                 # only FRI tests\ncargo test test_verify              # only verifier tests\ncargo test -- --nocapture           # show println output\n```\n\n---\n\n## Writing a Custom Program\n\n```rust\nuse zkvm_lib::{\n    vm::Instruction,\n    field::Felt,\n    trace::generate_trace,\n    constraints::ConstraintSystem,\n    prover::prove,\n    verifier::verify,\n};\n\nfn main() {\n    // Program: compute 3 * 4 = 12\n    let program = vec![\n        Instruction::Const(0, Felt::new(3)),\n        Instruction::Const(1, Felt::new(4)),\n        Instruction::Mul(2, 0, 1),\n        Instruction::Halt,\n    ];\n\n    // Execute and record trace\n    let (vm, trace) = generate_trace(\u0026program, 16);\n    println!(\"Result: r2 = {}\", vm.regs[2].0); // 12\n\n    // Prove\n    let cs    = ConstraintSystem::new(program, vec![vm.regs[2]]);\n    let proof = prove(\u0026trace, \u0026cs, vec![vm.regs[2]]);\n\n    // Verify\n    match verify(\u0026proof) {\n        Ok(())   =\u003e println!(\"Proof VALID\"),\n        Err(msg) =\u003e println!(\"Proof INVALID: {msg}\"),\n    }\n}\n```\n\n---\n\n## Cryptographic Stack\n\n- **No trusted setup** -- all randomness derived from Blake3 (Fiat-Shamir)\n- **Post-quantum** -- only hash functions, no elliptic curves\n- **FRI soundness** -- cheating prover is caught with probability \u003e= 1 - (1/|F|)^30 per query\n- **Completeness** -- honest prover always convinces verifier\n\n---\n\n## Resources\n\n- [Anatomy of a STARK](https://aszepieniec.github.io/stark-anatomy/) -- best tutorial\n- [STARK paper (Ben-Sasson et al.)](https://eprint.iacr.org/2018/046.pdf)\n- [FRI paper](https://eccc.weizmann.ac.il/report/2017/134/)\n- [Winterfell](https://github.com/facebook/winterfell) -- production STARK in Rust\n- [RISC Zero](https://github.com/risc0/risc0) -- zkVM for full RISC-V\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanjay-sol%2Fzkvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanjay-sol%2Fzkvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanjay-sol%2Fzkvm/lists"}