Oracle by Example brandingDeploying an Example Chaincode in Oracle Blockchain Platform

section 0Before You Begin

This 15-minute tutorial shows you how to use the advanced option to deploy an example chaincode to your Oracle Blockchain Platform network. This tutorial also shows you how to confirm the chaincode installation and instantiation, and its configuration in REST proxy.

Background

You can use these deployment options: quick deployment and advanced deployment. In this tutorial, you use the advanced deployment option to specify the parameters required to deploy the example chaincode.

When using the advanced deployment wizard, you can:

  • Install an example chaincode on existing peers.
  • Instantiate the chaincode to compile, build, and initialize it on an existing channel and peers.
  • Use the default endorsement policy. The default endorsement policy gets a chaincode transaction endorsement from any peer on the network. An endorsement is required before the transaction is added to a block and the block is submitted to the ledger.
  • Enable the chaincode to interact with a REST proxy to use the Oracle Blockchain Platform REST APIs.

What Do You Need?

  • Administrator access to your instance.
  • The URL of your instance's console.
  • The channel (default) included with your instance.
  • The peers (peer0-1 and peer0-2) included with your instance and joined to the default channel.
  • The default REST proxy node (restproxy1) included with your instance.

section 1Get the Example Chaincode

  1. Sign in to the Oracle Blockchain Platform console using administrator credentials.
  2. In the console, click the Developer Tools tab.
  3. In the Developer Tools tab, click the Samples pane.
  4. In the Samples pane, navigate to the Car Dealer sample, and then click its Download sample here link.
  5. Save the CarDealer.zip file to your computer.
  6. On your computer, locate and extract the CarDealer.zip file.
  7. Expand the Car Dealer folder, expand artifacts, expand src, expand github.com, and then select the cardealer_cc.go file. Copy and paste cardealer_cc.go to another location on your computer.
  8. Rename cardealer_cc.go to my_test_chaincode.go. Create a folder and name it my_test_chaincode and move my_test_chaincode.go into the folder.
  9. Select the my_test_chaincode folder and create an archive file named my_test_chaincode.zip.


section 1Access the Advanced Deployment Wizard

  1. In the console, select the Chaincodes tab. Click Deploy a New Chaincode.
  2. In the Deploy Chaincode dialog box, click Advanced Deployment.

section 2Install the Chaincode

  1. In the Deploy Chaincode (Advanced) - Step 1, enter MyTestChaincode in the Chaincode Name field.
  2. In the Version field, confirm the default value is v1.
  3. From the Target Peers list, select peer0-1 and peer0-2.
  4. Click Upload Chaincode File, locate and select the my_test_chaincode.zip file, and click Open. Click Next.
  5. Description of step_1_install_chaincode.png follows
    Description of the illustration step_1_install_chaincode.png

section 3Instantiate the Chaincode

  1. In the Deploy Chaincode (Advanced) - Step 2, select default from the Channel list.
  2. From the Peers list, select peer0-1 and peer0-2. Click Next.
  3. Description of step_2_instantiate_chaincode.png follows
    Description of the illustration step_2_instantiate_chaincode.png

section 4Enable the Chaincode in REST Proxy

  1. In the Deploy Chaincode (Advanced) - Step 3, select restproxy1 from the dropdown list in the REST Proxy Nodes field.
  2. In the Peers field, select peer0-1. Click Next.
  3. Description of step_3_restproxy.png follows
    Description of the illustration step_3_restproxy.png
  4. After receiving a message indicating that the chaincode was enabled in REST proxy successfully, click Close.

section 5Confirm the Deployment

  1. Select the Chaincodes tab.
  2. In the Chaincode Summary table, locate and expand MyTestChaincode.

    The following information displays in the table: the chaincode's path, that the chaincode is installed on two peers, and that the chaincode is instantiated on one channel.

  3. Description of chaincode_summary.png follows
    Description of the illustration chaincode_summary.png
  4. In the chaincode's Versions column, click v1.
  5. In the Chaincode Version Information page, confirm that the Installed on Peers tab is selected. You should see peer0-1 and peer0-2 listed in the table.
  6. Description of peer_summary.png follows
    Description of the illustration peer_summary.png
  7. Click Instantiated on Channels.

    You should see the default channel listed in the table.

  8. Description of channel_summary.png follows
    Description of the illustration channel_summary.png
  9. To confirm that the chaincode was enabled in the REST proxy, select the Nodes tab.
  10. In the Nodes Summary table, locate the restproxy1 node, click More Actions, and select Edit Configuration.
  11. In the Configure dialog box, locate MyTestChaincode. Confirm its channel is default and its endorsing peer is peer0-1.
  12. Description of configure_restproxy.png follows
    Description of the illustration configure_restproxy.png

more informationWant to Learn More?