Skip to content

Components

GraphExplorer

ReactFlow-based interactive graph renderer. Best for small-to-medium graphs (up to ~500 nodes).

tsx
import { GraphExplorer } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
nodesTxNode[]requiredArray of graph nodes
edgesTxEdge[]requiredArray of graph edges
statsTxGraphStatsOptional stats (shown in panel)
loadingbooleanfalseShow full-screen loading overlay
expandingNodestring | nullnullAddress of node currently being expanded (shows spinner)
selectedAddressstring | nullnullHighlight the path from root to this address
onNodeSelect(node: TxNode | null) => voidCalled when user clicks a node (or background)
onNodeExpand(address: string) => voidCalled when user clicks the + expand button
onNodeDelete(address: string) => voidCalled when user clicks the delete button

Layout

The graph uses Dagre for automatic left-to-right hierarchical layout. Nodes are arranged by transaction depth. Layout is recomputed whenever nodes or edges change.

Selection & Path Highlighting

When selectedAddress is set, the component:

  1. Finds all paths from the root node to the selected address (DFS with backtracking)
  2. Highlights nodes and edges on any path
  3. Dims all other nodes and edges (opacity 0.25)

Node Appearance

StateVisual
Root nodeBlue border + glow
High riskRed border + red background
Medium riskYellow border + yellow background
Low riskGreen border + green background
Unknown riskGray border
Stopped nodeDashed border + warning icon
SelectedBlue glow ring
Dimmed (not on path)25% opacity
ExpandingSpinner overlay

GraphExplorerSigma

Sigma.js + WebGL-based renderer. Best for large graphs (500+ nodes). Uses canvas for labels, WebGL for nodes/edges.

tsx
import { GraphExplorerSigma } from '@trustin/txgraph'

Props

Same props as GraphExplorer — both components implement GraphExplorerProps.

Interactions

ActionResult
Click nodeonNodeSelect(node)
Click backgroundonNodeSelect(null)
Double-click nodeonNodeExpand(address)
Right-click nodeonNodeDelete(address)
ScrollZoom in/out
DragPan

Built-in Controls

The Sigma renderer includes floating controls:

  • + / — Zoom in/out
  • — Fit all nodes in view

Layout

Uses a custom depth-based left-to-right layout:

  • X position = depth × 3.5 (graph coordinates)
  • Y position = evenly spaced within each depth level
  • No overlap guaranteed

Camera

On mount, the camera auto-fits to show all nodes at a comfortable ~38px radius. The camera ratio adapts to graph size.


ExportToolbar

Export functionality toolbar with support for multiple formats (PNG, SVG, JSON, CSV, PDF).

tsx
import { ExportToolbar } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
nodesTxNode[]requiredArray of graph nodes
edgesTxEdge[]requiredArray of graph edges
statsTxGraphStats | nullOptional stats for export
containerRefReact.RefObject<HTMLElement>requiredReference to graph container for image export
classNamestring''Additional CSS classes

Export Formats

FormatDescriptionUse Case
PNGHigh-quality raster image (html2canvas)Presentations, reports
SVGScalable vector graphicsPrint, high-resolution displays
JSONComplete graph data with metadataData backup, API integration
CSVTabular format (nodes + edges)Excel analysis, databases
PDFComprehensive report with graph + statsExecutive reports, compliance

Intelligent search component with address/hash detection and real-time results.

tsx
import { SearchBar } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
nodesTxNode[]requiredArray of nodes to search
edgesTxEdge[]requiredArray of edges to search
onResultSelect(result: SearchResult) => voidCalled when user selects a result
onClear() => voidCalled when search is cleared
placeholderstring"Search addresses..."Input placeholder text
classNamestring''Additional CSS classes

Search Capabilities

  • Address detection: Ethereum (0x...) and Tron (T...) addresses
  • Transaction hash detection: 64-character hex strings
  • Risk level search: "high", "medium", "low", "unknown"
  • Entity tag search: "exchange", "defi", "mixer", etc.
  • Token search: "USDT", "ETH", "BTC", etc.
  • Amount search: "100 USDT", "1.5 ETH", etc.

