Back to Blog

agentes-nativas-ciberseguridad-cumplimiento-normativo-crear-conozca-a-su-cliente-conozca-su-transaccion-con-x402

Phalcon Compliance
November 19, 2025
6 min read

加密合规不再是可选项,而是与链上资产交互的团队的基本要求。面对制裁地址、欺诈交易流、混币器暴露和跨链资金转移等风险,组织必须了解交易对象是谁以及资金如何流动,以确保安全和合规。

与此同时,一个新的参与者正在崛起:AI 代理。这些代理自主分析链上数据、执行交易并做出实时决策。一旦 AI 代理接触到真实资金,就需要与人类同等(甚至更高)级别的保护——将**KYA(了解您的地址)KYT(了解您的交易)**直接内嵌到其决策循环中。

这就引出了一个关键问题:

我们如何以 AI 代理能够真正消费的方式,为其提供合规级别的风险情报?

答案是 X402

为什么 X402 对 AI 原生合规至关重要

X402 是一种轻量级的、互联网原生的支付协议,它将微支付直接嵌入到 HTTP 请求中。当与合规 API(例如地址标签或地址筛查)结合使用时,它将这些 API 转变为对代理友好的、机器可支付的情报服务

在本文中,我们将以 https://x402.blocksec.ai 为例,演示如何构建一个支持 AI、启用了 X402 的“加密 KYA”API。 这种架构代表了代理原生加密合规的未来。

现代加密合规栈

加密合规通常涉及三个层次。使用 BlockSec 的 MetaSleuth(标签 + 轻度筛查)和 Phalcon Compliance(深度风险分析),我们概述了如下栈。

1. 地址标签(KYA)——MetaSleuth

地址标签 API 提供区块链地址的基本归属信息,包括:

  • 实体名称

  • 地址类别(交易所、混币器、欺诈、协议等)

  • 行为元数据

支持 25 多个区块链(以太坊、Solana、比特币、Tron、BNB、EVM 网络),标签构成了**了解您的地址(KYA)**的基础。

了解更多:MetaSleuth API 参考 – https://docs.metasleuth.io/blocksec-aml-api/address-label-api/apis

2. 轻度地址筛查——MetaSleuth

轻度筛查提供快速风险评估,包括:

  • 数值风险得分

  • 风险指标

  • 暴露因素(欺诈、混币器、制裁接近度等)

这对于钱包、桥接器和基本合规要求非常有用。

3. 深度多跳筛查(KYT)——Phalcon Compliance

轻度筛查存在局限性——它只评估直接(1 跳)交互。它无法满足机构的 KYT 要求,因为它:

  • 遗漏多跳资金暴露

  • 无法遵循 FATF 兼容的追踪逻辑

  • 在间接流量分析方面表现不佳

  • 未对跨链转移进行聚合

Phalcon Compliance 填补了这一空白,提供:

  • 多跳资金追踪(KYT)

  • 跨链风险聚合

  • 实体关联

  • FATF 兼容的风险评分

了解更多:https://blocksec.com/phalcon/compliance

这一深度层次对于交易所、托管方、支付处理商和机构合规至关重要。

为什么传统合规 API 对 AI 代理不起作用

尽管具有价值,但当今几乎所有的合规 API 都是为人类和企业平台构建的——而不是为自主代理。它们通常需要:

API 密钥、月度订阅、仪表盘和入职流程、固定使用层级、信用卡账单、长期账户身份

然而,AI 代理:

  • 今天可能调用 1 次,明天调用 300 次

  • 间歇性运行

  • 启动临时实例

  • 只在需要时执行检查

  • 没有“账户”或“账单周期”的概念

传统的合规 API 与 AI 代理根本不兼容。

X402 如何解决这个问题

X402 将每个 HTTP 请求转换为一个独立的、经过加密支付的交易

当代理调用:

GET /screen/deep/tron/{address}

……它会附加一个签名的 X402 支付证明

没有 API 密钥,没有积分,没有订阅,没有仪表盘。

只有按需支付,完美契合代理行为。这就是 X402 成为 AI 代理与加密合规之间原生桥梁的原因。

X402 概述:https://docs.cdp.coinbase.com/x402

构建一个启用了 X402 的 KYA/KYT 端点

下面是一个将标准的 Python FastAPI 端点转换为启用了 X402、可由代理支付的合规 API 的最小示例——与**x402.blocksec.ai** 中使用的模式相同。

1. 设置:获取 API 密钥

您需要一个Coinbase CDP API 密钥 + 密钥,用于验证支付证明。

2. 初始化 X402 中间件

from fastapi import FastAPI
from x402.fastapi.middleware import require_payment
from cdp.x402 import create_facilitator_config

app = FastAPI()

facilitator_config = create_facilitator_config(
    api_key_id=CDP_API_KEY_ID,
    api_key_secret=CDP_API_KEY_SECRET,
)

app.middleware("http")(
    require_payment(
        path="/screen/deep/*",
        price="$1.00",
        pay_to_address=ADDRESS,
        network="base",
        facilitator_config=facilitator_config,
    )
)

