Sherlock is a Bitcoin block analysis toolkit that parses raw block artifacts and surfaces behavioral heuristics through both machine-readable reports and an interactive web explorer.
It was originally built during the Summer of Bitcoin challenge and has been refined into a reusable, contributor-friendly project focused on transparent heuristic analysis.
- Works directly from raw Bitcoin data files: blk.dat, rev.dat, and xor.dat.
- Produces reproducible outputs suitable for research notes, dashboards, and audits.
- Keeps heuristic logic explicit and inspectable rather than hidden behind black-box scoring.
- Supports both CLI-first workflows and browser-based exploration.
- Raw parsing pipeline for block and undo files.
- Heuristic engine with pluggable detectors.
- Transaction classification into:
- simple_payment
- consolidation
- coinjoin
- self_transfer
- batch_payment
- unknown
- JSON and Markdown report generation.
- Web UI with:
- block selector
- statistics cards
- script type distribution
- heuristic chips
- classification filters
- transaction table with expandable details
- Upload and analyze flow for blk.dat, rev.dat, xor.dat from the UI, using the same analysis pipeline as preloaded data.
blk.dat + rev.dat + xor.dat
|
v
Parsers (block, transaction, rev)
|
v
Heuristic engine (cioh, change_detection, coinjoin, consolidation, address_reuse, round_number_payment)
|
v
Classifier + stats aggregation
|
v
Report writers (JSON + Markdown)
|
v
Web API + React visualizer
For detailed heuristic design notes and trade-offs, see APPROACH.md.
- Node.js 20.x
- ESM modules
- React + Vite
- Node built-in HTTP server for API and static hosting
src/
parser/ # blk/rev/tx parsing
heuristics/ # heuristic implementations
analysis/ # classifier, fee stats, script types, heuristic runner
reports/ # json + markdown report generators
web/ # API server + React app
out/ # generated and committed report outputs
fixtures/ # sample block artifacts
./setup.shThis installs dependencies and decompresses fixture files.
./cli.sh --block fixtures/blk04330.dat fixtures/rev04330.dat fixtures/xor.datExpected outputs:
- out/blk04330.json
- out/blk04330.md
./web.shThe command prints a URL, typically:
http://127.0.0.1:3000
Open it in your browser and explore results.
The web app supports direct upload of:
- blk.dat
- rev.dat
- xor.dat
Use the Upload and Analyze section in the UI.
Implementation notes:
- Files are sent to POST /api/upload.
- Backend invokes the existing CLI analysis pipeline.
- The resulting block data is indexed into the same in-memory store used by preloaded reports.
- UI reuses existing rendering/state paths, so all current views update without a separate code path.
- GET /api/health
- Returns service health and data counts.
- GET /api/blocks
- Returns list of loaded blocks with summary metadata.
- GET /api/block/:height
- Returns one analyzed block by height.
- GET /api/tx/:txid
- Returns one transaction and block context.
- POST /api/upload
- Accepts multipart form with blkFile, revFile, xorFile.
- Runs analysis and returns analyzed block payload.
- npm run setup
- npm run cli
- npm run web
- npm run build:web
- npm run dev:web
- npm run test
- npm run test:parser
npm run testnpm run dev:webVite serves the UI and proxies /api requests to the backend on PORT (default 3000).
npm run build:webJSON reports are emitted in a consistent schema used by both CLI consumers and the web app. See source and tests under:
- src/reports/jsonReport.js
- src/reports/jsonReport.test.js
Markdown reports are generated for human review under:
- src/reports/markdownReport.js
- src/reports/markdownReport.test.js
Demo walkthrough link is available in demo.md.
Contributions are welcome, especially around:
- additional heuristics
- false-positive analysis and confidence calibration
- richer visual analytics
- performance improvements for large block files
- test coverage for edge-case transactions
Suggested PR checklist:
- add or update tests with each behavior change
- keep CLI and web paths consistent with the same analysis pipeline
- avoid schema-breaking output changes unless intentionally versioned
- document notable trade-offs in APPROACH.md
- streaming analysis progress in UI for large uploads
- optional persistence layer for analyzed datasets
- heuristic explainability panels with comparative signals
- benchmark suite for parser and report generation speed
Built as part of Summer of Bitcoin and expanded as a practical open-source chain analysis project.