configtx.yaml配置文件解析
YAML语言语法
首先需要了解YAML语言的语法。可以参考<<YAML 语言教程>>
configtx.yaml主要用到了以下语法:
符号 含义
<< 合并到当前数据
- 数组
* 别名
& 锚点
configtx.yaml分析
configtx.yaml文件开头部分,主要配置项如下:
Profiles:
TwoOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
TwoOrgsChannel:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
结构如下:
TwoOrgsOrdererGenesis用来配置创世区块信息,TwoOrgsChannel来配置初始交易信息。
TwoOrgsOrdererGenesis配置项
传入profile参数的值为TwoOrgsOrdererGenesis
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
1
定义两个东西:一个是Orderer,另外一个是Consortiums。
因为生成创世区块需要以下信息:
Orderer信息
联盟信息
对于有一个Orderer,有两个组织Org1和Org2
Orderer配置
配置参数名 含义
OrdererType 类型solo或者kafka
Addresses Orderer地址
BatchTimeout 区块生成超时时间
MaxMessageCount 区块消息数量
AbsoluteMaxBytes 区块绝对最大字节数
PreferredMaxBytes 建议消息字节数。(暂时没有理解该字段,需翻源代码)
Brokers kafka地址
组织配置
配置参数名 含义
Name 组织名称
ID MSP ID
MSPDir msp目录(关于MSP这块后续单独说明)
AnchorPeers 该组织的锚节点
TwoOrgsChannel和TwoOrgsOrdererGenesis差不多,不再说明。
————————————————
版权声明:本文为CSDN博主「thedaydreamer」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/huiyanghu/java/article/details/82590230