A comprehensive blockchain monitoring service with two specialized applications for tracking smart contracts and events across multiple networks.
This repository contains two monitoring applications:
- Monitors the
getScaledInputData
function across multiple blockchains - Sends Slack alerts when the function returns
false
- Uses
config.yaml
for configuration - Uses
CONTRACT_ADDRESS
environment variable
- Monitors
RootSubmitted
events on distributor contracts across 14+ networks - Tracks campaign submissions with real-time Slack notifications
- JSON-based configuration for networks and contracts
- State persistence to resume monitoring after restarts
- Docker support for easy deployment
# 1. Configure environment
cp env.example .env
# Edit .env with your RPC URLs and Slack credentials
# 2. Configure contracts
# Update config/distributor/Contracts.json with actual contract addresses
# 3. Run
go run cmd/distributor/main.go
# 1. Setup environment
cp docker.env.example .env
# Edit .env with your credentials
# 2. Deploy
docker-compose up -d
# 3. View logs
docker-compose logs -f distributor-monitor
config/distributor/Chains.json
- Network metadata (14 networks, emojis, batch sizes)config/distributor/Contracts.json
- Distributor contract addresses per networkconfig/distributor/State.json
- Runtime state persistence (auto-managed)distributor-config.yaml
- Basic application settings
config.yaml
- Traditional YAML configuration- Environment variables for contract addresses
Network | Chain ID | Emoji | Status |
---|---|---|---|
Ethereum | 1 | π· | Active |
Polygon | 137 | π£ | Active |
BSC | 56 | π‘ | Active |
Arbitrum | 42161 | π΅ | Active |
Avalanche | 43114 | πΊ | Active |
Base | 8453 | π¦ | Active |
Berachain | 80085 | π» | Testnet |
Mantle | 5000 | π§ | Active |
Optimism | 10 | π΄ | Active |
Sonic | 146 | β‘ | Active |
Unichain | 130 | π¦ | Active |
Ronin | 2020 | βοΈ | Active |
Linea | 59144 | π | Active |
Hyper EVM | 999 | β‘ | Active |
Deployment-specific only (sensitive data):
SLACK_TOKEN
- Slack bot tokenSLACK_CHANNEL
- Slack channel for alerts{NETWORK}_NODE_URL
- RPC endpoints (e.g.,ETH_NODE_URL
,ARBITRUM_NODE_URL
)
Configuration managed in JSON files (no env vars needed):
- Contract addresses β
config/distributor/Contracts.json
- Network metadata β
config/distributor/Chains.json
- Batch sizes β
config/distributor/Chains.json
CONTRACT_ADDRESS
- Smart contract addressSLACK_WEBHOOK_URL
- Slack webhook for alerts
- π Multi-network: 14+ blockchain networks supported
- π¦ Docker Ready: Production-ready containerization
- πΎ State Persistence: Resume monitoring after restarts
- π― Smart Filtering: Skip networks with invalid contracts
- π Batch Processing: Configurable batch sizes per network
- π¨ Real-time Alerts: Instant Slack notifications with emojis
- π‘οΈ Robust Error Handling: Comprehensive retry logic and timeouts
- Multi-chain support: Monitor contracts on multiple networks
- KyberSwap integration: Fetches encoded swap data
- Detailed alerts: Comprehensive failure reporting
- Configurable monitoring: Adjustable intervals and parameters
RootSubmitted
Events: Tracks new campaign submissions- Real-time Processing: Immediate event detection and notification
- Batch Optimization: Network-specific batch sizes for efficiency
- Automatic Persistence: Saves last processed block per network
- Crash Recovery: Resumes from last known state after restarts
- No Duplicate Processing: Prevents re-processing old events
- Dynamic Configuration: Load networks from JSON config
- Validation: Skip invalid networks automatically
- Timeout Management: 30s connection, 15s block queries, 30s RPC operations
# Copy environment template
cp docker.env.example .env
# Edit .env with your:
# - Slack token and channel
# - RPC URLs for networks you want to monitor
# Start monitoring
docker-compose up -d
- Security: Non-root user, minimal Alpine image
- Monitoring: Health checks and structured logging
- Persistence: State data survives container restarts
- Resource Management: Memory limits and log rotation
See Docker.md
for complete deployment guide.
- Go 1.24+
- Access to blockchain RPC endpoints (Alchemy, Infura, etc.)
- Slack bot token and channel
# Install dependencies
go mod download
# Build distributor monitor
go build -o distributor-monitor ./cmd/distributor
# Build scale helper monitor
go build -o scale-helper-monitor ./cmd/monitor
# Check distributor configuration
go run scripts/check-distributor-config.go
# Test network connections
go run scripts/test-network-connection.go
# Clear saved state
go run scripts/clear-distributor-state.go
Real-time notifications for new campaign submissions:
π― New Campaign Submitted on π΅ Arbitrum
Campaign ID: 42
Transaction: 0x1234...abcd
Block: 158234567
Gas Used: 125,000
Batch alerts when getScaledInputData
returns false:
- Summary Statistics: Success rates and affected chains
- Detailed Failures: Token pairs, amounts, error details
- Tenderly Links: Simulation results for debugging
Monitors contracts emitting:
event RootSubmitted(uint256 indexed campaignId, bytes32 indexed root);
Expects contracts implementing:
function getScaledInputData(
bytes calldata inputData,
uint256 newAmount
) external view returns (bool isSuccess, bytes memory data);
- Docker Deployment Guide - Complete Docker setup and troubleshooting
- Environment Examples - Configuration templates
- Script Documentation - Debugging and utility scripts
- Fork the repository
- Create a feature branch
- Make your changes
- Test with both local and Docker setups
- Submit a pull request
This project is licensed under the MIT License.