Inspiration

The UX of transaction signing in Web3 is fundamentally broken. Right now, users are routinely forced to sign opaque hexadecimal calldata, trusting that a contract won't drain their wallet. We’ve seen countless hacks and phishing scams where users unknowingly grant unlimited token approvals to malicious actors. Existing tools are entirely reactive—they track stolen funds after the fact. We asked ourselves: What if we could intercept and simulate every transaction before the user even clicks sign?

We realized that by combining the deterministic privacy of the Midnight Network with the reasoning capabilities of AI, we could create an intelligent firewall for Web3.

What it does

Nocturne is an AI Security Copilot and deterministic pre-sign verification layer built natively for the Midnight Network.

When a user encounters a new dApp, smart contract, or transaction, Nocturne intercepts the payload. Before a signature is ever requested, Nocturne:

  1. Simulates the transaction locally using Midnight’s compact_call sandbox.
  2. Evaluates zero-knowledge constraints to ensure invariants hold true and the state transition is valid.
  3. Analyzes the threat landscape by querying a multi-hop Neo4j graph database to detect behavioral heuristics like phishing clusters and proxy laundering.

Users can literally ask their AI assistant, "Is this Midnight address safe to interact with?" Through our custom Model Context Protocol (MCP) server, the AI agent natively executes the simulation, reads the threat graph, and provides a clear, natural-language risk assessment along with a 0-100 safety score.

How we built it

We engineered Nocturne as a precision instrument, separating the deterministic ZK simulation runtime from the conversational AI interface.

  • The Brain (AI Integration): We built a custom Model Context Protocol (MCP) server. This allows AI agents (like Claude Desktop) to execute audit_wallet and simulate_transaction JSON-RPC commands directly against our backend.
  • The Core (Midnight Simulator): We integrated the @midnight-ntwrk/midnight-js SDK to build our Active Security Posture (ASP) Runtime Engine. This engine takes the transaction calldata and evaluates it against the Midnight Preview Testnet.
  • The Threat Graph (Heuristics): We deployed a Neo4j graph database to map blockchain interactions, allowing the AI to detect multi-hop laundering and unverified proxy delegations in milliseconds.
  • The Frontend: We built a stunning, hardware-accelerated dark-mode dashboard using Next.js 14, React, and TailwindCSS, giving users a premium security terminal experience.

Challenges we ran into

Integrating a deterministic blockchain simulator with a non-deterministic AI agent was incredibly difficult. Initially, the AI would hallucinate transaction outcomes or refuse to process Midnight's Bech32 addresses because it assumed all blockchain tools strictly used Ethereum hex formats. We had to build a rigid validation pipeline within our MCP server to bypass generic EVM checks and force the AI to rely exclusively on the deterministic outputs of our Midnight compact_call simulator.

Accomplishments that we're proud of

We are incredibly proud of successfully bridging the gap between conversational AI and zero-knowledge privacy. Watching our AI agent natively understand a Midnight address, execute a ZK simulation in the background, and return a human-readable security verdict in under two seconds was a massive "aha!" moment for the team.

What we learned

We gained a deep appreciation for the power of the Model Context Protocol (MCP). By formalizing how AI tools interact with local infrastructure, we realized that AI doesn't just have to be a chatbot—it can be a deterministic operating system for blockchain security. We also learned the immense value of Midnight's privacy-first architecture, as it allowed us to evaluate contract constraints without exposing sensitive transaction intents.

What's next for Nocturne

We plan to expand our Neo4j threat graph by integrating real-time phishing data feeds. Furthermore, we want to package the Nocturne ASP engine into a browser extension, so users can get real-time AI security audits injected directly into their Midnight wallets (like Lace) seamlessly during their browsing experience.

Built With

  • anthropic-claude
  • artificial-intelligence
  • compact
  • cybersecurity
  • midnight-network
  • model-context-protocol
  • neo4j-graph-database
  • next.js
  • node.js
  • prisma-orm
  • react
  • tailwindcss
  • typescript
  • zero-knowledge-proofs
  • zk-snarks
Share this project:

Updates

Submission history