> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trustgated.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Protocol Guard

> Context-aware trust checks and alerts for lending, governance, and treasury actions. Free for protocols.

## What it is

Protocol Guard is the monitoring surface. You tell it what a wallet is about to do — borrow, vote, hit an API, touch the treasury — and it returns whether that action clears a contextual floor, plus any alerts worth firing.

It does not replace your risk engine. It is one input, with a recommended default threshold per context that you can override.

Live UI: [trustgated.xyz/protocol-guard](https://www.trustgated.xyz/protocol-guard)

Pricing: **free**. Registration exists only to save alert channels and rules. Checks work anonymously without it.

## Check

```text theme={null}
POST https://www.trustgated.xyz/api/protocol-guard/check
```

```json theme={null}
{
  "wallet": "0x...",
  "context": "borrow",
  "amount": 50000,
  "economicReachUsd": 50000,
  "minScore": 60,
  "minConfidence": 50
}
```

`context` is one of: `borrow`, `vote`, `governance_vote`, `dex_swap`, `api_execution`, `treasury_control`, `generic`.

The response includes `allowed`, `walletScore`, `walletTier`, `confidence`, `flags`, a `contextualThreshold`, a `trustSurfaceArea` (`monitor` / `review` / `immediate`), and any `alerts`.

## Recommended defaults

These are **defaults**, not TrustGate policy. Override them per request or per registration.

| Context                    | Suggested floor                           |
| -------------------------- | ----------------------------------------- |
| `dex_swap`                 | Any tier                                  |
| `api_execution`            | MEDIUM+, surface flags                    |
| `borrow`                   | HIGH+ with a confidence floor             |
| `governance_vote` / `vote` | HIGH+; flagged wallets surface for review |
| `treasury_control`         | HIGH\_ELITE                               |
| `generic`                  | LOW+                                      |

## Trust Surface Area

When you pass `economicReachUsd`, `capitalAccess`, and (when relevant) a vote cluster, Guard computes a surface-area number used only to prioritize alerts:

* `monitor` — low potential damage
* `review` — look before the window closes
* `immediate` — low trust × high reach

Higher surface means more potential damage if the actor is adversarial, not "this wallet is guilty."

## Registration and alerts

```text theme={null}
POST /api/protocol-guard/subscribe
GET  /api/protocol-guard/subscriptions
```

Register a `protocolName`, optional `contactEmail`, `channels` (Discord webhook, Telegram, email, onchain event flag), and `rules`:

* `lending_low_trust_borrow`
* `dao_coordinated_vote`
* `wallet_score_floor`
* `token_flag_watch`

A `manageToken` is shown once at create. You need it to GET-by-id or PATCH.

<Warning>
  Subscriptions and alert state are stored in process memory on the current deployment. They do not survive a restart and are not shared across isolates. Fine for pilots. Not a durable billing or paging system.
</Warning>

## Build it

<CardGroup cols={2}>
  <Card title="Protocol Guard integration" icon="bell" href="/integrate/protocol-guard">
    Check body, contexts, registration, and the free-anonymous path.
  </Card>

  <Card title="Gating instead" icon="lock" href="/products/gating">
    If you need a signed attestation, not an alert.
  </Card>
</CardGroup>
