|
| 1 | +# TxGraph |
| 2 | + |
| 3 | +Blockchain transaction tracing graph components for React. Trace, visualize, and analyze on-chain transaction flows. |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <img src="docs/public/hero-features.svg" alt="TxGraph feature overview" width="720" /> |
| 7 | +</p> |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- **Risk-scored nodes** — color-coded risk levels (high / medium / low / unknown) with entity tags |
| 12 | +- **Path highlighting** — click any node to trace the fund flow from root, dimming unrelated edges |
| 13 | +- **Smooth bezier edges** — labeled with transfer amount, token, and timestamp (to the second) |
| 14 | +- **Two renderers** — ReactFlow (DOM-based, up to 500 nodes) and Sigma.js (WebGL, 500+ nodes) |
| 15 | +- **Dark / Light mode** — auto-detects `document.documentElement.classList` for `dark` class |
| 16 | +- **Interactive** — expand nodes on-demand, delete nodes, zoom / pan / fit-view |
| 17 | +- **AI-agent friendly** — REST API with self-registration, MCP-compatible tool definitions |
| 18 | + |
| 19 | +## Quick Start |
| 20 | + |
| 21 | +```bash |
| 22 | +pnpm add @trustin/txgraph |
| 23 | +``` |
| 24 | + |
| 25 | +```tsx |
| 26 | +import { GraphExplorer } from '@trustin/txgraph' |
| 27 | + |
| 28 | +<GraphExplorer |
| 29 | + nodes={nodes} |
| 30 | + edges={edges} |
| 31 | + stats={stats} |
| 32 | + onNodeSelect={(node) => console.log(node)} |
| 33 | + onNodeExpand={(address) => fetchMore(address)} |
| 34 | + onNodeDelete={(address) => remove(address)} |
| 35 | +/> |
| 36 | +``` |
| 37 | + |
| 38 | +## Project Structure |
| 39 | + |
| 40 | +``` |
| 41 | +txgraph/ |
| 42 | + packages/react/ # @trustin/txgraph — core React components |
| 43 | + examples/local-demo/ # Vite demo app connected to TrustIn API |
| 44 | + docs/ # VitePress documentation site |
| 45 | +``` |
| 46 | + |
| 47 | +## Development |
| 48 | + |
| 49 | +```bash |
| 50 | +# Install dependencies |
| 51 | +pnpm install |
| 52 | + |
| 53 | +# Build the core package |
| 54 | +pnpm build |
| 55 | + |
| 56 | +# Run the demo (requires VITE_TRUSTIN_API_KEY in examples/local-demo/.env) |
| 57 | +pnpm dev:demo |
| 58 | + |
| 59 | +# Run the docs site |
| 60 | +pnpm dev:docs |
| 61 | +``` |
| 62 | + |
| 63 | +## Four Layers |
| 64 | + |
| 65 | +| Layer | Description | Link | |
| 66 | +|-------|-------------|------| |
| 67 | +| **Layer 1** | Use TrustIn Explorer at [v2.trustin.info](https://v2.trustin.info) | [Guide](https://blackman99.github.io/txgraph/guide/layer1-product) | |
| 68 | +| **Layer 2** | AI Agent API — self-register and trace addresses | [Guide](https://blackman99.github.io/txgraph/guide/layer2-agent) | |
| 69 | +| **Layer 3** | Run the demo locally with your own API key | [Guide](https://blackman99.github.io/txgraph/guide/layer3-demo) | |
| 70 | +| **Layer 4** | Install `@trustin/txgraph` and build your own UI | [Guide](https://blackman99.github.io/txgraph/guide/layer4-component) | |
| 71 | + |
| 72 | +## Documentation |
| 73 | + |
| 74 | +Full documentation: [blackman99.github.io/txgraph](https://blackman99.github.io/txgraph/) |
| 75 | + |
| 76 | +## License |
| 77 | + |
| 78 | +MIT |
0 commit comments