https://github.com/saranshkr/langchain-bitcoin-analytics
An end-to-end real-time Bitcoin analytics pipeline that visualizes price trends and graph-based wallet transactions using Neo4j and Streamlit. Includes natural language Q&A powered by LangChain and Mistral via Ollama, enabling editable Cypher query generation with explanations.
https://github.com/saranshkr/langchain-bitcoin-analytics
bitcoin cypher data-pipeline graph-analytics langchain neo4j nlp streamlit
Last synced: about 2 months ago
JSON representation
An end-to-end real-time Bitcoin analytics pipeline that visualizes price trends and graph-based wallet transactions using Neo4j and Streamlit. Includes natural language Q&A powered by LangChain and Mistral via Ollama, enabling editable Cypher query generation with explanations.
- Host: GitHub
- URL: https://github.com/saranshkr/langchain-bitcoin-analytics
- Owner: saranshkr
- Created: 2025-06-02T20:52:26.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-06-30T23:18:37.000Z (8 months ago)
- Last Synced: 2025-07-14T02:13:09.038Z (8 months ago)
- Topics: bitcoin, cypher, data-pipeline, graph-analytics, langchain, neo4j, nlp, streamlit
- Language: Python
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📊 Real-time Bitcoin Analytics with LangChain & Neo4j
A real-time dashboard for exploring Bitcoin transaction data using Neo4j, LangChain (LLM-powered Q&A), and Streamlit. Supports natural language query generation, graph visualization, wallet activity stats, and price/volume trends.
## 🧩 Features
- **Real-time ingestion** of Bitcoin transactions
- **Cypher query generation** from natural language using LangChain + Mistral
- **Interactive wallet graph** (Pyvis)
- **Statistical summaries** (daily tx counts, top wallets, 24h stats)
- **Price chart** with 5-point moving average & 24h volume bars
- **Q&A mode** for explainable query interaction
- **Auto-refresh support** per tab
- **Custom ingestion pipeline** (fetch, push, simulate)
## 📁 Project Structure
```
.
├── README.md
├── analysis
│ ├── graph_pyvis.py # Generates wallet graph from Neo4j
│ ├── langchain_qa.py # Natural language to Cypher query
│ ├── langchain_summary.py # Summary generator using LangChain
│ └── price_chart.py # BTC price/volume chart
├── app.py # Streamlit dashboard entry point
├── ingest
│ ├── fetch_transactions.py # Get BTC data from external API
│ ├── push_to_neo4j.py # Push new transactions to Neo4j
│ ├── run_pipeline.py # Runs fetch + push + simulation as threads
│ └── simulate_wallets.py # Adds Wallet nodes & edges to txns
├── requirements.txt
├── run.sh # Shell script to regenerate data + launch dashboard
├── todo.txt
├── ui
│ ├── tabs
│ │ ├── price_chart.py
│ │ ├── query_explorer.py
│ │ ├── stats_tab.py
│ │ ├── summary_tab.py
│ │ └── wallet_graph.py
│ └── utils
│ ├── autorefresh.py # Utility for per-tab auto-refresh
│ └── helpers.py # Shared Neo4j query helpers
└── utils
└── cleanup.py # Optional cleanup script
```
## 🚀 Setup Instructions
### 1. Install dependencies
```bash
pip install -r requirements.txt
```
Ensure you have [Ollama](https://ollama.com/) running with the `mistral` model for local LLM inference.
### 2. Create your `.env` file:
```bash
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=your_password
```
## 📌 Example Workflow
### Start the ingestion pipeline
```bash
python ingest/run_pipeline.py
```
Use Ctrl+C to stop the pipeline
### Run the regeneration scripts (optional) and launch dashboard
```bash
bash run.sh [--regen]
```
## 💬 Example Questions
- Who received the highest transaction volume this week?
- Show wallets that sent transactions yesterday
- What are total transactions in the last 24 hours?
- Top 5 receivers this month?
## 🧠 Powered by
- [Neo4j](https://neo4j.com/) for graph storage
- [LangChain](https://github.com/langchain-ai/langchain) + [Ollama](https://ollama.com/) for local LLM reasoning
- [Streamlit](https://streamlit.io/) for interactive UI
## 🧠 Author
**Saransh Kumar**
🔗 [linkedin.com/in/saransh-kr](https://linkedin.com/in/saransh-kr)
🔗 [github.com/saranshkr](https://github.com/saranshkr)