Skip to content

About

Turns `custom program error: 0x1` into an actual answer. Solana transaction forensics: ranked failure diagnosis from RPC data, logs, and a scoring rule engine.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

EinstainedTX

Solana transaction failure decoder. Paste a failed transaction signature and get a ranked, human-readable diagnosis: what failed, where, why, how confident the analysis is, and what to do next.

custom program error: 0x1 is technically correct and completely useless. EinstainedTX turns raw failures into decision-ready explanations.

The problem

Solana failures are machine-correct but human-hostile. The same numeric error code means different things in different programs, so debugging means jumping between an explorer, raw logs, program source, and guesswork.

The approach

Deterministic first, AI optional. The default analysis path uses no AI at all:

signature → RPC fetch → log parser → program detection → rule/scoring engine → ranked hypotheses

An optional "Explain deeper" layer sits on top of the finished deterministic result. It never replaces it.

Features

  • Ranked diagnosis — primary cause plus alternative hypotheses, each with a confidence score and level (high / medium / low)
  • Scoring rule engine — 10 failure categories; multiple rules can match one transaction and are scored, not short-circuited by if
  • Failure Atlas — 15 documented failure patterns with typical log fragments and fixes
  • Program registry — resolves ~28 known program IDs (SPL Token, Token-2022, Jupiter, Raydium, Orca, Meteora, Marinade, Marginfi, Solend, Phoenix, Metaplex, Pump.fun, …)
  • Evidence panel — raw logs, program IDs, fee, compute units, signers, blockhash. Proof, not just a verdict
  • Log parser — reconstructs the program invoke/success/failure stack, extracts custom error codes and AnchorErrors
  • Fix suggestions — concrete, copyable next steps per diagnosis

Recognized failure categories

Token balance · account initialization · signer/authority · expired blockhash · slippage · program constraints (Anchor) · invalid instruction data · missing accounts / owner mismatch · compute budget · custom program errors

Tech stack

Next.js 14 (App Router) · React 18 · TypeScript · Tailwind CSS · Framer Motion · @solana/web3.js

Backend runs on Next.js API routes — no separate server needed.

API

Endpoint Purpose
GET /api/decode/:signature Fetch, parse, and diagnose a transaction
GET /api/patterns Failure pattern library
GET /api/programs/:programId Resolve a program ID to a known name
POST /api/explain Deeper explanation layer (optional)
GET /api/health Service status

Signatures are validated against a base58 format check, and custom RPC endpoints are restricted to an allowlist of hosts to prevent SSRF.

Getting started

npm install
cp .env.example .env.local   # optional but recommended
npm run dev

Open http://localhost:3000

Environment variables

Variable Required Description
SOLANA_RPC_URL No Server-side default RPC. Use a Helius/QuickNode URL in production — public endpoints are heavily rate-limited.

Dev utilities

npm run check:rpc                    # probe RPC endpoints for reachability
npm run decode -- <signature> 3000   # decode one signature, print full diagnosis

check:rpc is useful because some networks block or sinkhole specific RPC domains. It reports which endpoints actually respond.

Project structure

src/
├─ app/
│  ├─ api/           # decode, patterns, programs, explain, health
│  ├─ page.tsx       # hero → decode workspace → pattern library
│  └─ globals.css    # design system
├─ components/       # 18 UI components
├─ lib/
│  ├─ rpc.ts             # RPC fetch + orchestration
│  ├─ logParser.ts       # log → structured events
│  ├─ ruleEngine.ts      # scoring + ranking
│  └─ programRegistry.ts # program ID → name
├─ rules/            # 10 rule modules
├─ data/patterns.ts  # failure atlas
└─ types/            # shared types

Design

Monochrome near-black surface with a single lime signal color, editorial serif headings, and monospace log output. The interface is meant to read like a diagnostic instrument, not a marketing page.

Roadmap

  • Real LLM-backed explain layer with cited evidence and honest uncertainty
  • Anchor IDL ingestion for exact error-code mapping
  • Expanded rule and pattern coverage
  • Shareable analysis reports
  • Pre-flight simulation: explain why a transaction will fail before sending

License

MIT

About

Turns `custom program error: 0x1` into an actual answer. Solana transaction forensics: ranked failure diagnosis from RPC data, logs, and a scoring rule engine.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages