$ npm i okx-watchtower-middleware

Pre-Execution Security for Autonomous Trading Agents.

WatchTower is an API-native intelligence oracle. We run low-latency, multi-layer threat scans to block honeypots and malicious contracts before your agent signs the transaction.

A security gate your agent can enforce before execution.

No dashboards in the execution path. WatchTower pairs a machine-readable verdict with a self-hosted x402-style payment boundary, so agents can acquire threat intelligence per scan on X Layer Mainnet.

Synchronous API

Fast request-response checks for automated trading and risk agents.

Native MCP Server

Expose the same threat intelligence to MCP-compatible agent runtimes through one protected tool surface.

agent.ts
import { WatchTowerClient } from 'okx-watchtower-middleware';

// Pin automatic settlement to your X Layer Mainnet policy
const wt = new WatchTowerClient({
  apiUrl: 'https://watchtower.xyz',
  agentWallet: '0xYourAgent...',
  chainId: 196,
  paymentPrivateKey: process.env.AGENT_PAYMENT_KEY,
  paymentPolicy: {
    apiOrigin: 'https://watchtower.xyz',
    chainId: 196,
    tokenAddress: process.env.MAINNET_USDT_ADDRESS,
    treasuryAddress: process.env.MAINNET_TREASURY_ADDRESS,
    maxAmount: '1',
  }, 
});

async function executeTrade(targetToken) {
  // 1. Run the Firewall Scan (Costs 0.5 USDT via L402)
  const intel = await wt.guardTransaction(targetToken);

  // 2. Enforce strict safety thresholds
  if (intel.recommendation === 'ABORT') {
    console.log(`Trade blocked. Score: ${intel.threatScore}`);
    return;
  }

  // 3. Safe to execute
  await router.swap(targetToken);
}
1. Agent Intent
{
"action": "swap",
"target": "0x123..."
}
WatchTower Oracle
4 Threat Modules
3. Verdict Payload
{
"recommendation": "ABORT",
"score": 92,
"reason": "Hidden Mint"
}

Multi-Layered Threat Detection

Our engine runs four parallel analysis modules to build a comprehensive risk profile of any ERC-20 token in under a second.

Liquidity Intelligence

liquidity_usd: "low"
volume_24h: "thin"
pair_age: "new"

Contract DNA Scanner

is_honeypot: false
has_hidden_mint: true
can_take_back_ownership: true

Whale & Holder Analysis

top_10_holder_concentration: "85.4%"
creator_wallet_balance: "0.00"
is_supply_centralized: true

Social Threat Radar

social_links: "missing"
buy_sell_ratio: "skewed"
price_change_24h: "volatile"

Cryptographic Proof for Every Decision.

When your agent blocks a trade or executes a risky swap, your users will ask why. WatchTower's Deep Scans automatically generate an immutable scanHash on X Layer. Serve these cryptographic receipts to your users to prove your agent acted on verifiable threat intelligence.

API Pricing for Autonomous Scale

WatchTower uses self-hosted x402-style machine-to-machine payments. Pay purely for what your agents consume. No subscriptions.

X Layer Mainnet-ready: payment policy, settlement verification, and attestation are network-configured.

Tier 2: Firewall

0.5 USDT / scan
  • Instant cache-based threat score (0-100)
  • Recommendation (TRADE/CAUTION/ABORT)
  • Perfect for high-frequency trading bots
Popular

Tier 1: Deep Scan

1.0 USDT / scan
  • Includes everything in Firewall
  • Full pre-execution threat report
  • Generates a verifiable scanHash
  • Full detailed 4-module JSON payload
  • On-chain Smart Contract Attestation