更新文章

This commit is contained in:
2025-10-05 17:35:32 +08:00
parent 5984402fb2
commit ba6702c880
4 changed files with 418 additions and 2 deletions

View File

@@ -0,0 +1,59 @@
---
title: Console 控制台操作
createTime: 2025/10/03 02:55:49
permalink: /ops/blockchain/practice/console-operator/
---
## Console 控制台是什么?
Console 是 FISCO BCOS 官方提供的一个交互式命令行工具,用于直接与区块链节点交互。
主要功能包括:
- 查询区块链状态(如区块链高度、节点列表、群组信息)
- 部署和调用智能合约(支持 Solidity
- 管理节点(如查看节点共识状态、动态添加节点)
- 调试交易和查看回执
## 部署 Console 控制台
获取下载脚本:`wget https://gitee.com/FISCO-BCOS/console/releases/download/v2.8.0/console.tar.gz`
解压控制台安装包:`tar -zxf console.tar.gz console/`
复制配置文件:`cp conf/config-example.toml conf/config.toml`
编辑配置文件:`vim conf/config.toml`
```bash
# enSslKey = "conf/gm/gmensdk.key" # GM ssl cert file path
# default load the GM SSL encryption privateKey from ${certPath}/gm/gmensdk.key
[network]
# 请确保这里的连接地址都有节点
peers=["127.0.0.1:20200", "127.0.0.1:20201"] # The peer list to connect [!code warning]
# Configure a private topic as a topic message sender.
```
复制节点证书到 Console 的配置目录下
```bash
cp -r ../nodes/127.0.0.1/sdk/* conf/
```
通过 `bash start.sh` 就可以启动 Console 控制台啦!
![启动Console控制台](https://image.simengweb.com/notes/ops/blockchain/practice/console-operator/2025-10-03-161500.png)
## 常用控制台命令
这里的区块链的搭建是根据前一篇文章中的多机构多群组多节点的关系
### 合约相关命令
### 其他命令
- 查询区块高度:`getBlockNumber`
```bash title='output_example'
[group:1]> getBlockNumber
0
```
- 查看共识节点列表:`getSealerList`
```bash title='output_example'
[group:1]> getSealerList
[
d036a22f16909cba4c8521cd3c31db3be381e673c9749e3fd2848ab25eca134ef917cb9306f41893295c535078bce77bdc241eba3f92549a73efe4699d3c0df8,
f0535616759000b473a285d60814bc2c5927a9cb897644da46890de71e59df590cd6fe1b226a95e19a566b6fc127fd85032de0d9fdd3d529e5e50cd96ad51f28
]
```

View File

@@ -76,6 +76,19 @@ info|2025-10-02 17:08:33.807504|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generat
```
不断输出带有 `++++Generating seal` 的日志,说明共识正常
检查群组之间的共识
```bash
tail -f nodes/127.0.0.1/node0/log/log* | grep 'g:1.*+++'
```
输出样例如下:
```bash
info|2025-10-02 17:59:59.194525|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=fdb2da54...
info|2025-10-02 18:59:59.225102|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=b7d87997...
info|2025-10-02 19:59:59.327677|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=38dea43f...
info|2025-10-02 20:59:59.462059|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=cb0e89fa...
info|2025-10-02 21:59:59.284218|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=1,hash=721e8904...
```
### 部署多机构多群组多节点
在很多时候,我们需要部署多机构多群组多节点的联盟链,来满足不同业务场景下的需求。