Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

Setting Up Real-Time AML Transaction Monitoring

A technical guide for developers implementing automated Anti-Money Laundering (AML) screening for tokenized real estate and asset transactions.
Chainscore © 2026
introduction
OVERVIEW

Introduction

This guide explains how to implement real-time Anti-Money Laundering (AML) transaction monitoring for blockchain applications.

Real-time AML transaction monitoring is a critical compliance requirement for any financial service handling cryptocurrency. Unlike traditional batch processing, real-time monitoring analyzes transactions as they occur, enabling immediate risk assessment and intervention. This proactive approach is essential for detecting suspicious patterns like structuring, layering, or interactions with sanctioned addresses before funds are irreversibly settled on-chain. For developers, this means integrating monitoring logic directly into your application's transaction flow, using on-chain data and risk intelligence APIs to make programmatic decisions.

The technical foundation for this system involves querying and analyzing blockchain data. You need to programmatically inspect transaction details such as the sender (msg.sender), recipient, value, and the smart contracts involved. Services like Chainalysis, TRM Labs, and Elliptic provide APIs that return risk scores for addresses by checking them against known threat clusters. A basic monitoring check in your backend might involve calling such an API upon receiving a new transaction request and evaluating the returned score against your risk threshold before proceeding.

Implementing this requires a clear architecture. A typical flow involves an intercepting service—like a middleware in your Node.js backend or a pre-hook in your smart contract—that pauses the transaction process. This service fetches risk data, applies your compliance rules (e.g., blocking transactions with a risk score > 75), and logs the event. The key challenge is balancing security with user experience; decisions must be made in milliseconds to avoid degrading application performance. The following sections provide concrete code examples and system design patterns to build this capability.

prerequisites
SETUP GUIDE

Prerequisites

Before implementing real-time AML transaction monitoring, you need to establish the foundational infrastructure and data access. This guide outlines the essential technical prerequisites.

Real-time Anti-Money Laundering (AML) monitoring requires direct, low-latency access to blockchain data. The first prerequisite is a reliable node provider or a self-hosted node for the chains you wish to monitor (e.g., Ethereum, Polygon, Arbitrum). Services like Alchemy, Infura, or QuickNode offer dedicated RPC endpoints with WebSocket support, which is critical for subscribing to pending transactions and new blocks without polling. For production systems, ensure your provider offers high request limits and guaranteed uptime to avoid missing critical transaction events.

You will need a secure environment to run your monitoring application. This can be a cloud VM (AWS EC2, Google Cloud Compute), a containerized service (AWS ECS, Kubernetes), or a serverless function for event-driven architectures. The environment must have stable internet connectivity and sufficient resources to process transaction streams. For handling private keys or signing alerts, use a hardware security module (HSM) or a cloud KMS solution like AWS KMS or GCP Cloud KMS to manage cryptographic operations securely, never storing secrets in plaintext.

Your monitoring logic depends on accurate, enriched data. Integrate with on-chain analytics services to augment raw transaction data. Use APIs from providers like Chainalysis, TRM Labs, or Elliptic to fetch risk scores, cluster wallet addresses into entities, and check against known sanction lists. For analyzing transaction patterns, you may need a time-series database (e.g., TimescaleDB, InfluxDB) to store historical metrics and a graph database (e.g., Neo4j, TigerGraph) to map and query complex relationships between addresses and entities over time.

Define your alerting and response pipeline. This involves setting up a message queue (e.g., Apache Kafka, RabbitMQ) or a streaming service (AWS Kinesis) to handle incoming risk events. Configure alert destinations such as Slack channels, PagerDuty, or custom webhooks to notify compliance officers. For automated responses, you might integrate with smart contract functions to pause dubious transactions or with custodian APIs to freeze assets, though this requires careful legal and operational review to avoid false positives.

system-architecture
SYSTEM ARCHITECTURE OVERVIEW

Setting Up Real-Time AML Transaction Monitoring

This guide explains the core components and data flow required to build a system that screens blockchain transactions for Anti-Money Laundering (AML) risks as they occur.

