💡 Inspiration

We are living in the golden age of Artificial Intelligence, but it comes with a massive compromise: Personal Privacy. Today, utilizing powerful AI models requires handing over sensitive personal data whether it's financial records, medical history, or proprietary business logic to centralized tech giants. We asked ourselves: Why must we choose between capability and confidentiality?

Our inspiration for Aegis AI was born from the desire to break this paradox. We wanted to create a world where users maintain absolute sovereignty over their data while still leveraging cutting-edge AI, directly answering the Midnight Hackathon's call to solve the internet's biggest privacy challenges.

⚙️ What it does

Aegis AI is a confidential AI inference platform built on the Midnight network. It allows users to run AI models on their personal data without ever exposing that data to the model provider, the network nodes, or the public ledger.

When a user submits a prompt containing sensitive data, the data remains encrypted locally. We utilize Zero-Knowledge Machine Learning (zkML) concepts integrated with Midnight's shielded smart contracts to prove that the AI inference was executed correctly. The blockchain verifies the proof, guaranteeing the integrity of the AI response without ever seeing the raw data.

🛠️ How we built it

We architected Aegis AI to seamlessly blend a Web2 user experience with Web3 cryptographic guarantees:

  1. Frontend Interface: We built a sleek, responsive UI using Next.js and TailwindCSS that feels exactly like using standard AI chatbots, abstracting away the complex blockchain mechanics.
  2. Zero-Knowledge Proof Generation: When an inference request is made, we generate a cryptographic proof \( \pi \). Mathematically, if our AI model is represented by a function \( f \), public weights \( w \), private user input \( x \), and output \( y \), we generate a proof that: $$ f(x, w) = y $$ The proof \( \pi \) guarantees the computation is correct, while \( x \) (the sensitive data) remains completely hidden.
  3. Midnight Smart Contracts: We utilized Compact (Midnight's native programming language) to write smart contracts that manage the shielded state. The contract takes the proof \( \pi \) and verifies it on the Midnight network. This ensures that the transaction history and the exact inputs remain mathematically hidden from the public ledger, while the verifiable outcome is recorded.

🚧 Challenges we ran into

Building at the intersection of AI and Zero-Knowledge cryptography is incredibly complex.

  • Integrating zkML with Midnight: Generating proofs for AI models is computationally heavy. We had to optimize our circuit sizes and carefully design our data flow to ensure the proof generation didn't cripple the user experience.
  • Learning Compact: As a relatively new language, getting up to speed with Compact's unique approach to shielded states and data protection required a steep learning curve and extensive reading of the Midnight documentation.
  • State Management: Designing the architecture so that the public ledger and the private state remained perfectly synchronized without leaking metadata was a major architectural hurdle.

🏆 Accomplishments that we're proud of

  • Successfully deploying a privacy preserving smart contract on the Midnight network.
  • Achieving a seamless UI where a user can submit a completely hidden prompt and receive a mathematically verified response.
  • Building a project that doesn't just use blockchain as a buzzword, but fundamentally relies on Midnight's core value proposition to function.

📚 What we learned

We gained an incredible appreciation for the power of data protection technologies. We mastered the basics of the Compact language, deepened our understanding of zero-knowledge proofs, and learned how to think about decentralized applications in terms of "shielded" vs. "unshielded" states rather than just public ledgers.

🚀 What's next for Aegis AI

This is just the beginning. We plan to:

  1. Expand support to larger, more capable Open Source LLMs.
  2. Create a decentralized marketplace where researchers can train models on encrypted, crowdsourced data without ever seeing the raw information.
  3. Continue developing Aegis AI within the Build Club accelerator to bring true privacy to the AI revolution!

Built With

Share this project:

Updates