@@ -132,15 +132,170 @@ crypto-config
132
132
└── users
133
133
```
134
134
135
+ 签发证书后,我们就可以进行搭建工作了,首先使用` configtxgen ` 工具生成初始创世纪块,生成初始创世纪块依赖于` configtx.yaml ` 模板文件
136
+ ``` bash
137
+ ---
138
+
139
+
140
+ # 省略部分输出
141
+
142
+ Profiles:
143
+ TwoOrgsOrdererGenesis:
144
+ Orderer:
145
+ << : *OrdererDefaults
146
+ Organizations:
147
+ - *OrdererOrg
148
+ Consortiums:
149
+ SampleConsortium:
150
+ Organizations: #定义超级账本中的组织机构信息
151
+ - *Org1
152
+ - *Org2
153
+ TwoOrgsChannel: #定义超级账本中通道的属性信息
154
+ Consortium: SampleConsortium
155
+ Application:
156
+ <<: *ApplicationDefaults
157
+ Organizations:
158
+ - *Org1
159
+ - *Org2
160
+
161
+ ################################################################################
162
+ #
163
+ # Section: Organizations
164
+ #
165
+ ################################################################################
166
+ Organizations:
167
+
168
+ - &OrdererOrg
169
+ Name: Orderer1Org
170
+
171
+ # 定义Orderer节点的MSP名称,请记牢该配置名称后面有很详细的应用
172
+ ID: Orderer1MSP
173
+
174
+ # Orderer节点对应的MSP身份文件夹
175
+ MSPDir: crypto-config/ordererOrganizations/epoint.com.cn/msp
176
+ # 定义组织机构City1的属性
177
+ - &Org1
178
+ Name: city1
179
+
180
+ # City1的组织的MSP名称
181
+ ID: city1MSP
182
+ # 组织机构City1的对应的身份文件夹
183
+ MSPDir: crypto-config/peerOrganizations/city1.epoint.com.cn/msp
184
+ # 定义锚节点的配置信息,定义了哪一个机器以及使用的端口,锚节点负责组织结构内部的信息同步等操作
185
+ AnchorPeers:
186
+ - Host: peer0.city1.epoint.com.cn
187
+ Port: 7051
188
+
189
+ - &Org2
190
+ # DefaultOrg defines the organization which is used in the sampleconfig
191
+ # of the fabric.git development environment
192
+ Name: city2
193
+
194
+ # ID to load the MSP definition as
195
+ ID: city2MSP
196
+
197
+ MSPDir: crypto-config/peerOrganizations/city2.epoint.com.cn/msp
198
+
199
+ AnchorPeers:
200
+ # AnchorPeers defines the location of peers which can be used
201
+ # for cross org gossip communication. Note, this value is only
202
+ # encoded in the genesis block in the Application section context
203
+ - Host: peer0.city2.epoint.com.cn
204
+ Port: 7051
205
+
206
+ ################################################################################
207
+ #
208
+ # SECTION: Orderer
209
+ #
210
+ # - This section defines the values to encode into a config transaction or
211
+ # genesis block for orderer related parameters
212
+ #
213
+ ################################################################################
214
+ Orderer: &OrdererDefaults
215
+
216
+ # Orderer Type: The orderer implementation to start
217
+ # Available types are "solo" and "kafka"
218
+ OrdererType: solo
219
+
220
+ Addresses:
221
+ - orderer1.epoint.com.cn:7050
222
+
223
+ # Batch Timeout: The amount of time to wait before creating a batch
224
+ BatchTimeout: 2s
225
+
226
+ # Batch Size: Controls the number of messages batched into a block
227
+ BatchSize:
228
+
229
+ # Max Message Count: The maximum number of messages to permit in a batch
230
+ MaxMessageCount: 10
231
+
232
+ # Absolute Max Bytes: The absolute maximum number of bytes allowed for
233
+ # the serialized messages in a batch.
234
+ AbsoluteMaxBytes: 99 MB
235
+
236
+ # Preferred Max Bytes: The preferred maximum number of bytes allowed for
237
+ # the serialized messages in a batch. A message larger than the preferred
238
+ # max bytes will result in a batch larger than preferred max bytes.
239
+ PreferredMaxBytes: 512 KB
240
+
241
+ Kafka:
242
+ # Brokers: A list of Kafka brokers to which the orderer connects
243
+ # NOTE: Use IP:port notation
244
+ Brokers:
245
+ - 127.0.0.1:9092
246
+
247
+ # Organizations is the list of orgs which are defined as participants on
248
+ # the orderer side of the network
249
+ Organizations:
250
+
251
+ ################################################################################
252
+ #
253
+ # SECTION: Application
254
+ #
255
+ # - This section defines the values to encode into a config transaction or
256
+ # genesis block for application related parameters
257
+ #
258
+ ################################################################################
259
+ Application: &ApplicationDefaults
260
+
261
+ # Organizations is the list of orgs which are defined as participants on
262
+ # the application side of the network
263
+ Organizations:
135
264
265
+ ` ` `
266
+ 基于以上的配置我们就可以生成超级账本的创世纪块,以及交易通道的配置等等,下面我们就进行创世纪块的创建与配置等操作
136
267
268
+ ` ` ` bash
269
+ # Setup 1 - 生成创世纪块
270
+ Shell> export FABRIC_CFG_PATH=$PWD #配置configtx.yaml所在的目录为配置文件目录
271
+ Shell> configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./genesis.block # 生成创世纪块,genesis.block就是创世纪快
272
+ 2018-04-07 13:47:35.297 CST [common/configtx/tool] main -> INFO 001 Loading configuration
273
+ 2018-04-07 13:47:35.354 CST [common/configtx/tool] doOutputBlock -> INFO 002 Generating genesis block
274
+ 2018-04-07 13:47:35.357 CST [common/configtx/tool] doOutputBlock -> INFO 003 Writing genesis block
275
+
276
+ # Setup 2 - 生成应用通道的交易配置文件,该文件中包含定义的通道属于那些组织结构信息
277
+
278
+ Shell> export CHANNEL_NAME=epointchannel #定义通道的名称
279
+ Shell> configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./$CHANNEL_NAME .tx -channelID $CHANNEL_NAME #生成时应用通道交易配置文件,$CHANNEL_NAME .tx文件就是通道配置文件
280
+ 2018-04-07 13:53:30.353 CST [common/configtx/tool] main -> INFO 001 Loading configuration
281
+ 2018-04-07 13:53:30.363 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
282
+ 2018-04-07 13:53:30.363 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 003 Writing new channel tx
283
+
284
+ # Setup 3 - 生成锚节点更新配置文件,对每一个组织机构都需要生成
285
+ Shell> configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./city1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg city1
286
+ 2018-04-07 13:56:55.112 CST [common/configtx/tool] main -> INFO 001 Loading configuration
287
+ 2018-04-07 13:56:55.121 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
288
+ 2018-04-07 13:56:55.122 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer updateconfigtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./city1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg city1
289
+ 2018-04-07 13:56:55.112 CST [common/configtx/tool] main -> INFO 001 Loading configuration
290
+ 2018-04-07 13:56:55.121 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
291
+ 2018-04-07 13:56:55.122 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
292
+
293
+ Shell> configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./city2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg city2
294
+ 2018-04-07 13:57:20.323 CST [common/configtx/tool] main -> INFO 001 Loading configuration
295
+ 2018-04-07 13:57:20.332 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
296
+ 2018-04-07 13:57:20.332 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
137
297
138
-
139
-
140
-
141
-
142
-
143
-
298
+ ` ` `
144
299
145
300
146
301
0 commit comments