bitcoin-blockparser is a Bitcoin Blockchain Parser written in Rust language.
It allows extraction of various data types (blocks, transactions, scripts, public keys/hashes, balances, ...) and UTXO dumps from Bitcoin based blockchains.
This is a fork of the rusty-blockparser crate, which also contains support for other cryptocurrencies.
Bitcoin
and BitcoinTestnet3
.
IMPORANT: It assumes a local unpruned copy of the blockchain with intact block index and blk files,
downloaded with Bitcoin Core 0.15.1+ or similar clients.
If you are not sure whether your local copy is valid you can apply --verify
to validate the chain and block merkle trees.
If something doesn't match the parser exits.
Usage: bitcoin-blockparser [OPTIONS]
Options:
--verify
Verifies merkle roots and block hashes
-v...
Increases verbosity level. Info=0, Debug=1, Trace=2 (default: 0)
-c, --coin <NAME>
Specify blockchain coin (default: bitcoin) [possible values: bitcoin, testnet3]
-d, --blockchain-dir <blockchain-dir>
Sets blockchain directory which contains blk.dat files (default: ~/.bitcoin/blocks)
-s, --start <HEIGHT>
Specify starting block for parsing (inclusive)
-e, --end <HEIGHT>
Specify last block for parsing (inclusive) (default: all known blocks)
-h, --help
Print help
-V, --version
Print version
This tool should run on Windows, OS X and Linux.
All you need is rust
and cargo
.
You can download the latest release from crates.io:
cargo install bitcoin-blockparser
git clone https://github.com/dspicher/bitcoin-blockparser.git
cd bitcoin-blockparser
cargo build --release
cargo test --release
./target/release/bitcoin-blockparser --help
It is important to build with --release
, otherwise you will get a horrible performance!
Tested on Gentoo Linux with rust-stable 1.44.1
Bitcoin and Bitcoin Testnet transactions are parsed using rust-bitcoin, this includes transactions of type P2SH, P2PKH, P2PK, P2WSH, P2WPKH, P2TR, OP_RETURN and SegWit.
Use the issue tracker to report problems, suggestions and questions. You may also contribute by submitting pull requests.
- Implement Pay2MultiSig script evaluation