GithubHelp home page GithubHelp logo

isabella232 / fast-dat-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bitcoinjs/fast-dat-parser

0.0 0.0 0.0 205 KB

Superfast blockchain parser for stats

License: MIT License

Makefile 3.32% C++ 94.59% Shell 1.02% Python 1.07%

fast-dat-parser's Introduction

fast-dat-parser

Parses the blockchain about as fast as your IO can pipe it out. For a typical SSD, this can be around ~450 MiB/s.

All memory is allocated up front.

Output goes to stdout, stderr is used for logging.

WARNING: Not actively maintained, use with caution.

Usage

A fast blk*.dat parser for bitcoin blockchain analysis.

  • -j<THREADS> - N threads for parallel computation (default 1)
  • -m<BYTES> - memory usage (default 209715200 bytes, ~200 MiB)
  • -t<INDEX> - transform function (default 0, see pre-packaged transforms below)
  • -w<FILENAME> - whitelist file, for omitting blocks from parsing

Important to note is that the implementation skips bitcoind allocated zero-byte gaps, and includes orphan blocks unless -w omits them.

Transforms (-t)

Each of these pre-included functions write their output as raw data (binary, not hex). You can easily write your own though!

  • 0 - Outputs the unordered 80-byte block headers
  • 1 - Outputs every script prefixed with a uint16_t length
  • 2 - Displays the number of transaction inputs, outputs and number of transactions in the blockchain
  • 3 - Outputs HEIGHT | VALUE for each output, typically used for showing output balances over time

Use a whitelist (see -w) to stop orphan blocks from being parsed. (see below for filtering by best chain)

Examples

Output all scripts for the local-best blockchain

# parse the local-best blockchain
cat ~/.bitcoin/blocks/blk*.dat | ./parser -t0 | ./bestchain > chain.dat

# output every script found in the local-best blockchain
cat ~/.bitcoin/blocks/blk*.dat | ./parser -j4 -t1 -wchain.dat > ~/.bitcoin/scripts.dat

Useful tools

These tools are for the CLI, but will aid in preparing/using data produced by the above.

bestchain

A best-chain filter for block headers.

Accepts 80-byte block headers until EOF, then finds the best-chain in the set, and outputs the best-chain in the form of a sorted hash map (see HMap<K, V>).

LICENSE MIT

The constants and getOpString function in include/bitcoin-ops.hpp is copied from https://github.com/bitcoin/bitcoin/.

fast-dat-parser's People

Contributors

dcousens avatar ddustin avatar junderw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.