Skip to content

Latest commit

 

History

History
71 lines (51 loc) · 1.38 KB

README.md

File metadata and controls

71 lines (51 loc) · 1.38 KB

Ratchet

Blaxingly fast Bitcoin block and transaction analyzer written in Rust.

Overview

This tool parses raw Bitcoin block files (blk*.dat) and transactions (in JSON format), extracting and analyzing blockchain data including block headers, transactions, inputs, outputs, and metadata.

Features

  • Block Analysis — Parse blk*.dat, rev*.dat, and undo*.dat files from Bitcoin Core
  • Transaction Analysis — Decode and analyze individual transactions from JSON fixtures
  • Multiple Formats — Support for legacy and SegWit transactions
  • JSON Output — Structured output for easy integration with other tools

Installation

cargo build --release

Usage

Analyze a Transaction Fixture

cargo run path/to/fixture.json

Fixture format:

{
  "raw_tx": "hex-encoded-transaction",
  "prevouts": [
    {
      "scriptPubKey": "hex",
      "value": 100000
    }
  ]
}

Analyze Blocks

cargo run -- --block path/to/blk00000.dat path/to/rev00000.dat path/to/undo.dat

Processes Bitcoin Core block files along with their corresponding reversal and undo data.

Output

All output is in JSON format to stdout, with structured error reporting:

{
  "ok": true,
  "txid": "...",
  "analysis": {
    ...
  }
}

Requirements

  • Rust 2024 edition or later
  • Bitcoin Core data files (for block mode)

License

MIT