Skip to content

Commit 140c45f

Browse files
Jason Yellickmastersingh24
Jason Yellick
authored andcommitted
[FAB-6879] Fix configtxgen inaccuracies in doc
The configtxgen doc states that configtxgen will output a genesis block if no parameters are supplied. This is not true. The example output is also out of date. This CR fixes both of these issues. Change-Id: Ia6fb8cd55ee5d256853667a8e268cff61eadadfd Signed-off-by: Jason Yellick <[email protected]> Signed-off-by: Gari Singh <[email protected]> (cherry picked from commit 0496d91)
1 parent dc3586c commit 140c45f

File tree

1 file changed

+232
-104
lines changed

1 file changed

+232
-104
lines changed

docs/source/configtxgen.rst

+232-104
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,18 @@ After creating a configuration profile as desired, simply invoke
5151

5252
::
5353

54-
configtxgen -profile <profile_name>
54+
configtxgen -profile <profile_name> -outputBlock orderer_genesisblock.pb
5555

56-
This will produce a ``genesis.block`` file in the current directory. You
57-
may optionally specify another filename by passing in the ``-path``
58-
parameter, or, you may skip the writing of the file by passing the
59-
``dryRun`` parameter if you simply wish to test parsing of the file.
56+
This will produce an ``orderer_genesisblock.pb`` file in the current directory.
57+
This genesis block is used to bootstrap the ordering system channel, which the
58+
orderers use to authorize and orchestrate creation of other channels. By
59+
default, the channel ID encoded into the genesis block by ``configtxgen`` will be
60+
``testchainid``. It is recommended that you modify this identifier to something
61+
which will be globally unique.
6062

6163
Then, to utilize this genesis block, before starting the orderer, simply
6264
specify ``ORDERER_GENERAL_GENESISMETHOD=file`` and
63-
``ORDERER_GENERAL_GENESISFILE=$PWD/genesis.block`` or modify the
65+
``ORDERER_GENERAL_GENESISFILE=$PWD/orderer_genesisblock.pb`` or modify the
6466
``orderer.yaml`` file to encode these values.
6567

6668
Creating a channel
@@ -92,111 +94,237 @@ example:
9294

9395
::
9496

95-
$ build/bin/configtxgen -channelID foo -outputBlock foo.block -inspectBlock foo.block
96-
2017/03/01 21:24:24 Loading configuration
97-
2017/03/01 21:24:24 Checking for configtx.yaml at:
98-
2017/03/01 21:24:24 Checking for configtx.yaml at:
99-
2017/03/01 21:24:24 Checking for configtx.yaml at: /home/yellickj/go/src/github.com/hyperledger/fabric/common/configtx/tool
100-
2017/03/01 21:24:24 map[orderer:map[BatchSize:map[MaxMessageCount:10 AbsoluteMaxBytes:99 MB PreferredMaxBytes:512 KB] Kafka:map[Brokers:[127.0.0.1:9092]] Organizations:<nil> OrdererType:solo Addresses:[127.0.0.1:7050] BatchTimeout:10s] application:map[Organizations:<nil>] profiles:map[SampleInsecureSolo:map[Orderer:map[BatchTimeout:10s BatchSize:map[MaxMessageCount:10 AbsoluteMaxBytes:99 MB PreferredMaxBytes:512 KB] Kafka:map[Brokers:[127.0.0.1:9092]] Organizations:<nil> OrdererType:solo Addresses:[127.0.0.1:7050]] Application:map[Organizations:<nil>]] SampleInsecureKafka:map[Orderer:map[Addresses:[127.0.0.1:7050] BatchTimeout:10s BatchSize:map[AbsoluteMaxBytes:99 MB PreferredMaxBytes:512 KB MaxMessageCount:10] Kafka:map[Brokers:[127.0.0.1:9092]] Organizations:<nil> OrdererType:kafka] Application:map[Organizations:<nil>]] SampleSingleMSPSolo:map[Orderer:map[OrdererType:solo Addresses:[127.0.0.1:7050] BatchTimeout:10s BatchSize:map[MaxMessageCount:10 AbsoluteMaxBytes:99 MB PreferredMaxBytes:512 KB] Kafka:map[Brokers:[127.0.0.1:9092]] Organizations:[map[Name:SampleOrg ID:DEFAULT MSPDir:msp BCCSP:map[Default:SW SW:map[Hash:SHA3 Security:256 FileKeyStore:map[KeyStore:<nil>]]] AnchorPeers:[map[Host:127.0.0.1 Port:7051]]]]] Application:map[Organizations:[map[Name:SampleOrg ID:DEFAULT MSPDir:msp BCCSP:map[Default:SW SW:map[Hash:SHA3 Security:256 FileKeyStore:map[KeyStore:<nil>]]] AnchorPeers:[map[Port:7051 Host:127.0.0.1]]]]]]] organizations:[map[Name:SampleOrg ID:DEFAULT MSPDir:msp BCCSP:map[Default:SW SW:map[Hash:SHA3 Security:256 FileKeyStore:map[KeyStore:<nil>]]] AnchorPeers:[map[Host:127.0.0.1 Port:7051]]]]]
101-
2017/03/01 21:24:24 Generating genesis block
102-
2017/03/01 21:24:24 Writing genesis block
103-
2017/03/01 21:24:24 Inspecting block
104-
2017/03/01 21:24:24 Parsing genesis block
105-
Config for channel: foo
97+
$ build/bin/configtxgen -channelID foo -outputBlock foo_genesisblock.pb -inspectBlock foo_genesisblock.pb
98+
2017-11-02 17:56:04.489 EDT [common/tools/configtxgen] main -> INFO 001 Loading configuration
99+
2017-11-02 17:56:04.564 EDT [common/tools/configtxgen] doOutputBlock -> INFO 002 Generating genesis block
100+
2017-11-02 17:56:04.564 EDT [common/tools/configtxgen] doOutputBlock -> INFO 003 Writing genesis block
101+
2017-11-02 17:56:04.564 EDT [common/tools/configtxgen] doInspectBlock -> INFO 004 Inspecting block
102+
2017-11-02 17:56:04.564 EDT [common/tools/configtxgen] doInspectBlock -> INFO 005 Parsing genesis block
106103
{
107-
"": {
108-
"Values": {},
109-
"Groups": {
110-
"/Channel": {
111-
"Values": {
112-
"HashingAlgorithm": {
113-
"Version": "0",
114-
"ModPolicy": "",
115-
"Value": {
116-
"name": "SHA256"
117-
}
118-
},
119-
"BlockDataHashingStructure": {
120-
"Version": "0",
121-
"ModPolicy": "",
122-
"Value": {
123-
"width": 4294967295
124-
}
125-
},
126-
"OrdererAddresses": {
127-
"Version": "0",
128-
"ModPolicy": "",
129-
"Value": {
130-
"addresses": [
131-
"127.0.0.1:7050"
132-
]
133-
}
134-
}
135-
},
136-
"Groups": {
137-
"/Channel/Orderer": {
138-
"Values": {
139-
"ChainCreationPolicyNames": {
140-
"Version": "0",
141-
"ModPolicy": "",
142-
"Value": {
143-
"names": [
144-
"AcceptAllPolicy"
145-
]
146-
}
147-
},
148-
"ConsensusType": {
149-
"Version": "0",
150-
"ModPolicy": "",
151-
"Value": {
152-
"type": "solo"
153-
}
104+
"data": {
105+
"data": [
106+
{
107+
"payload": {
108+
"data": {
109+
"config": {
110+
"channel_group": {
111+
"groups": {
112+
"Consortiums": {
113+
"groups": {
114+
"SampleConsortium": {
115+
"mod_policy": "/Channel/Orderer/Admins",
116+
"values": {
117+
"ChannelCreationPolicy": {
118+
"mod_policy": "/Channel/Orderer/Admins",
119+
"value": {
120+
"type": 3,
121+
"value": {
122+
"rule": "ANY",
123+
"sub_policy": "Admins"
124+
}
154125
},
155-
"BatchSize": {
156-
"Version": "0",
157-
"ModPolicy": "",
158-
"Value": {
159-
"maxMessageCount": 10,
160-
"absoluteMaxBytes": 103809024,
161-
"preferredMaxBytes": 524288
162-
}
163-
},
164-
"BatchTimeout": {
165-
"Version": "0",
166-
"ModPolicy": "",
167-
"Value": {
168-
"timeout": "10s"
169-
}
170-
},
171-
"IngressPolicyNames": {
172-
"Version": "0",
173-
"ModPolicy": "",
174-
"Value": {
175-
"names": [
176-
"AcceptAllPolicy"
177-
]
178-
}
126+
"version": "0"
127+
}
128+
},
129+
"version": "0"
130+
}
131+
},
132+
"mod_policy": "/Channel/Orderer/Admins",
133+
"policies": {
134+
"Admins": {
135+
"mod_policy": "/Channel/Orderer/Admins",
136+
"policy": {
137+
"type": 1,
138+
"value": {
139+
"rule": {
140+
"n_out_of": {
141+
"n": 0
142+
}
179143
},
180-
"EgressPolicyNames": {
181-
"Version": "0",
182-
"ModPolicy": "",
183-
"Value": {
184-
"names": [
185-
"AcceptAllPolicy"
186-
]
187-
}
188-
}
144+
"version": 0
145+
}
189146
},
190-
"Groups": {}
147+
"version": "0"
148+
}
191149
},
192-
"/Channel/Application": {
193-
"Values": {},
194-
"Groups": {}
195-
}
196-
}
150+
"version": "0"
151+
},
152+
"Orderer": {
153+
"mod_policy": "Admins",
154+
"policies": {
155+
"Admins": {
156+
"mod_policy": "Admins",
157+
"policy": {
158+
"type": 3,
159+
"value": {
160+
"rule": "MAJORITY",
161+
"sub_policy": "Admins"
162+
}
163+
},
164+
"version": "0"
165+
},
166+
"BlockValidation": {
167+
"mod_policy": "Admins",
168+
"policy": {
169+
"type": 3,
170+
"value": {
171+
"rule": "ANY",
172+
"sub_policy": "Writers"
173+
}
174+
},
175+
"version": "0"
176+
},
177+
"Readers": {
178+
"mod_policy": "Admins",
179+
"policy": {
180+
"type": 3,
181+
"value": {
182+
"rule": "ANY",
183+
"sub_policy": "Readers"
184+
}
185+
},
186+
"version": "0"
187+
},
188+
"Writers": {
189+
"mod_policy": "Admins",
190+
"policy": {
191+
"type": 3,
192+
"value": {
193+
"rule": "ANY",
194+
"sub_policy": "Writers"
195+
}
196+
},
197+
"version": "0"
198+
}
199+
},
200+
"values": {
201+
"BatchSize": {
202+
"mod_policy": "Admins",
203+
"value": {
204+
"absolute_max_bytes": 10485760,
205+
"max_message_count": 10,
206+
"preferred_max_bytes": 524288
207+
},
208+
"version": "0"
209+
},
210+
"BatchTimeout": {
211+
"mod_policy": "Admins",
212+
"value": {
213+
"timeout": "2s"
214+
},
215+
"version": "0"
216+
},
217+
"ChannelRestrictions": {
218+
"mod_policy": "Admins",
219+
"version": "0"
220+
},
221+
"ConsensusType": {
222+
"mod_policy": "Admins",
223+
"value": {
224+
"type": "solo"
225+
},
226+
"version": "0"
227+
}
228+
},
229+
"version": "0"
230+
}
231+
},
232+
"mod_policy": "Admins",
233+
"policies": {
234+
"Admins": {
235+
"mod_policy": "Admins",
236+
"policy": {
237+
"type": 3,
238+
"value": {
239+
"rule": "MAJORITY",
240+
"sub_policy": "Admins"
241+
}
242+
},
243+
"version": "0"
244+
},
245+
"Readers": {
246+
"mod_policy": "Admins",
247+
"policy": {
248+
"type": 3,
249+
"value": {
250+
"rule": "ANY",
251+
"sub_policy": "Readers"
252+
}
253+
},
254+
"version": "0"
255+
},
256+
"Writers": {
257+
"mod_policy": "Admins",
258+
"policy": {
259+
"type": 3,
260+
"value": {
261+
"rule": "ANY",
262+
"sub_policy": "Writers"
263+
}
264+
},
265+
"version": "0"
266+
}
267+
},
268+
"values": {
269+
"BlockDataHashingStructure": {
270+
"mod_policy": "Admins",
271+
"value": {
272+
"width": 4294967295
273+
},
274+
"version": "0"
275+
},
276+
"HashingAlgorithm": {
277+
"mod_policy": "Admins",
278+
"value": {
279+
"name": "SHA256"
280+
},
281+
"version": "0"
282+
},
283+
"OrdererAddresses": {
284+
"mod_policy": "/Channel/Orderer/Admins",
285+
"value": {
286+
"addresses": [
287+
"127.0.0.1:7050"
288+
]
289+
},
290+
"version": "0"
291+
}
292+
},
293+
"version": "0"
294+
},
295+
"sequence": "0",
296+
"type": 0
297+
}
298+
},
299+
"header": {
300+
"channel_header": {
301+
"channel_id": "foo",
302+
"epoch": "0",
303+
"timestamp": "2017-11-02T21:56:04.000Z",
304+
"tx_id": "6acfe1257c23a4f844cc299cbf53acc7bf8fa8bcf8aae8d049193098fe982eab",
305+
"type": 1,
306+
"version": 1
307+
},
308+
"signature_header": {
309+
"nonce": "eZOKru6jmeiWykBtSDwnkGjyQt69GwuS"
197310
}
311+
}
198312
}
199-
}
313+
}
314+
]
315+
},
316+
"header": {
317+
"data_hash": "/86I/7NScbH/bHcDcYG0/9qTmVPWVoVVfSN8NKMARKI=",
318+
"number": "0"
319+
},
320+
"metadata": {
321+
"metadata": [
322+
"",
323+
"",
324+
"",
325+
""
326+
]
327+
}
200328
}
201329

202330
.. Licensed under Creative Commons Attribution 4.0 International License

0 commit comments

Comments
 (0)