EBA: The Temporal Graph of Bitcoin Transactions
website·Indexed 31 days ago
https://eba.b1aab.aiEBA provides a large-scale temporal graph of Bitcoin transactions designed for graph-based machine learning models. It includes an ETL pipeline to process the Bitcoin blockchain into Neo4j and TSV formats, featuring over 2.4 billion nodes and 39.72 billion edges. The project offers tools for custom graph sampling, community detection, and an MCP for chatbot-driven analysis of on-chain and market data.
What's inside EBA
- EBA solves the problem of 'lack of ML-first data' in Bitcoin by converting the cryptography-first Unspent Transaction Output (UTxO) model into a directed graph. In this graph, nodes represent Bitcoin scripts (addresses) and edges represent time-stamped transactions. This structure allows Graph Neural Networks (GNNs) to use message passing to learn the topology of financial flows, enabling tasks such as market forecasting, anomaly detection, and network dynamics analysis. The dataset encompasses over 8.72 billion BTC, 2.4 billion nodes, and 39.72 billion edges.
Overview of EBA Bitcoin Graph for Machine Learning
EBA addresses the lack of ML-first data in the Bitcoin ecosystem by converting the cryptography-first Unspent Transaction Output (UTxO) model into a directed graph. In this graph, nodes represent Bitcoin scripts (addresses) and edges represent time-stamped transactions. This structure allows Graph Neural Networks (GNNs) to use message passing to learn the topology of fund flows, enabling tasks such as market forecasting, anomaly detection, and network dynamics analysis. The dataset encompasses over 8.72 billion BTC, 2.4 billion nodes, and 39.72 billion edges.Overview of Bitcoin Graph for on-chain economic modeling
Bitcoin Graph provides a temporal heterogeneous graph of Bitcoin's on-chain economy, abstracting the complexities of the UTxO ledger into an intuitive representation of fund flows. It covers 16 years of economic evolution, allowing developers to analyze behavioral patterns and network topology that are typically obscured in static datasets.Understand the Bitcoin graph dataset TSV structure
The Bitcoin graph dataset (v1.0) is provided as a collection of TSV files separated into nodes and edges based on their schema. To optimize for storage and import, the files follow these rules:
- No Headers: Data files do not contain header lines.
- Header Files: Column names for each node or edge type are stored in corresponding
*_header.tsv.gzfiles. - Neo4j Compatibility: Files are grouped into batches and pre-formatted specifically for use with Neo4j's bulk import tool.
- Scale: The dataset consists of 1,966 files totaling approximately 1.17 TB.
Use Bitcoin Core REST API for block data extraction
Bitcoin Core is used as the primary client for communicating with the Bitcoin network and localizing blocks. To avoid the complexity and error-prone nature of implementing a custom parser for BIPs (Bitcoin Improvement Proposals), the project utilizes the Bitcoin Core REST API to parse data from blocks. This allows the system to focus on graph generation from transaction data while relying on Bitcoin Core to handle the technical details of reading transactions.Bitcoin ETL pipeline architecture and workflow
The Bitcoin ETL pipeline extracts data, transforms it into a graph format, and loads it into a Neo4j graph database. To manage high resource intensity and long runtimes (weeks for full history), the pipeline is designed for single-machine execution using on-disk processing and is divided into five distinct steps with checkpoints to allow resuming from any stage.Quick-start with pre-built Bitcoin models
The fastest way to explore the Bitcoin dataset is to use pre-built 'hello-world' solutions. These include data loading, model training, and evaluation on pre-sampled communities. This is ideal for a quick introduction to the data.# Quick-start Bitcoin script node classification # See: https://github.com/B1AAB/GraphStudio/tree/main/quickstart/script%5Fclassification # 101 Jupyter Notebook # See: https://github.com/B1AAB/GraphStudio/blob/main/g101/g101.ipynbAnalyze Bitcoin script balances and activity
Retrieve information about specific Bitcoin scripts or addresses using their SHA256 hash. This includes identifying the script type (e.g., Taproot/P2TR), checking current or historical balances at a specific block height, and generating transaction summary statistics (total received/sent, first/last activity).# Script type and current balance "Look up this Bitcoin script hash and tell me what type of script it is and what's the current balance: CNuDXVL4AFEohDSe4SvzTZxhSGFdWThhbwHrgatX6GoT" # Historical balance "What was the balance of script with SHA256 CNuDXVL4AFEohDSe4SvzTZxhSGFdWThhbwHrgatX6GoT at block 795000?" # Summary statistics "Give me transaction summary stats for this script with SHA256 CNuDXVL4AFEohDSe4SvzTZxhSGFdWThhbwHrgatX6GoT" # UTXO history "Show me the last 10 UTXOs the address with SHA CNuDXVL4AFEohDSe4SvzTZxhSGFdWThhbwHrgatX6GoT spent and the last 10 it received."Implement data storage using batched TSV files and Neo4j
The project uses a hybrid approach to balance portability and scalability for massive graph datasets:
- Batched TSV Files (Portability): To ensure the dataset is easy to share, data is stored in TSV files. To handle scale, a batching strategy is used where different node and edge types are stored in separate, homogeneous files with enforced size limits.
- Neo4j Graph Database (Scalability): Neo4j is used to perform complex graph queries, such as retrieving n-hop neighbors of a node, which would be inefficient in other database types.
Understand the Bitcoin TSV dataset structure
The Bitcoin dataset is provided as a collection of TSV files separated into nodes and edges based on their schema. To maintain compatibility with Neo4j's bulk import tool, the data files do not contain header lines. Instead, column names for each node or edge type are provided in separate corresponding*_header.tsv.gzfiles. The complete dataset consists of 1,966 files totaling approximately 1.17 TB.Hardware requirements and accessibility for the Bitcoin graph dataset
The Bitcoin graph dataset is extremely large, containing over 2.4 billion nodes and 39.72 billion time-stamped edges. Standard graph database solutions like Neo4j typically require specialized hardware for this scale (e.g., 1TB of RAM for imports and 96GB of RAM to project just 0.1% of the graph into memory for analytics).
To make this data accessible to users without specialized hardware, the provided solutions focus on:
- Storage-based processing: Leveraging disk storage to minimize RAM requirements.
- Vertical Scaling: Supporting extreme parallelization on a single machine.
- Pre-processed Data: Providing outputs for each major pipeline step so users can skip early stages and resume from a specific point.
Note: Horizontal scaling (distributing across multiple machines via Kubernetes) is currently not supported.
Develop models using pre-sampled Bitcoin graphs
For developers focusing on model architecture or conceptualizing new studies without the overhead of the sampling process, pre-sampled communities are available. This allows for rapid iteration on model development.# Access example models and general development guidelines # See: https://github.com/B1AAB/GraphStudio/