A real-time AML monitoring system for Web3 requires an architecture that can ingest, analyze, and flag transactions on-chain with minimal latency. The foundational layer is a blockchain data pipeline. This involves connecting to node providers like Alchemy, Infura, or QuickNode via WebSocket subscriptions to stream new blocks and pending transactions. For comprehensive coverage, you must also index historical data from services like The Graph or directly from an archive node to establish baseline wallet behaviors and risk scores. The pipeline's output is a normalized stream of transaction data, including sender/receiver addresses, value, and smart contract interactions, ready for analysis.

The core analysis engine processes this stream. It typically executes a series of rules and machine learning models. Rule-based checks are immediate, screening for red-flag patterns: transactions to sanctioned addresses (using lists from OFAC or Chainalysis), mixing through Tornado Cash, or interactions with known scam contracts. Concurrently, heuristic and ML models assess more complex risks like behavioral anomalies—sudden large withdrawals from a DeFi protocol or rapid fund cycling between wallets. This engine must be stateless and horizontally scalable to handle peak network activity, often deployed using serverless functions or containerized microservices.

Risk scoring and alerting form the decision layer. Each transaction and its associated addresses receive a composite risk score. You must define clear thresholds for low, medium, and high-risk alerts. High-confidence hits, like a direct match with a sanctioned address, should trigger an automated action, such as blocking the transaction in a custodial wallet's mempool or freezing funds. All data—raw transactions, risk scores, and alerts—must be logged immutably to an audit database like PostgreSQL or TimescaleDB. This creates an immutable audit trail for compliance reporting and model retraining.

Finally, the system requires a management and reporting interface. This dashboard allows compliance officers to review alerts, adjust risk parameters, and generate reports. Integration with existing compliance workflows is crucial; this often means exporting alerts to platforms like Slack or Jira and providing APIs for other systems to query risk scores. The entire architecture must be designed with data privacy and security in mind, especially if screening involves analyzing proprietary or sensitive on-chain data clusters.

key-concepts
FOR DEVELOPERS

Key AML Monitoring Concepts

Essential technical concepts for implementing real-time Anti-Money Laundering (AML) monitoring on blockchain networks. Focus on on-chain analysis, risk scoring, and compliance automation.

02

Risk-Based Scoring Models

Assigning a dynamic risk score to each wallet or transaction based on multiple on-chain and off-chain factors. A typical model evaluates:

  • Source of Funds: Proximity to known illicit addresses (e.g., sanctioned entities, mixers).
  • Transaction Behavior: Velocity, amount, and timing (e.g., rapid, round-number transfers).
  • Counterparty Risk: Risk scores of connected wallets in the transaction graph.
  • Jurisdictional Flags: Geoblocking based on IP or wallet association with high-risk regions. Scores trigger alerts (e.g., >80) for manual review or automated actions like blocking.
04

Behavioral Pattern Detection

Identifying anomalous activity that deviates from a wallet's established historical baseline or common user patterns. This includes:

  • Transaction Amount Anomalies: Sudden, large transfers from typically low-volume wallets.
  • Temporal Anomalies: Activity at unusual hours or in rapid, automated bursts.
  • Destination Anomalies: First-time interactions with high-risk protocols or cross-chain bridges.
  • Funding Pattern Shifts: A wallet that typically receives funds from a CEX suddenly receiving from a privacy mixer. Machine learning models can be trained on labeled datasets to improve detection of novel patterns.
05

Compliance Reporting (SAR/CTR)

