Cosmos Watchdog is a tool that allows you to synchronize all transactions of different types for a given validator and receive notifications on a Discord Channel when new transactions are seen.
For now only the osmosis blockchain is supported
To install Cosmos Watchdog, clone the repository and install the dependencies with Pipenv:
git clone https://github.com/astroquirks/cosmos-watchdog.git
cd cosmos-watchdog
pipenv install
Cosmos Watchdog provides a command-line interface (CLI) to interact with the tool. Here are the available commands:
To synchronize transactions related to a given validator, use the following command: The address argument specifies the validator address, and the optional tx-type argument(s) specify the type(s) of transactions to synchronize (e.g., REDELEGATE, DELEGATE, RESTAKE, UNDELEGATE, UNREDELEGATE). If no tx-type is specified, all transaction types will be synchronized.
Usage: pipenv run synchronize [OPTIONS] ADDRESS
Options:
-t, --tx-type [restake|delegate|undelegate|redelegate|unredelegate]
Transaction type(s) to synchronize
If not set, all transactions types
will be synchronized
--notify To notify upon new transactions
--help Show this message and exit.
To delete transactions related to a given validator, use the following command:
Usage: pipenv run wipe [OPTIONS]
Options:
-t, --tx-type [restake|delegate|undelegate|redelegate|unredelegate]
Transaction type(s) to wipe.
If not set, all transactions types
will be wiped
--from-offset INTEGER Wipe all transactions from offset
--help Show this message and exit.
To send a notification for a given transaction ID
Usage: pipenv run notify [OPTIONS]
Options:
-t, --tx-id INTEGER Transaction id to create a notification for
--help Show this message and exit.
You can configure Cosmos Watchdog using environment variables. Here are the available variables:
SYNCHRONIZER_VALIDATOR_ADDRESS: The validator address to synchronize transactions from.
SYNCHRONIZER_FREQUENCY: The synchronization frequency in seconds.
SYNCHRONIZER_NOTIFY: The synchronization frequency in seconds.
DB_SCHEMA,DB_USER, DB_HOST, DB_PORT, and DB_PASSWORD: The database connection parameters.
BOT_FREQUENCY: The notification frequency in seconds.
BOT_TOKEN: The auth token of your bot
BOT_CHANNEL_ID: The ID of the Discord channel
# config is taken from config.yaml file
pipenv run start-synchronizer
docker run -e SYNCHRONIZER_VALIDATOR_ADDRESS=<SYNCHRONIZER_VALIDATOR_ADDRESS> -e SYNCHRONIZER_FREQUENCY=<SYNCHRONIZER_FREQUENCY> -e SYNCHRONIZER_NOTIFY=<SYNCHRONIZER_NOTIFY> ghcr.io/astroquirkshq/cosmos-watchdog:<IMAGETAG>-sync
# config is taken from config.yaml file
pipenv run bot
docker run -e BOT_TOKEN=<BOT_TOKEN> -e BOT_CHANNEL_ID=<CHANNEL_ID> -e BOT_FREQUENCY=<BOT_FREQUENCY> ghcr.io/astroquirkshq/cosmos-watchdog:<IMAGETAG>-bot
# config is taken from config.yaml file
pipenv run server
docker run -e API_HOST=<API_HOST> -e API_PORT=<API_PORT> ghcr.io/astroquirkshq/cosmos-watchdog:<IMAGETAG>-api
To run the tests, use the following command:
pipenv run tests
To run the linter, use the following command:
pipenv run lint
- test with stargaze
- add docker-compose
- add db migration support
- add missing unit tests
- add NOTIFY_ON_INITIAL_SYNC env variable option
- find a smart way to handle restake for all kind of tx type
- find a way to group restake notifications
- add integration tests synchronizer
- add missing unit tests
- add multi-currency support
- support wipe-notification
- support validator name
- add integration tests discord bot
- add missing unit tests
- Expose discord command to :
- get balance
- get list of delegators
- get stats of my validator
- balance
- nb delegators
- get my history
- Expose delegation history through api endpoint by delegator
- Expose delegation history through api endpoint by validator