DEV Community

ANKIT KUMAR
ANKIT KUMAR

Posted on AI-assisted

Building SolShield AI: Byte-Level Honeypot & Rug Defense for Solana AI Agents

Stop Your AI Agent from Getting Rugged on Solana

In 2026, autonomous AI agents are executing high-frequency swaps, sniping liquidity pools, and rebalancing DeFi portfolios on Solana. Thanks to Solana's sub-cent fees and 400ms block confirmation times, Solana is the only blockchain where continuous agent micro-simulations are economically viable.

However, putting capital into an autonomous agent's hands exposes a catastrophic attack vector: agents cannot tell a legitimate token from a honeypot or rug pull before signing a transaction.


The Fatal Flaw of Metadata Scrapers

Most AI trading bots check token safety by hitting metadata APIs. That is table stakes.

The real rug pulls don't happen in off-chain metadata. They live inside the on-chain byte layout of the SPL Token Mint account:

  1. Active Freeze Authority: The token creator retains the byte-level right to freeze holder accounts, preventing users and bots from ever selling.
  2. Uncapped Mint Authority: The creator can print infinite tokens at zero cost and dump them directly into liquidity pools, diluting holders to zero.
  3. Runaway Agent Spending: Without deterministic constraints, agent hallucinations or faulty retry loops can drain a wallet in minutes.

To solve this, we built SolShield AI for the MLH Solana Hackathon 2026.


Architecture: Byte-Level Deserialization + Deterministic Guardrails

[ User Intent / Natural Language ]
               │
               ▼
   [ Autonomous Intent Parser ]
               │
   ┌───────────┴──────────────────────────────┐
   ▼                                          ▼
[ Guardrail Policy Check ]     [ 82-Byte SPL Mint Deserializer ]
  - Max spend per trade          - Bytes 0-35: Mint Authority
  - 24-hr daily budget cap       - Bytes 36-45: Supply & Decimals
  - Min safety score             - Bytes 46-81: Freeze Authority
   │                                          │
   └───────────┬──────────────────────────────┘
               ▼
[ Pre-Flight Jupiter Aggregator Routing (v6) ]
               ▼
 [ 400ms Safe Settlement on Solana ]
Enter fullscreen mode Exit fullscreen mode

1. Direct SPL Mint Byte Parsing

SolShield doesn't rely on cached APIs. It queries the raw 82-byte account data directly from the Solana RPC:

// Raw 82-byte SPL Token Mint layout
// Bytes 0-3:   Mint Authority Option (COption<Pubkey>)
// Bytes 4-35:  Mint Authority Pubkey (32 bytes)
// Bytes 36-43: Supply (u64, little-endian)
// Bytes 44:    Decimals (u8)
// Bytes 45:    isInitialized (bool)
// Bytes 46-49: Freeze Authority Option (COption<Pubkey>)
// Bytes 50-81: Freeze Authority Pubkey (32 bytes)

public parseSplMintBytes(data: Buffer | Uint8Array) {
  const buffer = Buffer.from(data);
  const mintAuthorityOption = buffer.readUInt32LE(0);
  const hasMintAuthority = mintAuthorityOption === 1;

  const freezeAuthorityOption = buffer.readUInt32LE(46);
  const hasFreezeAuthority = freezeAuthorityOption === 1;

  return { hasMintAuthority, hasFreezeAuthority };
}
Enter fullscreen mode Exit fullscreen mode

If freezeAuthorityOption === 1, SolShield flags the token as CRITICAL RUG RISK and terminates execution immediately.

2. Autonomous Intent Parser with Multi-Step Reasoning

Users and developers can interact using plain English:

  • "Audit BONK token" — Inspects authorities, liquidity depth, and top holder concentration.
  • "Swap 0.2 SOL to USDC" — Verifies token health, queries optimal routes via Jupiter Aggregator, and prepares transaction signing.
  • "Swap 0.5 SOL for Honeypot Moon" — Triggers an instant guardrail veto, showing how rogue tokens are rejected.

Open Source & Hackathon Submission

Built with passion for the MLH Solana Hackathon 2026! Special thanks to the DEV community whose discussions around token safety oracles and zero-custody AI agents inspired this architecture.

Top comments (0)