API 文档
实时 WebSocket API,用于监控 Tron 和 Ethereum 网络上的 USDT/USDC 封禁事件。
快速入门
连接到 WebSocket 端点以接收实时封禁事件并查询地址信息。
WebSocket 端点
wss://api.usdtbanlist.com/ws?apiKey=YOUR_API_KEY💡
获取 API 密钥
在 Telegram 中打开 @USDTBanBot,进入个人资料 → API Key 生成您的密钥。
身份验证
在连接 URL 中包含您的 API 密钥,或在连接后发送身份验证消息。
选项1:URL 参数(推荐)
wss://api.usdtbanlist.com/ws?apiKey=mk_your_api_key_here选项2:身份验证消息
{
"type": "auth",
"apiKey": "mk_your_api_key_here"
}连接响应
{
"type": "connected",
"clientId": "client_xxx",
"authenticated": true,
"tier": "free" // or "premium"
}事件
连接并验证身份后,您将收到实时封禁事件。
| 事件类型 | 描述 | 套餐 |
|---|---|---|
ban_submitted | 封禁待多签确认 | 高级版 |
ban_executed | 地址已封禁(已确认) | 免费版 |
unban_submitted | 解封待多签确认 | 高级版 |
unban_executed | 地址已解封 | 免费版 |
destroy_submitted | 资金销毁待多签确认 | 高级版 |
destroy_executed | 已从被封禁地址销毁资金 | 免费版 |
事件消息格式
{
"type": "event",
"event": {
"id": "uuid",
"network": "trx", // "trx" or "eth"
"eventType": "ban_executed",
"address": "41...", // hex format
"addressBase58": "T...", // TRX only
"symbol": "USDT",
"txHash": "...",
"blockNumber": 12345678,
"timestamp": "2024-01-15T12:00:00Z",
"amount": "1234.56", // balance at event time
"amountRaw": "1234560000"
}
}JSON-RPC 方法
发送 JSON-RPC 2.0 请求以查询数据和管理订阅。
ping检查连接健康状态
请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "ping"
}响应
{
"jsonrpc": "2.0",
"id": 1,
"result": "pong"
}getStatus获取当前连接状态和速率限制信息
请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "getStatus"
}响应
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tier": "free",
"subscriptions": ["all"],
"rateLimit": {
"used": 5,
"limit": 10,
"windowMs": 60000
}
}
}subscribe订阅事件频道
请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "subscribe",
"params": {
"channels": ["all"] // "all", "eth", "trx", or address
}
}响应
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"subscribed": ["all"],
"total": 1
}
}unsubscribe取消订阅频道
请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "unsubscribe",
"params": {
"channels": ["eth"] // empty array to unsubscribe all
}
}响应
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"unsubscribed": ["eth"],
"remaining": 1
}
}checkAddress检查地址是否被封禁
请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "checkAddress",
"params": {
"address": "TLJpijVuVyjAtKRahhGTAFkpZxfpzHMtWe"
}
}响应
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"address": "TLJpijVuVyjAtKRahhGTAFkpZxfpzHMtWe",
"network": "trx",
"isBanned": false,
"usdt_status": "active",
"usdc_status": "active",
"usdt_balance": "0.00",
"usdc_balance": "0.00",
"tag": { "type": "GasFree", "tag": "GasFree" },
"events": [{ "event_name": "UnBlock", "volume": "0.00", "symbol": "USDT", "status": "executed" }],
"walletScore": { "totalScore": 45, "riskLevel": "medium" },
"connections": { "totalConnections": 0, "categories": [] },
"formattedText": "..."
}
}getAddressInfo获取地址详细信息
请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "getAddressInfo",
"params": {
"address": "TLJpijVuVyjAtKRahhGTAFkpZxfpzHMtWe",
"network": "trx"
}
}响应
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"address": "TLJpijVuVyjAtKRahhGTAFkpZxfpzHMtWe",
"network": "trx",
"info": {
"label": "Exchange Wallet",
"firstSeen": "2023-01-15T10:00:00Z",
"lastSeen": "2024-01-10T15:30:00Z"
},
"cached": true
}
}速率限制
| 套餐 | RPC 请求 | 事件 |
|---|---|---|
| 免费版 | 10次/分钟 | 仅已执行事件 |
| 高级版 | 100次/分钟 | 所有事件(待处理 + 已执行) |
超过速率限制时,您将收到错误响应:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32000,
"message": "Rate limit exceeded"
}
}示例
JavaScript / Node.js
example.js
const WebSocket = require('ws');
const API_KEY = 'mk_your_api_key';
const ws = new WebSocket(`wss://api.usdtbanlist.com/ws?apiKey=${API_KEY}`);
ws.on('open', () => {
console.log('Connected');
// Subscribe to TRX events
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'subscribe',
params: { channels: ['trx'] }
}));
});
ws.on('message', (data) => {
const msg = JSON.parse(data);
if (msg.type === 'event') {
console.log('Ban event:', msg.event.eventType, msg.event.address);
}
if (msg.jsonrpc) {
console.log('RPC response:', msg);
}
});
ws.on('error', console.error);Python
example.py
import json
import websocket
API_KEY = 'mk_your_api_key'
def on_message(ws, message):
msg = json.loads(message)
if msg.get('type') == 'event':
event = msg['event']
print(f"Ban event: {event['eventType']} - {event['address']}")
if msg.get('type') == 'connected' and msg.get('authenticated'):
# Subscribe to all events
ws.send(json.dumps({
'jsonrpc': '2.0',
'id': 1,
'method': 'subscribe',
'params': {'channels': ['all']}
}))
def on_error(ws, error):
print(f"Error: {error}")
ws = websocket.WebSocketApp(
f"wss://api.usdtbanlist.com/ws?apiKey={API_KEY}",
on_message=on_message,
on_error=on_error
)
ws.run_forever()