LegalDefender: AI-Powered Tenant Protection Protocol

Inspiration

We witnessed countless low-income families and first-time renters in College Station being systematically exploited by predatory landlords. For these residents, a stolen security deposit isn't just an inconvenience—it’s the difference between making rent next month or facing eviction. Whether it was illegal late fees that trap tenants in debt cycles, hidden "as-is" clauses masking dangerous mold, or the fear of retaliatory eviction for requesting basic repairs, the power dynamic was always lopsided. Most tenants didn't know their rights under the Texas Property Code (Chapter 92) and had no safe way to warn their community about bad actors. We wanted to build a "digital shield" that equalizes this equation, using Gemini and the Solana Blockchain to protect the most vulnerable among us.

What it does

LegalDefender is a comprehensive tenant protection suite that combines AI legal analysis with decentralized reputation tracking:

  • Contract Scanner: Users upload their PDF lease, and our Gemini 1.5 Pro agent instantly "audit-reads" it against a database of Texas Tenant Laws, flagging illegal clauses (e.g., "Waiving right to jury trial") in seconds.
  • Landlord Radar: A map-based reputation engine where users can see "Credit Scores" for properties. We implemented a "Gatekeeper" system that uses OCR to verify a user actually lives at an address before they can leave a review, effectively preventing review bombing.
  • Immutable Trust: Validated reviews are "minted" to the Solana blockchain, creating a permanent, censorship-resistant record. This ensures that a landlord cannot delete negative feedback or hide their history of violations.
  • Evidence Locker: A secure vault for tenants to timestamp and store photos of move-in conditions, ensuring they have immutable proof when fighting for their deposit return.

How we built it

Analyzing Leases Like a Supercomputer (Best Use of Gemini API)

We pushed the boundaries of Google Gemini 1.5 Pro by treating it not just as a chatbot, but as an adversarial legal counsel. Leases are notoriously dense, often containing 50+ pages of intentional obfuscation.

  • Context Window Abuse: We leveraged Gemini's massive context window to ingest entire lease documents alongside the full JSON-structured Texas Property Code.
  • Adversarial Analysis: Instead of asking "Is this lease good?", we prompt Gemini to "Find every clause that violates Texas Property Code § 92.056 (Landlord Liability)." Gemini successfully identifies subtle illegalities—like usurious late fees—that a human would miss.
  • Structured Output: Gemini returns analysis in strict JSON, allowing our React frontend to highlight specific dangerous paragraphs in real-time. ***Evidence Locker: **A secure vault where tenants upload move-in photos that are cryptographically timestamped and anchored on the Solana blockchain, each with a verifiable transaction ID to create immutable proof for deposit disputes.
  • The "13 Keys" Database: We didn't just ask Gemini to "check the lease." We built a proprietary JSON database (texas_tenant_laws_13_categories.json) containing the exact text of 13 critical risk categories from Texas Law—including Repairs, Security Deposits, and Liability Waivers.
  • Context Window Abuse: We leveraged Gemini's massive context window to ingest entire leases alongside this structured legal database. This allows Gemini to cross-reference every paragraph of a user's contract against the actual letter of the law.
  • Scalable Legal Engineering: While we started with Texas, our database structure is designed to ingest legal codes from all 50 states. We can swap the "Texas Module" for "California Civil Code" instantly, making LegalDefender a scalable national platform.
  • Structured Output: Gemini returns analysis in strict JSON, allowing our React frontend to highlight specific dangerous paragraphs in real-time.

Minting Reputation at Light Speed (Best Use of Solana)

Trust is the core problem in tenant reviews. Centralized platforms (like Yelp or Google) allow landlords to pay for the removal of bad reviews. We solved this with Solana.

  • Decentralized Identity: We architected a system using Program Derived Addresses (PDAs), where each rental property exists as a unique on-chain account.
  • Immutable Reviews: When a verified tenant submits a review, the application constructs a Solana transaction that "mints" the review data permanently to the property's PDA. This creates an unalterable, public history of the landlord's behavior that cannot be scrubbed.
  • High-Frequency Verification: Solana's high throughput allows us to verify tenancy and mint the review in seconds, making the "blockchain" experience feel instant to the user. We leveraged this speed to implement our "Gatekeeper" logic—verifying lease documents and writing the proof on-chain without making the user wait.

Infrastructure for the Real World (Best Use of DigitalOcean)

To ensure LegalDefender could scale to handle thousands of students during "leasing season," we deployed our infrastructure on DigitalOcean.

  • App Platform: We hosted our Next.js 15 application on DigitalOcean App Platform. Its automated deployments from GitHub meant we could ship features instantly during the hackathon.
  • Scalable Compute: Our OCR "Gatekeeper" service requires significant processing power to scan lease PDFs for address data. DigitalOcean's robust compute instances allowed us to keep this processing fast and reliable, ensuring a smooth user experience even with heavy PDF uploads.

Challenges we ran into

  • Maps Integration: Getting Google Maps to play nicely with our custom React overlays and dark mode theme was tricky. We had to build a custom hook to synchronize the map camera with our "Demo Scenarios" to ensure a smooth presentation.
  • Legal Nuance: Teaching the AI to distinguish between "strict but legal" and "actually illegal" required fine-tuning our system prompts and injecting specific Texas Property Code statutes into the context.
  • The "Gatekeeper": We wanted to prevent fake reviews while preserving privacy. Verifying tenancy without exposing personal data was hard. We built a system that scans lease filenames and headers to confirm the address matches the verified property before allowing a review to be written to Solana, combining Web2 OCR with Web3 permissioning.

Accomplishments that we're proud of

  • The UI "Vibe": We moved away from the boring "legal" aesthetic and created something that feels like a Cyberpunk/Fintech tool—empowering, futuristic, and engaging.
  • The "Scanner-to-Map" Pipeline: We're proud of how analyzing a lease in one part of the app automatically populates the "Landlord Radar" map with that property's data, creating a fully connected ecosystem.
  • Real-Time Geocoding: Implementing a map search that feels alive, using real-world coordinates to instantly transport users to the properties they need to see.

What we learned

  • AI is a force multiplier for justice. Legal text is dense and exclusionary by design. LLMs like Gemini are incredibly good at "translating" legalese into plain English, which is a massive public good.
  • Trust is a UX problem. Blockchain features usually scare normal users. We learned to hide the complexity behind "Verified Badges" and "Minting" animations that feel rewarding rather than confusing.

What's next for LegalDefender

  • Mainnet Deployment: Transitioning our Solana architecture to live Mainnet PDAs using the Anchor framework for global availability.
  • Mobile App: Tenants need this tool in their pocket during walk-throughs.
  • Crowd-Sourced Legal Aid: Connecting verified users with local tenant unions and pro-bono legal clinics directly through the app.

Built With

Share this project:

Updates