Skip to content

Tools for analyzing data on Bitcoin and Lightning Network

License

Notifications You must be signed in to change notification settings

BitPolito/bitcoin-data-analysis

Repository files navigation

Bitcoin Data Analysis

License

Overview

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.

Installation

There are different ways to install the library.

Clone the repository:

    git clone https://github.com/BitPolito/bitcoin-data-analysis
    cd bitcoin-data-analysis

Docker

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.

Poetry

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

Config

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

Data Dashboard

Webpage built with streamlit, that displays some live statistics about bitcoin network. Try it here

Run the dashboard

    poetry run streamlit run dashboard/On-chain.py

Access the streamlit web page in your browser at http://localhost:8501.

BitData - Analysis

Some examples tools and script to analyze bitcoin data.

Coinbase String Monitor

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

Mining pool distribution

    poetry run python -m bitdata.analysis.mining

Transactions per block

    poetry run python -m bitdata.analysis.addresses

Taproot transaction count

    poetry run python -m bitdata.analysis.taproot

Contributing

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.

License

The Bitcoin Data Analysis Library is open source and released under the MIT License.

Acknowledgements

We would like to acknowledge the following resources and libraries that have contributed to the development of this project:

bitnodes.io blockchain.info bloackstream.info

About

Tools for analyzing data on Bitcoin and Lightning Network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published