Automating the generation and submission of regulatory reports like Suspicious Activity Reports (SARs) and Currency Transaction Reports (CTRs). Key technical requirements:

  • Data Aggregation: Pulling all relevant transaction data, wallet metadata, and risk flags into a structured format.
  • Narrative Generation: Using templates to auto-populate the 'reason for suspicion' field with specific on-chain evidence.
  • Secure Submission: Integrating with regulatory body portals (e.g., FinCEN's BSA E-Filing) via secure APIs.
  • Audit Trail: Maintaining immutable logs of all generated reports and alert justifications for examiners.
step-1-event-listening
FOUNDATION

Step 1: Listening for On-Chain Transactions

The first step in real-time AML monitoring is establishing a reliable data pipeline to capture on-chain activity as it happens. This guide covers the core methods for listening to blockchain transactions.

Real-time monitoring requires a direct connection to a blockchain node. You can run your own node using clients like Geth for Ethereum or Erigon for higher performance, or use a node provider service like Alchemy, Infura, or QuickNode. The primary mechanism for listening is the JSON-RPC WebSocket subscription. Unlike one-time HTTP calls, a WebSocket connection stays open, allowing the node to push new block data to your application instantly. The key method is eth_subscribe with the parameter "newHeads", which notifies you each time a new block is mined.

Once you receive a new block header, you must fetch its full transaction data. Call eth_getBlockByNumber with the fullTransactions flag set to true. This returns an array of all transactions in that block, including critical fields: from, to, value, input data (for contract calls), and the transaction hash. For AML analysis, you need to decode this input data for ERC-20 transfers or other token standards. Use the contract's Application Binary Interface (ABI) with a library like ethers.js or web3.py to parse function calls like transfer(address,uint256) and extract the recipient and amount.

A robust listener must handle chain reorganizations, where the canonical chain changes and previously seen blocks are orphaned. Your system should track block confirmations; a common practice is to only process transactions after 12-15 block confirmations on Ethereum to minimize reorg risk. Implement logic to listen for the "chainReorg" event some providers offer, or periodically check for changes in past block hashes. Failed transactions (where status is 0x0) should typically be filtered out, as they don't change state. However, monitoring for failed, high-value transactions from sanctioned addresses can still be valuable intelligence.

For production-scale monitoring across multiple chains or addresses, consider using specialized data streams. Services like Chainscore's Risk Streams API, The Graph for indexed historical data, or Blocknative for mempool transaction pre-monitoring can reduce infrastructure complexity. The core architecture involves: a subscription service, a transaction decoder, a confirmation depth checker, and a queue (e.g., Redis or RabbitMQ) to pass parsed transactions to your risk analysis engine. This ensures your AML logic operates on a consistent, validated stream of on-chain data.

step-2-risk-scoring
SETTING UP REAL-TIME AML TRANSACTION MONITORING

Integrating a Risk Scoring API

This guide covers the technical steps to integrate a risk scoring API, such as Chainscore's, into your application's transaction flow for real-time Anti-Money Laundering (AML) and fraud detection.

A risk scoring API provides a programmatic interface to evaluate the risk associated with a blockchain transaction or wallet address before it is finalized. By integrating this API into your deposit, withdrawal, or transfer logic, you can screen for high-risk indicators in real-time. These indicators include connections to sanctioned addresses, involvement in known scams or hacks, and patterns consistent with money laundering. The API typically returns a normalized risk score (e.g., 0-100) and a detailed breakdown of flagged categories, allowing your application to make an informed compliance decision.

Integration begins by obtaining API credentials from your provider. For a RESTful API like Chainscore's, you will need an API key for authentication. The core request is a POST call to an endpoint like /v1/assess/transaction, sending a JSON payload containing the transaction details. Essential parameters include the chainId (e.g., 1 for Ethereum Mainnet), the from and to addresses, the transaction value, and the data field. Here is a basic cURL example:

bash
curl -X POST https://api.chainscore.dev/v1/assess/transaction \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"chainId": 1, "from": "0x...", "to": "0x...", "value": "1000000000000000000"}'

The API response will contain the risk assessment. A typical response includes a riskScore, a level (e.g., low, medium, high, critical), and an array of riskIndicators. Each indicator has a category (like SANCTION, SCAM, MIXER) and a confidence score. Your application logic must define action policies based on this response. For instance, you might block transactions with a critical risk level, require manual review for high risk, and allow low and medium risk transactions to proceed automatically. It is crucial to log all assessments for audit trails and regulatory compliance.

For high-throughput applications, consider implementing asynchronous webhooks instead of synchronous API calls to avoid blocking your transaction pipeline. In this model, you send the transaction data to the risk API and immediately proceed with a "pending review" status. The API then processes the assessment and sends the result to a configured webhook endpoint on your server, where you finalize or revert the transaction. This pattern is essential for DeFi protocols or exchanges where latency is critical. Always implement rate limiting and retry logic with exponential backoff in your webhook handler to ensure reliability.

Finally, integrate the risk scoring check into your smart contract logic for on-chain enforcement. While the initial screening happens off-chain, you can use an oracle like Chainlink to fetch the risk score on-chain before executing a sensitive function. The contract would call the oracle, which queries the risk API and returns the score via a callback. If the score exceeds a threshold stored in the contract, the transaction can be reverted. This creates a defensive layer that prevents high-risk transactions from being included in a block, though it adds gas costs and complexity.

step-3-alerting-mechanisms
SETTING UP REAL-TIME AML TRANSACTION MONITORING

Configuring Alerting and Intervention

This guide explains how to configure automated alerts and define intervention workflows for suspicious on-chain activity.

Real-time transaction monitoring is the core of an effective AML program. It involves setting up rule-based detection systems that analyze blockchain data as transactions occur. Unlike traditional finance, blockchain's transparency allows for monitoring public addresses and smart contract interactions. Key data sources include transaction amounts, frequency, counterparty addresses (especially those on sanctions lists), and interaction with high-risk protocols like mixers or unregulated exchanges. The goal is to flag transactions that exhibit patterns associated with money laundering, such as structuring (smurfing), rapid movement through multiple addresses, or interactions with known illicit services.

To implement monitoring, you define specific detection rules. These are logical conditions that, when met, trigger an alert. Common rule types include: Volume Thresholds (e.g., single transaction > $10k), Velocity Checks (e.g., 50+ transactions from one address in an hour), Counterparty Risk (interaction with a sanctioned OFAC address), and Behavioral Anomalies (sudden change in transaction patterns). Rules should be calibrated to your platform's typical user behavior to minimize false positives. For example, a DeFi protocol might set rules for flash loan arbitrage patterns, while an NFT marketplace might monitor wash trading.

Here is a conceptual example of a rule defined in a monitoring system's configuration (pseudo-code):

yaml
rule_id: "HIGH_VELOCITY_SMURFING"
description: "Detects rapid, sub-threshold transactions from a single address"
condition: "tx_count(address) > 30 AND avg(tx_value) < $1000 WITHIN 1 hour"
risk_score: 85
action: "ALERT_HIGH"

This rule would calculate the transaction count and average value for an address over a rolling one-hour window. If the conditions are met, it assigns a high risk score and triggers an alert for review.

Once an alert is generated, you need a clear intervention workflow. This defines the steps your compliance team takes. A typical workflow includes: 1) Triage – classifying the alert's priority based on its risk score. 2) Investigation – using blockchain explorers like Etherscan and chain analysis tools to trace the funds and assess intent. 3) Decision – determining the action: no action, request for user information (KYC), or blocking the transaction/address. 4) Reporting – documenting the alert and decision, which is crucial for regulatory audits. For critical alerts, the system should be capable of initiating a transaction hold pending manual review.

