About
## Wave 1 submission
## Wave 1 — Foundation & Architecture
**What we completed this wave:**
### Protocol Design & Architecture
We designed the complete LexCrypt protocol architecture — a 5-module FHE-native legal AI infrastructure built on Fhenix CoFHE. The full system architecture has been defined across three layers: Client (CoFHE SDK + React hooks), Smart Contract (FHE.sol + 6 Solidity contracts), and Infrastructure (Arbitrum Sepolia + IPFS + Fhenix Threshold Network).
### Smart Contract Interface Specification We wrote the complete interface specification for all 5 contracts: - `LexCryptRegistry.sol` — central registry, role-based access (JUDGE_ROLE, STUDENT_ROLE, AUDITOR_ROLE), encrypted case struct definitions - `JudgeAssistant.sol` — FHE weighted scoring model interface, CaseAnalysisInput/Result structs, analyzeCase() function signature - `PracticeArena.sol` — double-blind student scoring, encrypted ELO rating system, scoreArgument() interface - `WinPredictor.sol` — 5-feature logistic regression on FHE ciphertext, predict() interface - `PrecedentEngine.sol` — immutable precedent index, encrypted searchPrecedents() function - `EvidenceVault.sol` — submitEvidence(), executeCourtOrder() with 3-of-5 multisig, VaultState enum
### Key FHE Design Decisions
- All sensitive inputs typed as `inEuint128` (identity/content hashes) or `inEuint32` (scores, codes, timestamps) - Access control model defined: FHE.allowThis() for contract self-access, FHE.allowSender() for submitter-only decrypt, FHE.allow(handle, addr) for selective court disclosure - Tamper-proof audit trail: every analysis commits keccak256(caseId, timestamp, judgeAddress) on-chain — existence proven without content exposed
### The Novel Student → Judge Pipeline
Designed a unique crowd-sourced second-opinion layer: law students practice on encrypted real cases, their encrypted recommendations and scores aggregate on-chain, and assigned judges receive a statistical summary (e.g. "87% of students predicted conviction, top arguments focused on chain of custody") — all without any student or judge seeing victim identities or sealed evidence. This is architecturally impossible without FHE.
### Documentation
Completed a full Technical Whitepaper (v2.0) covering: cryptographic foundation (TFHE scheme), complete Solidity interfaces with FHE operations, 8-step workflow tables for every module, threat model, market analysis (TAM $31.6B / SAM $8.4B / SOM $420M), and competitive positioning vs Harvey AI, Westlaw, SUPACE, and Adalat.AI.
**GitHub:** https://github.com/arpit2222/lexcrypt **Whitepaper:** in github => Started training my model on legal cases initially data.
### Why This Matters
38% of legal institutions globally refuse cloud AI due to data privacy. India has 54 million pending cases and a documented shortage of 5,000 judges. LexCrypt is the only protocol that removes the privacy barrier entirely — the AI computes on what it cannot read.
## Wave 2 submission
Wave 2 — FHE Smart Contracts Live on Arbitrum Sepolia Legal case analysis has never been possible on transparent rails. Attorney-client privilege, sealed evidence, and jurisdictional confidentiality requirements make on-chain legal tooling legally impossible without privacy guarantees. LexCrypt solves this with FHE computation over encrypted legal inputs — no raw data ever touches the chain. What we shipped this wave: → LexCryptRegistry.sol deployed on Arbitrum Sepolia — role-based access control with FHE.allowSender() permit management. Judges, attorneys, and clients each hold scoped decrypt permissions. → JudgeAssistant.sol — analyzeCase() accepts encrypted inputs (inEuint128, inEuint32), runs FHE weighted scoring over ciphertext, stores encrypted result handles. Zero plaintext ever on-chain. → WinPredictor.sol — 5-feature FHE logistic regression. predict() function live. Results decrypt client-side only via CoFHE permits. → Full @cofhe/sdk integration: useEncrypt(), useWrite(), useDecrypt() hooks working end-to-end. MetaMask wallet connection + FHE permit flow complete. → User submits case data in browser → CoFHE SDK encrypts client-side → calldata is pure ciphertext → result decrypts locally. No server. No trusted intermediary. Migrated fully from fhenixjs to CoFHE SDK.
## Wave 3 submission
Updates in this Wave: ⚖️ LexCrypt — PracticeArena Live + CoFHE SDK Migration Complete LexCrypt is private justice infrastructure. Attorney-client privilege, sealed evidence, and jurisdictional data requirements make legal AI on transparent rails legally impossible in most jurisdictions. LexCrypt resolves this: every computation runs on encrypted inputs and the AI model reads nothing it touches. 🔗 GitHub: https://github.com/arpit2222/lexcrypt 📦 Contracts on Arbitrum Sepolia: LexCryptRegistry.sol + JudgeAssistant.sol + WinPredictor.sol (Wave 2, carried forward) — role-based access control, FHE weighted case scoring, 5-feature encrypted logistic regression. PracticeArena.sol (Wave 3) — double-blind student scoring module. Law students submit encrypted legal arguments on anonymized case data. scoreArgument() accepts inEuint128 (argument content hash), inEuint32 (score). FHE.add() accumulates scores entirely on ciphertext. Assigned judge calls getAggregate() — receives encrypted statistical result, decrypts locally via permit. No student identity, argument content, or individual score ever on-chain as plaintext. 🛠 Wave 3 — What We Built: Migrated fully from deprecated FHE.decrypt() to new @cofhe/sdk paths: decryptForView for UI-side result display, decryptForTx for on-chain conditional logic. All 3 deployed contracts updated and redeployed. Fully compliant with April 20 CoFHE deprecation. ACL permission model finalized across all roles: FHE.allowSender() for attorney/student decrypt of own submissions, FHE.allow(handle, judgeAddr) for selective judge access to case results, FHE.allowThis() for contract self-access during scoring aggregation. Three-tier model covers every legal role. Frontend encrypted case submission flow complete: user inputs case data in browser → @cofhe/sdk useEncrypt() encrypts client-side → calldata is pure ciphertext → analyzeCase() on JudgeAssistant.sol runs FHE weighted scoring → result decrypts locally via useDecrypt() with MetaMask permit. No server. No trusted intermediary. No plaintext ever leaves the client. 25+ passing Hardhat tests: case submission, scoring, aggregation, role access control, permit grant/revoke, WinPredictor predict() function across 5 input combinations. 📈 Why This Market Needs FHE Now: 38% of legal institutions globally refuse cloud AI due to data privacy requirements. India alone has 54 million pending cases with a documented shortage of 5,000 judges. Harvey AI, Westlaw AI, SUPACE — all require uploading raw case data to cloud servers, making them inadmissible in sealed-evidence jurisdictions. LexCrypt is the only protocol where the AI computes on data it cannot read. This is not a privacy feature — it is the legal basis for the product's existence.
## Wave 4 submission
What We Shipped: → Enterprise PracticeArena (Live): Law firms now deploy encrypted case scoring in-house. Attorneys submit legal arguments (encrypted). LexCryptRegistry.sol assigns cases to judges via FHE role-based access. No case details exposed to contract layer. → Multi-Jurisdiction Compliance: WinPredictor.sol runs FHE logistic regression on 5-feature encrypted legal arguments. JudgeAssistant.sol aggregates 20+ cases in parallel without cross-case data leakage. Each jurisdiction enforces own decrypt permissions via FHE.allow() per court. → Sealed Evidence Preservation: Attorneys submit sealed exhibits encrypted. Case scoring & judge assignment happen entirely on ciphertext. Outcome commits on-chain with Merkle proof. Court releases seal → permit grant → judge decrypts verdict only for authorized participants. → Full CoFHE SDK Migration: @cofhe/sdk useEncrypt(), useWrite(), useDecrypt() hooks. Client-side browser encryption. MetaMask permit flow. Zero server intermediary. Testing & Validation:
30+ Hardhat tests: role-based decryption, multi-case aggregation, sealed evidence validation, judge assignment logic, jurisdiction enforcement Live with 5 simulated law firms + 3 simulated court jurisdictions 25+ passing tests covering case submission, scoring, aggregation, permit grants, outcome decryption
Deliverables:
🔗 GitHub: https://github.com/arpit2222/lexcrypt 🎯 Live Demo: https://vercel.com/arpit-projects-297ad7e9/lex-crypt/deployments Why This Matters: Legal AI is the last frontier where FHE unlocks genuine privacy guarantees. Harvey AI, Westlaw AI, and SUPACE all require uploading raw case data — making sealed evidence inadmissible in privacy-critical trials. LexCrypt is the only legal AI where attorneys use AI without losing privilege. This solves 38% of the legal sector's AI adoption blocker: encrypted evidence + transparent judgment + jurisdictional compliance, all cryptographically guaranteed.
## Wave 5 submission
Legal infrastructure isn't just about AI; it's about executing outcomes securely. In this final sprint, LexCrypt evolved from an encrypted legal AI tool into a fully-fledged institutional-grade privacy protocol, implementing the most advanced Fhenix capabilities specifically requested in the buildathon rubric (Sealed-Bids, Confidential Payments, and Compliance).
What We Shipped for the Final Wave:
→ Sealed-Bid Legal Marketplace (SealedBidRFP.sol): Citizens now post encrypted RFPs for representation. Lawyers submit retainer bids as inEuint32. The smart contract utilizes FHE.lt to evaluate the lowest bid entirely on-chain—assigning the case without exposing the losing bids or the winning price to the public. The exact "Sealed-Bid Mechanic" the market demanded.
→ Whistleblower Evidence Vault (WhistleblowerVault.sol): A cryptographic dead-man’s switch for corporate whistleblowers. Evidence (IPFS CID) is locked with an encrypted release deadline. If the whistleblower fails to check in, the FHE contract decrypts the timestamp logic (FHE.gt) and safely releases the evidence.
→ Privara SDK Integration (ConfidentialEscrow.sol): Added a simulated FHERC20 payment flow for legal retainers. Citizens can lock funds securely, ensuring that treasury balances and lawyer payouts remain entirely invisible to blockchain forensics.
→ Institutional Multi-Sig Execution (LegalContractFHE.sol): Upgraded our core legal agreements to support corporate governance. The contract now requires configurable multi-party threshold signatures (e.g., 3-of-5 board members) via FHE approvals before any encrypted M&A or earnout payment can execute.
→ Zero-Knowledge Selective Disclosure (Backend): Implemented an /api/fhe/audit endpoint that generates cryptographic Merkle Root hashes of the encrypted contract state. This allows regulators to verify execution integrity without us having to decrypt the sensitive legal terms.
Testing & Validation:
Complete end-to-end frontend integration via @cofhe/sdk in Next.js (New UIs for Sealed Bids and Whistleblower Vaults). All contracts successfully deployed and fully verifiable on the Arbitrum CoFHE Testnet. Deliverables: 🔗 GitHub: https://github.com/arpit2222/LexCrypt 🎯 Live Contracts (Arbitrum CoFHE):
LegalContractFHE: 0xEc8CBba8A35Db34498012c2C83be244aeb4f6d17 ConfidentialEscrow: 0xF35D45129Bb0FF34A9c431beAA7ed159c4DD1563 SealedBidRFP: 0xA48017BfdB85973bc89d524029B3fB93cA565F5e WhistleblowerVault: 0x5Ed8ba4C6f182bf13c53CeE0E187C549ceD636AA
From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.





