Requirements
To develop the CoW Protocol Watch Tower, you’ll need:node(>= v16.18.0)yarnnpm
Installation
Install project dependencies:Local development workflow
It is recommended to test against the Goerli or Sepolia testnet during development. To run the watch-tower locally:Using the CLI
The watch-tower provides a CLI interface with multiple commands:Available CLI options
--config-path <path>- Path to chain configuration file (default:./config.json)--database-path <path>- Path to the database (default:./database)--log-level <level>- Log level (default:INFO)--dry-run- Do not publish orders to the OrderBook API--one-shot- Run the watch-tower once and exit--disable-api- Disable the REST API--api-port <port>- Port for the REST API (default:8080)--silent- Disable notifications (local logging only)--slack-webhook <url>- Slack webhook URL--only-owner <address...>- Monitor specific contract/safe addresses only
Testing against testnets
When developing, it’s recommended to test against Goerli or Sepolia testnet:- Configure your RPC endpoint in the config file
- Set the appropriate deployment block for the testnet
- Run the watch-tower with your test configuration
Environment variables
All CLI options can also be set via environment variables:LOG_LEVEL- Log levelCONFIG_PATH- Path to configuration fileDATABASE_PATH- Path to databaseDRY_RUN- Dry run modeONE_SHOT- One-shot modeDISABLE_API- Disable API serverAPI_PORT- API server portDISABLE_NOTIFICATIONS- Disable notificationsSLACK_WEBHOOK- Slack webhook URL