chanhosuh / bitcoin-monitor

Bitcoin block explorer, using Django and React
MIT License
4 stars 0 forks source link
bitcoin django react

Build Status

bitcoin-monitor

Bitcoin block explorer, using Django to persist blocks from the bitcoin node (bitcoind) into Postgres, and displaying through a React frontend.

Celery is used for the persist tasks and Channels is used to notify the frontend of new blocks. Redis is used as the persistence store for both.

Docker is used to encapsulate the separate pieces. Nginx is used for the production setup (see docker-compose.prod.yml) and omitted for the dev setup (docker-compose.yml).

Quickstart guide

Setup

Run Docker

Persisting blocks into Postgres

To run the Celery tasks that read block data from bitcoind and persist to Postgres (db container), use make process_blockchain. If you attach to the celery logging, you will see the workers processing the block tasks.

Block explorer frontend

For dev setup, just cd frontend and then npm start. Then visit localhost:3000 in your browser. You should see the initial list of blocks and as each celery task completes, the websocket will pick up the block message and prepend to the list.

For prod setup, you should build the static files first:

Then visit localhost:80 in your browser.

Quick end?

If you're playing around with this, you will probably want to cleanup at some point; the full Bitcoin blockchain is nearing 300GB currently and the postgres db can get even larger.

After make down, make clear_redis; make nuke_db; make nuke_blockchain; make clean will take care of cleaning out data and extraneous docker thingies.

If you really want to trash everything, don't forget to use docker image ls, docker rmi, etc. to identify and remove the images.

References