Integrating these systems requires connecting to blockchain nodes or data providers. Services like Chainalysis, TRM Labs, and Elliptic offer APIs for risk scoring, while open-source tools like the Go-Ethereum (geth) client can be used to stream raw transaction data. The key is to build a pipeline that ingests transactions, applies your rule engine, and routes alerts to a dashboard or ticketing system like Jira. Regular rule tuning is essential; analyze false positives and adjust thresholds to improve accuracy. Effective alerting transforms raw blockchain data into actionable compliance intelligence.

AML FOCUS

Blockchain Analytics Provider Comparison

Key features and metrics for selecting a provider for real-time transaction monitoring.

Feature / MetricChainalysisTRM LabsElliptic

Real-time API Latency

< 500ms

< 1 sec

< 2 sec

Risk Score Granularity

0-1000 scale

Low/Med/High + Score

1-10 scale

Covered Assets

1000

800

700

Sanctions List Updates

Smart Contract Risk Analysis

DeFi/NFT Risk Coverage

Custom Rule Engine

Pricing Model (Enterprise)

Custom Quote

Tiered + Usage

Custom Quote

REAL-TIME AML MONITORING

Frequently Asked Questions

Common questions and troubleshooting for developers integrating on-chain AML transaction monitoring.

Real-time AML (Anti-Money Laundering) monitoring is the automated analysis of blockchain transactions as they occur to detect illicit financial activity. It works by streaming transaction data from nodes or indexers, applying a rules engine and risk models, and flagging suspicious patterns.

