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. |
Midnight Team full-stack development, smart contract architecture, and ZK protocol design. |
Copyright 2026 AutoDiscovery Team. All rights reserved.