A Midnight-based dApp that automates legal discovery with jurisdiction-aware compliance,
zero-knowledge proofs, and privacy-first architecture.
This project is built on the Midnight Network.
Project Overview Β· Build Plan Β· Architecture Β· Discovery Protocol Β· Email Safety
With legal discovery sanctions reaching $8.5 million in a single case and 6 attorneys referred to the State Bar for discipline, discovery management in its current state is a huge problem in the US.
The legal discovery process is messy, time consuming, and varies by jurisdiction β with enormous consequences for compliance failures resulting in lost cases, unfavorable case delays, extremely expensive sanctions, and the potential of being disbarred.
π° $8.5M+ top sanction (single case) Β· π $704,094 avg sanction Β· ποΈ 38,000+ NYC cases dismissed (2024) Β· βοΈ 28% of malpractice claims from missed deadlines Β· πΈ $30B+/yr litigation cost from discovery
In New York City alone, 38,000+ cases were dismissed in 2024 due to discovery compliance failures β and conviction rates dropped from 50% to 25%. Nationally, discovery consumes 20β50% of total litigation costs β over $30 billion a year.
With autoDiscovery.legal, we aim to organize and formalize a hard-coded, geographically compliant, law-based protocol that will help organize, distribute, and give proper, accurate, and secure access control to user-aggregated legal discovery.
This protocol will abstract away liability, reduce man hours and overall costs, increase profits, and form an immutable (existing forever) proof of compliance, custody, provenance, and access.
It is our hope that autoDiscovery.legal will be the default protocol for accurate and dependable discovery/evidence management β backed with error insurance that will protect law firms from errors and omissions.
"AutoDiscovery doesn't just help you manage discovery β it mathematically proves you did it right."
|
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER'S MACHINE β
β Local state: documents, AI metadata, search indexes, encryption β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β PRIVATE LEDGER (on-chain, encrypted) β
β Document metadata Β· Party records Β· Deadlines Β· Case details β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β PUBLIC LEDGER (on-chain, immutable) β
β Compliance proof hashes Β· Timestamps Β· Production Merkle roots β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β SEALED LEDGER (write-once) β
β Commitment schemes Β· Pre-disclosure freezes β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Contract | Purpose |
|---|---|
| discovery-core | Case lifecycle, discovery steps, obligation tracking |
| jurisdiction-registry | Modular rule packs per jurisdiction |
| compliance-proof | ZK attestation generation and verification |
| document-registry | Production tracking, Merkle trees, Twin Protocol bonds |
| access-control | YubiKey-based authentication, role-gated permissions |
| expert-witness | W-9/I-9 workflows, qualification attestation |
π Full Architecture β Β· YubiKey Access Control β Β· Discovery Automation β
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 19 Β· Vite 6 Β· TypeScript 5 Β· Tailwind CSS 4 | Glass-morphism UI with jurisdiction comparatives |
| UI Components | shadcn/ui Β· Lucide Icons | Accessible, themeable component library |
| Smart Contracts | Compact (Midnight) | Privacy-preserving ZK smart contracts |
| Blockchain | Midnight Network | Dual-ledger (public + private) with ZK proofs |
| Wallet | Lace Browser Extension | User key management and transaction signing |
| Build | Turborepo Β· npm workspaces | Monorepo orchestration |
| Hosting | Vercel / Netlify | Frontend deployment |
AutoDiscovery/
βββ frontend-demoland-vite-react/ # React application
β βββ src/
β β βββ components/ # Reusable UI (email safety dialog, etc.)
β β βββ layouts/ # App shell, sidebar, navigation
β β βββ pages/ # Dashboard, case view, contacts, login
β β βββ providers/ # Provider pattern (auth, cases, docs, AI, contacts, email safety)
β β β βββ demoland/ # Mock providers for demo environment
β β βββ lib/ # Utilities
β βββ public/
βββ autodiscovery-contract/ # Compact smart contracts & TypeScript types
β βββ src/types/ # Strongly-typed data model (6 entities)
βββ autodiscovery-cli/ # CLI tools for deployment & operations
βββ docs/ # Comprehensive documentation (20+ docs)
β βββ discovery-automation/ # 9-step discovery protocol deep dives
β βββ reference/ # Jurisdiction research archives
βββ media/ # Brand assets
βββ turbo.json # Monorepo configuration
| Tool | Version | Link |
|---|---|---|
| Node.js | v23+ | nodejs.org |
| npm | v11+ | Bundled with Node.js |
| Docker | Latest | docker.com |
| Git LFS | Latest | git-lfs.com |
| Compact Compiler | Latest | docs.midnight.network |
| Lace Wallet | Latest | Chrome Web Store |
# Clone the repository
git clone git@github.com:SpyCrypto/AutoDiscovery.git
cd AutoDiscovery
# Install all dependencies (monorepo)
npm install
# Build smart contracts
npm run build
# Start frontend in demoLand mode
npm run dev:frontend# Copy environment templates
cp autodiscovery-cli/.env_template autodiscovery-cli/.env
cp frontend-demoland-vite-react/.env_template frontend-demoland-vite-react/.envThe repo ships Docker Compose files in autodiscovery-cli/ for running the proof server locally without a live network:
# Start proof server only (for contract compilation & testing)
cd autodiscovery-cli
docker compose -f ps-undeployed.yml up
# Or start the full local dev stack (proof server + indexer + node)
docker compose -f standalone.yml upDefault endpoints when running locally:
| Service | URL |
|---|---|
| Proof server | http://localhost:6300 |
| Indexer | http://localhost:8088 |
| Node | ws://localhost:9944 |
The proof server image used is midnightnetwork/proof-server:7.0.0.
Before deploying to PreProd, check docs.midnight.network/relnotes for the latest Ledger 7.0-compatible image tag.
To interact with Midnight PreProd you need a wallet funded with tDUST tokens:
- Install the Lace wallet browser extension and create or import a wallet.
- Switch Lace to the Midnight PreProd network.
- Copy your unshielded address from Lace.
- Visit the faucet at https://faucet.midnight.network/ and request tDUST tokens.
- You will need two values when configuring the CLI
.env:- Wallet mnemonic (24-word BIP-39 phrase) β
MY_PREVIEW_MNEMONIC - Unshielded address β
MY_UNDEPLOYED_UNSHIELDED_ADDRESS
- Wallet mnemonic (24-word BIP-39 phrase) β
| Variable | Description | How to obtain |
|---|---|---|
MY_PREVIEW_MNEMONIC |
24-word BIP-39 mnemonic for the deployer wallet | Export from Lace wallet settings |
MY_UNDEPLOYED_UNSHIELDED_ADDRESS |
Unshielded tDUST address used for local/undeployed testing | Copy from Lace wallet (unshielded address) |
| Variable | Description | How to obtain |
|---|---|---|
VITE_AD_MODE |
demoland for mock data, realdeal for live blockchain |
Set to realdeal when connecting to PreProd |
VITE_CONTRACT_ADDRESS |
On-chain address of the deployed discovery-core contract | Output from CLI deployment (npm run tui-preview) |
VITE_MIDNIGHT_NETWORK |
Midnight network target (testnet for PreProd) |
Use testnet for PreProd |
VITE_AI_SERVICE_URL |
URL for the AI metadata extraction service (optional) | Set if running the AI parsing service locally |
| Variable | Description | How to obtain |
|---|---|---|
VITE_CONTRACT_ADDRESS |
On-chain address of the deployed contract | Output from CLI deployment |
Follow these steps to connect the frontend to a live PreProd deployment:
- Deploy the contracts from the CLI:
cd autodiscovery-cli npm run tui-preview - Copy the contract address printed in the deployment output.
- Update the frontend
.env:VITE_AD_MODE=realdeal VITE_CONTRACT_ADDRESS=<address from step 2>
- Restart the frontend dev server.
Note: The realDeal provider layer is currently a stub (see finding 5.1 from the Build Club review). Setting
VITE_AD_MODE=realdealwill currently still fall back to demoLand providers. This section documents the intended flow for when the realDeal providers are fully implemented.
| Resource | Description |
|---|---|
| midnight-local-dev | Local development stack |
| midnight-doc-manager | Working PreProd integration example |
| Midnight Release Notes | Docker image versions & Ledger compatibility |
| Document | Description |
|---|---|
| Project Overview | Executive summary, problem statement, solution architecture |
| Build Plan | Living roadmap with phase tracking |
| Smart Contract Partitioning | 6-contract architecture, private/public/sealed state mapping |
| Discovery Automation | 9-step protocol, 24 categories, Merkle hashing, Twin Protocol |
| Email Safety Protocol | Threat levels, recipient flags, attachment scanning, tandem approval |
| Case Contacts Feature | Team-based contacts, star precedence, connected glow, drag reorder |
| YubiKey Access Control | Hardware key auth design (3 modes) |
| DemoLand vs RealDeal | Mock vs production architecture split |
| Jurisdiction Deep Dive | ID, OH, WA, UT, CA, NY rule mapping |
| Customer Analysis Matrix | Market research and adoption strategy |
| UI Design Notes | Brand palette, glass morphism, component guidelines |
| Pitch Deck | 11-slide investor pitch with stats, horror stories, and ROI math |
| Pitch Fodder | Shock & awe stats, landmark cases, one-pager, shareable synopsis |
| Week 3 Homework | Build Club deliverables tracker, resource pack, 3-min script outline |
| GeoZ Oracle | π Companion project β privacy-preserving geolocation oracle on Midnight (GeoZ.us / GeoZ.app) |
π₯ Idaho (IRCP) Β· π₯ Utah (URCP) Β· π₯ Washington (CR) Β· 4οΈβ£ California (CCP) Β· 5οΈβ£ New York City (CPLR) Β· 6οΈβ£ Ohio (Civ.R.)
Modular jurisdiction rule packs β add new states/federal circuits without code changes. Ohio included early due to serendipitous research.
One of AutoDiscovery's standout features β a multi-layered protection system that prevents accidental disclosure to the wrong party.
| Threat Level | Trigger | Action |
|---|---|---|
| SAFE | All recipients on our team | Standard send |
| CAUTION | Court staff, unknown recipients | Review content |
| DANGER | Opposing counsel or their team | Attachment review + tandem recommended |
| CRITICAL | Judge or magistrate | Tandem approval REQUIRED (2 approvers) |
Features include recipient auto-detection against the case contacts database, attachment metadata scanning (EXIF, tracked changes, hidden PDF layers), image preview before send, and a tandem approval workflow where N approvers must sign off on sensitive communications.
|
Domain Expert Β· Legal Discovery Specialist 20 years complex litigation paralegal experience. Published statistics reports for Idaho government agencies. Jurisdiction expertise across Idaho, Utah, and Washington. |
Developer Β· Midnight Builder Β· Architect Full-stack development, smart contract architecture, and ZK protocol design. |
Copyright 2026 AutoDiscovery Team. All rights reserved.