DEV Community

Ashlesha Anjarkar
Ashlesha Anjarkar

Posted on

Building BlinkGuard: A Pre-Sign AI Transaction Firewall & Trading Copilot on Solana

Every month, Web3 users lose millions to blind-signing wallet drainers disguised as routine DeFi transactions. At the same time, autonomous AI agents executing on-chain swaps lack standardized preflight security guardrails.

Over the weekend for the MLH Solana Global Hackathon, I built BlinkGuard—a real-time, pre-sign AI transaction firewall and natural-language trading copilot on Solana.


⚡ The Problem We Solved

  1. Blind Signing & Phishing Drainers: Standard wallet approval popups obscure complex contract logic, tricking users into approving unbounded token delegations or malicious escrow instructions.
  2. Unsafe AI Agent Execution: Autonomous agents interacting with Solana DEXs are vulnerable to prompt injection and malicious swap routing without an independent verification layer.
  3. DeFi UX Friction: Setting slippage thresholds, verifying token mints, and finding optimal liquidity routes across AMMs remains intimidating for everyday users.

💡 How BlinkGuard Works

BlinkGuard acts as a two-sided defensive layer on Solana:

  • For End Users: A conversational DeFi swap copilot powered by Gemini 2.5 Flash and Jupiter V6. You type plain English (e.g., "Swap 0.5 SOL to USDC"), and BlinkGuard simulates the balance changes, assigns a 0–100 Risk Score, and cryptographically attests the preflight check via Phantom Wallet (signMessage). If a drainer pattern or unbounded authority delegation is detected (Risk Score ≥ 80), the signature button locks automatically.
  • For Autonomous AI Agents: A standardized Solana Agent Skill endpoint (/api/skill) that any agent runtime can call as zero-trust middleware before signing a transaction.

text
User / Agent Prompt
       │
       ▼
[/api/parse] (Gemini 2.5 Flash Structured Schema)
       │
       ├─► Threat Detected (Risk Score ≥ 80 / Drainer Vector)
       │     └─► [LOCK] Signature button disabled & malicious vector flagged
       │
       └─► Intent Benign (Risk Score < 20)
             │
             ├─► [Jupiter v6] Optimized swap route fetched
             ├─► [Simulation] Expected in/out token balance diffs confirmed
             └─► [Wallet] Phantom signs cryptographic preflight attestation receipt

🛠️ Tech Stack

    Frontend & Framework: Next.js 15 (App Router), React, Tailwind CSS, Lucide Icons

    Blockchain & Wallet: @solana/web3.js, Solana Wallet Adapter (Phantom, Solflare)

    AI Engine: Google GenAI SDK (gemini-2.5-flash with strict JSON Schema evaluation)

    DEX Aggregation: Jupiter Aggregator API v6

    Deployment: Vercel

🤖 Solana Agent Skill Integration (/api/skill)

To make BlinkGuard composable for other builders, it exposes a machine-readable manifest and execution handler at https://blinkguard-uoq6-six.vercel.app/api/skill.

Any AI agent can audit an intent before signing using our TypeScript SDK (lib/solanaAgentSkill.ts):
TypeScript

import { blinkGuardAgentSkill } from "@/lib/solanaAgentSkill";

// Run preflight audit before initiating wallet signature
const result = await blinkGuardAgentSkill.execute({
  prompt: "Swap 0.5 SOL to USDC",
  userAddress: "YourSolanaPublicKeyHere",
});

if (!result.allowed) {
  console.error("Execution blocked by BlinkGuard:", result.reason);
}

🔗 Try It Out & Source Code

    Live dApp: https://blinkguard-uoq6-six.vercel.app

    Agent Skill Endpoint: https://blinkguard-uoq6-six.vercel.app/api/skill

🛡️ BlinkGuard

Pre-Sign AI Transaction Firewall & Natural-Language Trading Copilot on Solana

Built for the Solana Global Hackathon (Major League Hacking)

Live App Solana Skill YouTube Demo License: MIT


⚡ The Problem

  1. Blind Signing & Phishing Drainers: Users frequently authorize unbounded token delegations, malicious escrow instructions, or fake airdrop claims because standard wallet approval dialogs obscure transaction logic.
  2. Autonomous Agent Security Risks: AI trading agents operating on Solana lack standardized, independent preflight execution guardrails, exposing them to prompt injections and compromised swap routes.
  3. Complex DeFi Friction: Navigating decentralized exchanges, slippage thresholds, liquidity routes, and mint addresses presents a steep technical barrier for everyday users.

💡 Solution: What is BlinkGuard?

BlinkGuard delivers an active, two-sided defensive layer on Solana:

  • For End Users: A natural-language DeFi copilot that simulates transactions, scores threats (0–100), and dynamically disables signature actions upon detecting malicious drainer patterns.
  • For Autonomous AI Agents: A standardized Solana Agent Skill endpoint (/api/skill) and SDK (lib/solanaAgentSkill.ts…



I would love to hear your feedback on the architecture or ideas for expanding the preflight simulation rules! Drop a comment below if you're building with Solana or AI agents. 👇

Enter fullscreen mode Exit fullscreen mode

Top comments (0)