<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rajesh S</title>
    <description>The latest articles on DEV Community by Rajesh S (@rajeshselvam02).</description>
    <link>https://dev.to/rajeshselvam02</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3831427%2Fb26777bd-7c9c-4758-89f6-8fd14c03e8f9.png</url>
      <title>DEV Community: Rajesh S</title>
      <link>https://dev.to/rajeshselvam02</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rajeshselvam02"/>
    <language>en</language>
    <item>
      <title>I built an open source Bitcoin AML forensics tool in TypeScript that runs on Android</title>
      <dc:creator>Rajesh S</dc:creator>
      <pubDate>Wed, 18 Mar 2026 12:29:20 +0000</pubDate>
      <link>https://dev.to/rajeshselvam02/i-built-an-open-source-bitcoin-aml-forensics-tool-in-typescript-that-runs-on-android-19dg</link>
      <guid>https://dev.to/rajeshselvam02/i-built-an-open-source-bitcoin-aml-forensics-tool-in-typescript-that-runs-on-android-19dg</guid>
      <description>&lt;p&gt;&lt;strong&gt;ChainTrail — Open Source Bitcoin AML Forensics&lt;/strong&gt;&lt;br&gt;
I spent the last few weeks building ChainTrail, a real-time Bitcoin &lt;br&gt;
transaction monitoring and AML forensics platform. The interesting part? &lt;br&gt;
I built and run the entire thing on my Android phone using Termux.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What it does&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;ChainTrail connects to the live Bitcoin mempool via WebSocket and lets &lt;br&gt;
investigators trace fund flows across the blockchain graph.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Live demo:&lt;/strong&gt; &lt;a href="https://cary-uncompensated-joanie.ngrok-free.dev" rel="noopener noreferrer"&gt;https://cary-uncompensated-joanie.ngrok-free.dev&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Key features&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Live mempool stream via mempool.space WebSocket&lt;/li&gt;
&lt;li&gt;Transaction graph tracer using PostgreSQL recursive CTEs&lt;/li&gt;
&lt;li&gt;Interactive D3.js graph visualization&lt;/li&gt;
&lt;li&gt;1,258+ threat intel entries (WannaCry, Lazarus Group, Silk Road, OFAC)&lt;/li&gt;
&lt;li&gt;ML risk scoring 0-100 with feature extraction&lt;/li&gt;
&lt;li&gt;Address clustering using Union-Find heuristic&lt;/li&gt;
&lt;li&gt;Pattern detection: layering, smurfing, fan-out, peeling chain&lt;/li&gt;
&lt;li&gt;Case management with PDF report export&lt;/li&gt;
&lt;li&gt;Ethereum support with Tornado Cash detection&lt;/li&gt;
&lt;li&gt;Webhook alerts via Telegram and Discord&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Tech stack&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Node.js + TypeScript + Express&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; PostgreSQL (recursive CTEs for graph traversal)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache:&lt;/strong&gt; Redis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; Next.js + Tailwind + D3.js&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; mempool.space WebSocket&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  **The interesting part — graph traversal
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
The core of ChainTrail is a PostgreSQL recursive CTE that walks the &lt;br&gt;
Bitcoin transaction graph:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
sql
WITH RECURSIVE tx_graph AS 
![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5wfcjbr368zg7k70ow5o.jpg)(
  SELECT i.from_address, t.txid, o.value_satoshi, 1 AS hop,
         ARRAY[i.from_address] AS path
  FROM tx_inputs i
  JOIN transactions t ON t.txid = i.txid
  JOIN tx_outputs o ON o.txid = t.txid
  WHERE o.to_address = $1

  UNION ALL

  SELECT i.from_address, t.txid, o.value_satoshi, g.hop + 1,
         g.path || i.from_address
  FROM tx_graph g
  JOIN tx_inputs i ON ...
  WHERE g.hop &amp;lt; $2
    AND NOT (i.from_address = ANY(g.path))
)
SELECT * FROM tx_graph ORDER BY hop;
This lets you trace any Bitcoin address N hops backward to find the
origin of funds — identifying mixers, exchanges, and sanctioned wallets
along the way.
**ML Risk Scoring**
Each address gets a risk score 0-100 based on extracted features:
Direct threat intel match → +40 to +100
Proximity to bad actor (hop distance) → decays with distance
Fan-out pattern (sending to many addresses) → +20
Fan-in pattern (receiving from many) → +15
Known exchange → -30 (reduces false positives)
Cluster risk level → +5 to +50

**What I learned**
PostgreSQL recursive CTEs are surprisingly powerful for graph
traversal — no graph database needed
mempool.space WebSocket pushes ~6 new transactions every few seconds
Union-Find is the right data structure for address clustering
Running a full stack on Android is actually practical for development
**What's next**
OFAC sanctions auto-sync from US Treasury
Better ML model trained on labeled data
Lightning Network support
Deploy to cloud for production use
Links
GitHub: https://github.com/rajeshselvam02/chaintail
Live demo: https://cary-uncompensated-joanie.ngrok-free.dev
Pricing: https://chaintail-landing.vercel.app
Built with ❤️ by Rajesh Selvam
---
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>bitcoin</category>
      <category>typescript</category>
      <category>opensource</category>
      <category>security</category>
    </item>
  </channel>
</rss>
