A Go service that monitors governance proposals on Cosmos networks and sends notifications when voting is about to start or end.
- Real-time monitoring of governance proposals across multiple Cosmos networks
- Smart notifications for voting start/end with configurable time thresholds
- Multiple notification channels: Telegram and Slack
- Startup notifications to confirm service is running
- Comprehensive logging with structured output
- Production-ready with error handling and graceful shutdown
- Babylon Mainnet (
bbn-1
) - via PublicNode REST API - ZetaChain Mainnet (
zetachain_7000-1
) - via BlockPI REST API
- Go 1.22+
- Telegram bot token (optional)
- Slack webhook URL (optional)
# Clone and build
git clone <repository>
cd governance-alerts-cosmos
go build -o governance-alerts-cosmos .
# Run with default config
./governance-alerts-cosmos --config config/config.yaml
Edit config/config.yaml
:
# Alert settings
alerts:
hours_before_start: 24 # Notify 24h before voting starts
hours_before_end: 6 # Notify 6h before voting ends
check_interval_minutes: 60 # Check every hour
notify_on_startup: true # Send notification when service starts
# Networks
networks:
babylon-mainnet:
name: "Babylon Mainnet"
rest_endpoint: "https://babylon-rest.publicnode.com"
chain_id: "bbn-1"
zetachain-mainnet:
name: "ZetaChain Mainnet"
rest_endpoint: "https://zetachain-athens.blockpi.network/lcd/v1/public"
chain_id: "zetachain_7000-1"
# Notifications
notifications:
telegram:
enabled: true
bot_token: "YOUR_BOT_TOKEN"
chat_id: 123456789
governance-alerts-cosmos/
├── cmd/ # Application entry point
├── internal/
│ ├── config/ # Configuration management
│ ├── governance/ # Cosmos governance client
│ ├── notifications/ # Notification handlers
│ ├── service/ # Core service logic
│ └── types/ # Data structures
├── config/ # Configuration files
└── docs/ # Documentation
go build -o governance-alerts-cosmos .
go test ./...
# With custom config
./governance-alerts-cosmos --config /path/to/config.yaml
# With debug logging
./governance-alerts-cosmos --log-level debug
The service provides:
- Startup notifications
- Real-time proposal monitoring
- Error logging for network issues
- Graceful shutdown handling
# View logs
tail -f governance-alerts-cosmos.log
# Check for errors
grep "Error" governance-alerts-cosmos.log
# Build image
docker build -t governance-alerts-cosmos .
# Run container
docker run -d \
--name governance-alerts-cosmos \
-v $(pwd)/config:/app/config \
governance-alerts-cosmos
Create /etc/systemd/system/governance-alerts-cosmos.service
:
[Unit]
Description=Governance Alerts Cosmos Service
After=network.target
[Service]
Type=simple
User=governance
WorkingDirectory=/opt/governance-alerts-cosmos
ExecStart=/opt/governance-alerts-cosmos/governance-alerts-cosmos --config /opt/governance-alerts-cosmos/config/config.yaml
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- Network connectivity errors: Check REST endpoint availability
- Telegram bot errors: Verify bot token and chat ID
- No proposals found: Networks may not have active governance proposals
./governance-alerts-cosmos --log-level debug --config config/config.yaml
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License