bittensor-cost-observatory
by xgbtxy
README.md
# Bittensor Subnet Economics & AI Inference Cost Observatory (`+ MCP Server`)
[](https://github.com/xgbtxy/bittensor-subnet-cost-observatory/actions/workflows/ci.yml)
[](https://github.com/xgbtxy/bittensor-subnet-cost-observatory/actions/workflows/refresh-snapshot.yml)
[](./LICENSE)
> **Live Web Terminal**: **<https://xgbtxy.github.io/bittensor-subnet-cost-observatory/>**
> **Live JSON Snapshot**: **<https://xgbtxy.github.io/bittensor-subnet-cost-observatory/data/snapshot.json>**
> **Hackathon Track**: **2026 Bittensor Global Hackathon (HackQuest) — Track 2: Bittensor Developer Tools & Infrastructure**
An institutional-grade, zero-dependency **Node.js >=20 ESM** developer observatory and **Streamable HTTP Model Context Protocol (MCP) Server** for **Bittensor Dynamic TAO (dTAO)** subnets. It decodes binary **Substrate SCALE** telemetry directly from Opentensor's **Subtensor Finney Mainnet L1 RPC**, executes on-chain `swap_simSwapTaoForAlpha` slippage quotes, audits multi-subnet operator concentration, and benchmarks live **Bittensor decentralized AI inference (SN64 Chutes, including confidential TEE models)** against centralized frontier APIs (`Anthropic`, `OpenAI`, `Google`, `DeepSeek`).
---
## Live Screenshots
### 1. dTAO Liquidity Depth vs Daily Emission Share Quadrant (`134 Active Finney Subnets`)

### 2. Decentralized Bittensor SN64 vs Centralized Frontier LLM Cost Comparator & 80/20 Hybrid Router

### 3. Finney Emission Concentration Waterfall, Operator Entity Clusters & Subnet Scorecard Explorer

---
## Architecture (`Zero Mocked Data · Zero External NPM Dependencies`)
```mermaid
flowchart LR
subgraph L1["Live Public Production Sources (0-Key Default)"]
FIN["Subtensor Finney Mainnet RPC<br/>entrypoint-finney.opentensor.ai<br/>(SCALE DynamicInfo + SubnetInfov2 + simSwap)"]
CHU["Bittensor SN64 Chutes Gateway<br/>llm.chutes.ai/v1/models<br/>(USD + TAO/1M + TEE Attestation)"]
FRO["Frontier LLM Catalog<br/>openrouter.ai/api/v1/models<br/>(Anthropic / OpenAI / Google / DeepSeek)"]
MKT["Multi-Oracle TAO Spot<br/>CoinGecko + Coinbase Cross-Check<br/>(+ Optional TAOSTATS_API_KEY)"]
end
subgraph CORE["Isomorphic Node 20 ESM Engine"]
SCALE["src/lib/scale-subtensor.mjs<br/>Byte-Exact Substrate SCALE Codec"]
ECON["docs/lib/economics-core.mjs<br/>HHI/Gini + Redlines + 80/20 Router"]
COL["scripts/collect.mjs<br/>6h GitHub Actions Refresh"]
end
subgraph OUT["Developer Surfaces"]
WEB["docs/index.html + Pure SVG Charts<br/>GitHub Pages Static Terminal + iframe Embeds"]
MCP["src/mcp-server.mjs<br/>JSON-RPC 2.0 Streamable HTTP POST /mcp"]
BRF["docs/data/daily-brief.md<br/>Deterministic Daily Markdown & X Brief"]
end
FIN --> SCALE --> COL
CHU --> COL
FRO --> COL
MKT --> COL
COL --> ECON
ECON --> WEB
ECON --> MCP
ECON --> BRF
```
---
## Key Capabilities for Bittensor Builders & AI Routing Teams
1. **Direct L1 Subtensor Finney Binary SCALE Telemetry (`src/lib/scale-subtensor.mjs`)**:
- Decodes `subnetInfo_getAllDynamicInfo` and `subnetInfo_getSubnetsInfo_v2` directly from Finney Mainnet without requiring external SDK bloat or paid indexer keys.
- Verifies **exact 100-TAO on-chain swap price impact (`bps`) and protocol fees** via Subtensor runtime `swap_simSwapTaoForAlpha`.
- Links every subnet directly to `https://taostats.io/subnets/{netuid}` and its verified on-chain `SubnetIdentityV3` GitHub repository.
2. **Bittensor Decentralized Inference vs Centralized Frontier API Cost Comparator**:
- Pulls live `/v1/models` token pricing from **Bittensor SN64 (Chutes)** in both **USD/1M** and native **TAO/1M** (highlighting hardware-attested **Confidential Compute TEE** models) alongside live `Claude`, `GPT-4o`, `Gemini 2.5 Pro`, and `DeepSeek` pricing.
- Interactive **80/20 Hybrid Routing Calculator**: models routing 80% of high-volume coding/RAG traffic to Bittensor subnets while retaining 20% centralized frontier fallback — demonstrating **`~70%+` monthly TCO reduction**.
3. **Validator/Miner Health, Thin-Liquidity & Operator Cluster Redlines**:
- Computes network-wide **Emission HHI**, **Emission & Liquidity Gini**, and **Pool Coverage Days** (`tao_in / daily_tao_emission`).
- Automatically flags **`THIN_ALPHA_LIQUIDITY`**, **`HIGH_AMM_SLIPPAGE`**, **`EMISSION_WHALE_SHARE`**, **`SPOT_EMA_DIVERGENCE`**, **`MINER_BURN_WALL`**, and **multi-subnet operator clusters** combining L1 coldkey fingerprints with verified `SubnetIdentityV3` GitHub organizations (e.g., `gh:macrocosm-os`, `gh:datura-ai`, `gh:taostat`, `gh:qbittensor-labs`).
4. **Streamable HTTP MCP Server (`src/mcp-server.mjs`)**:
- Exposes live Bittensor subnet economics directly to AI coding agents (`Claude Code`, `Cursor`, `Windsurf`, custom agent harnesses) over JSON-RPC 2.0 `POST /mcp`.
---
## Quickstart (`Node.js >= 20`, Zero `npm install` Required)
```bash
git clone https://github.com/xgbtxy/bittensor-subnet-cost-observatory.git
cd bittensor-subnet-cost-observatory
cp .env.example .env
# 1. Fetch fresh live Subtensor Finney L1 + SN64 + Market telemetry
npm run collect
# 2. Run the 17+ assertion test suite (SCALE codec, economics, SVG charts, MCP JSON-RPC)
npm test
# 3. Start the local Web Observatory + Streamable HTTP MCP Server on http://127.0.0.1:8788
npm run mcp
```
---
## Streamable HTTP MCP Server Configuration (`POST /mcp`)
Add to your MCP client configuration (`claude_desktop_config.json`, `.cursor/mcp.json`, etc.):
```json
{
"mcpServers": {
"bittensor-cost-observatory": {
"type": "streamable-http",
"url": "http://127.0.0.1:8788/mcp"
}
}
}
```
### Exposed MCP Tools
| Tool Name | Purpose | Key Arguments |
|---|---|---|
| `get_bittensor_subnet_snapshot` | Query live Finney dTAO subnet reserves, spot/EMA prices, 100-TAO swap slippage, UID saturation, burn cost & Taostats links | `netuid`, `category`, `status`, `sortBy`, `limit` |
| `compare_tao_vs_centralized_llm` | Compute pure & 80/20 hybrid monthly/annual TCO between live Bittensor SN64 models and centralized frontier APIs | `monthlyTokensM`, `inputShare`, `bittensorShare`, `selectedBittensorId`, `selectedCentralizedId` |
| `audit_subnet_concentration` | Audit network-wide HHI, Gini, multi-subnet operator clusters, and critical thin-liquidity / slippage redlines | `onlyCritical`, `limit` |
### Example `curl` MCP Call
```bash
curl -s http://127.0.0.1:8788/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_bittensor_subnet_snapshot","arguments":{"netuid":64}}}'
```
### Embeddable Live Charts (`<iframe>`)
Append `?embed=quadrant`, `?embed=comparator`, or `?embed=concentration` to embed individual interactive panels inside documentation or research portals:
```html
<iframe
src="https://xgbtxy.github.io/bittensor-subnet-cost-observatory/?embed=comparator"
width="100%"
height="560"
style="border:0;border-radius:12px;"
loading="lazy">
</iframe>
```
---
## 2026 Bittensor Global Hackathon (HackQuest) Alignment
- **Selected Track**: **Track 2 — Bittensor Developer Tools & Infrastructure** (`Subnet monitoring and analytics dashboards`, `Performance evaluation & cost benchmarking`, `Developer & AI coding assistant MCP tooling`).
- **Greenfield Disclosure**: 100% net-new open-source codebase built specifically during the 2026 Bittensor Global Hackathon window (`Nov 27, 2026 – Jan 12, 2027`).
- **Walkthrough Script**: See [`DEMO_SCRIPT_3MIN.md`](./DEMO_SCRIPT_3MIN.md) for the complete 3-minute demonstration flow and go-to-market summary.
---
## License
Released under the [MIT License](./LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues