Deploying chaincode

OBP offers two different deployment options. A quick deployment option for one-step chaincode deployment and advanced deployment options. The quickstart deployment option is recommended for chaincode testing, while the advanced deployment option allows you to specify various advanced deployment settings such as choosing the peers on which the chaincode will be installed, the endorsement policy to use, and so on. This section shows both deployment options.

The following is the procedure for deploying the chaincode:

  1. Navigate to the Chaincodes tab:

Chaincode deployment
  1. Click on the Deploy a New Chaincode button. The following screen will be opened with two deployment options:

Chaincode deployment options
  1. Quick Deployment: The one-step chaincode deployment option uses default settings and is enabled in the selected REST proxies. However, we'll use the Advanced Deployment option to deploy our chaincode in this section. The following is the screen for you to refer to for Quick Deployment:

Quick chaincode deployment
  1. Advanced Deployment provides a multi-step wizard to install, instantiate, and enable the REST proxy for chaincode. Select this option from the Deploy Chaincode menu. The step-by-step wizard will be opened and the first step follows, where you provide details of the chaincode such as the chaincode name, version, target peers on which the chaincode should be deployed, and the actual chaincode package. (If it is a single .go file, then there's no need for a package. The single file can be selected, but if it has multiple files or the code is written in Node.js or Java, then package all the files in a ZIP file.) Fill in the fields shown in the following screenshot and click on Next. Remember, none of these values can be altered after installing the chaincode:

Details page
  1. When the Install process is successful, the wizard will show step 2, which is Instantiate. The chaincode will be instantiated only once per channel per version. In this step, you specify which channel the chaincode should be applied to; the peers to participate; the array of the initial parameters if any, are to be passed to the Init() method in the chaincode; the endorsement policy, if any (see the next section for details on the endorsement policy); and the private data collection (see the next section for the details). Fill the form as follows and click Next; it may take a while to go to the next step:

Advance chaincode deployment
  1. After the chaincode is instantiated successfully, the wizard will show step 3, which is to enable the chaincode in a REST proxy. OBP provides multiple REST proxies. You can choose more than one REST proxy to enable the chaincode. Fill in the fields as follows and click Next:

REST proxy
  1. After completing all of the steps in the wizard, finally, you will see this success screen. Click on Close:

Deployment completion message
  1. So far, you have deployed the chaincode in the founder instance. You need to deploy the chaincode in all the participant instances. Repeat the deployment process as we just saw; however, you just need to deploy the chaincode—instantiation will be applied automatically as it is done from the founder of the channel. So, in the Advanced Deployment wizard, after step 1 installation is done, in the step 2 screen, click on the Close button.
  1. Go to the Channels tab. You will find that the chaincode is instantiated. Look at the following references.

The following is the channel before chaincode installation:

Channel before chaincode installation

The following screenshot is the channel after chaincode installation:

Channel after chaincode installation

Multiple chaincodes can be installed on a channel. Also, a chaincode can be enabled on multiple REST proxies.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset