The Bitcoin Data Analysis is a Python library designed to facilitate the analysis of Bitcoin on-chain data and Lightning Network data. It provides various functionalities and data providers to retrieve, process, and analyze Bitcoin-related information.
The library consists of the following components:
- bitdata: This module contains different providers to fetch Bitcoin data and some functions to help analysis.
- dashboard: This folder contains a Streamlit web page for visualizing and interacting with the analyzed data.
There are different ways to install the library.
Clone the repository:
git clone https://github.com/BitPolito/bitcoin-data-analysis
cd bitcoin-data-analysis
If you don't have Docker installed, you can follow the instructions here.
Build and run the docker image with:
make docker
Access the streamlit web page in your browser at http://localhost:8501.
If you don't have poetry installed, follow the instructions in the official Poetry documentation to install Poetry for your operating system.
Install python libraries
poetry install
Add your own configuration file in the root folder of the project. You can use the .env.example file as a template.
cp .env.example .env
# edit .env file with your configuration
nano .env
Webpage built with streamlit, that displays some live statistics about bitcoin network. Try it here
poetry run streamlit run dashboard/On-chain.py
Access the streamlit web page in your browser at http://localhost:8501.
Some examples tools and script to analyze bitcoin data.
This script analyze the coinbase of the last 10 blocks of the testnet, if it found the target string on the coinbase transaction will send a message in a telegram channel. Will continue to analyze new blocks every 30 seconds.
- Change BOT_TOKEN and CHAT_ID in the .env file to enable the telegram bot
- The bot should be added to the channel as an administrator. The CHAT_ID is the chat of the bot with the channel.
- Change DISCORD_WEBHOOK_URL in the .env file to enable the discord bot
- The bot should be created as explained here and added with the right priviledges in the server. At this point the webhook url can be exctracted from the sub-channel that you want the bot will notify into.
poetry run python -m bitdata.analysis.coinbase -n testnet -t "Stratum v2" -p 10
poetry run python -m bitdata.analysis.mining
poetry run python -m bitdata.analysis.addresses
poetry run python -m bitdata.analysis.taproot
Contributions to the Bitcoin Data Analysis Library are welcome! If you encounter any issues, have feature suggestions, or would like to contribute code, feel free to open an issue or submit a pull request.
The Bitcoin Data Analysis Library is open source and released under the MIT License.
We would like to acknowledge the following resources and libraries that have contributed to the development of this project: