github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/docs/source/configtxgen.rst (about) 1 Channel Configuration (configtxgen) 2 =================================== 3 4 This document describe the usage for the ``configtxgen`` utility for 5 manipulating Hyperledger Fabric channel configuration. 6 7 For now, the tool is primarily focused on generating the genesis block 8 for bootstrapping the orderer, but it is intended to be enhanced in the 9 future for generating new channel configurations as well as 10 reconfiguring existing channels. 11 12 Configuration Profiles 13 ---------------------- 14 15 The configuration parameters supplied to the ``configtxgen`` tool are 16 primarily provided by the ``configtx.yaml`` file. This file is located 17 at ``fabric/sampleconfig/configtx.yaml`` in the fabric.git 18 repository. 19 20 This configuration file is split primarily into three pieces. 21 22 1. The ``Profiles`` section. By default, this section includes some 23 sample configurations which can be used for development or testing 24 scenarios, and refer to crypto material present in the fabric.git 25 tree. These profiles can make a good starting point for construction 26 a real deployment profile. The ``configtxgen`` tool allows you to 27 specify the profile it is operating under by passing the ``-profile`` 28 flag. Profiles may explicitly declare all configuration, but usually 29 inherit configuration from the defaults in (3) below. 30 2. The ``Organizations`` section. By default, this section includes a 31 single reference to the sampleconfig MSP definition. For production 32 deployments, the sample organization should be removed, and the MSP 33 definitions of the network members should be referenced and defined 34 instead. Each element in the ``Organizations`` section should be 35 tagged with an anchor label such as ``&orgName`` which will allow the 36 definition to be referenced in the ``Profiles`` sections. 37 3. The default sections. There are default sections for ``Orderer`` and 38 ``Application`` configuration, these include attributes like 39 ``BatchTimeout`` and are generally used as the base inherited values 40 for the profiles. 41 42 This configuration file may be edited, or, individual properties may be 43 overridden by setting environment variables, such as 44 ``CONFIGTX_ORDERER_ORDERERTYPE=kafka``. Note that the ``Profiles`` 45 element and profile name do not need to be specified. 46 47 Bootstrapping the orderer 48 ------------------------- 49 50 After creating a configuration profile as desired, simply invoke 51 52 :: 53 54 configtxgen -profile <profile_name> 55 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. 60 61 Then, to utilize this genesis block, before starting the orderer, simply 62 specify ``ORDERER_GENERAL_GENESISMETHOD=file`` and 63 ``ORDERER_GENERAL_GENESISFILE=$PWD/genesis.block`` or modify the 64 ``orderer.yaml`` file to encode these values. 65 66 Creating a channel 67 ------------------ 68 69 The tool can also output a channel creation tx by executing 70 71 :: 72 73 configtxgen -profile <profile_name> -channelID <channel_name> -outputCreateChannelTx <tx_filename> 74 75 This will output a marshaled ``Envelope`` message which may be sent to 76 broadcast to create a channel. 77 78 Reviewing a configuration 79 ------------------------- 80 81 In addition to creating configuration, the ``configtxgen`` tool is also 82 capable of inspecting configuration. 83 84 It supports inspecting both configuration blocks, and configuration 85 transactions. You may use the inspect flags ``-inspectBlock`` and 86 ``-inspectChannelCreateTx`` respectively with the path to a file to 87 inspect to output a human readable (JSON) representation of the 88 configuration. 89 90 You may even wish to combine the inspection with generation. For 91 example: 92 93 :: 94 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 106 { 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 } 154 }, 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 } 179 }, 180 "EgressPolicyNames": { 181 "Version": "0", 182 "ModPolicy": "", 183 "Value": { 184 "names": [ 185 "AcceptAllPolicy" 186 ] 187 } 188 } 189 }, 190 "Groups": {} 191 }, 192 "/Channel/Application": { 193 "Values": {}, 194 "Groups": {} 195 } 196 } 197 } 198 } 199 } 200 } 201 202 .. Licensed under Creative Commons Attribution 4.0 International License 203 https://creativecommons.org/licenses/by/4.0/