Automated daily TAO earnings reporter for Bittensor miners. Fetches earnings data from the Taostats API and posts summaries to Discord via webhook.
- 📊 Fetches TAO earnings for multiple coldkeys from Taostats accounting API
- 📅 Configurable lookback period (daily, weekly, or all-time)
- 🔄 Supports multiple Bittensor networks (Finney, Nakamoto, Kusanagi)
- 📱 Posts formatted earnings reports to Discord webhook
- ⚙️ Designed for automated execution via GitHub Actions or cron
- Clone the repository:
git clone https://github.com/yourusername/bittensor-tao-earnings-reporter.git
cd bittensor-tao-earnings-reporter- Create a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateCreate a .env file in the project root:
# Required
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url
TAOSTATS_API_KEY=your-taostats-api-key
MINER_ADDRESSES=5ABC...,5DEF...,5GHI...
# Optional
TAO_LOOKBACK_DAYS=10 # Days to look back (0 = all time)
TAO_NETWORK=finney # Network: finney, nakamoto, or kusanagi
TAOSTATS_BASE_URL=https://api.taostats.io/api
DEBUG=false # Enable debug modepython daily_tao_to_discord.pyThe repository includes a GitHub Actions workflow that runs automatically.
Limitation: GitHub Actions has a 5-minute minimum for scheduled workflows.
Setup:
-
Add GitHub Secrets:
- Go to your repository → Settings → Secrets and variables → Actions
- Add the following secrets:
DISCORD_WEBHOOK_URL- Your Discord webhook URLTAOSTATS_API_KEY- Your Taostats API keyMINER_ADDRESSES- Comma-separated coldkey addressesTAO_LOOKBACK_DAYS(optional) - Default: 10TAO_NETWORK(optional) - Default: finneyDEBUG(optional) - Default: false
-
Workflow will automatically:
- Run every 5 minutes (GitHub minimum)
- Fetch earnings data
- Post to Discord webhook
-
Manual trigger:
- Go to Actions tab → TAO Earnings Discord Reporter → Run workflow
For true 2-minute intervals, use a cron job on your server:
-
Set up environment variables in your
.envfile (see Configuration section) -
Add to crontab:
crontab -e # Add this line: */2 * * * * /path/to/daily-tao-script/cron-2min.sh
-
Or use the provided script:
chmod +x cron-2min.sh # Then add to crontab: */2 * * * * /full/path/to/cron-2min.sh >> /var/log/tao-reporter.log 2>&1
Note: See .github/SECRETS_SETUP.md for detailed GitHub Secrets setup instructions.
| Variable | Required | Default | Description |
|---|---|---|---|
DISCORD_WEBHOOK_URL |
Yes | - | Discord webhook URL |
TAOSTATS_API_KEY |
Yes | - | Taostats API key |
MINER_ADDRESSES |
Yes | - | Comma-separated list of coldkey addresses |
TAO_LOOKBACK_DAYS |
No | 10 |
Number of days to look back (0 = all time) |
TAO_NETWORK |
No | finney |
Bittensor network name |
TAOSTATS_BASE_URL |
No | https://api.taostats.io/api |
Taostats API base URL |
DEBUG |
No | false |
Enable debug logging |
- Python 3.9+
python-dotenv(optional, for.envfile support)