A Telegram bot that monitors the hashrate (proofrate) of the Nockchain network using data from NockBlocks.
- 📊 Real-time Metrics - Get current proofrate, difficulty, block time, and epoch progress
- 🔔 Smart Alerts - Subscribe to notifications when proofrate drops below threshold
- ⏰ Automatic Monitoring - Periodic checks with configurable intervals
- 📈 Network Stats - Track difficulty adjustments and epoch progress
- Open Telegram and message @BotFather
- Send
/newbotand follow the prompts - Copy the bot token (looks like
123456789:ABCdefGHIjklMNOpqrSTUvwxYZ)
cd nockbot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt# Copy the example config
cp env.example .env
# Edit with your credentials
nano .env # or use your preferred editorRequired settings in .env:
TELEGRAM_BOT_TOKEN- Get from @BotFather on TelegramNOCKBLOCKS_API_KEY- Your NockBlocks API key
source venv/bin/activate
python bot.py| Command | Description |
|---|---|
/start |
Show welcome message and quick actions |
/hashrate |
Get current mining metrics |
/proofrate |
Same as /hashrate |
/subscribe |
Subscribe to proofrate alerts |
/unsubscribe |
Stop receiving alerts |
/status |
Check bot and monitoring status |
/help |
Show all available commands |
- Difficulty - Current network difficulty (e.g.,
2^31.1) - Proofrate - Network hash rate (e.g.,
1.57 MP/s) - Avg Block Time - Average time between blocks
- Epoch Progress - Progress through current difficulty epoch
- Blocks to Adjustment - Blocks remaining until difficulty adjustment
- Est. Time to Adjustment - Estimated time until next adjustment
- Next Adjustment Ratio - Expected difficulty change
The bot monitors the network proofrate and sends alerts when:
⚠️ Proofrate drops below the configured threshold- ✅ Proofrate recovers above the threshold
Configure the threshold in your .env file using PROOFRATE_ALERT_THRESHOLD.
- Set up the virtual environment on your server:
cd /home/ubuntu/nockbot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt- Copy the included service file to systemd:
sudo cp nockbot.service /etc/systemd/system/Or create /etc/systemd/system/nockbot.service manually:
[Unit]
Description=Nockbot Telegram Bot
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/nockbot
ExecStart=/home/ubuntu/nockbot/venv/bin/python /home/ubuntu/nockbot/bot.py
Restart=always
RestartSec=10
EnvironmentFile=/home/ubuntu/nockbot/.env
[Install]
WantedBy=multi-user.target- Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable nockbot
sudo systemctl start nockbot- Check status:
sudo systemctl status nockbotFROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "bot.py"]docker build -t nockbot .
docker run -d --env-file .env nockbotAll metrics are sourced from NockBlocks by SWPSCo.
