BlockSci is composed of two major components, the parser, and the analysis library. The parser is used to generate the backing blocksci database format. The analysis library can then be pointed at the generated data.
Note that BlockSci runs best with 64GB of RAM or above though 32 GB is feasable although much slower.
The BlockSci parser extracts blockchain data generated by a full node (such as bitcoind or an altcoin node). Thus to set up BlockSci, you must first run a full node.
The BlockSci parser provides two different mechanisms for processing blockchain data, a disk mode and a RPC mode.
Disk mode is optimized for parsing Bitcoin’s data files. It reads blockchain data directly from disk in a rapid manner. However this means that it does not work on many other blockchains which have different serialization formats than Bitcoin.
blocksci_parser --output-directory bitcoin-data update disk --coin-directory .bitcoin
RPC mode uses the RPC interface of a cryptocurrency to extract data regarding the blockchain. It works with a variety of cryptocurrencies which have the same general model as Bitcoin, but with minor changes to the serialization format which break the parser in disk mode. Examples of this are Zcash and Namecoin. To use the parser in RPC mode, you’re full node must be running with txindex enabled.
blocksci_parser --output-directory bitcoin-data update rpc --username [user] --password [pass] --address [ip] --port [port]
BlockSci can be kept up to date with the blockchain by setting up a cronjob to periodically run the parser command. Updates to the parser should not noticeably impact usage of the analysis library. It is recommended that the Blockchain be kept approximately 6 blocks back from the head of the chain in order to avoid imperfect reorg handling in BlockSci.
For example you can set BlockSci to update hourly and stay 6 blocks behind the head of the chain via adding
@hourly /usr/local/bin/blocksci_parser --output-directory /home/ubuntu/bitcoin-data update --max-block -6 disk --coin-directory /home/ubuntu/.bitcoin
to your system crontab.
BlockSci provides an optional mempool recorder will record the arrival times of blocks and transactions at your local node. The recorder works by repeatedly pinging the RPC interface and obvserving as new transactions arrive. This data is accessable directly through the python API via Tx.time_seen and Block.time_seen which will return a datetime or None if the transaction or block was not observed.
Running the mempool recorder is very similar to running the parser in RCP mode.
mempool_recorder <data location> --username <username> --password <password> [--address <address>] [--port <port>]