OrdererOrgs: - Name: Orderer Domain: example.com Specs: - Hostname: orderer PeerOrgs: - Name: Org1 Domain: org1.example.com EnableNodeOUs: true Template: Count: 2 Users: Count: 1 - Name: Org2 Domain: org2.example.com EnableNodeOUs: true Template: Count: 2 Users: Count: 1 #example.com orderer的顶级域名 映射到IP:xxx.xxx.xx.xx #org1.example.com 联盟的顶级域名 #Template.Count 2 表示该联盟下有两个节点,默认两个子节点的名字分别为peer0,peer1,多个节点名字依次顺延 #Users.Count 1 表示每一个组织下有一个用户,默认用户名为User0,多个用户名字依次顺延。此外,还会有一个Admin帐户
./cryptogen generate --config=crypto-config.yaml --output crypto-config
执行以上命令,生成证书文件到crypto-config
文件夹,以下:网络
configtx.yaml主要用到了如下语法:spa
Profiles: TwoOrgsOrdererGenesis: Capabilities: <<: *ChannelCapabilities Orderer: <<: *OrdererDefaults Organizations: - *OrdererOrg Capabilities: <<: *OrdererCapabilities Consortiums: SampleConsortium: Organizations: - *Org1 - *Org2 TwoOrgsChannel: Consortium: SampleConsortium Application: <<: *ApplicationDefaults Organizations: - *Org1 - *Org2 Capabilities: <<: *ApplicationCapabilities Organizations: - &OrdererOrg Name: OrdererOrg ID: OrdererMSP MSPDir: crypto-config/ordererOrganizations/example.com/msp - &Org1 Name: Org1MSP ID: Org1MSP MSPDir: crypto-config/peerOrganizations/org1.example.com/msp AnchorPeers: - Host: peer0.org1.example.com Port: 7051 - &Org2 Name: Org2MSP ID: Org2MSP MSPDir: crypto-config/peerOrganizations/org2.example.com/msp AnchorPeers: - Host: peer0.org2.example.com Port: 7051 Orderer: &OrdererDefaults OrdererType: solo Addresses: - orderer.example.com:7050 BatchTimeout: 2s BatchSize: MaxMessageCount: 10 AbsoluteMaxBytes: 99 MB PreferredMaxBytes: 512 KB Kafka: Brokers: - 127.0.0.1:9092 Organizations: Application: &ApplicationDefaults Organizations: Capabilities: Global: &ChannelCapabilities V1_1: true Orderer: &OrdererCapabilities V1_1: true Application: &ApplicationCapabilities V1_1: true #TwoOrgsOrdererGenesis.Orderer: 在创始区块保存orderer配置信息 使用solo模式,区块的域名是orderer.example.com:7050, # 区块生成超时时间2s,区块消息最大数量10,区块绝对最大字节数99MB,PreferredMaxBytes不用管。 #TwoOrgsOrdererGenesis.Orderer.Organizations: 在创始区块保存Orderer证书配置信息 MSPDir是成员管理服务的目录。 #TwoOrgsOrdererGenesis.Consortiums.SampleConsortium.Organizations: 在创始区块保存联盟证书配置信息 MSPDir是成员管理服务的目录 # 指定锚节点的域名是peer0.org1.example.com,端口是7051。org2同理。 #TwoOrgsOrdererGenesis.Capabilities: ChannelCapabilities ChannelCapabilities段定义了全局fabric程序要加入网络所必须支持的特性,V1_1表示 # fabric程序至少要知足V1_1版本特性,不知足该能力要求的fabric程序,将没法处理交易,除非升级到新的版本。 #TwoOrgsOrdererGenesis.Orderer.Capabilities: OrdererCapabilities OrdererCapabilities 仅应用于排序节点,要加入排序联盟所必须支持的特性,V1_1表示 # Orderer程序至少要知足V1_1版本特性。 #TwoOrgsChannel.Application.Capabilities.ApplicationCapabilities Application配置仅应用于对等网络,不需考虑排序节点的升级。将该配置项 # 设置为true代表要求对等节点具有该能力
执行3d
./configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
能够看到channel-artifacts
文件夹下生成了创始区块genesis.block
code
channel.tx
的获取?blog