Key components include:

  • Transaction Ingestion: Pulling mempool and on-chain data via RPC nodes or services like Alchemy, Infura, or Chainscore's own indexer.
  • Risk Scoring: Applying heuristics for patterns like mixing, rapid bridging, or interaction with sanctioned addresses.
  • Alerting: Generating real-time notifications via webhooks, APIs, or dashboards for flagged transactions.

Unlike batch analysis, real-time monitoring allows protocols to screen deposits or trades before they are finalized, enabling preventative compliance actions.

conclusion-next-steps
IMPLEMENTATION SUMMARY

Conclusion and Next Steps

You have now configured a foundational system for real-time AML transaction monitoring. This guide covered the core components: data ingestion, risk rule application, and alerting workflows.

Your monitoring pipeline should now be operational, ingesting transactions from sources like eth_getBlockByNumber or WebSocket streams, applying a basic set of risk heuristics—such as screening against OFAC lists, checking for interaction with known mixer contracts like Tornado Cash, and analyzing transaction patterns—and routing high-risk alerts to a designated channel. The true power of this system lies in its extensibility. The initial rules are a starting point; they must be refined based on your specific risk tolerance and the evolving threat landscape documented by entities like Chainalysis and Elliptic.

To move from a proof-of-concept to a production-grade system, focus on these next steps:

Enhance Rule Sophistication

Integrate more nuanced risk signals. This includes deploying machine learning models for anomaly detection on transaction graphs, implementing velocity checks (e.g., volume spikes from a new address), and incorporating on-chain reputation scores from providers like TRM Labs or Crystal Blockchain. Consider implementing a scoring engine where multiple risk factors contribute to a composite risk score, allowing for more granular alert prioritization.

Improve Data Enrichment

Raw transaction data is limited. Enrich alerts with off-chain intelligence. Use APIs from blockchain analytics firms to attach entity clustering data (e.g., "address is associated with Exchange X") and threat categorizations. This context is critical for investigators to triage alerts effectively, distinguishing between a high-risk mixer withdrawal and a false positive from a privacy-conscious user.

Operationalize the Workflow

An alert is only as good as its response. Integrate your monitoring output with case management tools like Slack, Jira, or dedicated compliance platforms. Establish clear procedures for alert review, escalation, and, if necessary, reporting to authorities via Suspicious Activity Reports (SARs). Automate evidence gathering by having the system snapshot relevant transaction histories and wallet profiles upon alert generation.

Conduct Regular Testing and Tuning

Continuously validate your system's effectiveness. Use historical attack data from rekt.news or Immunefi to create test scenarios. Measure key metrics: false positive rate, alert volume, and time-to-investigation. Calibrate rule thresholds based on these findings. A static rule set will quickly become obsolete against adaptive adversaries.

Finally, remember that technical monitoring is one pillar of a robust AML/CFT program. It must be complemented by strong internal policies, Know Your Customer (KYC) procedures, and ongoing staff training. For developers, staying updated with the latest security research from OpenZeppelin and the Ethereum Foundation is essential. Your code, like the threats it mitigates, must continuously evolve.

How to Set Up Real-Time AML Transaction Monitoring | ChainScore Guides