How smit134/crypto-demo works
Purpose
VASPTrace investigates an unknown Bitcoin wallet and produces an explainable attribution graph linking likely common-control address clusters to known Virtual Asset Service Providers (VASPs). Its governing pipeline is evidence-first: collect blockchain evidence, visualize it, then optionally apply AI/ML.
Entry Points and Runtime
The repository is a TypeScript/Node.js project with a Next.js application build under frontend/.next. The primary HTTP entry points exposed by the built App Router are:
• Investigation collection: frontend/.next/server/app/api/investigations/route.js
• Investigation detail: frontend/.next/server/app/api/investigations/[id]/route.js
• Investigation graph: frontend/.next/server/app/api/investigations/[id]/graph/route.js
• Main UI route: frontend/.next/server/app/page.js
The source tree shown does not include the corresponding frontend source routes; .next is generated output and should not be treated as the implementation boundary.
Investigation API and Orchestration
The investigation API is the system boundary between clients and attribution processing. A client creates or requests an investigation, retrieves its persisted state by ID, and separately fetches graph-shaped evidence for visualization. This separates lifecycle/detail concerns from graph delivery:
• frontend/.next/server/app/api/investigations/route.js
• frontend/.next/server/app/api/investigations/[id]/route.js
• frontend/.next/server/app/api/investigations/[id]/graph/route.js
The API is expected to coordinate wallet input, blockchain lookup, candidate attribution, persistence, and graph assembly; exact orchestration source is not present in the supplied tree.
Blockchain Intelligence Boundary
Blockchain access is isolated under src/lib/blockchain, indicating a provider abstraction rather than direct provider calls throughout the application. This is the key external-service boundary for transaction/address history and mempool-derived evidence:
• src/lib/blockchain/provider.ts
• src/lib/blockchain/mempool.ts
This boundary should normalize upstream blockchain API responses into application evidence models, handle provider failure/rate-limit behavior, and avoid leaking vendor-specific formats into investigation or visualization layers.
Attribution Evidence and VASP Reference Data
Known VASP labels are maintained as local seed data and loaded through an explicit seeding process:
• data/vasps.json
• src/scripts/seed-vasps.ts
The attribution stage compares discovered wallet/cluster evidence against this labelled address corpus, then ranks candidate VASPs using multiple signals. The reference dataset is distinct from live blockchain intelligence: labelled identities are locally managed, while transactional evidence comes through the blockchain provider boundary.
Persistence and Investigation State
Prisma defines the durable data-model boundary:
• prisma/schema.prisma
Investigations need stable IDs because both detail and graph API routes are ID-addressed. Persistence should therefore retain the queried wallet, investigation status, evidence/candidate results, confidence or ranking outputs, and enough graph data to reproduce the explanation without rerunning external intelligence calls.
Visualization Contract
The frontend consumes graph data from the dedicated graph route and renders the investigation as connected wallet, cluster, VASP, and evidence relationships. Build artifacts show @xyflow/react is included, indicating a React graph/canvas runtime:
• frontend/.next/server/app/page.js
• frontend/.next/dev/static/chunks/node_modules_@xyflow_react_dist_style_0w-ra00.css
The graph API is the critical contract: backend attribution logic should emit visualization-neutral nodes, edges, labels, evidence references, and confidence metadata rather than UI-specific state.
Main entry points: page.js Investigation UI · graph/route.js Investigation graph API · provider.ts Blockchain provider boundary · investigations/route.js Investigation collection API
Components 15
Built application
Next.js build artifacts expose the current runtime surface.
- Investigation UI
frontend/.next/server/app/page.js - Investigation collection API · Creates or requests investigations.
frontend/.next/server/app/api/investigations/route.js - Investigation detail API · Retrieves durable investigation state by ID.
frontend/.next/server/app/api/investigations/[id]/route.js - Investigation graph API · Delivers visualization-neutral evidence graphs by ID.
frontend/.next/server/app/api/investigations/[id]/graph/route.js - Graph canvas · Renders wallet, cluster, VASP, and evidence relationships.
frontend/.next/dev/static/chunks/node_modules_@xyflow_react_dist_style_0w-ra00.css
Investigation pipeline
Coordinates evidence collection, attribution, persistence, and graph delivery.
- Investigation orchestration · Coordinates lookup, attribution, durable state, and graph assembly.
- Normalized chain evidence · Provider-neutral address, transaction, and mempool-derived evidence.
- Candidate attribution · Matches cluster evidence to labelled VASP addresses and confidence signals.
- Explanation graph assembly · Produces nodes, edges, labels, evidence references, and confidence metadata.
- Prisma data model · Defines stable investigation and reproducible result storage.
prisma/schema.prisma - Investigation store · Persists wallet query, status, evidence, candidates, and graph data.
Intelligence sources
Live chain evidence and local identity labels remain separate.
- Blockchain provider boundary · Normalizes upstream responses and contains vendor failure behavior.
src/lib/blockchain/provider.ts - Mempool intelligence
src/lib/blockchain/mempool.ts - VASP seed loader · Loads managed VASP identity labels into reference data.
src/scripts/seed-vasps.ts - Labelled VASP corpus · Locally managed known VASP address labels.
data/vasps.json
Connections 19
- Investigation UI → Investigation collection API: starts investigation
- Investigation UI → Investigation detail API: loads state
- Investigation UI → Investigation graph API: fetches graph
- Investigation graph API → Graph canvas: graph payload
- Investigation collection API → Investigation orchestration: wallet request
- Investigation detail API → Investigation store: reads by ID
- Investigation graph API → Investigation store: reads saved graph
- Investigation orchestration → Blockchain provider boundary: collects chain history
- Mempool intelligence → Blockchain provider boundary: mempool evidence
- Blockchain provider boundary → Normalized chain evidence: normalizes
- Investigation orchestration → Candidate attribution: submits evidence
- Normalized chain evidence → Candidate attribution: cluster signals
- Labelled VASP corpus → Candidate attribution: known labels
- Candidate attribution → Explanation graph assembly: candidates and confidence
- Investigation orchestration → Explanation graph assembly: investigation context
- Investigation orchestration → Investigation store: persists results
- Explanation graph assembly → Investigation store: stores explanation graph
- Prisma data model → Investigation store: defines model
- VASP seed loader → Labelled VASP corpus: loads seed labels