https://github.com/edycutjong/nansenredstring
๐ด On-chain forensic investigation engine โ BFS wallet graph traversal, financial enrichment, and interactive 3D WebGL visualization. Built on Nansen CLI.
https://github.com/edycutjong/nansenredstring
3d-visualization blockchain cli defi forensics investigation nansen typescript wallet-analysis web3 webgl
Last synced: 2 months ago
JSON representation
๐ด On-chain forensic investigation engine โ BFS wallet graph traversal, financial enrichment, and interactive 3D WebGL visualization. Built on Nansen CLI.
- Host: GitHub
- URL: https://github.com/edycutjong/nansenredstring
- Owner: edycutjong
- License: mit
- Created: 2026-04-06T23:26:48.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-07T02:03:18.000Z (2 months ago)
- Last Synced: 2026-04-07T03:23:43.341Z (2 months ago)
- Topics: 3d-visualization, blockchain, cli, defi, forensics, investigation, nansen, typescript, wallet-analysis, web3, webgl
- Language: TypeScript
- Homepage: https://redstring.edycu.dev
- Size: 28.4 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ด RedString โ On-Chain Forensic Investigation Engine
```text
____ __ _____ __ _
/ __ \___ ____/ / / ___// /______(_)___ ____
/ /_/ / _ \/ __ / \__ \/ __/ ___/ / __ \/ __ `/
/ _, _/ __/ /_/ / ___/ / /_/ / / / / / / /_/ /
/_/ |_|\___/\__,_/ /____/\__/_/ /_/_/ /_/\__, /
/____/
```
[](https://github.com/edycutjong/NansenRedString/actions)
[](https://www.typescriptlang.org/)
[](https://nodejs.org/)
[](LICENSE)
### ๐ด [Live Demo โ redstring.edycu.dev](https://redstring.edycu.dev/)
**Map wallet networks as interactive 3D graphs.** RedString is a forensic investigation CLI that wraps the [Nansen CLI](https://docs.nansen.ai) to perform BFS traversal of on-chain wallet connections, enrich nodes with financial intelligence, and render self-contained WebGL visualizations.
> Built for the **Nansen CLI Build Challenge โ Week 4**
---
## ๐ฌ Demo
---
## โจ Features
- ๐ต๏ธ **BFS Graph Traversal** โ Discover wallet networks with configurable depth (1โ3) and width (5โ20)
- ๐ฐ **Financial Enrichment** โ Labels, balances, 30d PnL, DeFi protocol exposure per node
- ๐ **3D WebGL Visualization** โ Self-contained HTML with auto-orbit cameras, particle effects, and screenshot export
- ๐ **OSINT Integration** โ Off-chain intelligence via Nansen web search
- โก **Disk Cache** โ SHA256-keyed persistent cache to minimize API costs (configurable TTLs)
- ๐ **Telemetry Receipt** โ Forensic audit trail of every API call with latency tracking
- ๐ญ **Mock Mode** โ Full offline development with synthetic data (`NANSEN_MOCK=true`)
## ๐๏ธ Architecture
```
redstring investigate 0xdead... --depth 2 --width 10
โ
โโโโ BFS Engine (graph-builder.ts)
โ โโโ profiler trace โ connections
โ โโโ profiler counterparties โ fallback
โ โโโ enrichNode โ labels, balance, PnL, DeFi
โ
โโโโ OSINT Layer (osint.ts)
โ โโโ web search โ off-chain intelligence
โ
โโโโ Terminal Report (terminal-report.ts)
โ โโโ Palantir-aesthetic forensic summary
โ
โโโโ HTML Renderer (html-renderer.ts)
โ โโโ 3D force-directed graph (3d-force-graph)
โ
โโโโ Telemetry (telemetry.ts)
โโโ API call receipt with cache hit rates
```
## ๐ Quick Start
### Prerequisites
- **Node.js** โฅ 18
- **Nansen CLI** installed and authenticated (`npm i -g @nansen/cli`)
### Install & Run
```bash
# Clone
git clone https://github.com/edycutjong/nansen-redstring.git
cd nansen-redstring
# Install dependencies
npm install
# Run in mock mode (no API key needed)
NANSEN_MOCK=true npx tsx src/index.ts investigate 0xdead...beef
# Run with live Nansen API
npx tsx src/index.ts investigate 0xdead...beef --depth 2 --width 10
```
### Global Install
```bash
npm run build
npm link
redstring investigate 0xdead...beef
```
## ๐ Commands
### `investigate
`
Core forensic command. Traces wallet connections via BFS and renders a 3D graph.
| Flag | Description | Default |
|------|-------------|---------|
| `-d, --depth ` | BFS traversal depth (1โ3) | `2` |
| `-w, --width ` | Max counterparties per node (5โ20) | `10` |
| `-c, --chain ` | Blockchain network | `ethereum` |
| `-m, --min-volume ` | Minimum USD volume filter | `0` |
| `--osint` | Include off-chain web search | `false` |
| `--no-cache` | Bypass disk cache | `false` |
| `--no-open` | Skip auto-opening browser | `false` |
| `--json` | Output raw graph JSON | `false` |
| `-o, --output ` | Output directory for HTML | `cwd` |
### `compare `
Head-to-head wallet comparison. Shows correlation score, common counterparties, and shared tokens.
| Flag | Description | Default |
|------|-------------|---------|
| `-c, --chain ` | Blockchain network | `ethereum` |
| `--json` | Output raw JSON | `false` |
### `profile
`
Deep wallet profile โ labels, balance, PnL, DeFi positions, and recent transactions.
| Flag | Description | Default |
|------|-------------|---------|
| `-c, --chain ` | Blockchain network | `ethereum` |
| `--json` | Output raw JSON | `false` |
## ๐ฎ 3D Visualizer Controls
| Shortcut | Action |
|----------|--------|
| `S` | Screenshot (PNG export) |
| `R` | Reset camera position |
| `L` | Toggle node labels |
| Mouse drag | Rotate view |
| Scroll | Zoom in/out |
| Click node | Open detail panel |
### Node Color Legend
| Color | Meaning |
|-------|---------|
| ๐ด Neon Crimson | Seed / Target wallet |
| ๐ก Cyber Gold | Smart Money |
| ๐ต Neon Cyan | Labeled entity (Exchange, DEX, etc.) |
| โซ Dim Slate | Unknown wallet |
| ๐ Muted Gray | Contract |
## ๐ธ Gallery

Investigate

Profile

Compare

Compare (Full)

Telemetry Receipt
## ๐งช Development
```bash
# Type check
npm run typecheck
# Lint
npm run lint
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Full CI pipeline (typecheck + lint + test:coverage)
npm run ci
```
### Demo Cast (Suggested Wallets)
| Alias | Address | Why |
|-------|---------|-----|
| jaredfromsubway.eth | `0xae2Fc483527B8EF99EB5D9B44875F005ba1FaE13` | MEV bot operator |
| Wintermute | `0x0000000000000000000000000000000000000000` | Market maker |
| Nomad Exploiter | `0x56D8B635A7C88Fd1104D23d632AF4003B16d0BF6` | Bridge exploit |
## ๐ง Environment Variables
| Variable | Description |
|----------|-------------|
| `NANSEN_MOCK` | Enable synthetic data mode (`true`/`false`) |
| `NANSEN_DEBUG` | Enable verbose API error logging (`true`/`false`) |
## ๐ Project Structure
```
src/
โโโ index.ts # CLI entry point (Commander.js)
โโโ commands/
โ โโโ investigate.ts # BFS investigation command
โ โโโ compare.ts # Wallet comparison command
โ โโโ profile.ts # Deep wallet profile command
โโโ lib/
โ โโโ graph-builder.ts # BFS traversal engine
โ โโโ nansen.ts # Nansen CLI wrapper + caching
โ โโโ html-renderer.ts # 3D WebGL HTML generator
โ โโโ enricher.ts # Node financial enrichment
โ โโโ osint.ts # Off-chain intelligence
โ โโโ disk-cache.ts # SHA256-keyed persistent cache
โ โโโ telemetry.ts # API call tracking
โ โโโ terminal-report.ts # Terminal formatting
โ โโโ mock.ts # Synthetic data generator
โโโ types/
โโโ graph.ts # GraphNode, GraphEdge, GraphData
โโโ investigation.ts # InvestigationOptions, results
โโโ wallet.ts # Raw API response shapes
```
## ๐ License
MIT ยฉ [edycutjong](https://github.com/edycutjong)