Giter VIP home page Giter VIP logo

blk_parser's Introduction

โš ๏ธ This repo is not maintained anymore

Header Image

Bitcoin Blk Parser

This tool is a parser for the blk files of the Bitcoin blockchain. You can use it to parse raw hexadecimal blocks into json, it also contains a really simple blockchain explorer. After parsing data into json you will need to run a second script in order to get the sender address of transactions.

Demo : raw data to json

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • You need to install Python 3 on your computer.
> sudo apt-get install python3.X
  • The readdressing script needs pySpark to run. You can find a good tutorial to install pySpark HERE

Installing

Download or clone this repo

> git clone https://github.com/PilouInfo/blk_parser.git

Using Blk_Parser

Blk_Parser

Blk_Parser has two different modes : fast parsing, and Cli.

  • The fast parsing mode converts raw blk files into json files
    • -i : path to the input folder (blk .dat files)
    • -o : path to the output folder (json files)
    • -n : id (number) of the blk file to parse, use * to parse every blk files in the input folder
$> cd script
$> python3 blk_parser.py -i ./../data -o ./../result -n *
  • The Cli mode let you parse and explore blk files
    • -c : run blk_parser in Cli mode
$> cd script
$> python3 blk_parser.py -c
blk_parser> help 
  • To display the help message run the script with -h option
$> cd script
$> python3 blk_parser.py -h

Readdressing

After parsing data into json you might have noticed that some transactions doesn't contain the sender address, this is because these addresses are stored elsewhere in the blockchain as receiver addresses. So you need to run the readdressing script in order to complete the missing sender addresses. Due to the massive amount of data to process the readdressing script run with the help of Apache Spark.

  • -i : the folder containing the json files to readdress
  • -o : the folder where the readdressed files will be stored
  • -h : display the help message
$> cd script
$> spark-submit readdress.py -i ./../result -o ./../readdressed

/!\ Warning /!\ If the output folder already exists on your computer, it will be deleted along with all its content ! Be sure to move or rename this folder (if it exist) before running the readdressing script.

Author

  • Pierre-Louis DESPAIGNE

License

This project is licensed under the GNU GPL v3 License - see the LICENSE.txt file for details

blk_parser's People

Contributors

pldespaigne avatar

Stargazers

 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.