X402 Presign Guard

io.github.kaito3636由 GitHub 账号 kaito3636 发布v0.1.1更新于 Oct 25, 2026

Pre-sign EVM tx/approval safety for AI agents: decode calldata, flag drainers, return GO/HOLD/BLOCK.

已验证STDIO仅桌面金融安全与监控

概览

AI 生成的概览

在签名前检查 EVM 交易与代币授权,标记钱包盗空模式并返回 GO、HOLD 或 BLOCK 结论。

可以做什么
  • 签名前检查原始 EVM 交易:解码 calldata,返回 GO/HOLD/BLOCK 及标记项。
  • 检查代币授权:标记无限额度授权以及授权给已知恶意花费者的情形。
  • 识别 setApprovalForAll、无 gas permit、向恶意地址转账等盗空模式,并借助已知可信路由降低误报。
  • 两个工具均转发到托管的 guard 服务,而非在本地解码。
适用场景
适合准备 EVM 交易或授权的智能体与用户,在签名前获得安全性判断,尤其适用于处理陌生合约和花费者的交易或钱包智能体。
运行要求
通过 npm 包 x402-presign-guard 以 npx 在本地运行,并把请求转发到托管的 guard 端点(GUARD_URL,默认为项目线上地址),因此需要能访问该服务的网络。未声明任何 API 密钥或环境变量。
安装前请注意
结论仅供参考,且来自会收到所提交交易详情的第三方托管服务,不能替代模拟执行或自行审查。README 说明存在以 USDC 结算的付费 x402 端点,部分检查可能涉及花费资金,且该托管服务为匿名自托管钱包模式。

安装

在 SourceWeft 中

  1. 打开 控制台中的 X402 Presign Guard,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

x402-presign-guard

"Should I sign this?" — a pay-per-call pre-sign safety layer for AI trading/wallet agents. An agent POSTs a raw EVM transaction (or an approval) before signing; this decodes the calldata, flags the patterns that drain wallets, and returns GO / HOLD / BLOCK. Settles in USDC via x402 to a self-custody (pseudonymous) wallet.

Why this axis (the honest frame)

10-angle research (2026) on the x402 / agent-payment economy concluded:

  • Real x402 demand is tiny and hyper-concentrated (~$28K/day real commerce; the all-time #1 data seller ≈ $940/mo). Flat/commodity APIs — dates, OCR, raw chain reads — earn ≈ $0. (Confirms why the earlier x402-jp-data fleet made nothing.)
  • The only categories with real crypto-native willingness-to-pay: computed risk/safety verdicts a trading agent must get before it signs — and first-party MEASURED data you generate yourself (no scraping ToS / copyright, un-backfillable time-series).
  • This project is both: a computed pre-sign verdict (not a commodity score card), backed by an accumulating malicious-signature set — the moat that gets bigger the longer it runs.

Honest expectation: $1,000/mo is NOT achievable passively on x402 rails in 2026 — it's above the current top seller. The realistic path is distribution: ship this as an MCP tool that lands in agents' default toolsets (dual-rail: x402 pay-per-call + flat MCP key). x402 is the on-ramp; the MCP install base is the demand. The POC proves the mechanism and starts the compounding asset now.

What it does (POC — pure code, no keys, no RPC)

src/decode.ts statically decodes calldata and catches the real drain vectors:

  • unlimited approve / increaseAllowance to an unknown or known-malicious spender
  • setApprovalForAll(true) (classic NFT drainer) to unknown / malicious operators
  • gasless permit / Permit2 approvals (common drainer vector)
  • transfer / transferFrom to known-malicious recipients
  • calls to known-malicious contracts; unknown selectors flagged "simulate before signing" Known-good routers (Uniswap/Permit2/1inch/Seaport) reduce false positives.

Endpoints

pathpricewhat
GET /guard/token?token=&chain=0.05 USDCpre-TRADE ERC-20 safety for trading agents: malicious-DB + on-chain rug/honeypot red-flags (owner controls, mint/pause/blacklist, renounced?)
GET /guard/tx?to=&data=&value=&chain=0.05 USDCfull pre-sign risk check → GO/HOLD/BLOCK + flags
GET /guard/approval?token=&spender=&amount=freeapproval-specific (unlimited + malicious-spender) — free adoption tier
GET /guard/signaturesfreesize of the accumulating signature set (the moat)
GET /, GET /.well-known/x402freedocs + Bazaar discovery

Live (2026-10-24)

Running in production, paid mode on: https://x402-presign-guard.vercel.app

bash
curl https://x402-presign-guard.vercel.app/.well-known/x402            # discovery (free)curl "https://x402-presign-guard.vercel.app/guard/tx?to=0x..."         # 402 + payment requirements

A 402 returns the x402 v1 payment requirements (scheme exact, network base, USDC); an x402-capable client pays and retries. Implemented + tested: 25/25 PASS (decode 19 + app 6), tsc clean. Runs on both Cloudflare Workers and Vercel from one codebase.

Use it as an MCP server

Point any MCP client (Claude Desktop, agent frameworks) at the hosted guard — no install build, no npm account needed:

json
{  "mcpServers": {    "presign-guard": {      "command": "npx",      "args": ["-y", "x402-presign-guard"]    }  }}

Published on npm: x402-presign-guard (or run straight from source: npx -y github:kaito3636/x402-presign-guard). Exposes two tools — presign_guard_tx and presign_guard_approval — that forward to the hosted guard (GUARD_URL, default the live URL above). The agent calls the guard before it signs.

The compounding engine (v2, wired but off)

wrangler.toml has a commented cron + KV: a scheduled job ingests malicious selectors/addresses from live threat feeds + own honeypot probes, timestamped — so the signature set and the never-backfillable time-series grow every day. That daily accrual is the "掘るほど美味い" asset.

Deploy your own

Vercel (how the live one runs):

bash
npm installnpx vercel deploy --prod                       # free mode firstnpx vercel env add PAY_TO production            # Base self-custody wallet 0x… → go paidnpx vercel deploy --prod

Cloudflare Workers (alternative; same code):

bash
npx wrangler login && npx wrangler deploynpx wrangler secret put PAY_TO && npx wrangler deploy

Distribution (the real lever)

MCP server (this repo, npx github:…) → Official MCP Registry / mcp.so; x402 Bazaar discovery needs a facilitator that implements /discovery/resources (e.g. Coinbase CDP — set FACILITATOR_URL + CDP keys); list on x402scan. The hosted endpoint already serves /.well-known/x402 for crawlers.

来源:README.md,提交 356a459

工具

2

presign_guard_tx

Check whether an EVM transaction is safe to sign BEFORE signing it. Decodes the calldata, flags wallet-drainer patterns (unlimited approvals, setApprovalForAll, gasless permits, transfers/approvals to known-malicious addresses) and returns a GO / HOLD / BLOCK verdict.

输入参数todatachainvalue

presign_guard_approval

Check whether a token approval is safe to sign. Flags unlimited allowances and approvals to known-malicious spenders. Returns GO / HOLD / BLOCK.

输入参数chaintoken必填amountspender必填

版本历史

1
  1. v0.1.1最新Oct 25, 2026

评分

已满足适用检查项的 80%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。