osnadmin channel

The osnadmin channel command allows administrators to perform channel-related operations on an orderer, such as joining a channel, listing the channels an orderer has joined, and removing a channel. The channel participation API must be enabled and the Admin endpoint must be configured in the orderer.yaml for each orderer.

*Note: For a network using a system channel, list (for all channels) and remove (for the system channel) are the only supported operations. Any other attempted operation will return an error.

Syntax

The osnadmin channel command has the following subcommands:

  • join

  • list

  • remove

osnadmin channel

  1. usage: osnadmin channel <command> [<args> ...]
  2. Channel actions
  3. Flags:
  4. --help Show context-sensitive help (also try
  5. --help-long and --help-man).
  6. -o, --orderer-address=ORDERER-ADDRESS
  7. Admin endpoint of the OSN
  8. --ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
  9. certificate(s) for the OSN
  10. --client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
  11. key to use for mutual TLS communication with
  12. the OSN
  13. --client-key=CLIENT-KEY Path to file containing PEM-encoded private key
  14. to use for mutual TLS communication with the
  15. OSN
  16. --no-status Remove the HTTP status message from the command
  17. output
  18. Subcommands:
  19. channel join --channelID=CHANNELID --config-block=CONFIG-BLOCK
  20. Join an Ordering Service Node (OSN) to a channel. If the channel does not
  21. yet exist, it will be created.
  22. channel list [<flags>]
  23. List channel information for an Ordering Service Node (OSN). If the
  24. channelID flag is set, more detailed information will be provided for that
  25. channel.
  26. channel remove --channelID=CHANNELID
  27. Remove a channel from an Ordering Service Node (OSN).

osnadmin channel join

  1. usage: osnadmin channel join --channelID=CHANNELID --config-block=CONFIG-BLOCK
  2. Join an Ordering Service Node (OSN) to a channel. If the channel does not yet
  3. exist, it will be created.
  4. Flags:
  5. --help Show context-sensitive help (also try
  6. --help-long and --help-man).
  7. -o, --orderer-address=ORDERER-ADDRESS
  8. Admin endpoint of the OSN
  9. --ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
  10. certificate(s) for the OSN
  11. --client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
  12. key to use for mutual TLS communication with
  13. the OSN
  14. --client-key=CLIENT-KEY Path to file containing PEM-encoded private key
  15. to use for mutual TLS communication with the
  16. OSN
  17. --no-status Remove the HTTP status message from the command
  18. output
  19. -c, --channelID=CHANNELID Channel ID
  20. -b, --config-block=CONFIG-BLOCK
  21. Path to the file containing an up-to-date
  22. config block for the channel

osnadmin channel list

  1. usage: osnadmin channel list [<flags>]
  2. List channel information for an Ordering Service Node (OSN). If the channelID
  3. flag is set, more detailed information will be provided for that channel.
  4. Flags:
  5. --help Show context-sensitive help (also try
  6. --help-long and --help-man).
  7. -o, --orderer-address=ORDERER-ADDRESS
  8. Admin endpoint of the OSN
  9. --ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
  10. certificate(s) for the OSN
  11. --client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
  12. key to use for mutual TLS communication with
  13. the OSN
  14. --client-key=CLIENT-KEY Path to file containing PEM-encoded private key
  15. to use for mutual TLS communication with the
  16. OSN
  17. --no-status Remove the HTTP status message from the command
  18. output
  19. -c, --channelID=CHANNELID Channel ID

osnadmin channel remove

  1. usage: osnadmin channel remove --channelID=CHANNELID
  2. Remove a channel from an Ordering Service Node (OSN).
  3. Flags:
  4. --help Show context-sensitive help (also try
  5. --help-long and --help-man).
  6. -o, --orderer-address=ORDERER-ADDRESS
  7. Admin endpoint of the OSN
  8. --ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
  9. certificate(s) for the OSN
  10. --client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
  11. key to use for mutual TLS communication with
  12. the OSN
  13. --client-key=CLIENT-KEY Path to file containing PEM-encoded private key
  14. to use for mutual TLS communication with the
  15. OSN
  16. --no-status Remove the HTTP status message from the command
  17. output
  18. -c, --channelID=CHANNELID Channel ID

Example Usage

osnadmin channel join examples

Here’s an example of the osnadmin channel join command.

  • Create and join a sample channel mychannel defined by the application channel genesis block contained in file mychannel-genesis-block.pb. Use the orderer admin endpoint at orderer.example.com:9443.

    1. osnadmin channel join -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel --config-block mychannel-genesis-block.pb
    2. Status: 201
    3. {
    4. "name": "mychannel",
    5. "url": "/participation/v1/channels/mychannel",
    6. "consensusRelation": "consenter",
    7. "status": "active",
    8. "height": 1
    9. }

    Status 201 and the channel details are returned indicating that the channel has been successfully created and joined.

osnadmin channel list example

Here are some examples of the osnadmin channel list command.

  • Listing all the channels that the orderer has joined. This includes the system channel (if one exists) and all of the application channels.

    1. osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY
    2. Status: 200
    3. {
    4. "systemChannel": null,
    5. "channels": [
    6. {
    7. "name": "mychannel",
    8. "url": "/participation/v1/channels/mychannel"
    9. }
    10. ]
    11. }

    Status 200 and the list of channels are returned.

  • Using the --channelID flag to list more details for mychannel.

    1. osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
    2. Status: 200
    3. {
    4. "name": "mychannel",
    5. "url": "/participation/v1/channels/mychannel",
    6. "consensusRelation": "consenter",
    7. "status": "active",
    8. "height": 3
    9. }

    Status 200 and the details of the channels are returned.

osnadmin channel remove example

Here’s an example of the osnadmin channel remove command.

  • Removing channel mychannel from the orderer at orderer.example.com:9443.

    1. osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
    2. Status: 204

    Status 204 is returned upon successful removal of a channel.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.