|
| 1 | +configtxgen |
| 2 | +============= |
| 3 | + |
| 4 | +## Description |
| 5 | + |
| 6 | +The `configtxgen` command allows users to create and inspect channel config |
| 7 | +related artifacts. The content of the generated artifacts is dictated by the |
| 8 | +contents of `configtx.yaml`. |
| 9 | + |
| 10 | +## Syntax |
| 11 | + |
| 12 | +The `configtxgen` tool has no sub-commands, but supports flags which can be set |
| 13 | +to accomplish a number of tasks. |
| 14 | + |
| 15 | +``` |
| 16 | +Usage of configtxgen: |
| 17 | + -asOrg string |
| 18 | + Performs the config generation as a particular organization (by name), only including values in the write set that org (likely) has privilege to set |
| 19 | + -channelID string |
| 20 | + The channel ID to use in the configtx (default "testchainid") |
| 21 | + -inspectBlock string |
| 22 | + Prints the configuration contained in the block at the specified path |
| 23 | + -inspectChannelCreateTx string |
| 24 | + Prints the configuration contained in the transaction at the specified path |
| 25 | + -outputAnchorPeersUpdate string |
| 26 | + Creates an config update to update an anchor peer (works only with the default channel creation, and only for the first update) |
| 27 | + -outputBlock string |
| 28 | + The path to write the genesis block to (if set) |
| 29 | + -outputCreateChannelTx string |
| 30 | + The path to write a channel creation configtx to (if set) |
| 31 | + -printOrg string |
| 32 | + Prints the definition of an organization as JSON. (useful for adding an org to a channel manually) |
| 33 | + -profile string |
| 34 | + The profile from configtx.yaml to use for generation. (default "SampleInsecureSolo") |
| 35 | + -version |
| 36 | + Show version information |
| 37 | +``` |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +### Output a genesis block |
| 42 | + |
| 43 | +Write a genesis block to `genesis_block.pb` for channel `orderer-system-channel` |
| 44 | +for profile `SampleSingleMSPSolo`. |
| 45 | + |
| 46 | +``` |
| 47 | +configtxgen -outputBlock genesis_block.pb -profile SampleSingleMSPSolo -channelID orderer-system-channel |
| 48 | +``` |
| 49 | + |
| 50 | +### Output a channel creation tx |
| 51 | + |
| 52 | +Write a channel creation transaction to `create_chan_tx.pb` for profile |
| 53 | +`SampleSingleMSPChannel`. |
| 54 | + |
| 55 | +``` |
| 56 | +configtxgen -outputCreateChannelTx create_chan_tx.pb -profile SampleSingleMSPChannel -channelID application-channel-1 |
| 57 | +``` |
| 58 | + |
| 59 | +### Inspect a genesis block |
| 60 | + |
| 61 | +Print the contents of a genesis block named `genesis_block.pb` to the screen as |
| 62 | +JSON. |
| 63 | + |
| 64 | +``` |
| 65 | +configtxgen -inspectBlock genesis_block.pb |
| 66 | +``` |
| 67 | + |
| 68 | +### Inspect a channel creation tx |
| 69 | + |
| 70 | +Print the contents of a channel creation tx named `create_chan_tx.pb` to the |
| 71 | +screen as JSON. |
| 72 | + |
| 73 | +``` |
| 74 | +configtxgen -inspectChannelCreateTx create_chan_tx.pb |
| 75 | +``` |
| 76 | + |
| 77 | +### Print an organization definition |
| 78 | + |
| 79 | +Construct an organization definition based on the parameters such as MSPDir |
| 80 | +from `configtx.yaml` and print it as JSON to the screen. (This output is useful |
| 81 | +for channel reconfiguration workflows, such as adding a member). |
| 82 | + |
| 83 | +``` |
| 84 | +configtxgen -printOrg Org1 |
| 85 | +``` |
| 86 | + |
| 87 | +### Output anchor peer tx |
| 88 | + |
| 89 | +Output a configuration update transaction to `anchor_peer_tx.pb` which sets the |
| 90 | +anchor peers for organization Org1 as defined in profile SampleSingleMSPChannel |
| 91 | +based on `configtx.yaml`. |
| 92 | + |
| 93 | +``` |
| 94 | +configtxgen -outputAnchorPeersUpdate anchor_peer_tx.pb -profile SampleSingleMSPChannel -asOrg Org1 |
| 95 | +``` |
0 commit comments