Building a DeFi KYC Agent: Bringing Tier-1 Banking Compliance to Web3
Claire Li3 min read·Just now--
From “Visible Data” to “Actionable Risk”
To Traditional Finance (TradFi), the blockchain often looks like a ledger full of passwords but no translation.
During my time at Standard Chartered, managing core systems and over 50 banking API integrations, I learned a vital lesson: The essence of compliance is not about “rejection,” but about “proof.” In the Web3 world, when an address interacts with Tornado Cash, existing analytics tools often just throw a red exclamation mark. For a bank auditor, that is nowhere near enough. They need a Professional Narrative: How is this risk defined? Which regulatory rule does it trigger? This was the genesis of my DeFi KYC Agent — evolving on-chain due diligence from “manual screenshots” to “second-level automated generation.”
Technical Architecture: Why LangGraph is the Optimal Choice
In my GitHub repository, you’ll see this system isn’t just a simple linear script; it is a State Machine built on LangGraph.
Why avoid traditional linear development? Because the compliance process is inherently full of “decision points.” In my implementation, I designed four core nodes:
- AddressValidator: Immediate identification of chain and format to ensure downstream API precision.
- DataCollector: Fetches raw transactions via Etherscan API v2, maintaining a complete Audit Trail.
- RiskAssessor: My custom “Rule Engine” that relies on deterministic rules (e.g.,
TORNADO_CASH_DIRECT) rather than AI guessing. - ReportGenerator: The stage where I collaborate most deeply with Claude AI.
This architecture ensures total traceability — you can clearly see exactly at which step the Agent decided to pivot into an “escalated risk” path.
Taming AI: How I Orchestrated Claude’s Prompting
This is the heart of the project: How do you make an AI think like a seasoned banker?
In the reports/ template design, I didn't let Claude roam free. Instead, I translated the rigorous requirements for compliance documentation I used in my Atomic Settlement research into a structured prompt framework.
My core orchestration strategy is: Logic is handled by Code; Narratives are handled by AI. I instructed Claude: “Your role is a Senior Compliance Officer. Based on the rule_id and raw JSON output from the RiskAssessor, generate evidence-based descriptions for audit purposes. Strictly avoid hallucinations.”
For example, when high-risk interaction is detected, Claude doesn’t just say “this is dangerous.” It outputs: “Detected: Direct interaction with Tornado Cash mixer contract (Hash: 0x722…). Per internal control standards, we recommend escalating to Tier 4 — Prohibited transaction.” This evidence-backed narrative is exactly what a Chief Compliance Officer (CCO) looks for.
Business Impact: A 125,000x Efficiency Revolution
As a PM, I am obsessed with ROI. I specifically embedded a “Cost Analysis” module into the report.
Based on live testing data:
- Traditional Manual Cost: Approx. $25.00 USD / report (Analyst lookup, screenshots, writing).
- Agent Execution Cost: Only approx. $0.0002 USD / report.
This isn’t just about saving money; it enables a bank to perform deep due diligence on every transaction in real-time, rather than just random sampling. This shift from “post-event remediation” to “real-time compliance” is the true value of AI Agents in finance.
Conclusion: Compliance Should Not Block Innovation
Through this DeFi KYC Agent, I’ve found that Web3 doesn’t lack data — it lacks an “Interpreter.” By combining the reasoning power of Claude AI with the rigorous structure of LangGraph, we can build compliance infrastructure that meets banking audit standards at Web3 speeds. Moving forward, I plan to integrate complex 1-Hop relationship analysis and multi-chain support, turning this system into the “safety belt” for TradFi entering the decentralized world.
View full code and implementation: GitHub Repo
Author: Claire Lee
Senior Technical PM | Ex-Standard Chartered | WEB3+AI Agent Practitioner