The blockchain_analyzer
- deserializes the raw bitcoin blockchain,
- imports it into a Postgres database,
- and analyzes transactions to find clusters of addresses.
Here is a high-level overview of our system architecture, to illustrate how the
blockchain_analyzer
interacts with the other components:
- Everything:
cargo build
blk_file_reader
only:cargo build -p blk_file_reader
blockchain_analyzer
only:cargo build -p blockchain_analyzer
Run cargo run -p blk_file_reader -- -h
to get a help text for blk_file_reader
.
Running the blockchain_analyzer
requires a little bit of configuration which
is done by setting a handful of environment variables. If the variables are not
set in the environment, the blockchain_analyzer
tries to read them from a
.env
file at the path from where it was invoked. These variables are
described in .env.sample.
There fore, you can simply
- make a copy of
.env.sample
:cp .env.sample .env
- and adapt the variables in
.env
to your needs.
The blockchain_analyzer
can then be invoked via cargo run -p blockchain_analyzer
.
Running the tests requires additional tools:
- Docker: for example Docker Community Edition.
diesel_cli
:cargo install diesel_cli --no-default-features --features postgres
:
Before your run the tests, you have to:
- Spin up a Postgres DB via Docker:
docker run --rm --name blockninjas_postgres -p 5432:5432 -e POSTGRES_PASSWORD=test postgres
- Set up the DB via
diesel_cli
:diesel database reset --database-url=postgres://postgres:[email protected]:5432/bitcoin_blockchain --migration-dir=blockchain_analyzer/migrations
Then run the tests:
- Everything:
cargo test
blk_file_reader
only:cargo test -p blk_file_reader
blockchain_analyzer
only:cargo test -p blockchain_analyzer