FilterPanel

Advanced filtering panel with multi-dimensional controls.

tsx
import { FilterPanel } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
nodesTxNode[]requiredArray of nodes for filter options
edgesTxEdge[]requiredArray of edges for filter options
filterFilterConfigrequiredCurrent filter configuration
onChange(filter: FilterConfig) => voidrequiredCalled when filters change
classNamestring''Additional CSS classes

Filter Options

FilterTypeDescription
Risk Levelsstring[]Filter by risk: high, medium, low, unknown
Chainsstring[]Filter by blockchain networks
Depth Range[number, number]Filter by transaction depth (0-N)
Amount Range[number, number]Filter by transaction amounts
Date Range[Date | null, Date | null]Filter by transaction timestamps
Tokensstring[]Filter by token types
Only Root NodesbooleanShow only root/starting nodes
Only Stopped NodesbooleanShow only exploration-stopped nodes
Hide UntaggedbooleanHide nodes without entity tags

GraphControlPanel

Comprehensive control panel combining search and filtering functionality.

tsx
import { GraphControlPanel } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
nodesTxNode[]requiredArray of graph nodes
edgesTxEdge[]requiredArray of graph edges
statsTxGraphStats | nullOptional graph statistics
onNodeSelect(node: TxNode | null) => voidCalled when user selects a node
onFilterChange(nodes: TxNode[], edges: TxEdge[]) => voidCalled when filtered data changes
classNamestring''Additional CSS classes

Features

  • Integrated search and filtering
  • Real-time filter statistics
  • Selected node information panel
  • Automatic data synchronization

ClusterAnalysis

AI-powered clustering analysis for detecting related addresses and suspicious patterns.

tsx
import { ClusterAnalysis } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
nodesTxNode[]requiredArray of nodes to analyze
edgesTxEdge[]requiredArray of edges to analyze
onClusterSelect(cluster: Cluster | null) => voidCalled when user selects a cluster
onHighlightNodes(addresses: string[]) => voidCalled to highlight specific nodes
classNamestring''Additional CSS classes

Cluster Types

TypeDescriptionDetection Method
ExchangeTrading platform addressesTag analysis + transaction patterns
MixerPrivacy/tumbling servicesHigh fan-in/fan-out patterns
PoolLiquidity pools, stakingDeFi tags + concentrated activity
BridgeCross-chain bridgesBridge tags + multi-chain activity
UnknownUnclassified clustersPattern-based grouping only

Anomaly Detection

Anomaly TypeDescription
Rapid SuccessionMany transactions in short time periods
Round AmountsFrequent use of round numbers (potential structuring)
ConcentrationCollection/distribution patterns
Unusual PatternStatistical outliers in behavior

RealTimeManager

WebSocket-based real-time transaction monitoring and notification system.

tsx
import { RealTimeManager } from '@trustin/txgraph'

Props

PropTypeDefaultDescription
wsUrlstring'wss://api.trustin.info/ws'WebSocket server URL
watchedAddressesstring[][]Addresses to monitor
onUpdate(update: RealTimeUpdate) => voidCalled for all real-time updates
onGraphUpdate(graph: Partial<TxGraph>) => voidCalled for graph data updates
onNewTransaction(tx: any) => voidCalled for new transactions
onRiskUpdate(address: string, riskLevel: string) => voidCalled for risk level changes
classNamestring''Additional CSS classes

Update Types

TypeDescriptionTriggers
new_transactionNew transaction detectedTransaction monitoring
risk_updateRisk level changedRisk assessment updates
node_updateNode data updatedEntity classification changes
graph_updateGraph structure changedNew connections discovered

Connection Management

  • Auto-reconnection: Automatic retry with exponential backoff
  • Heartbeat: Ping/pong keepalive messages
  • Status monitoring: Connection state and error tracking
  • Notification support: Browser push notifications for alerts

Released under the MIT License.