This project provides automated monitoring for Cartesi blockchain events and contract states, with notifications sent to Discord. The monitoring is designed to run both locally and automatically via GitHub Actions.
Features
Event Monitoring: Watches for CommitmentJoined events on the blockchain and detects disputes in tournaments.
Balance Monitoring: Checks if a specified node address has a critically low balance.
Settlement Monitoring: Monitors the canSettle and getCurrentSealedEpoch contract functions to detect when epochs can be settled or if there are issues with claims.
Discord Notifications: Sends alerts to a Discord channel via webhook when important events or issues are detected.
Automated via GitHub Actions: Runs every 5 minutes and can also be triggered manually.
How It Works
1. Blockchain Event Monitoring
The monitor.js script connects to the Sepolia network and listens for CommitmentJoined events.
It tracks claims for each tournament and notifies Discord if multiple claims (disputes) are detected.
It also checks the balance of a specified node address and sends an alert if the balance is below a threshold.
2. Settlement Monitoring
The canSettleMonitor.js script checks the state of the DAVE contract to determine if an epoch can be settled.
It alerts if an epoch has been open for settlement for over an hour or if there are no claims for a new epoch after an hour.
3. Discord Integration
Both scripts use a Discord webhook (provided via environment variable) to send notifications.
Running with GitHub Actions
Monitoring is automated using a GitHub Actions workflow defined in .github/workflows/monitor.yml.
Workflow Details
Schedule: Runs every 5 minutes via cron.
Manual Trigger: Can be started manually via the GitHub Actions UI.
Steps:
Checks out the repository.
Sets up Node.js (version 22).
Installs dependencies with pnpm install.
Runs monitor.js and canSettleMonitor.js with required environment variables.
Commits and pushes any updated data files back to the repository.
Required Secrets (via GitHub Actions)
Set the following secrets in your GitHub repository:
DISCORD_WEBHOOK: Discord webhook URL for notifications.
RPC_URL: Ethereum node RPC URL (e.g., for Sepolia).
GITHUB_TOKEN: (Automatically provided by GitHub Actions).
Cartesi Dave Monitoring
This project provides automated monitoring for Cartesi blockchain events and contract states, with notifications sent to Discord. The monitoring is designed to run both locally and automatically via GitHub Actions.
Features
CommitmentJoinedevents on the blockchain and detects disputes in tournaments.canSettleandgetCurrentSealedEpochcontract functions to detect when epochs can be settled or if there are issues with claims.How It Works
1. Blockchain Event Monitoring
monitor.jsscript connects to the Sepolia network and listens forCommitmentJoinedevents.2. Settlement Monitoring
canSettleMonitor.jsscript checks the state of the DAVE contract to determine if an epoch can be settled.3. Discord Integration
Running with GitHub Actions
Monitoring is automated using a GitHub Actions workflow defined in
.github/workflows/monitor.yml.Workflow Details
pnpm install.monitor.jsandcanSettleMonitor.jswith required environment variables.Required Secrets (via GitHub Actions)
Set the following secrets in your GitHub repository:
DISCORD_WEBHOOK: Discord webhook URL for notifications.RPC_URL: Ethereum node RPC URL (e.g., for Sepolia).GITHUB_TOKEN: (Automatically provided by GitHub Actions).DAVE_CONTRACT_ADDRESS: Used by consensus.Running Locally
DISCORD_WEBHOOKRPC_URLDAVE_CONTRACT_ADDRESS,BATCH_BLOCK,NODE_ADDRESS,MIN_BALANCEDependencies