Case StudyMay 15, 20265 min read

How we built real-time threat detection in under 100ms

AI wallets are a new category of software - autonomous agents that hold real money and execute transactions without human approval. When we started building AttoGuard, the security layer for these wallets, we had one constraint that shaped every decision: every transaction has to be scanned in under 100 milliseconds.

The problem: prompt injection meets real money

AI wallets work by letting a large language model interpret user intent and execute blockchain transactions. You say "send 5 USDC to Alice," and the AI agent parses that, constructs the transaction, and submits it. This is powerful. It's also dangerous, because the same natural language interface that makes the wallet useful makes it vulnerable to prompt injection.

A prompt injection attack embeds malicious instructions inside what looks like normal input. The attack surface is enormous because every piece of text the AI processes is a potential vector - transaction memos, token names, contract interaction payloads, even encoded characters that render as whitespace but contain hidden instructions.

Existing security solutions didn't address this. The blockchain security ecosystem was focused on smart contract auditing - checking Solidity code for vulnerabilities. Important work, but completely orthogonal to our problem. Nobody was protecting the AI layer. The vulnerability wasn't in the contract. It was in the agent reading the input.

Why existing approaches fell short

The obvious solution is to pass every input through a second AI to check if it looks like an attack. This actually works in terms of accuracy. The problem is speed. Even a fast inference takes 200-800ms. For a security layer in the critical path of every transaction, that's unacceptable. Users won't tolerate that delay, and for time-sensitive DeFi operations - arbitrage, liquidation protection, limit orders - it can mean the difference between a successful trade and a missed opportunity.

We also couldn't batch. Each transaction needs an independent, real-time verdict. There's no shortcut that helps here. Every input is unique, every scan is isolated, and the result has to be available before the transaction proceeds.

Our approach

AttoGuard uses a proprietary, adaptive detection engine that scans wallet transactions for prompt injection attacks across 7 EVM networks in under 100ms. The system sits between the user input and the AI wallet agent, intercepting every transaction request before it reaches the wallet logic.

The core insight was that not every input needs the same depth of analysis. The vast majority of wallet interactions are unambiguously safe. A straightforward transfer to a known address with no unusual payload doesn't need deep analysis. By designing the system to resolve obvious cases quickly and only escalate ambiguous ones, we keep the overall latency well within budget.

The system supports 12 languages, detects encoding tricks and disguise attempts, and runs transaction simulations on the actual target network before execution. Detection is accurate to current on-chain conditions across Ethereum, Polygon, Arbitrum, Optimism, Base, Avalanche, and BNB Chain.

Continuous evolution

A static security system is a losing game. Attackers iterate faster than any team can manually write rules. AttoGuard's detection engine evolves continuously - every blocked attack strengthens the system's defenses across the entire network of protected wallets.

The system is tested rigorously on an ongoing basis to ensure coverage against evolving attack techniques. This creates a dynamic where defenses improve automatically as the threat landscape changes, without requiring manual intervention.

The result

AttoGuard today operates across 7 blockchain networks with a continuously growing threat pattern database. Sub-100ms scan latency in production. The system handles real transactions with real money at stake, every day.

This is the kind of problem we live for at Kaev - systems where the constraints are tight, the stakes are real, and the solution has to be engineered, not hacked together. AttoGuard isn't a wrapper around an existing security tool. It's a purpose-built system designed from scratch for a threat model that didn't exist three years ago.

Need a system built under hard constraints? Kaev engineers production infrastructure where performance, security, and reliability aren't optional. Get in touch.

Back to blog