# Block Bot 监控

### Block Bot 监控是什么？

Block Bot 监控用于对目标链区块 Gas 消耗情况的追踪，从而达到对链可能发生情况做预判的目的。

### Block Bot 监控典型场景

1. 区块 Gas Fee 数值监控
2. 区块 Gas 消耗占总区块限制最大比例的监控
3. 监控区块 miner

**支持的数据源**

| 数据源      | 类型       | 稳定性 |
| -------- | -------- | --- |
| Ethereum | on chain | 极高  |

### 如何配置 Block Bot 监控？

登录 ChainBot 平台后，右上角 "Create Bot" -> "Block Monitor"。

<figure><img src="/files/XHEMMvZf3BkCrzazKMJk" alt=""><figcaption><p>Create a Block Bot</p></figcaption></figure>

#### Info 说明

| 字段名   | 说明               | 是否必填 |
| ----- | ---------------- | ---- |
| Name  | Bot 监控名          | 是    |
| Chain | 用户选择的链           | 是    |
| Tags  | Bot 监控 tags，利于搜索 | 是    |

#### Conditions 说明

| 参数             | Symbol           | 说明          |
| -------------- | ---------------- | ----------- |
| Miner          | ==               | 监控特定矿工产出区块  |
| BlockNumber    | >, >=, <, <=, == | 区块高度        |
| BaseFeePerGas  | >, >=, <, <=, == | 区块 Gas Fee  |
| GasUsedPercent | >, >=, <, <=, == | 区块 Gas 消耗占比 |

#### 模板变量说明

| 变量                    | 说明            |
| --------------------- | ------------- |
| $block.number         | 区块高度          |
| $block.baseFeePerGas  | 区块 gas fee    |
| $block.gasUsedPercent | 区块消耗 Gas 的百分比 |
| $block.miner          | 矿工地址          |
| $block.time           | 区块产生时间        |

#### 默认告警模板

```
[{$bot.name}]
View: https://etherscan.io/block/{$block.height}
Time: {$alert.time}
```

[了解告警通知模板？](/zh/advanced-features/alarm-notification-template.md)

#### 通知消息示例

> \[ Ethereum Base Fee monitor ]\
> BaseFee: 10.35 Gwei\
> View: <https://etherscan.io/block/16081313>\
> Time: 2022-11-30T11:28:11+04:00\
> Created By [ChainBot.io](https://www.chainbot.io)

#### Block Bot 监控案例

[Block Bot 案例](/zh/bot-case/block-bot-demo.md)


---

# 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.chainbot.io/zh/basic-usage/bots/block-bot.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.
