{"id":35118574,"url":"https://github.com/maxim91136/bittensor-labs","last_synced_at":"2026-01-31T11:00:52.267Z","repository":{"id":322230345,"uuid":"1088581299","full_name":"maxim91136/bittensor-labs","owner":"maxim91136","description":"Bittensor-Labs.com the incentive layer terminal","archived":false,"fork":false,"pushed_at":"2025-12-27T16:19:33.000Z","size":29967,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-29T21:35:44.293Z","etag":null,"topics":["bittensor","labs","tao"],"latest_commit_sha":null,"homepage":"https://bittensor-labs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxim91136.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-03T07:01:30.000Z","updated_at":"2025-12-27T16:19:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maxim91136/bittensor-labs","commit_stats":null,"previous_names":["maxim91136/bittensor-hub","maxim91136/bittensor-labs"],"tags_count":181,"template":false,"template_full_name":null,"purl":"pkg:github/maxim91136/bittensor-labs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim91136%2Fbittensor-labs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim91136%2Fbittensor-labs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim91136%2Fbittensor-labs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim91136%2Fbittensor-labs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxim91136","download_url":"https://codeload.github.com/maxim91136/bittensor-labs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxim91136%2Fbittensor-labs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28939486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T10:18:23.202Z","status":"ssl_error","status_checked_at":"2026-01-31T10:18:22.693Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bittensor","labs","tao"],"created_at":"2025-12-27T22:52:46.361Z","updated_at":"2026-01-31T11:00:52.242Z","avatar_url":"https://github.com/maxim91136.png","language":"JavaScript","readme":"\n# bittensor-labs\n\n**Live Bittensor network terminal with Matrix aesthetics**\n\n## Overview\nStarted: November 3, 2025\n\nA Matrix-styled terminal for exploring Bittensor network metrics. Track TAO price, halving projections, network stats, and market conditions with a unique terminal aesthetic.\n\n**Latest release:** `v1.0.0-rc.40.0.0` — see [Releases](https://github.com/maxim91136/bittensor-labs/releases) for details.\n\n## Features\n\n### 🔧 Developer Activity (RC38+)\nGitHub development metrics from opentensor repositories (updated every 6h):\n\n**Tracked Repositories**:\n- `opentensor/bittensor` - Main SDK\n- `opentensor/subtensor` - Blockchain layer\n- `opentensor/bittensor-subnet-template` - Subnet template\n\n**Metrics**:\n- **Active Developers**: Unique contributors (7d/30d)\n- **Commits**: Code changes (7d/30d)\n- **Total Contributors**: All-time contributor count\n- **Per-Repository Breakdown**: Visual bars showing activity distribution\n\n**Data Source**: GitHub API (free, 5000 req/hour) - Updates every 6 hours\n\n### 🔭 Talent Scouting - Rising Underdogs (RC33.22+)\nHunger Games-style talent discovery for subnets outside the Top 10:\n\n**The Katniss Principle**:\nFind the next breakout subnet before it hits the mainstream. Tracks subnets ranked #11+ that show strong momentum and real traction.\n\n**Emission Health Zones** (RC33.28+):\nVisual indicators showing subnet viability based on emission share:\n- 🟢 **Healthy** (≥1.0%) - Miners profitable, sustainable subnet\n- 🟡 **Rising** (0.5-1.0%) - Gaining momentum, approaching profitability\n- 🟠 **Struggling** (0.2-0.5%) - Needs growth, miner attrition risk\n- 🔴 **Critical** (\u003c0.2%) - Death zone, miners leaving\n\n**Emission Trend Arrows** (RC33.29+):\nDirection matters! Trend arrows show if emission is improving or declining:\n- 🟠↗ **Struggling + Rising** = Katniss moment (underdog climbing from danger zone)\n- 🟠↘ **Struggling + Falling** = EXIT warning (heading toward death zone)\n- 🟡↗ **Rising + Climbing** = Healthy momentum\n- Hover for exact delta (e.g., \"+0.19% vs 7d ago\")\n\n**Investment Strategy**:\n- Watch 🟠→🔴 transitions as EXIT signals\n- 🟢 subnets are Champion candidates\n- All Struggling subnets still have active miners (not dead yet)\n\n**Prospect Rankings**:\n- ⭐ **Top Prospect** (#1) - Highest momentum underdog\n- 🔥 **Hot Prospects** (#2-3) - Strong risers with liquidity\n- 📈 **Prospects** (#4-5) - Worth watching\n\n**Selection Criteria**:\n- Rank #11+ (outside Top 10 champions)\n- Pool liquidity \u003e 5K TAO (real market traction)\n- Positive 7-day rank improvement\n\n**Displayed Metrics**:\n- Current emission rank\n- 7-day momentum (rank change)\n- Pool liquidity (TAO)\n- Market cap (TAO + USD)\n\n**Watch List Mode**:\nWhen collecting historical data (first 7 days), shows top candidates by liquidity with \"...\" placeholder for momentum. Once data is available, switches to momentum-based ranking.\n\n**Deep Underdog Bonus**:\nSubnets ranked #30+ get a 1.5x multiplier in the sorting algorithm - rewarding truly unexpected risers from the bottom of the pack.\n\n**Fallen Giants Detection** (RC33.24+):\nIdentifies former Top 10 subnets that have fallen from grace:\n- Scans ALL historical data (not just 7 days) to find peak rank\n- 👑 Badge marks subnets that were once in Top 10\n- Shows total fall from peak (e.g., ↓70 = fell 70 ranks from peak)\n- Fallen Giants go to \"Fallen Angels\" section regardless of recent momentum\n- Prevents misclassifying a +2 recovery as a \"prospect\" when the subnet actually fell 70 ranks total\n\n**Example**: Gradients (SN56) was rank #10 on Dec 3, fell to rank #80 by Dec 15. Even though it recovered +2 in the last 7 days, it's correctly shown as a Fallen Giant with ↓70 total fall, not as a \"Top Prospect.\"\n\n### 🏆 Subnet Champions League (RC33.16+)\nML-powered subnet ranking projection model with boxing-style presentation:\n\n**Boxing-Style Rankings**:\n- 🥇 **P4P World Champion** (Rank #1) - Pound-for-pound king\n- 🥊 **WBA/WBC/IBF/IBO Champions** (Ranks #2-5) - Federation title holders\n- 🥊 **Contenders** (Ranks #6-10) - Fighting for a title shot\n\n**Toggle Views**:\n- **Emissions**: Current emission share ranking (who's earning the most TAO)\n- **Market Cap**: Alpha token market capitalization ranking\n- **Hybrid**: ML prediction probability for reaching #1 position\n\n**Prediction Model Features**:\n- Calculates probability of each subnet reaching #1 emission position\n- Based on historical emission trends, momentum, and rank stability\n- Shows →#1 probability column in Hybrid view\n- \"PRO\" button easter egg (click to unlock - it's all open source!)\n\n**Zero-Emission Warning** ⚠️:\nIn Market Cap view, subnets with high market cap but **zero emissions** are flagged:\n- Red background highlighting for at-risk rows\n- ⚠️ Warning icon next to subnet name\n- Red \"0.00τ\" in daily emission column\n- Tooltip: \"No emissions - speculative value\"\n\nThis helps identify potentially overvalued subnets - high market cap with no revenue is pure speculation.\n\n**Example**: SN5 Hone has 67K τ market cap but generates 0 τ/day in emissions (due to net TAO outflows under the Taoflow model).\n\n**Data Architecture**:\n- UI shows Top 10 (Power Law: Top 3 = ~60% of emissions)\n- Backend stores Top 100 emitters for prediction coverage\n- Chain data provides all 128+ subnets for alpha prices\n\n### 🎯 Halving Projections: Doug's Cheat + Triple-Precision GPS (RC33+)\n\n**World's first implementation of \"Doug's Cheat\" halving projection methodology**\n\nInstead of using protocol-defined theoretical emission (7200/2^n), we calculate the **actual emission rate** from historical data BEFORE the halving, then halve it. This accounts for real-world protocol variations and provides higher accuracy than theoretical approximations.\n\n**How It Works**:\n1. **Measure pre-halving emission** from chain history (7 days before halving)\n2. **Halve it** for post-halving projections: `measured_emission / (2 ^ halvings_since_last)`\n3. **Result**: Real-world accuracy using actual on-chain data\n\n**Example** (Halving #1 → #2):\n- Pre-halving measured: **7193.74 τ/day** (not theoretical 7200)\n- Post-halving: 7193.74 / 2 = **3596.87 τ/day** 🎯\n- Theoretical would be: 3600 τ/day\n- **0.09% more accurate!**\n\n**Triple-Precision GPS (Global Positioning System)**:\nDistance-adaptive emission selection methodology that ensures accurate projections across all time horizons:\n\n- **Stage 1 (0-7 days post-halving)**: Doug's Cheat for all projections\n  - Both 7d and 30d averages contaminated with pre-halving data\n  - Solution: Use real pre-halving emission (halved) - zero contamination!\n\n- **Stage 2 (7-30 days)**: Transition Period\n  - Terminal approach (\u003c30d away): Clean 7d empirical data\n  - Long-range (\u003e30d away): Theoretical (30d still contaminated)\n\n- **Stage 3 (30+ days)**: Full GPS Operation\n  - Terminal approach: 7d for real-time precision\n  - Long-range: 30d for stable noise-resistant forecasts\n\n**Transparency Metadata**:\n- GPS stage indicators (`post_halving_stabilization`, `terminal_approach`, `long_range`)\n- Confidence levels (`empirical_halved`, `high`, `medium`, `low`)\n- Days since halving + days until clean data\n- Exact emission rate used for each threshold\n\n**Results**:\n- ✅ Halving #1: **100% accuracy** (0 seconds error) - predicted 13:31 UTC, occurred 13:31 UTC\n- 🔮 Halving #2-4: Using Doug's Cheat (3596.87 τ/day → 1798.44 τ/day → 899.22 τ/day)\n\nProps to **Doug from Taostats** for pioneering this methodology!\n\nSee [docs/HALVING_ESTIMATES.md](docs/HALVING_ESTIMATES.md) for complete technical documentation.\n\n### 🧪 Decentralization Score 2.0 (RC30.37+)\nExperimental model separating **Technical** vs **Economic** decentralization:\n\n**Three Scores**:\n- **TDS (Technical)**: Who controls the keys? CEX holdings + validator concentration\n- **EDS (Economic)**: Who owns the tokens? Wallet distribution + subnet strength\n- **Hybrid**: Combined score (50% TDS + 50% EDS)\n\n**Why Two Models?**\n- A protocol can be **technically centralized** (CEX custody, few validators) but **economically decentralized** (broad ownership)\n- Classic score mixes everything → hides CEX/validator risk\n- Score 2.0 exposes it: \"EDS 67 but TDS 32\" tells a clearer story\n\n**Technical Metrics (TDS)**:\n- CEX Holdings % (Binance, Coinbase, etc.)\n- Validator Top10 concentration\n\n**Economic Metrics (EDS)**:\n- Wallet distribution (35%)\n- Subnet score (35%)\n- Gini + Stake spread (30%)\n\n### 📊 TAO Distribution Analysis (RC30+)\nInstitutional-grade wealth distribution metrics:\n\n**Percentile Rankings**:\n- Find out where you rank among all TAO holders\n- Top 1% threshold: 395 τ\n- Top 10% threshold: 25 τ\n- Top 50% threshold: 1 τ\n\n**Distribution Metrics**:\n- **Gini Coefficient**: Measures wealth inequality (0 = perfect equality, 1 = total inequality)\n- **Total Wallets**: Track the growth of the TAO holder base\n- **Decentralization Score**: Comprehensive analysis of wallet distribution\n\n**Data Quality**:\n- Based on real on-chain wallet data\n- Updated weekly from Taostats API\n- Transparent sample counts and timestamps\n\n### 🎯 Network Decentralization Score (RC30+)\nFirst institutional-grade decentralization analysis for Bittensor:\n\n**Composite Score** (0-100):\n- Combines Wallets (30%), Validators (30%), and Subnets (40%)\n- Color-coded thresholds: Critical (\u003c40), Low (40-60), Moderate (60-80), High (80+)\n\n**Key Metrics**:\n- **Nakamoto Coefficient**: Minimum entities needed to control 51% of stake\n  - Higher is better (more decentralized)\n  - Separate calculations for Validators and Subnets\n- **Gini Index**: Inequality measure (0 = perfect equality, 1 = total inequality)\n  - Lower is better (more equal distribution)\n- **HHI (Herfindahl-Hirschman Index)**: Market concentration (0-10,000)\n  - Lower is better (less concentrated)\n\n**Three Pillars**:\n1. **Wallets**: TAO holder distribution analysis\n2. **Validators**: Stake concentration among validators\n3. **Subnets**: Emission distribution across subnets\n\n**Visual Features**:\n- Score gauge with threshold indicators\n- Historical tracking (shows trend over time)\n- Expandable details with plain-language explanations\n- Last updated timestamps\n\n### 📈 Price Chart (RC29+)\n- **Candlestick Chart**: Professional OHLC visualization with green/red candles\n- **Volume Bars**: Trading volume displayed below price chart\n- **Multiple time ranges**: 1D, 7D, 30D, 90D, Max (~600 days)\n- **Multi-asset comparison**: Compare TAO vs BTC, ETH, and SOL performance\n- **EUR currency support**: View prices in Euros with live conversion\n- **Smart Toggle Logic**: Candle/Volume and Compare modes are mutually exclusive\n- **Data sources**: Binance (primary), Taostats, CoinGecko (fallbacks)\n\n### 📈 Leaderboard Ranking System (RC26+)\nTrack position changes across all Top 10 cards with visual indicators:\n- **Position Change Indicators**: ▲ (rank up), ▼ (rank down), NEW (new entry)\n- **Historical Comparison**: Compares current ranking against previous snapshot\n- **Color-Coded Signals**: Green for improvements, Red for drops, Blue for new entries\n- **Compact Display**: Rank + change indicator in single column (e.g., \"1 ▲2\")\n- **Supported Cards**: Subnets (netuid), Validators (hotkey), Wallets (address)\n\n### 🎯 Market Conditions Intelligence (RC25+)\nReal-time market analysis card combining multiple data sources into actionable intelligence:\n\n**Four Key Metrics** (Matrix-style 2x2 grid):\n- **Signal** 🟢 Bullish/🔴 Bearish/🟠 Watch/🟡 Caution - Multi-factor short-term signal\n- **Volume 24h** - Dollar amount ($180M) + percentage change (+145%)\n- **Price 24h** - Short-term price change percentage\n- **Trend (3d/7d)** - Medium-term price trend (3-day vs 7-day MA comparison)\n\n**Market Phase Analysis**:\n- Contextual phase detection (Bullish/Bearish/Neutral)\n- Fear \u0026 Greed Index integration (CMC current + Alternative.me historical)\n- Weekend activity context\n- Clear explanations in expandable section\n\n**Moving Averages Dashboard**:\n- MA-2h, MA-4h, MA-3d, MA-7d live tracking\n- Percentage difference from current price\n- Green (above MA) / Red (below MA) indicators\n- Trend analysis at a glance\n\n**Data Quality \u0026 Transparency**:\n- Confidence scoring (high/medium/low)\n- Sample count and hours of data displayed\n- Last updated timestamps\n- Transparent data provenance\n\n**Visual Design**:\n- Strategic color usage: Neutral values (white), conditional signals (green/red)\n- Matrix console aesthetic with monospace typography\n- Fully responsive (4 → 2 → 1 columns on mobile)\n- Complete light/dark mode support\n\n### 📊 Network Metrics\n- **TAO price** with 24h change indicator and breathing animation\n- **Live pricing** from Binance API (\u003c1 second delay)\n- **EUR/USD toggle** on price pill and chart (synced, persisted)\n- **Circulating Supply** tracking against the 21M cap\n- **Total Issuance** from on-chain data via Bittensor SDK\n- **Active Neurons** count across all subnets\n- **Tooltip Transparency**: Every stat card shows data source + last updated timestamp\n\n### ⚡ Emission \u0026 Halving\n- **AVG. Emission/Day** calculated from on-chain issuance history\n- **Halving Countdown** with Triple-Precision GPS projections\n- **Emission curve visualization** showing TAO distribution over time\n- **GPS Metadata**: Real-time contamination tracking and confidence levels\n\n### 😱 Fear \u0026 Greed Index\n- **Hybrid data source**: CoinMarketCap (current, frequent updates) + Alternative.me (historical)\n- Spoon gauge visualization (0-100 scale)\n- Historical timeline: Now → Yesterday → Week → Month\n- Integration with Market Conditions Card for comprehensive analysis\n- Tooltip shows both sources with individual timestamps\n\n### 🏆 Leaderboards\n- **Top Validators** by stake with delegation info\n- **Top Wallets** by TAO holdings\n- **Top Subnets** by emission allocation\n\n### 🌗 Dark/Light Mode\n- Auto-detects system preference\n- Manual toggle with smooth transitions\n- Optimized color palettes for both modes\n\n### 📱 Responsive Design\n- Mobile-first layout\n- Touch-friendly tooltips\n- Optimized for all screen sizes\n\n### 🥚 Easter Eggs\n- Hidden Matrix-themed surprises - can you find them?\n\n### 🔌 API Status Card\n- Real-time health monitoring of all 7 data sources\n- Color-coded status chips: OK (green), Partial (yellow), Error (red)\n- Critical vs Non-critical API classification\n- Tooltip with detailed per-source status\n\n### ♿ Accessibility\n- `prefers-reduced-motion` support\n- High contrast text\n- Semantic HTML structure\n\n## Installation\n\n```bash\ngit clone https://github.com/maxim91136/bittensor-labs.git\ncd bittensor-labs\nnpm install\n```\n\n## Usage\n\n```bash\nnpm run start\n```\n\nThen open [http://localhost:3000](http://localhost:3000) in your browser.\n\n## Contributing\n\nPull requests and issues are welcome! Please follow the guidelines in CONTRIBUTING.md.\n\n## CI \u0026 Releases\n\nThis repository uses a release script for consistent releases:\n\n```bash\n# 1. Update VERSION file with new version\n# 2. Add entry to CHANGELOG.md\n# 3. Run the release script\n./scripts/release.sh\n```\n\nThe script automatically:\n- Updates `README.md` with the version from `VERSION`\n- Commits changes and pushes to main\n- Creates a git tag\n- Creates a GitHub Release with commit list\n\nFor debugging in the client, set `window._debug = true` in the browser console to get debug logs about halving calculation and fallback behavior.\n\n## License\n\nMIT License\n\n## Contact\n\nFor questions or feedback, please open an [Issue](https://github.com/maxim91136/bittensor-labs/issues) or submit a Pull Request on GitHub.\n\n## Disclaimer \u0026 Data Sources\n\nThis terminal is an independent, community-run project provided for informational purposes only and is not affiliated with, endorsed by, or certified by the Opentensor Foundation.\n\n### Data Sources (7 APIs)\n\n| Source | Data Provided | Update Frequency |\n|--------|---------------|------------------|\n| **Bittensor SDK** | On-chain data: subnets, validators, neurons, issuance, block height | Every 10 min |\n| **Taostats** | Supply, validators, wallets, subnets, price history | Every 10 min |\n| **Binance** | Real-time TAO price, 24h volume, candlestick data, EUR/USD rate | Real-time (\u003c1s) |\n| **CoinGecko** | Fallback price data | On-demand |\n| **CoinMarketCap** | Fear \u0026 Greed Index (current), global metrics, BTC dominance | Hourly |\n| **Alternative.me** | Fear \u0026 Greed historical (yesterday, week, month) | Daily |\n| **DexScreener** | wTAO DEX pairs, liquidity, trading volume | Every 15 min |\n\n### Legal\n\n- **Not financial advice**: This project is not financial, legal, or investment advice. Always verify critical information using authoritative sources and consult a professional before acting on any data shown here.\n- **No warranty**: All data is provided \"as-is\" without warranty of any kind; the project maintainer disclaims liability for losses resulting from the use of this site.\n- **Privacy**: This site uses Cloudflare for security and performance; personal data is not stored by the project unless explicitly submitted by you.\n- **Trademarks**: \"Bittensor\", \"TAO\" and other asset names are trademarks of their respective owners and are used for identification only.\n- **Rate limits**: Third-party APIs may be subject to rate limits; data may be temporarily unavailable.\n\n### Community\n\n- **Reddit**: [u/WrongdoerSweet3851](https://reddit.com/u/WrongdoerSweet3851)\n- **Discord**: STRM1109\n\n### Special Thanks\n\n**Doug from Taostats** - For pioneering the \"Doug's Cheat\" methodology and providing invaluable insights into halving projection accuracy. The world's first implementation of real pre-halving emission tracking is built on his brilliant work.\n\n## Docs\n\nDetailed documentation for issuance history and halving projections lives under the `docs/` folder:\n\n- `docs/README.md` — index of available docs about issuance history and halving projections.\n- `docs/HALVING_ESTIMATES.md` — **Complete specification** for Doug's Cheat + Triple-Precision GPS methodology, field-level docs for `halving_estimates`, `emission_used`, `step`, GPS metadata, and projection confidence.\n- `docs/ISSUANCE_HISTORY_README.md` — operational notes about how issuance snapshots are collected and stored in Cloudflare KV.\n\nVisit the `docs/` directory for more details on using the network API and interpreting projection results.\n\n## Deployment (Cloudflare Worker)\n\nBrief: A small GitHub Actions workflow publishes the Cloudflare Worker that serves the ATH/ATL API.\n\n- Trigger: the workflow runs on `push` to `main` **only** when one of these paths changes:\n\t- `functions/**`\n\t- `worker-entry.js`\n\t- `.github/workflows/deploy-worker.yml`\n\n- Manual run: you can also start the workflow from the Actions UI (`Run workflow`) or with the GH CLI:\n\n\t```bash\n\tgh workflow run deploy-worker.yml --ref main\n\t```\n\n- What it does: generates `wrangler.toml` from repository secrets and runs `wrangler deploy` to publish the Worker.\n\n- Required repo secrets used by the workflow (make sure they exist in Settings → Secrets):\n\t- `CF_API_TOKEN` (passed to Wrangler as `CLOUDFLARE_API_TOKEN`)\n\t- `CF_ACCOUNT_ID`\n\t- `CF_METRICS_NAMESPACE_ID`\n\n- Safety: the workflow is limited to worker-related pushes to avoid accidental deploys from unrelated changes.\n\nQuick smoke checks after a deploy:\n\n```bash\ncurl -sS https://\u003cyour-worker\u003e.workers.dev/api/taostats | jq .\ncurl -sS https://\u003cyour-worker\u003e.workers.dev/api/taostats_history | jq .\ncurl -sS https://\u003cyour-worker\u003e.workers.dev/api/taostats_history/health | jq .\n```\n\nIf you prefer fully manual deploys only, run the workflow from the Actions UI; if you want assistance changing triggers, I can update the workflow.\n\n## Automated Backups — `issuance_history`\n\nBrief: The repository runs a scheduled, opt-in job that collects the `issuance_history` value from Cloudflare Workers KV and stores a timestamped copy. This job runs every 6 hours and can optionally upload the snapshot to an R2 bucket.\n\n- What is backed up: the `issuance_history` KV value, written as `issuance_history-YYYYMMDDTHHMMSSZ.json`.\n- Schedule: every 6 hours (GitHub Actions cron). The workflow also supports manual runs via the Actions UI.\n- Upload: uploads to R2 are strictly opt-in. To enable uploading set `ENABLE_R2=true` and provide the following repository secrets (see below).\n\nRequired repository secrets for backups\n- `CF_ACCOUNT_ID` — Cloudflare account id (used to read KV)\n- `CF_API_TOKEN` — Cloudflare API token with KV read rights\n- `CF_METRICS_NAMESPACE_ID` — KV namespace id where `issuance_history` lives\n\nOptional (for R2 uploads; only required if `ENABLE_R2=true`)\n- `ENABLE_R2` = `true` to enable uploads (string `true`)\n- `R2_ENDPOINT` — S3-compatible endpoint URL for your R2 account\n- `R2_BUCKET` — R2 bucket name\n- `R2_ACCESS_KEY_ID` / `R2_SECRET_ACCESS_KEY` — R2 access credentials\n- `R2_PREFIX` — optional path prefix for uploaded objects\n\nHow to test (manual run)\n\n```bash\n# trigger a manual run\ngh workflow run backup-issuance-history-r2.yml --ref main\n\n# then stream logs\ngh run list --workflow backup-issuance-history-r2.yml --limit 5\ngh run view \u003crun-id\u003e --log\n```\n\nBehavior: If R2 secrets are not provided or `ENABLE_R2` is not `true`, the workflow will still fetch `issuance_history` and write a local timestamped file, but it will skip any upload.\n\nIf you want me to also back up additional KV keys or other datasets, I can add modular scripts and hook them into the same scheduled job.\n\n### Taostats (price \u0026 volume) history backup\n\n- We now collect price and `volume_24h` snapshots into a separate `taostats_history` JSON and store it in Cloudflare Workers KV under the key `taostats_history`.\n - The `publish-taostats` workflow appends to `taostats_history.json` and writes it to KV on every run (defaults to every 10 minutes).\n - Note: The workflow now writes `taostats_history` directly to Cloudflare KV (PUT), so a dedicated write-appending Worker is optional; if you prefer server-side appends, you can deploy the `taostats_history` Worker and configure `CF_WORKER_URL` in secrets.\n - Note: The workflow will attempt to append via a deployed `taostats_history` Worker (preferred) if `CF_WORKER_URL` is set, otherwise it will fall back to direct KV PUT/merge. If you deploy the Worker and want server-side appends, set these repo secrets:\n\t - `CF_WORKER_URL` (e.g., https://bittensor-taostats.\u003cxxx\u003e.workers.dev)\n\t - `CF_WORKER_WRITE_TOKEN` (optional): The write token if configured in the Worker `HISTORY_WRITE_TOKEN`. If not provided, the workflow will POST without a token (Worker must allow unauthenticated writes).\n\t - `ALLOW_KV_PUT_FALLBACK` (optional): set to `true` to allow client-side PUT fallback if the Worker POST fails (default: false). If you want strict server-only appends, do not set this or set to `false`.\n- A new scheduled workflow `backup-taostats-r2` runs every 3 hours and will fetch `taostats_history` from KV and upload a timestamped copy to R2. To enable the R2 upload set `ENABLE_R2=true` and the R2 credentials mentioned above.\n - A new per-run archival step in the `publish-taostats` workflow optionally uploads a timestamped entry to R2 for each fetch (if `ENABLE_R2=true`), so we can retain as much history as possible in R2 while keeping the recent history compact in KV. This ensures the terminal can display long-term history later even if KV has size limits.\n - (Previously) A daily consolidation job aggregated `taostats_entry-` files into daily files. Consolidation has now been removed.\n- The history file stores a compact array of entries: `{ _timestamp, price, volume_24h }`. The collector keeps a bounded number of entries (default 10,000) which can be adjusted with `HISTORY_MAX_ENTRIES` environment variable.\n\n### Cloudflare Worker \u0026 KV setup (if starting from scratch)\n\nIf you don't have a Cloudflare Worker or KV namespace set up, follow these steps to create one and enable the `taostats_history` endpoint used by the workflows:\n\n1. Create a KV namespace (via the dashboard or Wrangler):\n\n\t Using Wrangler:\n\t ```bash\n\t wrangler login\n\t wrangler kv:namespace create \"metrics_kv\" --binding METRICS_KV\n\t ```\n\n\t Or via the API (requires `CF_API_TOKEN` and `CF_ACCOUNT_ID`):\n\t ```bash\n\t curl -s -X POST \"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/storage/kv/namespaces\" \\\n\t\t -H \"Authorization: Bearer ${CF_API_TOKEN}\" \\\n\t\t -H \"Content-Type: application/json\" \\\n\t\t --data '{\"title\":\"metrics_kv\"}'\n\t ```\n\n\t The response will include an `id` — set that as `CF_METRICS_NAMESPACE_ID` (or `CF_KV_NAMESPACE_ID`) in your repository secrets.\n\n2. Deploy or add a Worker to serve the `taostats_history` endpoint. A simple Worker can be implemented using the KV binding from step 1 and exposing this route:\n\n\t - GET `/api/taostats_history` -\u003e return `TAO_STATS_KV.get(\"taostats_history\")`\n\t - PUT `/api/taostats_history` -\u003e `TAO_STATS_KV.put(\"taostats_history\", body)` (if you want writes through a Worker)\n\n\t Bind the KV namespace in `wrangler.toml` or the dashboard for the Worker to use (avoid naming collision).\n\n3. Validate KV access \u0026 API setup (manual quick test):\n\n\t - Check account id is correct:\n\t\t ```bash\n\t\t curl -s -H \"Authorization: Bearer ${CF_API_TOKEN}\" \"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}\" | jq .\n\t\t ```\n\t - Check KV namespace exists:\n\t\t ```bash\n\t\t curl -s -H \"Authorization: Bearer ${CF_API_TOKEN}\" \"https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/storage/kv/namespaces/${CF_KV_NAMESPACE_ID}\" | jq .\n\t\t ```\n\t\t If this returns `404` or `No route for that URI`, verify your `CF_ACCOUNT_ID` / `CF_KV_NAMESPACE_ID` are correct and that the `CF_API_TOKEN` was created under the same Cloudflare account.\n\n4. Set these as repository secrets: `CF_API_TOKEN`, `CF_ACCOUNT_ID`, `CF_METRICS_NAMESPACE_ID` (or `CF_KV_NAMESPACE_ID`). The workflows use those to write to KV.\n\nNotes:\n - If you expect historical data already present in KV, we can implement a merge strategy (fetch and merge arrays) before overwriting the `taostats_history` key. Currently the `publish-taostats` workflow POSTs the latest entry to the Worker (worker appends server-side) and then downloads the merged history back. The workflow performs a pre/post GET check when `CF_WORKER_URL` is set, and will fail if the history count does not increase after the POST — this helps detect route/permission issues before any direct PUT would run.\n - If you are starting from scratch (no existing KV entries), the current workflow will create new `taostats_history` payloads and write them to the KV key on the first run.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxim91136%2Fbittensor-labs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxim91136%2Fbittensor-labs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxim91136%2Fbittensor-labs/lists"}