A Hyperledger Fabric channel can function as a network inside a network. When two or more users want to create a separate environment where they can interact without involving other parties on the network, they create a channel. A channel is an essential entity of a blockchain network and the only way to communicate within the network.
Channels are one of the main reasons why Hyperledger Fabric is considered one of the best private blockchains.
If you create a channel inside a Hyperledger Fabric network, other network members will not know of its existence. Each channel has a separate ledger which the channel members maintain. All transactions inside a channel are added to this ledger. Only the members of a particular channel can read or write transactions to the ledger of that channel. The possibility of creating channels gives more granularity and flexibility to the Hyperledger permissioned blockchain.
Creating a channel on the Hyperledger Fabric requires in-depth knowledge of the Fabric architecture and knowledge about the different required elements. However, Catalyst Blockchain Platform makes it extremely easy to create a channel. Even if a non-technical person wants to develop their solution on top of Hyperledger Fabric, all they need to do is follow the documentation's instructions.
To create a new channel on Catalyst Blockchain Platform, select the Channels tab on the navigation bar. It will display all of the channels that you participate in or have created. Then click on the ‘Add channel’ button.
It opens a new window that allows you to create a new channel with your preferred customizations.
The first two fields you need to fill in are the Channel name and Policy.
- Name - When naming a channel, keep in mind that every channel will have a unique name on the platform.
Note: Sometimes you cannot create a channel with a new name because other organizations in your network already used that name for a channel on which your organization does not participate.
- Policy - The channel policy is the governing model for a channel. Activities such as validation of a transaction, addition of a new organization, and chaincode-related actions are all executed according to the channel policy.
After that, you need to select an ordering service and a consortium.
Then you need to add organizations to a channel. At least one organization is required at the time of the creation of a new channel. You can add new organizations later as well.
Note: Only consortium members can create channels and be added to the channel during creation. Other organizations that are required can be added to the channel at a later point in time.
In the organization section, you must define the following parameters:
- Organization - You can only add organizations to the channel that are already a part of the network. Therefore, in the current version of Catalyst Blockchain Platform, you must add an organization to the ordering service before adding it to a channel.
- Anchor peers - You add anchor peers for peer discovery. It is important to note that this is not a specific peer, rather it is just a role. Every organization must have at least one anchor peer. You can skip adding an anchor peer in this step and add it later with the ‘Update Anchor’ button.
- Joined peers - This is the list of peers that belong to the user’s organization. You can select all or specific peers to join the channel. If you are adding an organization, you can not add their peers, but just the system channel's consenters.
Note: You can add peers only for your organization. Other organizations should add their peers by adding them to a channel.
- Consenters - These are the subset of the ordering nodes that are part of the system channel, responsible for ordering the transactions on a given channel. At least one consenter must be added.
- Select rights
- Admin - An admin organization takes part in the channel configurations.
- Writer - A writer organization can update a ledger.
- Reader - A reader organization can query the ledger.
- Endorser - An organization that is involved in approving the chaincode on a particular channel.
Note: You need to assign the role according to your business needs, but each role should be covered by at least one organization while creating a channel.
After this, there is also an option of removing an organization if it was added by mistake.
There is a button called “Add organization,” which allows you to add as many organizations as you want.
Click on the “Save” button after entering all of the details and your channel will be created.
The channel will appear under the “Channel” tab only after at least one peer has been added. To know more about adding a peer to the channel, please refer to this section.
After you have successfully created a channel, you can configure it under the “Channels” tab. If you cannot see the channel name you need under this tab, it can be because no peer was added to that particular channel. For additional help on adding the peer to a channel, please refer to this section. Click on the name of the channel you want to configure and it will expand the channel box. The information displayed on the screen consists of two sections.
Section one contains the general information about the channel, such as the block height, current block hash, previous block hash, policy, and capabilities.
The second section in the lower part of the screen constitutes five tabs.
This tab shows organizations and peers that are a part of the selected channel.
You can add an organization or remove an organization from the channel. You need admin rights to be able to perform these actions.
Note: The Remove organization action removes the organization along with its consenter. Because of Raft specific, you cannot remove an organization with more than one consenter belonging to this organization added to the channel. To be able to remove an organization with two or more consenters, please remove its consenters from the channel.
Warning: You can initiate removing your organization from the channel by yourself, but follow the following instructions.
If the channel policy is MAJORITY or ALL and there is more than one organization with admin rights on the channel, this action will create a proposal. If your organization has admin rights on the channel, you can (or in case of ALL policy – you should) approve the proposal. But DO NOT commit this proposal to the channel by your organization. Instead, this proposal should be committed by another organization in the channel.
You can also add more peers to the channel or update anchor peers for your organization.
Info: We recommend having at least one anchor peer for the organization for service discovery.
Here you can see the information about the channel genesis block configuration along with the "Edit" option.
In the Consenters block, you can view the MSPID of the consenters, TLS certificates, and perform specific actions such as adding or removing a consenter. However, updating the consenter list is subject to the channel policy, which may require proposals according to the Raft protocol in case of MAJORITY or ALL channel’s policies.
Note: The Raft ordering service facilitates the addition or removal of nodes dynamically, meaning that a node can be added to the channel while the channel is being serviced. However, you can do this if only one node is added or removed at a time. For more information, please refer to the official documentation here.
We recommend adding or removing consenters with caution.
Warning: We do not recommend removing your last consenter from the channel. In this case we recommend removing your organization instead of removing the consenter as described in the section before. This action will remove your organization along with your consenter from the channel.
Inside this tab, you can see the blocks representing transactions that have happened sequentially over the channel. In addition, you can see the number of transactions inside a block, which shows the type of all transactions and transaction details upon clicking the "Open details" button.
These are the transaction proposals that are validated according to the policy of the corresponding channel. The proposal is created automatically when:
- Channel has a MAJORITY or ALL policy.
- There is more than one organization with admin rights on the channel.
- An organization submits action which affects the channel configuration, such as adding an organization or adding a consenter.
Proposals can be approved or rejected only by organizations with admin rights. The details of a proposal are displayed in this block through the following fields:
- Proposal Name
While most fields under the proposal block are self-explanatory, it is imperative to understand the “Status” field. The proposal can be in the following possible statuses at any given time:
- Created - The proposal is ready to be voted on.
- Voting - The proposal is voted by at least one organization, but the policy is not satisfied yet.
- Voted - The proposal has been voted on and the channel policy is satisfied, so the proposal can be completed.
- Completed - All needed approvals were done, the proposal was successfully completed.
- Canceled - The proposal was canceled by the organization that created it.
You can vote with the “Vote” button present in the “Action” field. The organization, which initiates this proposal can also cancel this proposal.
Note: A new proposal cannot be initiated until the existing proposal is complete or has been deleted. A channel snapshot is always taken when a proposal is created.
Note: These proposals (voting functionality) are implemented as a system chaincode and are integrated into the peer images. Therefore, we recommend using the IntellectEU Hyperledger Fabric peer image. If any other peer image is used, the proposals will not be available. You can choose a peer image while creating a peer set (see details here).
Under the Chaincode tab, you can perform the following actions:
- Approve chaincode - A chaincode needs to be approved by an organization with endorser rights according to the channel policy. For more details, please refer to the chaincode lifecycle official documentation here or the chaincode section.
- Commit chaincode - Organizations having endorser rights according to an endorsement policy can commit chaincode to a channel. In addition, an organization can commit a chaincode if the required number of organizations have approved it. See more about how to commit a chaincode in the chaincode section.
Info: Only that organization that previously approved the chaincode can commit it to the channel.
You can view the chaincodes approved by your organization or committed to the channel. Parameters such as the ID, version, sequence, status and action are present under this tab. The Status field allows you to view the chaincode status on that particular channel and what approvals are needed for chaincode to be committed. In the "Action" field, you can test your chaincode using query or invoke methods after the chaincode is committed to the channel. You can view the chaincode approval process details by clicking on the particular chaincode.
- The organization required to join the channel should already be a part of the network (one of the orderer organizations in the RAFT section of the ordering service).
1. Organization 1, which has already joined the channel, should add Organization 2 through the “Add organization” button, which opens a new side window.
A drop-down menu is available here, which displays the consenters that belong to Organization 2. Organization 1 needs to select at least one of these consenters and then select the desired rights before clicking “Submit.”
Add an organization to a channel
2. Now, Organization 2 must go to the peer section and click “Join to channel.” After this, it is required to type the channel's exact name and click "Join." The channel name is case-sensitive. Please note that there is no option to select channels to join from the dropdown menu due to security reasons.
Join a peer to the channel
After Organization 2 has successfully joined the channel, the channel will appear under the “Channels” tab. Here, Organization 2 can update the anchor peer for this channel, add other peers to the channel, add or delete consenters, and more.