{"id":51430477,"url":"https://github.com/oxarbitrage/orchard-formal","last_synced_at":"2026-07-05T03:30:41.613Z","repository":{"id":355222107,"uuid":"1227268696","full_name":"oxarbitrage/orchard-formal","owner":"oxarbitrage","description":"Lean 4 formalization of Zcash Orchard protocol — double-spend prevention, balance integrity, and DH key agreement proofs","archived":false,"fork":false,"pushed_at":"2026-06-20T21:46:15.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-20T23:17:47.851Z","etag":null,"topics":["cryptography","formal-verification","lean4","orchard","shielded-protocol","zcash"],"latest_commit_sha":null,"homepage":"https://oxarbitrage.github.io/blog/formally-verifying-the-zcash-orchard-stack/","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxarbitrage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-05-02T12:55:01.000Z","updated_at":"2026-06-20T21:46:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oxarbitrage/orchard-formal","commit_stats":null,"previous_names":["oxarbitrage/orchard-formal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oxarbitrage/orchard-formal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Forchard-formal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Forchard-formal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Forchard-formal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Forchard-formal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxarbitrage","download_url":"https://codeload.github.com/oxarbitrage/orchard-formal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxarbitrage%2Forchard-formal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35142824,"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-07-05T02:00:06.290Z","response_time":100,"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":["cryptography","formal-verification","lean4","orchard","shielded-protocol","zcash"],"created_at":"2026-07-05T03:30:41.027Z","updated_at":"2026-07-05T03:30:41.587Z","avatar_url":"https://github.com/oxarbitrage.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# orchard-formal\n\n**Status:** Fully proven — zero `sorry` statements.\n\nLean 4 formalization of Zcash's Orchard shielded protocol, composing Poseidon, Sinsemilla, and RedPallas into machine-verified proofs of the protocol's core security properties.\n\n## What's formalized\n\n**Key results:**\n\n- **`nullifier_uniqueness`** — distinct notes produce distinct nullifiers: the formal proof of double-spend prevention.\n- **`balance_multi_binding`** — a balanced multi-action transaction produces a verifiable binding key [Σ rcvᵢ]·BindingG.\n- **`dh_shared_secret`** — sender and recipient derive identical shared secrets: [esk]·pk_d = [ivk]·epk.\n- **`paymentAddress_pk_d_from_spendingKey`** — the `pk_d` in a payment address matches whether derived via the full `sk → FVK → IVK` chain or directly from `sk.rivk` (relies on the first-pass simplification `IVK = rivk`).\n- **`decrypt_encryptNote`** — under the explicit ciphertext-correctness boundary, decrypting a note encrypted for the matching incoming viewing path recovers the original plaintext.\n- **`node_root_injective`** — under collision resistance, equal Merkle roots imply equal subtrees.\n- **`action_no_double_spend`** — satisfied action circuits cannot double-spend.\n- **`bundle_balances`** — end-to-end balance proof: from binding signature extractability and DLR hardness, a valid bundle with bounded values cannot create or destroy ZEC.\n\n52 named theorems and lemmas across value commitments, nullifiers, note commitments, DH key agreement, viewing keys, payment addresses, note encryption/decryption correctness, Merkle paths, and action circuit soundness (the count includes a small number of theorem-layer aliases / re-exports).\n\n## Axioms\n\n| Axiom | Justification |\n|-------|--------------|\n| `ValueBaseV`, `K`, `NoteCommitR` | Certified Zcash generators |\n| `noteCommitHash` | Sinsemilla-based hash, axiomatized as opaque |\n| `Ciphertext`, `encrypt`, `decrypt`, `decrypt_encrypt_roundtrip` | First-pass abstract ciphertext interface and round-trip correctness boundary |\n| `merkleHash_collision_resistant` | Standard collision-resistance assumption |\n| `commitToLeaf` | Leaf hash function, axiomatized as opaque |\n\n## Build\n\n```shell\nlake build\n```\n\n## Dependencies\n\nLean 4 (`v4.30.0-rc2`), [Mathlib4](https://github.com/leanprover-community/mathlib4), [pasta-formal](https://github.com/oxarbitrage/pasta-formal), [poseidon-formal](https://github.com/oxarbitrage/poseidon-formal), [redpallas-formal](https://github.com/oxarbitrage/redpallas-formal), [sinsemilla-formal](https://github.com/oxarbitrage/sinsemilla-formal).\n\n## References\n\n- [Zcash Protocol Spec §4.2, §4.3, §4.7, §4.17](https://zips.z.cash/protocol/protocol.pdf)\n- [Halo 2 book](https://zcash.github.io/halo2/)\n\n---\n\n## Part of a series\n\nSix repositories formally verifying the Zcash Orchard cryptographic stack:\n\n| Layer | Repository |\n|-------|-----------|\n| Curves | [pasta-formal](https://github.com/oxarbitrage/pasta-formal) |\n| Hash | [poseidon-formal](https://github.com/oxarbitrage/poseidon-formal) |\n| Hash-to-curve | [sinsemilla-formal](https://github.com/oxarbitrage/sinsemilla-formal) |\n| Signatures | [redpallas-formal](https://github.com/oxarbitrage/redpallas-formal) |\n| Protocol | [orchard-formal](https://github.com/oxarbitrage/orchard-formal) |\n| Proof system | [halo2-formal](https://github.com/oxarbitrage/halo2-formal) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxarbitrage%2Forchard-formal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxarbitrage%2Forchard-formal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxarbitrage%2Forchard-formal/lists"}