> For the complete documentation index, see [llms.txt](https://d3fenders.gitbook.io/d3fenders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://d3fenders.gitbook.io/d3fenders/9.-watchtower-setup-and-troubleshooting.md).

# 9. Watchtower Setup & Troubleshooting

## 🛡️ Watchtower User Guide

### Overview

**Watchtower** is a free, AI-powered Discord bot developed by [D3fenders](https://d3fenders.com/) that scans **Solana and EVM wallets** for signs of compromise.

It’s designed to help users quickly identify if their wallet has interacted with blacklisted addresses, been exposed to drainer activity, or shows patterns consistent with a leaked seed phrase — all directly from Discord.

***

### 🔍 What Watchtower Does

When a user clicks the **Scan Wallet** button, Watchtower:

1. **Identifies the chain** based on the address (Solana or EVM)
2. **Fetches transaction history**
   * Solana: via Helius API
   * EVM: via Polygonscan API
3. **Checks blacklists**
   * Solana: Phantom’s blocklist
   * EVM: MetaMask’s phishing domain blocklist
4. **Uses GPT-3.5 Turbo** to review wallet activity and assign a risk score
5. **Returns a private result** to the user:
   * 🟢 Safe
   * ⚠️ Warning
   * 🔴 Compromised\
     With an explanation and next steps.

***

### 🔄 Ongoing Development

Watchtower is in **active development**.\
We are constantly shipping updates to improve accuracy, performance, and features — including expanded blacklist coverage, new chain support, and deeper behavioral analysis.

What you’re using today will only get better with time.

If you have ideas or feedback, we’re listening.

***

### ⚙️ Setup Guide (For Admins)

To set up Watchtower in your server:

#### 1. Invite the Bot

> Use the invite link provided by D3fenders or host your own instance by deploying the code from our GitHub.

#### 2. Use the `/setupwatchtower` Command

In Discord:

```bash
/setupwatchtower channel_id:<channel_id> role_id:<role_id>
```

* `channel_id`: The channel where the **Scan Wallet** button will appear.
* `role_id`: The Discord role allowed to access the scanner.

🛠️ This command will:

* Store your config
* Post an embed with a **Scan Wallet** button

#### 3. Add Permissions

Make sure the bot has the following:

* Send Messages
* Embed Links
* Use Slash Commands
* Read Messages in the configured channel

***

### 🧪 How to Use (For Users)

Once the bot is set up:

1. Click the **Scan Wallet** button.
2. Enter your Solana or EVM wallet address in the popup.
3. Wait a few seconds for the scan to complete.
4. Receive your private result directly in Discord.

***

### 🧠 Why We Use AI

Watchtower uses OpenAI's GPT-3.5 to analyze transaction patterns in real time. This allows us to go beyond static heuristics and provide context-aware evaluations based on:

* Drainer activity
* Interaction frequency with suspicious contracts
* Unusual gas/token transfers
* Known phishing tactics

***

### 👐 Community Access

Watchtower is free for all communities.\
Why? Because **security is for everyone.**

If you're a mod or project lead and want to bring Watchtower to your server:

👉 Reach out via [d3fenders.com](https://d3fenders.com/)\
or message `@mr_burnz` on Telegram

***

### 🛠️ Developer Notes

Tech Stack:

* `discord.py`
* `discord.app_commands`
* `requests`
* `dotenv`
* `openai`

APIs Used:

* [Helius API](https://www.helius.xyz/)
* [Polygonscan](https://polygonscan.com/apis)
* [OpenAI GPT](https://openai.com/)
* Phantom & MetaMask blocklists

***

Let me know if you'd like a GitBook-ready Markdown file or web-optimized export next.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://d3fenders.gitbook.io/d3fenders/9.-watchtower-setup-and-troubleshooting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
