github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/docs/source/commands/configtxgen.md (about) 1 <!--- 2 File generated by help_docs.sh. DO NOT EDIT. 3 Please make changes to preamble and postscript wrappers as appropriate. 4 ---> 5 6 # configtxgen 7 8 The `configtxgen` command allows users to create and inspect channel config 9 related artifacts. The content of the generated artifacts is dictated by the 10 contents of `configtx.yaml`. 11 12 ## Syntax 13 14 The `configtxgen` tool has no sub-commands, but supports flags which can be set 15 to accomplish a number of tasks. 16 17 ## configtxgen 18 ``` 19 Usage of configtxgen: 20 -asOrg string 21 Performs the config generation as a particular organization (by name), only including values in the write set that org (likely) has privilege to set 22 -channelCreateTxBaseProfile string 23 Specifies a profile to consider as the orderer system channel current state to allow modification of non-application parameters during channel create tx generation. Only valid in conjunction with 'outputCreateChannelTx'. 24 -channelID string 25 The channel ID to use in the configtx 26 -configPath string 27 The path containing the configuration to use (if set) 28 -inspectBlock string 29 Prints the configuration contained in the block at the specified path 30 -inspectChannelCreateTx string 31 Prints the configuration contained in the transaction at the specified path 32 -outputAnchorPeersUpdate string 33 [DEPRECATED] Creates a config update to update an anchor peer (works only with the default channel creation, and only for the first update) 34 -outputBlock string 35 The path to write the genesis block to (if set) 36 -outputCreateChannelTx string 37 The path to write a channel creation configtx to (if set) 38 -printOrg string 39 Prints the definition of an organization as JSON. (useful for adding an org to a channel manually) 40 -profile string 41 The profile from configtx.yaml to use for generation. 42 -version 43 Show version information 44 ``` 45 46 ## Usage 47 48 ### Output a genesis block 49 50 Write a genesis block to `genesis_block.pb` for channel `orderer-system-channel` 51 for profile `SampleSingleMSPRaftV1_1`. 52 53 ``` 54 configtxgen -outputBlock genesis_block.pb -profile SampleSingleMSPRaftV1_1 -channelID orderer-system-channel 55 ``` 56 57 ### Output a channel creation tx 58 59 Write a channel creation transaction to `create_chan_tx.pb` for profile 60 `SampleSingleMSPChannelV1_1`. 61 62 ``` 63 configtxgen -outputCreateChannelTx create_chan_tx.pb -profile SampleSingleMSPChannelV1_1 -channelID application-channel-1 64 ``` 65 66 ### Inspect a genesis block 67 68 Print the contents of a genesis block named `genesis_block.pb` to the screen as 69 JSON. 70 71 ``` 72 configtxgen -inspectBlock genesis_block.pb 73 ``` 74 75 ### Inspect a channel creation tx 76 77 Print the contents of a channel creation tx named `create_chan_tx.pb` to the 78 screen as JSON. 79 80 ``` 81 configtxgen -inspectChannelCreateTx create_chan_tx.pb 82 ``` 83 84 ### Print an organization definition 85 86 Construct an organization definition based on the parameters such as MSPDir 87 from `configtx.yaml` and print it as JSON to the screen. (This output is useful 88 for channel reconfiguration workflows, such as adding a member). 89 90 ``` 91 configtxgen -printOrg Org1 92 ``` 93 94 ### Output anchor peer tx (deprecated) 95 96 Output a channel configuration update transaction `anchor_peer_tx.pb` based on 97 the anchor peers defined for Org1 and channel profile SampleSingleMSPChannelV1_1 98 in `configtx.yaml`. Transaction will set anchor peers for Org1 if no anchor peers 99 have been set on the channel. 100 ``` 101 configtxgen -outputAnchorPeersUpdate anchor_peer_tx.pb -profile SampleSingleMSPChannelV1_1 -asOrg Org1 102 ``` 103 104 The `-outputAnchorPeersUpdate` output flag has been deprecated. To set anchor 105 peers on the channel, use [configtxlator](configtxlator.html) to update the 106 channel configuration. 107 108 ## Configuration 109 110 The `configtxgen` tool's output is largely controlled by the content of 111 `configtx.yaml`. This file is searched for at `FABRIC_CFG_PATH` and must be 112 present for `configtxgen` to operate. 113 114 Refer to the sample `configtx.yaml` shipped with Fabric for all possible 115 configuration options. You may find this file in the `config` directory of 116 the release artifacts tar, or you may find it under the `sampleconfig` folder 117 if you are building from source. 118 119 120 <a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.