A browser-based Bitcoin transaction script analyzer and debugger, inspired by btcdeb.
ScriptScope lets you paste any Bitcoin transaction ID, dissect its inputs and outputs, identify script types, and step through opcode execution in a visual debugger β all from a sleek, dark "X-Ray" interface.
- Transaction Analysis β Fetch and decode any Bitcoin transaction by TXID via Blockstream API
- Script Classification β Auto-detect P2PKH, P2SH, P2WPKH, P2WSH, P2TR (Taproot), P2MS, OP_RETURN
- Full Opcode Debugger β 50+ opcodes with flow control (
OP_IF/OP_ELSE), arithmetic, stack manipulation, crypto hashing, and locktime support - Real Signature Verification β Optional
OP_CHECKSIGverification using the raw transaction hex andtiny-secp256k1 - Taproot Inspector β Decode Schnorr signatures, key paths, script paths, and control blocks
- OP_RETURN Decoder β Detect Ordinals/Runes and OMNI protocols in data outputs
- X-Ray UI β Deep-black canvas with animated Digital Loom threads, glassmorphic panels, JetBrains Mono typography
scriptscope/
βββ packages/
β βββ api/ β Express + TypeScript backend (port 4000)
β βββ web/ β React + Vite + Tailwind frontend (port 5173)
βββ package.json β npm workspaces
βββ turbo.json β Turborepo config
| Layer | Stack | Purpose |
|---|---|---|
| Backend | Express, TypeScript, bitcoinjs-lib, tiny-secp256k1 | Fetch raw tx, classify scripts, run opcode debugger |
| Frontend | React 18, Vite 5, Tailwind CSS 3, Framer Motion, Lucide Icons | Render X-Ray UI with live transaction data |
- Node.js β₯ 18
- npm β₯ 9
cd scriptscope
npm installOpen two terminals:
Terminal 1 β Backend API:
cd packages/api
npm run devExpress server starts on
http://localhost:4000with hot-reload (tsx watch)
Terminal 2 β Frontend:
cd packages/web
npm run devVite dev server starts on
http://localhost:5173with HMR
Navigate to http://localhost:5173 in your browser.
- Paste a Bitcoin Transaction ID into the search bar
- Click Analyze β the backend fetches the raw transaction from Blockstream
- Inspect the decoded inputs, outputs, script types, and witness data
- Click Debug on any input to launch the Stack Debugger
- Step through opcodes with Prev / Next, watch the stack in real-time
| Script Type | TXID |
|---|---|
| P2PKH (Legacy) | a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d |
| P2WPKH (SegWit) | f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16 |
| P2TR (Taproot) | 33e794d097969002ee05d336686fc03c9e9a73215e9da48c66e6acca57889534 |
All endpoints are served from the backend on port 4000. The Vite dev server proxies /api/* automatically.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/tx/:txid |
Full transaction analysis |
GET |
/api/tx/:txid/input/:index |
Single input analysis |
GET |
/api/tx/:txid/output/:index |
Single output analysis |
POST |
/api/script/classify |
Classify a script hex β type + ASM |
POST |
/api/script/debug |
Step-by-step opcode debugger |
GET |
/health |
Health check |
{
"scriptSig": "483045022100...",
"scriptPubKey": "76a914...",
"witness": ["3044...", "0279..."],
"rawTxHex": "0200000001...",
"inputIndex": 0
}| Field | Required | Description |
|---|---|---|
scriptSig |
β | ScriptSig hex |
scriptPubKey |
β | ScriptPubKey hex of the output being spent |
witness |
Optional | Array of witness hex items |
rawTxHex |
Optional | Full raw transaction hex β enables real OP_CHECKSIG verification |
inputIndex |
Optional | Index of the input being debugged (required with rawTxHex) |
Response: Array of DebugStep objects with opcode, stackBefore, stackAfter, and error fields.
packages/api/src/
βββ server.ts β Express app (port 4000)
βββ routes/ β API route handlers
β βββ index.ts
β βββ script.ts
β βββ tx.ts
βββ services/
β βββ tx-fetcher.ts β Blockstream/Mempool API client
βββ classifiers/ β Script & witness type detection engine
β βββ index.ts
β βββ input-classifier.ts
β βββ script-classifier.ts
β βββ witness-classifier.ts
βββ debugger/ β Full opcode execution engine (50+ opcodes)
β βββ index.ts
β βββ engine.ts
β βββ crypto-verifier.ts
β βββ script-number.ts
β βββ stack-utils.ts
βββ taproot.ts β Taproot-specific analysis
βββ utils/ β Shared utilities
β βββ crypto-utils.ts
β βββ script-utils.ts
β βββ validation-utils.ts
βββ types.ts β Shared TypeScript interfaces
packages/web/src/
βββ main.tsx β React entry point
βββ App.tsx β Main layout (sidebar + header + content)
βββ types.ts β Frontend type definitions
βββ styles/index.css β Global CSS (dark theme, fonts, scrollbars)
βββ context/
β βββ TxContext.tsx β Global state for tx analysis & debugger
βββ components/
β βββ TxSearch.tsx β Glassmorphic search bar
β βββ StackDebugger.tsx β Interactive opcode step-through
β βββ OpcodeRef.tsx β Collapsible opcode reference table
β βββ ScriptPanel.tsx β Script hex/ASM display
β βββ TxOverview.tsx β Transaction summary
β βββ ui/ β Reusable primitives
β βββ digital-loom-background.tsx β Animated canvas
βββ hooks/
β βββ useCopyToClipboard.ts
βββ lib/
βββ api.ts β Fetch helpers
βββ utils.ts β cn() Tailwind merge utility
From each package directory:
| Command | Description |
|---|---|
npm run dev |
Start with hot-reload (tsx watch) |
npm run build |
Compile TypeScript to dist/ |
npm start |
Run compiled build |
npm test |
Run Jest tests |
npm run typecheck |
Type-check only (no emit) |
| Command | Description |
|---|---|
npm run dev |
Start Vite dev server |
npm run build |
Production build to dist/ |
npm run preview |
Preview production build |
npm run typecheck |
Type-check only (no emit) |
The UI follows a "Cryptographic Brutalist" aesthetic:
| Token | Value | Usage |
|---|---|---|
| Canvas | #0c0f0f |
Base background |
| Primary | #c1c1ff |
Active states, links |
| Primary Container | #8183ff |
Buttons, accents |
| Secondary | #c8c3e1 |
Output panels |
| Tertiary | #ffb689 |
Taproot badges |
| Error | #ffb4ab |
Failed verifications |
| Body Font | Inter | UI text |
| Code Font | JetBrains Mono | Data, opcodes, hashes |
Effects: Glassmorphism (bg-black/60 backdrop-blur-md), animated Digital Loom canvas threads, custom neon scrollbars.
The debugger engine supports 50+ opcodes across all major categories:
| Category | Opcodes |
|---|---|
| Constants | OP_0 β OP_16, OP_1NEGATE |
| Flow Control | OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF, OP_VERIFY, OP_RETURN |
| Stack | OP_DUP, OP_2DUP, OP_3DUP, OP_DROP, OP_2DROP, OP_SWAP, OP_2SWAP, OP_ROT, OP_2ROT, OP_OVER, OP_2OVER, OP_NIP, OP_TUCK, OP_PICK, OP_ROLL, OP_IFDUP, OP_DEPTH, OP_SIZE, OP_TOALTSTACK, OP_FROMALTSTACK |
| Arithmetic | OP_ADD, OP_SUB, OP_1ADD, OP_1SUB, OP_NEGATE, OP_ABS, OP_NOT, OP_0NOTEQUAL, OP_NUMEQUAL, OP_NUMEQUALVERIFY, OP_NUMNOTEQUAL, OP_LESSTHAN, OP_GREATERTHAN, OP_LESSTHANOREQUAL, OP_GREATERTHANOREQUAL, OP_MIN, OP_MAX, OP_WITHIN, OP_BOOLAND, OP_BOOLOR |
| Crypto | OP_SHA256, OP_SHA1, OP_RIPEMD160, OP_HASH160, OP_HASH256 |
| Signature | OP_CHECKSIG*, OP_CHECKSIGVERIFY*, OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY |
| Equality | OP_EQUAL, OP_EQUALVERIFY |
| Locktime | OP_CHECKLOCKTIMEVERIFY, OP_CHECKSEQUENCEVERIFY |
* Real ECDSA verification when rawTxHex and inputIndex are provided; otherwise returns CHECKSIG_SKIPPED.
| Issue | Fix |
|---|---|
| IDE shows stale type errors | Ctrl+Shift+P β "TypeScript: Restart TS Server" |
| Port already in use | Kill stale process: kill $(lsof -ti:4000) |
| API connection refused | Ensure packages/api is running on port 4000 |
| Canvas threads not visible | Hard refresh (Ctrl+Shift+R) |
MIT