Inspiration AI is becoming essential in healthcare, finance, and legal services, but these industries handle highly sensitive data that cannot safely be sent to public AI services or exposed on public blockchains. We wanted to build a way to use powerful AI inference while preserving data confidentiality and eliminating the need to blindly trust the AI provider.
This led to PrivateInfer: a trustless marketplace for private, off-chain AI inference powered by Midnight's zero-knowledge architecture.
What it does ? PrivateInfer allows a Query Maker to submit encrypted, sensitive data and request an AI inference from a decentralized AI Provider.
The query and AI response remain off-chain and private. The provider processes the request inside a secure Trusted Execution Environment (TEE). Cryptographic commitments are stored on the Midnight Preview Network instead of the sensitive data itself. The provider submits a result hash and Zero-Knowledge proof to demonstrate that the requested computation was performed correctly. A Compact smart contract verifies the proof and manages the tDUST escrow. Payment is released automatically only after successful verification.
This creates a trust-minimized workflow where users can verify computation without exposing their private inputs or outputs on-chain.
How we built it : PrivateInfer combines a modern web stack with Midnight's privacy-preserving smart contract model: Next.js 14 + TypeScript for the application and dashboards. Midnight Compact for the smart contract, private witnesses, ZK-proof verification, state transitions, and escrow. 1AM Wallet for transaction signing and network interaction. Neon PostgreSQL + Prisma for off-chain metadata and query/provider management. TEE-based AI Provider Node for secure off-chain inference. TailwindCSS + shadcn/ui for the frontend. Jest for testing cryptographic and parsing utilities. GitHub Actions for frontend, contract, and type-checking CI.
The architecture deliberately separates public on-chain state—commitments, hashes, statuses, and escrow—from private off-chain data, such as the actual AI prompt, sensitive input, and inference output.
Challenges we ran into The biggest challenge was designing the boundary between private computation and public blockchain verification. Sensitive AI data cannot simply be placed on-chain, so we had to carefully structure commitments and private witnesses while ensuring the smart contract could still verify the required conditions.
We also faced challenges around: Integrating Midnight Compact circuits with the application. Handling ZK-proof generation and verification correctly. Managing encrypted/off-chain data alongside on-chain commitments. Integrating wallet transactions and tDUST escrow flows. Parsing wallet public keys into the exact byte formats required by the circuits. Coordinating asynchronous AI provider execution with blockchain state transitions. Accomplishments that we're proud of
We successfully built and deployed a working PrivateInfer MVP on the Midnight Preview Network.
We're particularly proud of: Deploying and interacting with a functional Compact smart contract. Implementing a complete query → inference → proof → payment workflow. Using ZK proofs to verify computation without exposing sensitive information. Building an escrow mechanism that releases payment only after verification. Separating public blockchain state from private AI inference data. Creating dedicated interfaces for both Query Makers and AI Providers. Establishing automated CI and tests for critical application logic. Demonstrating the complete workflow through real Preview Network transactions. What we learned
We learned that building privacy-preserving applications requires a fundamentally different architecture from traditional Web3 applications. The goal is not simply to encrypt everything, but to carefully determine what needs to be public, what should remain private, and what can be proven without being revealed.
Working with Midnight Compact also taught us how powerful the combination of private witnesses, public commitments, and zero-knowledge proofs can be for decentralized applications.
Most importantly, we learned that blockchain can act as a verification and settlement layer for AI rather than needing to perform the AI computation itself.
What's next for PrivateInfer ? Our next goal is to make PrivateInfer capable of proving increasingly complex AI computations.
Planned improvements include: ZK-VM integration to prove larger portions of an AI/LLM execution trace. Provider reputation, staking, and slashing to incentivize reliable inference providers. MPC-based inference to distribute computation across multiple parties for stronger privacy. Support for more sophisticated AI models and enterprise workloads. Improved provider discovery, pricing, and marketplace functionality. Production-ready security, scalability, and compliance features.
Ultimately, we envision PrivateInfer becoming a trustless privacy layer for enterprise AI, allowing organizations to use AI on sensitive data without surrendering control of that data or blindly trusting the infrastructure performing the computation.
Built With
- compact
- midnight
- next
- prisma
- tailwind
- typescript

Log in or sign up for Devpost to join the conversation.