- Published on
How AI Detects Suspicious DeFi Transactions: Methods and Limits
Listen to the full article:
- Authors

- Name
- Jagadish V Gaikwad

Decentralised finance (DeFi) runs on public smart contracts, so every transaction is visible. That makes it possible to build detection systems, but "visible" is not the same as "understood". This guide explains the common detection techniques and why they sometimes fail. Checked on 19 November 2026. It describes general approaches from public material, not a specific vendor's system.
What "suspicious" can mean
- Theft and exploits: draining a protocol through a bug or manipulated price.
- Money laundering: splitting, moving and obscuring funds, including through bridges and mixers.
- Sanctions exposure: interacting with sanctioned addresses or services.
- Scams: rug pulls, fake tokens and phishing drainers.
- Market manipulation: wash trading and pump-and-dump patterns.
Chainalysis's 2026 report, as summarised in the press, said illicit addresses received at least $154 billion in 2025 and that stablecoins made up 84% of illicit volume, which is why stablecoin flows get so much attention (Forklog).
Common techniques
- Known-bad lists. Matching addresses and contracts against known hacks, scams and sanctions lists. Simple and reliable for known cases, useless for new ones.
- Rules. For example, flag a transfer above a threshold, a fast chain of hops, or interaction with a mixer.
- Anomaly detection. Models learn what normal looks like for a protocol or wallet and flag departures, such as a sudden large withdrawal or an unusual call sequence.
- Graph analysis. Looking at how funds flow between wallets to spot fan-out, fan-in and layering. See our post on mapping wallet relationships.
- Contract and transaction simulation. Replaying a transaction to see what it would do before or after it happens.
- Cross-chain tracking. Following funds through bridges and swaps, which is harder than tracing within one chain.
Why detection fails
- False positives. Legitimate activity can look odd. Arbitrage bots, market makers and large funds produce unusual patterns every day.
- New attacks. A model trained on past exploits may miss a novel one.
- Evasion. Attackers adapt, spread funds, use privacy tools and time their moves.
- Data gaps. Labels are inferred, and some chains and bridges have thin coverage.
- Speed. Many exploits finish in a single block, before a human can react. Detection after the fact still helps recovery and investigation.
What good systems do
- Show reasons, not just scores, so an analyst can judge the alert.
- Combine several signals, so one weak sign does not trigger action.
- Let teams tune thresholds to their own volume.
- Keep a human in the loop for decisions that freeze funds or file reports.
- Track precision and recall over time.
If you run or use a DeFi protocol
- Monitor your contracts for unusual calls and large outflows, with alerts to a real person.
- Have an incident plan, including who can pause the system and under what conditions.
- Use audits and bug bounties, but do not treat them as a guarantee.
- Limit what any single transaction or admin key can do.
If you are a user
- Be careful with approvals and with new, unaudited protocols.
- Use transaction simulation or warnings where your wallet offers them.
- Remember that detection tools protect platforms more than individuals. Your own habits matter most.
This is general information, not security advice.
Walking through a hypothetical flash-loan style attack
A concrete scenario shows what detection systems are trying to catch. Imagine a made-up lending protocol that values collateral using the price in a single small trading pool. An attacker follows these steps, all inside one transaction.
- Borrow a very large amount of a token for a single transaction, using a mechanism that requires repayment before the transaction ends.
- Use that money to buy a large amount of a thinly traded token in the small pool, pushing its price far above its normal level.
- Deposit the inflated token as collateral in the lending protocol, which now values it at the distorted price.
- Borrow a large amount of other assets against that collateral.
- Repay the original loan and keep the rest.
When the price returns to normal, the protocol is left with collateral worth far less than the loans. Detection systems look for the footprints of this pattern: an enormous short-lived loan, a sudden price swing in a small pool, a deposit and a withdrawal in the same block and a newly created address with no prior history.
Three layers of detection
Real systems combine approaches, and each has strengths and weaknesses.
Rules and signatures. Fixed conditions, such as "alert if a contract is called by a new address and drains more than a set share of its balance in one block." Rules are easy to understand and explain, but attackers adapt, and rules only catch what their authors imagined.
Statistical anomaly detection. Models learn what normal looks like for a protocol, such as typical transaction sizes or call sequences, and flag departures. These can catch unfamiliar behaviour, but they also flag harmless events such as a legitimate large trade or a sudden surge in popularity.
Simulation and code analysis. Some tools simulate a pending transaction before it is confirmed to see what it would do to balances, or scan contracts for dangerous patterns. This can be powerful, but time is short, and the setup is complex.
A mature setup uses all three and routes the alerts to humans who can act.
Why speed and false alerts pull in opposite directions
An alert that arrives after the funds have left helps only with the investigation. To protect users, a protocol needs warnings fast enough to pause contracts or block withdrawals, which requires pre-agreed procedures and the authority to use them. Yet the faster the system reacts, the more it risks reacting to a false alarm, and an unnecessary pause can damage trust and cost users money. Teams therefore decide in advance who can trigger an emergency pause, what evidence is needed and how the decision is explained to users.
What users can do
You cannot monitor a protocol's contracts yourself in real time, but you can reduce your exposure.
- Prefer protocols with published audits, active monitoring and a clear incident process.
- Avoid putting all funds in one protocol or one chain.
- Revoke token approvals you no longer need.
- Watch the project's official channels, for announcements about incidents, and verify them through more than one source, because fake announcements are common.
- Be cautious with new protocols offering unusually high yields.
Questions readers ask
Can AI stop all hacks? No. It can reduce risk and speed up the response, but novel attacks, insider access and mistakes in the response itself still happen.
Who pays when a protocol is exploited? It depends on the protocol. Some have insurance funds, some negotiate returns with attackers and others leave users with losses. Read what a protocol says about this before depositing.
Are decentralised protocols monitored by anyone? Some run their own monitoring, some use third-party services and some have almost none. Ask what is in place.
What is a bug bounty? It is a programme that pays researchers who responsibly report vulnerabilities. A well-funded bounty is a good sign, though not a guarantee.
Is the on-chain data enough to catch everything? Not always. Some risks sit off-chain, such as compromised administrator keys or a manipulated price feed, and need other kinds of monitoring.
After an incident: what a response looks like
When monitoring raises a serious alert, a prepared team follows a script. First, confirm whether the alert is real by reading the transaction on a block explorer. Second, decide whether to pause affected contracts, using the pre-agreed authority. Third, tell users clearly and quickly through official channels, saying what is known and what is not. Fourth, preserve evidence: transaction hashes, addresses and timelines. Fifth, contact exchanges and security researchers who may be able to freeze or track funds. Sixth, publish a post-incident report explaining the cause and the fixes. Rehearsing this once makes the real thing far less chaotic.
Reading a post-mortem
When a protocol publishes an incident report, look for the root cause, the timeline, the amount lost, how users will be treated and what changes will stop a repeat. A clear, honest report is a positive sign about the team, while a vague one is a warning.
Common warning signs for ordinary users
Be cautious when a protocol launches with unusually high rewards and little history, when its code is not verified or audited, when administrators can change critical settings instantly without a delay, when most liquidity belongs to a few addresses, when the team is anonymous and silent and when the website pushes you to hurry. None of these proves a problem, but several together should make you reduce your exposure or stay away.
Where research is heading
Researchers are studying ways to detect attacks before they confirm, by simulating pending transactions and monitoring unusual contract calls. These methods are promising but still imperfect, and they do not replace careful design, audits and sensible limits on how much a protocol can lose in one transaction.
Sources (checked 19 November 2026)
- Illicit volume (press summary of Chainalysis): Forklog
- Related guides on this site: mapping wallet relationships, transaction monitoring

