# 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="https://269759277-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoG8PqN7GJCejgjqG74o%2Fuploads%2FqPkWcRh87cVc8Vqlgkn1%2Fcreate-block-monitor.png?alt=media&#x26;token=694c6c1b-17f4-4e45-b317-1b919b6dff41" 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}
```

[了解告警通知模板？](https://docs.chainbot.io/zh/advanced-features/alarm-notification-template)

#### 通知消息示例

> \[ 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-demo](https://docs.chainbot.io/zh/bot-case/block-bot-demo "mention")
