feat: v1.0.0 祀梦笔记:从 0 到 1 的数字化花园建设
This commit is contained in:
28
docs/notes/ops/blockchain/README.md
Normal file
28
docs/notes/ops/blockchain/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: 区块链运维指南
|
||||
createTime: 2025/09/28 07:54:17
|
||||
permalink: /ops/blockchain/
|
||||
---
|
||||
|
||||
## 区块链简介
|
||||
区块链就像是一本神奇的共享账本哦~它由许许多多的"区块"连接而成,每个区块里都记录着各种交易信息~最特别的是,这本账本不是由某一个人或组织保管的,而是由网络里的所有人一起维护呢~
|
||||
|
||||
想象一下,当有新的交易发生时,网络里的每个人都会收到一份拷贝,大家一起验证这份交易的真实性,然后把它添加到账本里~这样一来,就没有人能够偷偷篡改账本啦~是不是很神奇呢~♪
|
||||
|
||||
区块链还有一个超棒的特点哦~它不需要中间人的帮忙,就能让互不相识的人们安全地进行交易~就像魔法一样,让信任在数字世界里自然生长~
|
||||
|
||||
## 区块链的理论基础
|
||||
|
||||
呜呜~在网上找关于完整区块链原理的资料好难呀,现在就只看到一些比较基础的课程和书籍呢。
|
||||
|
||||
嘿嘿,在B站的话,发现有一个课程超棒哒,就是肖臻老师的[《区块链技术与应用》](https://www.bilibili.com/video/BV1Vt411X7JF/)呢!
|
||||
|
||||
在Youtube上也可以去看看[Binance Academy](https://www.youtube.com/@BinanceAcademy)的视频哟,感觉也很不错哒!
|
||||
|
||||
至于书籍嘛,目前还没找到特别好的,不过没关系,会继续努力找找哒!如果有好的课程的话,可以评论留言分享一下哦~
|
||||
|
||||
## 区块链的运维实践
|
||||
|
||||
嘿嘿~区块链的搭建呀,主要就是通过 [FISCO BCOS](https://fisco-bcos-documentation.readthedocs.io/zh-cn/latest/docs/introduction.html) 来实现哒!
|
||||
|
||||
它呢,是一个开源的、基于Java的区块链平台哟~还支持智能合约的部署和执行呢,超厉害的!
|
||||
70
docs/notes/ops/blockchain/practice/basic-deployment.md
Normal file
70
docs/notes/ops/blockchain/practice/basic-deployment.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
title: 区块链产品设计和基础部署
|
||||
description: 详细介绍区块链产品设计和基础部署
|
||||
createTime: 2025/09/28 20:15:00
|
||||
permalink: /ops/blockchain/practice/basic-deployment/
|
||||
---
|
||||
|
||||
## 区块链产品方案设计
|
||||
|
||||
### 区块链产品需求分析
|
||||
|
||||
区块链产品分析主要是以下几个步骤:
|
||||
|
||||
1. 明确业务需求
|
||||
|
||||
围绕指定业务分析区块链落地解决的痛点,提出围绕业务的功能概述。
|
||||
|
||||
2. 搜集业务相关信息
|
||||
|
||||
针对设计功能,分析收集数据的方向、类型和具体维度
|
||||
|
||||
3. 分析搜集数据
|
||||
|
||||
借助数据分析工具整合收集数据,并能根据收集数据得出初步结论
|
||||
|
||||
能够保证收集数据的准确性和安全性
|
||||
|
||||
4. 确定应用需求
|
||||
|
||||
根据业务需求和收集数据,细化产品具体功能需求
|
||||
|
||||
5. 落地区块链平台
|
||||
|
||||
形成具体平台的设计需求报告
|
||||
|
||||
形成平台验收的准则
|
||||
|
||||
### 区块链平台设计方案
|
||||
|
||||
区块链平台包括:区块链底层平台、智能合约层、业务层、应用层和用户层
|
||||
|
||||

|
||||
|
||||
### 业务功能模块设计
|
||||
|
||||
业务功能模块设计包括三层:功能平台、功能模块、详细功能
|
||||
|
||||

|
||||
|
||||
### 业务流程图
|
||||
|
||||
关于业务流程图的一些常见符号:
|
||||
|
||||

|
||||
|
||||
有一些好用的在线绘制流程图的网站:
|
||||
|
||||
1. [Draw.io](https://app.diagrams.net/)
|
||||
|
||||
### ER 图设计
|
||||
|
||||
E-R 图(实体-关系图)是数据库设计中常用的一种工具,E 是实体,拥有一组属性,R 是关系,用于找到实体之间的联系。
|
||||
|
||||
实体与实体之间的关系,可能是一对一(1:1),一对多(1:n),多对多(m:n)
|
||||
|
||||
实体:通常用矩形表示,代表系统中的一个对象或概念,如"学生","课程","老师"
|
||||
|
||||
属性:通常用椭圆形表示,表示实体的特征,如"学生"的"姓名","班级"
|
||||
|
||||
关系:用菱形表示,用于不同实体间的联系,如"课程"和"学生"之间的"选修"关系
|
||||
59
docs/notes/ops/blockchain/practice/console-operator.md
Normal file
59
docs/notes/ops/blockchain/practice/console-operator.md
Normal 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 控制台啦!
|
||||

|
||||
|
||||
## 常用控制台命令
|
||||
|
||||
这里的区块链的搭建是根据前一篇文章中的多机构多群组多节点的关系
|
||||
|
||||
### 合约相关命令
|
||||
### 其他命令
|
||||
- 查询区块高度:`getBlockNumber`
|
||||
```bash title='output_example'
|
||||
[group:1]> getBlockNumber
|
||||
0
|
||||
```
|
||||
- 查看共识节点列表:`getSealerList`
|
||||
```bash title='output_example'
|
||||
[group:1]> getSealerList
|
||||
[
|
||||
d036a22f16909cba4c8521cd3c31db3be381e673c9749e3fd2848ab25eca134ef917cb9306f41893295c535078bce77bdc241eba3f92549a73efe4699d3c0df8,
|
||||
f0535616759000b473a285d60814bc2c5927a9cb897644da46890de71e59df590cd6fe1b226a95e19a566b6fc127fd85032de0d9fdd3d529e5e50cd96ad51f28
|
||||
]
|
||||
```
|
||||
122
docs/notes/ops/blockchain/practice/node-deployment.md
Normal file
122
docs/notes/ops/blockchain/practice/node-deployment.md
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
title: 区块链网络部署与管理
|
||||
createTime: 2025/10/02 04:13:08
|
||||
permalink: /ops/blockchain/practice/node-deployment/
|
||||
---
|
||||
|
||||
## FISCO BCOS 简介
|
||||
|
||||
嘿呀~FISCO BCOS 可是金链盟开源工作组超用心牵头打造的企业级金融区块链底层平台哟!它就像一个超级厉害的小能手,有着高性能、高可用、安全可控这些超棒的特点呢。还支持多群组架构喔,能轻轻松松满足不同业务场景下的数据隔离和隐私保护需求,简直太赞啦!
|
||||
|
||||
而且呢,FISCO BCOS 还准备了好多丰富的开发工具和组件,就像给开发者们准备了一个魔法百宝箱,帮助大家能快速搭建区块链应用。现在在金融、政务、供应链这些好多好多领域都能看到它活跃的身影,应用可广泛啦!
|
||||
|
||||
## FISCO BCOS 网络部署
|
||||
|
||||
FICSO BCOS 提供了一个 build_chain.sh 来部署区块链,下面的步骤都是通过这个脚本来部署的区块链网络
|
||||
```
|
||||
# 可以通过这个指令下载脚本并赋予执行权限
|
||||
curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.11.0/build_chain.sh && chmod u+x build_chain.sh
|
||||
```
|
||||
|
||||
### 部署单群组4节点联盟链
|
||||
这里要确保机器的30300-30303,20200-20203,8545-8548端口都没有被占用
|
||||
|
||||
```
|
||||
# 部署单群组4节点联盟链
|
||||
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545 -e ./fisco-bcos
|
||||
```
|
||||
|
||||
如果是国密版本,执行下面的命令
|
||||
```
|
||||
# 部署单群组4节点联盟链(国密版本)
|
||||
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545 -g -G -e ./fisco-bcos
|
||||
```
|
||||
|
||||
参数解析:
|
||||
- -l:指定节点的IP地址和节点数
|
||||
- -p:指定节点的端口号
|
||||
- -g 和 -G:使用国密sm算法
|
||||
- -e:使用指定的 fisco-bcos 文件
|
||||
|
||||
默认情况下脚本会去 github 上下载 fisco-bcos 二进制文件,这一步在国内很有可能失败,建议提前下载好,然后直接使用本地的
|
||||
|
||||
部署完成之后就可以启动节点了
|
||||
|
||||
```
|
||||
bash nodes/127.0.0.1/start_all.sh
|
||||
```
|
||||
|
||||
检查节点进程是否存在
|
||||
```
|
||||
ps -ef | grep fisco-bcos
|
||||
```
|
||||
|
||||
检查节点之间是否互相链接了
|
||||
```
|
||||
# 这里是检查 node0 的日志文件
|
||||
tail -f nodes/127.0.0.1/node0/log/log* | grep connected
|
||||
```
|
||||
输出样例如下:
|
||||
```
|
||||
info|2025-10-02 17:06:40.006979|[P2P][Service] heartBeat,connected count=3
|
||||
...
|
||||
```
|
||||
这里可以看到 count=3,说明 node0 已经链接了另外的三个节点
|
||||
|
||||
检查节点之间是否存在共识
|
||||
```
|
||||
# 这里是检查 node0 的日志文件
|
||||
tail -f nodes/127.0.0.1/node0/log/log* | grep +++
|
||||
```
|
||||
输出样例如下:
|
||||
```
|
||||
info|2025-10-02 17:08:29.795822|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=0,hash=5b5f44f4...
|
||||
info|2025-10-02 17:08:33.807504|[g:1][CONSENSUS][SEALER]++++++++++++++++ Generating seal on,blkNum=1,tx=0,nodeIdx=0,hash=50fec464...
|
||||
...
|
||||
```
|
||||
不断输出带有 `++++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...
|
||||
```
|
||||
|
||||
### 部署多机构多群组多节点
|
||||
|
||||
在很多时候,我们需要部署多机构多群组多节点的联盟链,来满足不同业务场景下的需求。
|
||||
|
||||
现在有需求如下:
|
||||
|
||||
|IP|节点数|所属机构|所属群组|P2P端口|Channel端口|RPC端口|
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| 127.0.0.1 | 2 | agencyA | 1,2 | 30300 | 20200 | 8545 |
|
||||
| 127.0.0.2 | 2 | agencyB | 2,3 | 30400 | 20300 | 8645 |
|
||||
| 127.0.0.3 | 2 | agencyC | 3 | 30500 | 20400 | 8745 |
|
||||
| 127.0.0.4 | 2 | agencyD | 4 | 30600 | 20500 | 8845 |
|
||||
|
||||
这种时候建议直接编辑配置文件,参考样例如下:
|
||||
```bash title='ipconf'
|
||||
127.0.0.1:2 agencyA 1,2 30300,20200,8545
|
||||
127.0.0.1:2 agencyB 2,3 30400,20300,8645
|
||||
127.0.0.1:2 agencyC 3 30500,20400,8745
|
||||
127.0.0.1:2 agencyD 4 30600,20500,8845
|
||||
```
|
||||
|
||||
通过配置文件部署多机构多群组多节点联盟链
|
||||
```
|
||||
bash build_chain.sh -f ipconf -p 30300,20200,8545 -e ./fisco-bcos
|
||||
```
|
||||
这里查看一下输出信息,应当如下图所示:
|
||||

|
||||
|
||||
## 参考文章
|
||||
- [搭建第一个区块链网络](https://fisco-bcos-documentation.readthedocs.io/zh-cn/latest/docs/installation.html)
|
||||
- [开发部署工具](https://fisco-bcos-documentation.readthedocs.io/zh-cn/release-2.7.0/docs/manual/build_chain.html)
|
||||
6
docs/notes/ops/blockchain/theory/basic-principles.md
Normal file
6
docs/notes/ops/blockchain/theory/basic-principles.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: 区块链的基本原理
|
||||
createTime: 2025/09/28 12:39:11
|
||||
permalink: /ops/blockchain/theory/basic-principles/
|
||||
---
|
||||
|
||||
342
docs/notes/ops/blockchain/theory/fisco-bcos-node-type.md
Normal file
342
docs/notes/ops/blockchain/theory/fisco-bcos-node-type.md
Normal file
@@ -0,0 +1,342 @@
|
||||
---
|
||||
title: 区块链的节点
|
||||
createTime: 2025/10/05 13:07:05
|
||||
permalink: /ops/blockchain/theory/fisco-bcos-node-type/
|
||||
---
|
||||
|
||||
## 节点的基础概念
|
||||
|
||||
FISCO BCOS 引入了[游离节点、观察者节点和共识节点](https://fisco-bcos-documentation.readthedocs.io/zh-cn/latest/docs/design/security_control/node_management.html#id6),这三种节点类型可以通过控制台互相转换。
|
||||
|
||||
组员:
|
||||
- 共识节点:参与共识的节点,拥有群组的所有数据(搭链时默认都生成共识节点)。
|
||||
- 观察者节点:不参与共识,但能实时同步链上数据的节点。
|
||||
|
||||
非组员:
|
||||
- 游离节点:已启动,等待加入群组的节点。处在一种暂时的节点状态,不能获取链上的数据。
|
||||
|
||||
## 节点配置文件详解
|
||||
|
||||
节点搭建完成之后会有`config.ini`、`conf/group.%group_id.genesis`、`conf/group.%group_id.ini`、`node.nodeid` 等配置文件
|
||||
|
||||
::: code-tabs
|
||||
@tab config.ini
|
||||
```bash
|
||||
# RPC (Remote Proceduce Call 远程过程调用)
|
||||
# 用于配置节点对外提供的 RPC 服务,包括 JSON-RPC ( 用于 Web3.js,控制台等 )和 Channel 通信( 用于 SDK,Java 应用等 )
|
||||
[rpc]
|
||||
# 允许外部访问
|
||||
channel_listen_ip=0.0.0.0
|
||||
channel_listen_port=20200
|
||||
# 只允许内部访问
|
||||
jsonrpc_listen_ip=127.0.0.1
|
||||
jsonrpc_listen_port=8545
|
||||
|
||||
# P2P (Peer-to-Peer 点对点通信)
|
||||
# 用于配置节点之间的 P2P 通信
|
||||
[p2p]
|
||||
listen_ip=0.0.0.0
|
||||
listen_port=30300
|
||||
; nodes to connect
|
||||
node.0=127.0.0.1:30300
|
||||
node.1=127.0.0.1:30301
|
||||
node.2=127.0.0.1:30400
|
||||
node.3=127.0.0.1:30401
|
||||
node.4=127.0.0.1:30500
|
||||
node.5=127.0.0.1:30501
|
||||
node.6=127.0.0.1:30600
|
||||
node.7=127.0.0.1:30601
|
||||
|
||||
# 证书的黑白名单控制
|
||||
[certificate_blacklist]
|
||||
; crl.0 should be nodeid, nodeid's length is 128
|
||||
;crl.0=
|
||||
|
||||
[certificate_whitelist]
|
||||
; cal.0 should be nodeid, nodeid's length is 128
|
||||
;cal.0=
|
||||
|
||||
# 群组的配置目录和数据目录
|
||||
# 启动的时候会自动加载 group_config_path 下的所有群组
|
||||
[group]
|
||||
group_data_path=data/
|
||||
group_config_path=conf/
|
||||
|
||||
# 配置网络安全
|
||||
[network_security]
|
||||
; directory the certificates located in
|
||||
# 网络部分的配置文件目录
|
||||
data_path=conf/
|
||||
; the node private key file
|
||||
# 节点的私钥文件
|
||||
key=node.key
|
||||
; the node certificate file
|
||||
# 节点的证书文件
|
||||
cert=node.crt
|
||||
; the ca certificate file
|
||||
# CA 的证书文件
|
||||
ca_cert=ca.crt
|
||||
|
||||
# 配置加密存储
|
||||
# 用于对接 KMS ,实现落盘数据加密
|
||||
# 具体的可以查看参考文献中的第2篇文章,落盘加密
|
||||
[storage_security]
|
||||
enable=false
|
||||
key_manager_ip=
|
||||
key_manager_port=
|
||||
cipher_data_key=
|
||||
|
||||
# 链的基本信息
|
||||
[chain]
|
||||
# 链的 ID ,不同链ID的节点无法通信
|
||||
id=1
|
||||
; use SM crypto or not, should nerver be changed
|
||||
# 是否启动国密算法,这一步在创建的时候就应该规划好
|
||||
# 一旦设定,不可更改,否则无法和其他节点通信
|
||||
sm_crypto=false
|
||||
# cannel 是否启用国密,需和 SDK 一致
|
||||
sm_crypto_channel=false
|
||||
|
||||
# 兼容性配置
|
||||
[compatibility]
|
||||
; supported_version should nerver be changed
|
||||
# 指定节点兼容的 FISCO BCOS 的版本
|
||||
# 默认值即可,不应手动修改
|
||||
supported_version=2.8.0
|
||||
|
||||
# 日志配置
|
||||
[log]
|
||||
# 启用配置
|
||||
enable=true
|
||||
# 日志配置目录
|
||||
log_path=./log
|
||||
; enable/disable the statistics function
|
||||
# 是否启用统计功能
|
||||
enable_statistic=false
|
||||
; network statistics interval, unit is second, default is 60s
|
||||
# 统计信息刷新间隔(单位:秒)
|
||||
stat_flush_interval=60
|
||||
; info debug trace
|
||||
# 日志级别,可选值(trace < debug < info < warning < error)
|
||||
level=info
|
||||
; MB
|
||||
# 单个日志文件最大大小(单位:MB)
|
||||
max_log_file_size=200
|
||||
# 是否实时刷盘
|
||||
flush=true
|
||||
|
||||
# 流量控制
|
||||
[flow_control]
|
||||
; restrict QPS of the node
|
||||
# 限制 QPS 每秒请求数,防止 DDOS
|
||||
;limit_req=1000
|
||||
; restrict the outgoing bandwidth of the node
|
||||
; Mb, can be a decimal
|
||||
; when the outgoing bandwidth exceeds the limit, the block synchronization operation will not proceed
|
||||
# 限制节点出带宽(单位Mbps)
|
||||
# 超出之后会暂停区块同步,避免网络拥塞
|
||||
;outgoing_bandwidth_limit=2
|
||||
```
|
||||
@tab group.1.genesis
|
||||
```bash
|
||||
# 共识机制配置
|
||||
[consensus]
|
||||
; consensus algorithm now support PBFT(consensus_type=pbft), Raft(consensus_type=raft)
|
||||
; rpbft(consensus_type=rpbft)
|
||||
# 共识算法
|
||||
consensus_type=pbft
|
||||
; the max number of transactions of a block
|
||||
# 每个区块的最大打包量,超出的部分会留在交易池,等待下一次打包
|
||||
max_trans_num=1000
|
||||
; in seconds, block consensus timeout, at least 3s
|
||||
# 共识算法的超时时间
|
||||
consensus_timeout=3
|
||||
; rpbft related configuration
|
||||
; the working sealers num of each consensus epoch
|
||||
# 仅在 rpbft 的时候生效,每轮共识 epoch 中参与打包的共识节点数。
|
||||
epoch_sealer_num=2
|
||||
; the number of generated blocks each epoch
|
||||
# 仅在 rpbft 的时候生效,每轮 epoch 持续的区块数。
|
||||
epoch_block_num=1000
|
||||
; the node id of consensusers
|
||||
# 群组中共识节点的列表
|
||||
node.0=f0535616759000b473a285d60814bc2c5927a9cb897644da46890de71e59df590cd6fe1b226a95e19a566b6fc127fd85032de0d9fdd3d529e5e50cd96ad51f28
|
||||
node.1=d036a22f16909cba4c8521cd3c31db3be381e673c9749e3fd2848ab25eca134ef917cb9306f41893295c535078bce77bdc241eba3f92549a73efe4699d3c0df8
|
||||
|
||||
# 存储区块链的状态信息
|
||||
# 支持 storage state 和 MPT state
|
||||
# storage state 效率高
|
||||
# MPT state 效率低,但是包含完整的历史信息
|
||||
[state]
|
||||
type=storage
|
||||
# transaction (交易)相关配置
|
||||
# gas 是一种计算智能合约执行过程中消耗的计算和存储资源,包括交易的gas的最大值的限制和区块的gas最大值的限制
|
||||
# 如果交易或区块执行消耗的 gas 超过限制,则会丢弃交易区块
|
||||
# FISCO BCOS 是联盟链,简化了 gas 的设计,仅保留交易最大 gas 限制,区块最大 gas 是通过共识配置的
|
||||
[tx]
|
||||
; transaction gas limit
|
||||
gas_limit=300000000
|
||||
# 群组的配置
|
||||
[group]
|
||||
# 群组 ID
|
||||
id=1
|
||||
# 群组的创世区块的时间戳(ms)
|
||||
timestamp=1759397321000
|
||||
|
||||
# 群组的 EVM 配置
|
||||
# 是否开启 free storage
|
||||
# 这里具体的内容,可以查看参考文献中的第4篇文章,【教程】如何修改FISCO-BCOS内的EVM的gas...
|
||||
[evm]
|
||||
enable_free_storage=false
|
||||
```
|
||||
@tab group.1.ini
|
||||
```bash
|
||||
# 共识运行参数(PBFT 优化)
|
||||
[consensus]
|
||||
; the ttl for broadcasting pbft message
|
||||
# PBFT 消息在网络中最多转发 2 跳
|
||||
ttl=2
|
||||
; min block generation time(ms)
|
||||
# 最小出块时间 500ms
|
||||
min_block_generation_time=500
|
||||
# 动态调整区块大小 genesis 中的 max_trans_num
|
||||
enable_dynamic_block_size=true
|
||||
# 优化 TLL 转发逻辑,提升 PBFT 在大规模网络中的效率
|
||||
enable_ttl_optimization=true
|
||||
# Prepare 消息中只包含交易哈希,减少网络传输量
|
||||
# 大幅提示大区块场景下的共识效率
|
||||
enable_prepare_with_txsHash=true
|
||||
; The following is the relevant configuration of rpbft
|
||||
; set true to enable broadcast prepare request by tree
|
||||
# 使用树状拓扑广播 Prepare 广播(而非全网广播)
|
||||
# 适合节点多的场景
|
||||
# 仅在 rpbft 或优化版 PBFT 中有效
|
||||
broadcast_prepare_by_tree=true
|
||||
; percent of nodes that broadcast prepare status to, must be between 25 and 100
|
||||
# 广播 Prepare 状态给33%的节点,必须在 25%~100% 之间
|
||||
prepare_status_broadcast_percent=33
|
||||
; max wait time before request missed transactions, ms, must be between 5ms and 1000ms
|
||||
# 请求缺失交易前,最多等待 100ms(收集更多交易)
|
||||
# 范围 5 ~ 1000ms
|
||||
max_request_missedTxs_waitTime=100
|
||||
; maximum wait time before requesting a prepare, ms, must be between 10ms and 1000ms
|
||||
# 请求缺失 Prepare 消息前,最多等待 100ms
|
||||
# 范围 10ms ~ 1000ms
|
||||
max_request_prepare_waitTime=100
|
||||
|
||||
[storage]
|
||||
; storage db type, rocksdb / mysql / scalable, rocksdb is recommended
|
||||
# 存储引擎
|
||||
# 推荐使用 rocksdb (高性能,嵌入式 KV 数据库)
|
||||
# 支持 mysql ( 不推荐,性能差 ) , scalable (分布式存储,实验性)
|
||||
type=rocksdb
|
||||
; set true to turn on binary log
|
||||
# 开启二进制日志,默认关闭,开启会增加IO
|
||||
binary_log=false
|
||||
; scroll_threshold=scroll_threshold_multiple*1000, only for scalable
|
||||
# 仅在 scalable 存储引擎下生效
|
||||
scroll_threshold_multiple=2
|
||||
; set fasle to disable CachedStorage
|
||||
# 启用缓存层(非常推荐)
|
||||
cached_storage=true
|
||||
; max cache memeory, MB
|
||||
# 缓存最大内容,32MB
|
||||
max_capacity=32
|
||||
# 允许节点最多超前同步10个区块
|
||||
max_forward_block=10
|
||||
; only for external, deprecated in v2.3.0
|
||||
# 最大重试次数,默认 60 次
|
||||
max_retry=60
|
||||
topic=DB
|
||||
; only for mysql
|
||||
db_ip=127.0.0.1
|
||||
db_port=3306
|
||||
db_username=
|
||||
db_passwd=
|
||||
db_name=
|
||||
# 交易池
|
||||
[tx_pool]
|
||||
# 交易池最大容量,默认 150000
|
||||
limit=150000
|
||||
; transaction pool memory size limit, MB
|
||||
# 交易池最大内存占用:512 MB
|
||||
memory_limit=512
|
||||
; number of threads responsible for transaction notification,
|
||||
; default is 2, not recommended for more than 8
|
||||
# 用于通知 SDK 交易上链结果的线程数
|
||||
notify_worker_num=2
|
||||
# 区块同步优化
|
||||
[sync]
|
||||
; max memory size used for block sync, must >= 32MB
|
||||
# 区块同步最大内存:512MB,必须大于等于 32 MB
|
||||
max_block_sync_memory_size=512
|
||||
# 同步空闲时,等待 200ms 再检查新块
|
||||
idle_wait_ms=200
|
||||
; send block status by tree-topology, only supported when use pbft
|
||||
# 使用树状拓扑同步区块
|
||||
# 可以大幅度降低网络带宽
|
||||
# 仅在 PBFT 下支持
|
||||
sync_block_by_tree=true
|
||||
; send transaction by tree-topology, only supported when use pbft
|
||||
; recommend to use when deploy many consensus nodes
|
||||
# 交易广播也使用树状拓扑
|
||||
send_txs_by_tree=true
|
||||
; must between 1000 to 3000
|
||||
; only enabled when sync_by_tree is true
|
||||
# Gossip 协议心跳间隔
|
||||
gossip_interval_ms=1000
|
||||
# 每个节点维护 3 个gossip邻居
|
||||
gossip_peers_number=3
|
||||
; max number of nodes that broadcast txs status to, recommended less than 5
|
||||
# 交易状态最多广播给5个节点
|
||||
txs_max_gossip_peers_num=5
|
||||
|
||||
# 群组级的流量控制
|
||||
[flow_control]
|
||||
; restrict QPS of the group
|
||||
# 限制群组的 QPS 为 1000
|
||||
;limit_req=1000
|
||||
; restrict the outgoing bandwidth of the group
|
||||
; Mb, can be a decimal
|
||||
; when the outgoing bandwidth exceeds the limit, the block synchronization operation will not proceed
|
||||
# 限制群组的出链带宽为 2Mbps/s
|
||||
;outgoing_bandwidth_limit=2
|
||||
|
||||
# SDK 连接白名单
|
||||
[sdk_allowlist]
|
||||
; When sdk_allowlist is empty, all SDKs can connect to this node
|
||||
; when sdk_allowlist is not empty, only the SDK in the allowlist can connect to this node
|
||||
; public_key.0 should be nodeid, nodeid's length is 128
|
||||
;public_key.0=
|
||||
```
|
||||
@tab node.nodeid
|
||||
```bash
|
||||
# 节点的 ID
|
||||
f0535616759000b473a285d60814bc2c5927a9cb897644da46890de71e59df590cd6fe1b226a95e19a566b6fc127fd85032de0d9fdd3d529e5e50cd96ad51f28
|
||||
```
|
||||
:::
|
||||
|
||||
## 节点操作命令
|
||||
|
||||
- `addSealer`:将节点转换为共识节点。
|
||||
- `addObserver`:将节点转换为观察节点。
|
||||
- `removeNode`:将节点设置为游离节点。
|
||||
|
||||
- `getSealerList`:查询当前的共识节点的列表
|
||||
- `getObserverList`:查询当前的观察者节点的列表·
|
||||
- `getNodeList`:查询当前的所有节点的列表
|
||||
|
||||
操作节点的时候是通过节点ID进行操作的,节点ID可以在节点目录的`conf/node.nodeid`中获取
|
||||
|
||||
请确保节点加入的区块链所有节点共识正常:正常的节点会输出`+++`日志
|
||||
|
||||
|
||||
## 参考文章:
|
||||
|
||||
1. [组员节点管理](https://fisco-bcos-documentation.readthedocs.io/zh-cn/latest/docs/manual/node_management.html)
|
||||
|
||||
2. [落盘加密](https://fisco-bcos-documentation.readthedocs.io/zh-cn/latest/docs/design/features/storage_security.html)
|
||||
|
||||
3. [【全网首发】FISCO-BCOS从底层讲起链从配置文件开始解析...](https://blog.csdn.net/LforikQ/article/details/130920092)
|
||||
|
||||
4. [【教程】如何修改FISCO-BCOS内的EVM的gas值,让区块链预防DOS攻击...](https://blog.csdn.net/qq_57309855/article/details/126334115)
|
||||
Reference in New Issue
Block a user