docs/source/commands/osnadminchannel.md
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.
The osnadmin channel command has the following subcommands:
usage: osnadmin channel <command> [<args> ...]
Channel actions
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
-o, --orderer-address=ORDERER-ADDRESS
Admin endpoint of the OSN
--ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
certificate(s) for the OSN
--client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
key to use for mutual TLS communication with
the OSN
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
--no-status Remove the HTTP status message from the command
output
Subcommands:
channel join --channelID=CHANNELID --config-block=CONFIG-BLOCK
Join an Ordering Service Node (OSN) to a channel. If the channel does not
yet exist, it will be created.
channel list [<flags>]
List channel information for an Ordering Service Node (OSN). If the
channelID flag is set, more detailed information will be provided for that
channel.
channel remove --channelID=CHANNELID
Remove a channel from an Ordering Service Node (OSN).
channel update --channelID=CHANNELID --config-update-envelope=CONFIG-UPDATE-ENVELOPE [<flags>]
Update an Ordering Service Node (OSN) to a channel.
channel fetch --channelID=CHANNELID --blockID=BLOCKID --outputfile=OUTPUTFILE [<flags>]
Fetch a specified block, writing it to a file.
usage: osnadmin channel join --channelID=CHANNELID --config-block=CONFIG-BLOCK
Join an Ordering Service Node (OSN) to a channel. If the channel does not yet
exist, it will be created.
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
-o, --orderer-address=ORDERER-ADDRESS
Admin endpoint of the OSN
--ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
certificate(s) for the OSN
--client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
key to use for mutual TLS communication with
the OSN
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
--no-status Remove the HTTP status message from the command
output
-c, --channelID=CHANNELID Channel ID
-b, --config-block=CONFIG-BLOCK
Path to the file containing an up-to-date
config block for the channel
usage: osnadmin channel list [<flags>]
List channel information for an Ordering Service Node (OSN). If the channelID
flag is set, more detailed information will be provided for that channel.
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
-o, --orderer-address=ORDERER-ADDRESS
Admin endpoint of the OSN
--ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
certificate(s) for the OSN
--client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
key to use for mutual TLS communication with
the OSN
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
--no-status Remove the HTTP status message from the command
output
-c, --channelID=CHANNELID Channel ID
usage: osnadmin channel remove --channelID=CHANNELID
Remove a channel from an Ordering Service Node (OSN).
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
-o, --orderer-address=ORDERER-ADDRESS
Admin endpoint of the OSN
--ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
certificate(s) for the OSN
--client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
key to use for mutual TLS communication with
the OSN
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
--no-status Remove the HTTP status message from the command
output
-c, --channelID=CHANNELID Channel ID
usage: osnadmin channel update --channelID=CHANNELID --config-update-envelope=CONFIG-UPDATE-ENVELOPE [<flags>]
Update an Ordering Service Node (OSN) to a channel.
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
-o, --orderer-address=ORDERER-ADDRESS
Admin endpoint of the OSN
--ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
certificate(s) for the OSN
--client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
key to use for mutual TLS communication with
the OSN
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
--no-status Remove the HTTP status message from the command
output
-c, --channelID=CHANNELID Channel ID
-e, --config-update-envelope=CONFIG-UPDATE-ENVELOPE
Path to the file containing an up-to-date
config update envelope for the channel
-t, --tlsHandshakeTimeShift=0 The amount of time to shift backwards for
certificate expiration checks during TLS
handshakes with the orderer endpoint
usage: osnadmin channel fetch --channelID=CHANNELID --blockID=BLOCKID --outputfile=OUTPUTFILE [<flags>]
Fetch a specified block, writing it to a file.
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
-o, --orderer-address=ORDERER-ADDRESS
Admin endpoint of the OSN
--ca-file=CA-FILE Path to file containing PEM-encoded TLS CA
certificate(s) for the OSN
--client-cert=CLIENT-CERT Path to file containing PEM-encoded X509 public
key to use for mutual TLS communication with
the OSN
--client-key=CLIENT-KEY Path to file containing PEM-encoded private key
to use for mutual TLS communication with the
OSN
--no-status Remove the HTTP status message from the command
output
-c, --channelID=CHANNELID Channel ID
-b, --blockID=BLOCKID Block ID - <newest|oldest|config|(number)>
-f, --outputfile=OUTPUTFILE Puth to a file.
-t, --tlsHandshakeTimeShift=0 The amount of time to shift backwards for
certificate expiration checks during TLS
handshakes with the orderer endpoint
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.
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
Status: 201
{
"name": "mychannel",
"url": "/participation/v1/channels/mychannel",
"consensusRelation": "consenter",
"status": "active",
"height": 1
}
Status 201 and the channel details are returned indicating that the channel has been successfully created and joined.
Here are some examples of the osnadmin channel list command.
Listing all the channels that the orderer has joined. Note that the system channel will always be NULL because it is no longer supported from release v3.0 onwards.
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY
Status: 200
{
"systemChannel": null,
"channels": [
{
"name": "mychannel",
"url": "/participation/v1/channels/mychannel"
}
]
}
Status 200 and the list of channels are returned.
Using the --channelID flag to list more details for mychannel.
osnadmin channel list -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
Status: 200
{
"name": "mychannel",
"url": "/participation/v1/channels/mychannel",
"consensusRelation": "consenter",
"status": "active",
"height": 3
}
Status 200 and the details of the channels are returned.
Here's an example of the osnadmin channel remove command.
Removing channel mychannel from the orderer at orderer.example.com:9443.
osnadmin channel remove -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel
Status: 204
Status 204 is returned upon successful removal of a channel.
Here's an example of the osnadmin channel update command.
Update the example of the my channel channel defined by the modified config
contained in the my channel-config-envelope.pb file.
Use the endpoint of the order administrator
at order.example.com:9443.
osnadmin channel update -o orderer.example.com:9443 --ca-file $CA_FILE --client-cert $CLIENT_CERT --client-key $CLIENT_KEY --channelID mychannel --config-update-envelope mychannel-genesis-block.pb
Status: 201
{
"name": "mychannel",
"url": "/participation/v1/channels/mychannel",
"consensusRelation": "consenter",
"status": "active",
"height": 1
}
Status 201 and the channel details are returned indicating that the channel has been successfully updated.
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"></a> 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>.