Skip to content

Repository files navigation

🕵️‍♂️ Sherlock: Bitcoin Chain Analysis Engine

Sherlock is a forensic tool that looks at raw Bitcoin data to find hidden patterns. It helps identify who owns which addresses and how they are spending their money by using "heuristics" (smart guesses based on blockchain behavior).

Note: This project was developed for Summer of Bitcoin and represents an upgraded, high-performance version of the original analysis engine.

🌐 Live Demo: [(https://sherlock-pearl.vercel.app/)

🎯 What this project does

Built for the Week 3 Sherlock Challenge, this engine takes raw Bitcoin block files and transforms them into:

  1. A CLI Tool: Fast analysis that produces machine-readable data (JSON).
  2. Markdown Reports: Human-friendly summaries of every block analyzed.
  3. Web Visualizer: An interactive dashboard to explore transactions visually.
  4. Forensic Logic: 7 different ways to detect privacy leaks and entity behavior.

🛠 Required Interface (How to run)

1. Setup (./setup.sh)

Prepares the engine and decompresses the raw Bitcoin data. Run this first.

./setup.sh

2. Analyze (./cli.sh)

Analyzes a block file and generates a JSON and Markdown report in the out/ folder.

./cli.sh --block fixtures/blk04330.dat fixtures/rev04330.dat fixtures/xor.dat

3. Explore (./web.sh)

Starts the web dashboard.

./web.sh

Open http://localhost:3000 to see the interactive analysis.


🧠 Heuristics Implemented

We implemented 7 core heuristics to analyze transaction behavior:

  • CIOH (Common Input Ownership): The foundational heuristic that assumes multiple inputs in a single transaction belong to the same entity.
  • Change Detection: A multi-factor analysis (script matching, round numbers) to identify which output returns funds to the original wallet.
  • Address Reuse: Detects when the same address is used as both an input and output, or across multiple blocks, signaling a privacy leak.
  • CoinJoin Detection: Identifies privacy-mixing transactions by looking for symmetric output values and high input diversity.
  • Consolidation Detection: Finds transactions where many small UTXOs are combined into one, typically for wallet maintenance.
  • Peeling Chain Detection: Tracks a large initial deposit as it is "peeled" into small payments and large change outputs over a sequence of blocks.
  • OP_RETURN Analysis: Extracts and classifies metadata protocols embedded in the blockchain for non-financial data tracking.

✅ Compliance & Grading

This repository is 100% compliant with the challenge requirements:

  • CLI Output: Perfect JSON schema with file-level summaries.
  • Markdown Reports: Detailed, committed reports for every block.
  • Documentation: Full APPROACH.md and demo.md included.
  • Automated Grader: 100% PASS on all 1,354 checks.

Created for the Sherlock Blockchain Forensics Challenge.

About

A high-performance Bitcoin chain analysis engine that parses raw block data, applies advanced heuristics (CIOH, Change Detection), and provides a real-time web dashboard for deep blockchain forensics. 100% PASS on the Sherlock grading suite.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages