crypto.bi – ELI5 Cryptography, cryptocurrency and programming

Getting started with crypto.bi Toolbox [README.first]

This is a quick guide to getting started with Crypto.BI Toolbox.

Following these steps should get Toolbox in a working state quickly, so you can begin exploring the Bitcoin blockchain.

So, let’s jump right into Toolbox setup!

1. Clone the Toolbox and Bitcoin Core Github repositories

Create a working directory where you’ll download the source code to Bitcoin Core and Toolbox.

$ cd work_dir/
$ git clone https://github.com/bitcoin/bitcoin.git
$ git clone https://github.com/cryptobi/toolbox.git

2. Compile Bitcoin Core

Follow the Bitcoin Core build instructions.

3. Compile Boost Libraries

Build the required Boost libraries.

You may use the same working directory as Toolbox and Bitcoin Core.

4. Last Pre-Requisites

Gather the two last library pre-requisites: MySQL Connector C++ and SPDLOG and build them in their own directory.

Take note of all the build directories, you’ll need them on the next step.

5. Compile Toolbox

You must have ninja build tool and cmake installed.

Now we can proceed to build Toolbox.

$ export BITCOIN_SRC_DIR=yourworkingdir/bitcoin
$ export BOOST_SRC_DIR=yourworkingdir/boost-1.xxx
$ export MYSQLCONN_DIR=yourworkingdir/mysql-connector....
$ export SPDLOG_DIR=yourworkingdir/spdlog-x.xx
$ export FMT_DIR=yourworkingdir/fmt...
$ cd yourworkingdir/toolbox
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug 
-DFMT_DIR=$FMT_DIR 
-DSPDLOG_DIR=$SPDLOG_DIR 
-DMYSQLCONN_DIR=$MYSQLCONN_DIR 
-DCMAKE_VERBOSE_MAKEFILE=ON 
-DBOOST_SRC_DIR=$BOOST_SRC_DIR 
-DBITCOIN_SRC_DIR=$BITCOIN_SRC_DIR 
-DCB_BUILD_EXAMPLES=1 
-DBUILD_TESTING=1 
..
$ ninja -v

6. Configure Toolbox

Edit $HOME_DIRECTORY/.Crypto.BI/crypto.bi.ini file and fill the following fields:

[DEFAULT]
db.user=yourdbuser
db.host=localhost
db.db=schemaname
db.pass=yourdbpassword
bitcoin_blocks_dir=/disk5/bitcoindata/blocks
log_to_file=1
log_to_console=1

Substitute /disk5/bitcoindata/blocks for the correct path to your Bitcoin installation’s blkxxxxx.dat files.

7. Build the Toolbox Database

This step is the longest running one. Having a correctly built local database is essential to get accurate results.

First, generate the DB schema:

mysql -u username -p  < scripts/sql/mysql/cryptobitoolbox_bitcoin.sql

Now, load data into the DB:

$ export CRYPTOBI_HOME=yourworkingdir/toolbox
$ cd $CRYPTOBI_HOME
# the next step might take from several hours to several days. 
# let it run completely, avoiding interruption
$ ./toolbox/db/blocks_inserter --threaded 1 --threads 8 
# if your system is overloaded by the multithreaded inserter, you can run it
# in single thread mode as well (uncomment line):
# $ ./toolbox/db/blocks_inserter
$ cd $CRYPTOBI_HOME/python

# the next two processes may also take a very long time
# depending on your hardware setup
$ python3 toolbox/bitcoin/build_blockchain.py
$ python3 toolbox/bitcoin/build_address_graph.py

A clean database build is essential to get good results when analyzing the blockchain.

Althought blocks_inserter can restart from the latest inserted blocks file, it is recommended that you run it from start to finish without interruptions.

Note: Tracing addresses on the blockchain will only work after running toolbox/bitcoin/build_address_graph.py Querying blocks and TX’s will work without the address graph.

8. Begin exploring!

Test some of the Crypto.BI python tools like address_query.py, block_query.py, transaction_query.pyand so on.

New programs are being added all the time.

Check out the latest Crypto.BI version to access new tools.

Links

crypto.bi Toolbox Home

Exit mobile version