A TypeScript + LangGraph project that fetches on-chain transaction data (RPC / Tenderly / Etherscan) and generates a natural-language explanation using an LLM.
pnpm install
cp .env.example .envMinimum required in .env:
# LLM
LLM_PROVIDER=openrouter # or: anthropic
OPENROUTER_API_KEY=... # or: ANTHROPIC_API_KEY=...
LLM_MODEL=anthropic/claude-3.5-sonnet
# RPC
ETHEREUM_RPC_URL=https://eth.llamarpc.com
CHAIN_ID=1Optional (recommended):
# Better traces (historical debug_traceTransaction via Tenderly RPC)
TENDERLY_RPC_URL=https://mainnet.gateway.tenderly.co/YOUR_KEY
USE_TENDERLY_SIMULATION=true
# Contract ABI / source (when available)
ETHERSCAN_API_KEY=YOUR_KEYIf you need a proxy, run via:
./run-with-proxy.sh pnpm exec tsx src/cli.ts 0xYOUR_TX_HASHCLI
pnpm exec tsx src/cli.ts 0xYOUR_TX_HASHChat API (for frontend)
pnpm run serverPOST /api/chat— body:{ "conversationId"?: string, "message": string }. Response: SSE stream.- Rule-based: if
messagecontains a tx hash (0x + 64 hex), the backend runs the analysis pipeline and streams progress events (rpc_done,etherscan_start,etherscan_done,tenderly_start,tenderly_done,draft_start,draft_done,done), thenmessage_endwith{ content, report }. - First event:
sessionwith{ conversationId }. If no tx hash, reply is: "Send a transaction hash (0x...) to analyze it."
MIT (see LICENSE).