# 区块链监控

### 支持 URL接收回执 与 Telegram bot 通知

<figure><img src="/files/QeiNSXvYV24BLwWvzeir" alt=""><figcaption></figcaption></figure>

您可以通过以下方式接收 CatFee 区块链监控服务的回执通知：

1\. 您可以将您的回调 URL 发送给我们，我们将在区块链数据变化时向您发送通知。

2\. 您可以将您的 Telegram bot 与我们的服务绑定，我们将在区块链数据变化时向您发送通知。

**URL通知：**

当监测到区块链交易（如 USDT、ETH 等币种）的金额变动时，我们会通过您提供的回调 URL 向您推送通知信息。通知内容包含：交易哈希、区块编号、监测地址、付款地址、合约地址、收款地址、交易金额、币种、公链等重要信息。我们采用可靠的重发机制，确保通知送达：

* 首次通知失败后，将按照特定时间间隔重新发送
* **🔔通知规则说明**

  ✅成功接收回调请求后，请返回 success 以通知服务器

  🛑服务器收到 success 后，通知将立即停止

  ⏱️未收到 success 时，将按以下频率发送10次通知：

  0秒 → 15秒 → 30秒 → 3分钟 → 10分钟 → 20分钟 → 30分钟 → 60分钟 → 3小时 → 6小时
* 收到成功响应后立即终止重发

接收方只需返回字符串 'success' 即可确认收到通知，建议异步处理业务逻辑并使用 chain+txn\_hash 作为主键防重。\
\
API 使用示例

**请求方式**

POST {您的回调URL}

**请求参数（JSON）**

```
{
    "txn_hash": "0x1a2b3c4d5e...",  // 交易哈希
    "block_id": 123456789,      // 区块编号
    "name","我的钱包",            // 地址昵称
    "address": "T123456...",   // 监测地址
    "from_address": "T123456...", // 付款地址
    "to_address": "T654321...",  // 收款地址
    "contract_address": "T888888...", // 合约地址
    "amount": 1000000,          // 原始金额
    "decimals": 6,              // 金额精度
    "currency": "USDT",         // 币种
    "chain": "TRON",             // 公链
    "paid_at": 1684789012      // 交易时间戳
  }
```

**响应示例**

```
"success"
```

**Node.js 接收示例**

```
const express = require('express');
  const app = express();
  app.use(express.json());
  
  app.post('/webhook', async (req, res) => {
    try {
      const notification = req.body;
      
      // 使用 chain+txn_hash 作为主键防重
      const key = `${notification.chain}-${notification.txn_hash}`;
      
      // 异步处理业务逻辑
      process.nextTick(() => {
        processNotification(notification);
      });
  
      // 立即返回成功响应
      res.send('success');
    } catch (error) {
      console.error('处理通知失败:', error);
      res.status(500).send('error');
    }
  });
  
  app.listen(3000, () => {
    console.log('Webhook 服务已启动');
  });
```

Telegram bot 通知\
当监测到区块链交易（如 USDT、ETH 等币种）的金额变动时，我们将通过您的 Telegram bot 向您发送通知信息。\
\\

<figure><img src="/files/akp7TQey731tS3srtu33" alt=""><figcaption></figcaption></figure>

#### 使用步骤

1. 1

   **申请机器人**

   * 打开Telegram，搜索并添加[【@BotFather】](https://t.me/BotFather)
   * 输入命令 /newbot 开始创建新机器人
   * 按照提示设置机器人的名称和用户名
   * 记录下生成的机器人token，这是后续绑定的关键
2. 2

   **绑定机器人到Catfee**

   * 登录Catfee.io个人中心，选择机器人设置页面输入机器人的token
   * 点击"绑定"按钮，完成机器人绑定
   * 绑定后同步开通能量售卖机器人，免费使用哦！
3. 3

   **配置机器人接收通知**

   * 将机器人添加到需要接收钱包监控变更消息的会话中
   * 在Catfee.io个人中心中，选择"添加监控钱包"
   * 输入会话ID，确保机器人能正确接收通知
4. 4

   **设置监控参数**

   * 在监控钱包页面，选择需要监听的区块链类型
   * 输入需要监控的钱包地址
   * 选择 \[Telegram bot] 类型，设置需要监听的区块链类型（BTC | ETH | TRON）
   * 设置会话ID，可以选择频道、群组或个人会话

\
**什么是 telegram 会话ID？**

会话ID 是用于标识 Telegram 用户、群组或频道的唯一数字标识符。个人用户的会话ID为正整数（如：8090000000），群组的会话ID为负整数（如：-4980000000）。

**会话ID 获取方法：**

1. 访问 Telegram 机器人：[@CatFeeProBot](https://t.me/CatFeeProBot)
2. 向机器人发送 `"/tools"` 命令
3. 在弹出的工具列表中选择会话ID查询工具
4. 机器人将返回当前会话的ID，例如：
   * 用户ID返回格式：用户ID:8090000000 （其中 8090000000 即为用户会话ID）
   * 群组ID返回格式：群组ID:-4980000000 （其中 -4980000000 即为群组会话ID）

通过以上步骤，您可以轻松实现区块链钱包的实时监控，确保不错过任何重要的余额变动。

区块链地址监控api的帮助教程可以点击这里查阅：<https://catfee.io/zh/blockchain/monitoring/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.catfee.io/getting-started/qu-kuai-lian-jian-kong.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
