Telegram watcher for the Gnosis Chain Seer registry (0x5aAF9E23A11440F8C1Ad6D2E2e5109C7e52CC672). It polls confirmed blocks, decodes events, and pushes HTML alerts to Telegram with Seer/Curate deep links and the on-chain market name.
- Monitors the Light Generalized TCR registry on Gnosis via JSON-RPC and listens for
NewItem,RequestSubmitted, andDispute. - For submissions, fetches the
_dataIPFS JSON, extracts the market contract address, callsmarketName(), and builds Seer + Curate links. - For disputes, maps the dispute to the original
itemID(via tx/evidence group), optionally resolves the market address through a subgraph, fetchesmarketName(), and posts a “challenged” alert with Curate (and Seer when address is known). - Waits for configurable confirmations and resumes from the last processed block stored in
state.json. - Deduplicates per transaction so each submission triggers one notification; handles Telegram chat migrations automatically.
- Emits rich logging with checksummed addresses for easy cross-referencing in explorers.
- Python 3.10+
- A Telegram bot token issued by @BotFather
- The numeric
chat_id(negative for groups/supergroups, positive for direct chats)
- Clone the repository and open the project directory.
- (Optional) create a virtual environment:
python3 -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Copy the sample environment file and populate it:
Edit
cp .env.example .env
.envwith your bot token and chat id. Keep the chat id updated if Telegram migrates the conversation to a supergroup.
Environment variables are read via python-dotenv:
TELEGRAM_BOT_TOKEN(required) – Bot token from BotFather.TELEGRAM_CHAT_ID(required) – Destination chat or channel id, e.g.YOUR_TELEGRAM_CHAT_ID.SUBGRAPH_URL(required) – GraphQL endpoint (e.g., Envio/Hyperindex) to resolve the market address by itemID when it isn’t available from IPFSGNOSIS_RPC_URL(required)– HTTPS endpoint for Gnosis RPC (defaults tohttps://rpc.gnosischain.com).CONFIRMATIONS– Minimum confirmations to wait before notifying (default3).POLL_INTERVAL– Sleep duration between polling rounds in seconds (default15).BATCH_SIZE– Block span pereth_getLogsrequest (default200).START_BLOCK– Optional starting block; otherwise the script resumes fromstate.json.REGISTRY_ADDRESS– Registry contract to monitor (default points to the Seer registry).EXPLORER_TX_URL– Base URL used for transaction links (default GnosisScan).IPFS_GATEWAY– Gateway base URL used to fetch IPFS metadata (defaulthttps://ipfs.io).IPFS_TIMEOUT– Timeout in seconds for IPFS HTTP fetches (default20).
You can override any variable inline when launching, e.g.:
LOG_LEVEL=DEBUG POLL_INTERVAL=10 python3 bot.pyRun locally:
- (Recommended) create and activate a venv:
python3 -m venv .venv source .venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Configure
.env(copy from.env.example) withTELEGRAM_BOT_TOKEN,TELEGRAM_CHAT_ID, and any overrides (SUBGRAPH_URLis optional for dispute address resolution). - Start the watcher:
python3 bot.py
Logs stream to stdout; state.json is updated with the last processed block so restarts don’t replay beyond the confirmation buffer.
- Notifications are sent for
NewItem,RequestSubmitted, andDispute. Submissions fetch the_dataIPFS JSON, derive the market address for the Seer link, and callmarketName(); Curate always uses the on-chainitemID. - For disputes, the bot maps the dispute to its
itemID(via tx/evidence group), optionally usesSUBGRAPH_URLto recover the market address if not known, then callsmarketName(); if the address cannot be resolved, only the Curate link is sent. - Transaction hashes are deduplicated in-memory per process; restarting clears the seen set.
- The script retries automatically if Telegram migrates the chat id during execution.
- All addresses in logs and messages are rendered in checksum (EIP-55) form for consistency with block explorers.
- Ensure the bot has been started by a user or added to the destination group/channel; otherwise Telegram rejects outbound messages.
- If you rotate the chat id (new group or migration), update
.envbefore restarting the watcher. - For verbose diagnostics, run with
LOG_LEVEL=DEBUG.