注意:像 /screen/deep/* 这样的通配符路径无法区分 /screen/deep/A/screen/deep/B,这可能导致安全问题。使用 x-resource 头部进行严格的资源分离(本博客未涵盖)。

3. 返回结果

async def phalcon_wallet_deep_screening(chain: str, address: str):
    chain_id = resolve_chain_id(chain)
    payload = {
        "chainId": chain_id,
        "address": address,
        "enableReScreening": False,
        "includeDetails": False
    }

    headers = {
        "API-Key": PHALCON_WS_API_KEY,
        "Content-Type": "application/json",
    }
   
async with httpx.AsyncClient(timeout=10) as client:
        resp = await client.post(PHALCON_WS_API_URL, json=payload, headers=headers)
        resp.raise_for_status()
        return resp.json()

4. 添加路由

@app.get("/screen/deep/{chain}/{address}")
async def screen_wallet_deep(chain: str, address: str, request: Request):
    data = await phalcon_wallet_deep_screening(chain, address)
    return data

使用 x402.blocksec.ai 上的实时演示

上述实现已实时部署在: 👉 https://x402.blocksec.ai

此演示包含完全可操作的、机器可支付的 KYA/KYT 端点,并由 BlockSec 的情报提供支持。

可用端点

  • 地址标签 — /label/{chain}/{address}

  • 轻度筛查 — /screen/light/{chain}/{address}

  • 深度筛查 — /screen/deep/{chain}/{address}

深度筛查示例

https://x402.blocksec.ai/screen/deep/tron/TYXqLb9ZyAeJeTFkt3Tx7kNyc3HufjvnMs

您将看到标准的 402 Payment Required 响应——这就是 X402 为代理协商的工作方式。

402 Payment Required
402 Payment Required

使用 X402 兼容的客户端

传统的 HTTP 客户端无法完成请求。 您必须使用:

  • AI 代理

  • 加密钱包

  • Coinbase CDP SDK

  • X402 兼容的运行时

结论:AI 原生加密合规的未来

随着加密货币与自动化日益深度集成,合规情报必须超越仪表盘和基于订阅的平台。AI 代理将越来越多地读取链上数据、路由资金、管理投资组合并与智能合约交互。为了安全地做到这一点,它们必须理解它们正在与谁交互以及它们继承了哪些风险——这是 KYA 和 KYT 的基础。

传统 API 并非为自主软件设计。 X402 通过使合规变得:

  • 机器可支付

  • 无许可

  • 无状态

  • 按请求付费

从而改变了范式。

x402.blocksec.ai 上的实时演示展示了这一新模式——用 X402 包装的合规端点,由 BlockSec 的 MetaSleuth 和 Phalcon Compliance 情报提供支持,无需账户或 API 密钥即可访问。

随着 AI 代理成为金融生态系统中的一等参与者,它们将需要对实时、合规级别的情报进行原生访问。X402 提供了缺失的桥梁:一种简单、互联网原生的方式,供代理在需要时精确获取风险数据。

长期以来为人类设计的加密合规,正在成为代理原生的。这开启了一个新的设计空间,用于构建更安全、更自主的链上系统。

Sign up for the latest updates
The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis
Security Insights

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis

This BlockSec deep-dive analyzes the KelpDAO $290M rsETH cross-chain bridge exploit (April 18, 2026), attributed to the Lazarus Group, tracing a causal chain across three layers: how a single-point DVN dependency enabled the attack, how DeFi composability cascaded the damage through Aave V3 lending markets to freeze WETH liquidity exceeding $6.7B across Ethereum, Arbitrum, Base, Mantle, and Linea, and how the crisis forced decentralized governance to exercise centralized emergency powers. The article examines three parameters that shaped the cascade's severity (LTV, pool depth, and cross-chain deployment count) and provides an exclusive technical breakdown of Arbitrum Security Council's forced state transition, an atomic contract upgrade that moved 30,766 ETH without the holder's signature.

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026

This BlockSec weekly security report covers four DeFi attack incidents detected between April 6 and April 12, 2026, across Linea, BNB Chain, Arbitrum, Optimism, Avalanche, and Base, with total estimated losses of approximately $928.6K. Notable incidents include a $517K approval-related exploit where a user mistakenly approved a permissionless SquidMulticall contract enabling arbitrary external calls, a $193K business logic flaw in the HB token's reward-settlement logic that allowed direct AMM reserve manipulation, a $165.6K exploit in Denaria's perpetual DEX caused by a rounding asymmetry compounded with an unsafe cast, and a $53K access control issue in XBITVault caused by an initialization-dependent check that failed open. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Start Real-Time AML with Phalcon Compliance

Turn Phalcon Network alerts into actions with Phalcon Compliance. Use verified blockchain intelligence to screen wallets, monitor transactions and investigate risks. This helps you respond quickly and stay compliant in the digital assets ecosystem.

Phalcon Compliance