github.com/kaituanwang/hyperledger@v2.0.1+incompatible/docs/source/commands/configtxgen.md (about)

     1  # configtxgen
     2  
     3  The `configtxgen` command allows users to create and inspect channel config
     4  related artifacts.  The content of the generated artifacts is dictated by the
     5  contents of `configtx.yaml`.
     6  
     7  ## Syntax
     8  
     9  The `configtxgen` tool has no sub-commands, but supports flags which can be set
    10  to accomplish a number of tasks.
    11  
    12  ## configtxgen
    13  ```
    14  Usage of configtxgen:
    15    -asOrg string
    16      	Performs the config generation as a particular organization (by name), only including values in the write set that org (likely) has privilege to set
    17    -channelCreateTxBaseProfile string
    18      	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'.
    19    -channelID string
    20      	The channel ID to use in the configtx
    21    -configPath string
    22      	The path containing the configuration to use (if set)
    23    -inspectBlock string
    24      	Prints the configuration contained in the block at the specified path
    25    -inspectChannelCreateTx string
    26      	Prints the configuration contained in the transaction at the specified path
    27    -outputAnchorPeersUpdate string
    28      	Creates an config update to update an anchor peer (works only with the default channel creation, and only for the first update)
    29    -outputBlock string
    30      	The path to write the genesis block to (if set)
    31    -outputCreateChannelTx string
    32      	The path to write a channel creation configtx to (if set)
    33    -printOrg string
    34      	Prints the definition of an organization as JSON. (useful for adding an org to a channel manually)
    35    -profile string
    36      	The profile from configtx.yaml to use for generation.
    37    -version
    38      	Show version information
    39  ```
    40  
    41  ## Usage
    42  
    43  ### Output a genesis block
    44  
    45  Write a genesis block to `genesis_block.pb` for channel `orderer-system-channel`
    46  for profile `SampleSingleMSPRaftV1_1`.
    47  
    48  ```
    49  configtxgen -outputBlock genesis_block.pb -profile SampleSingleMSPRaftV1_1 -channelID orderer-system-channel
    50  ```
    51  
    52  ### Output a channel creation tx
    53  
    54  Write a channel creation transaction to `create_chan_tx.pb` for profile
    55  `SampleSingleMSPChannelV1_1`.
    56  
    57  ```
    58  configtxgen -outputCreateChannelTx create_chan_tx.pb -profile SampleSingleMSPChannelV1_1 -channelID application-channel-1
    59  ```
    60  
    61  ### Inspect a genesis block
    62  
    63  Print the contents of a genesis block named `genesis_block.pb` to the screen as
    64  JSON.
    65  
    66  ```
    67  configtxgen -inspectBlock genesis_block.pb
    68  ```
    69  
    70  ### Inspect a channel creation tx
    71  
    72  Print the contents of a channel creation tx named `create_chan_tx.pb` to the
    73  screen as JSON.
    74  
    75  ```
    76  configtxgen -inspectChannelCreateTx create_chan_tx.pb
    77  ```
    78  
    79  ### Print an organization definition
    80  
    81  Construct an organization definition based on the parameters such as MSPDir
    82  from `configtx.yaml` and print it as JSON to the screen. (This output is useful
    83  for channel reconfiguration workflows, such as adding a member).
    84  
    85  ```
    86  configtxgen -printOrg Org1
    87  ```
    88  
    89  ### Output anchor peer tx
    90  
    91  Output a configuration update transaction to `anchor_peer_tx.pb` which sets the
    92  anchor peers for organization Org1 as defined in profile
    93  SampleSingleMSPChannelV1_1 based on `configtx.yaml`.
    94  
    95  ```
    96  configtxgen -outputAnchorPeersUpdate anchor_peer_tx.pb -profile SampleSingleMSPChannelV1_1 -asOrg Org1
    97  ```
    98  
    99  ## Configuration
   100  
   101  The `configtxgen` tool's output is largely controlled by the content of
   102  `configtx.yaml`.  This file is searched for at `FABRIC_CFG_PATH` and must be
   103  present for `configtxgen` to operate.
   104  
   105  Refer to the sample `configtx.yaml` shipped with Fabric for all possible
   106  configuration options.  You may find this file in the `config` directory of
   107  the release artifacts tar, or you may find it under the `sampleconfig` folder
   108  if you are building from source.
   109  
   110  
   111  <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>.