Introduction

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 deployment.

Background

You can use two 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.
  • Deploy the chaincode on an existing channel. Deploying a chaincode consists of approving and committing a chaincode definition.
  • 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.

Prerequisites

  • An Oracle Blockchain Platform founder instance.
  • Administrator access to your instance.
  • The URL of the Oracle Blockchain Platform console.
  • The channel (default) included with your instance.
  • The peers (peer0 and peer1) included with your instance and joined to the default channel.
  • The Go programming language installed on your local computer.

Task 1: Get the Example Chaincode

  1. Sign in to the Oracle Blockchain Platform service console using an administrative user ID.
  2. Click the Developer Tools tab.
  3. Click the Samples pane.
  4. In the Samples pane, locate 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 CarDealer folder, expand artifacts, expand src, expand github.com, expand go, and then select the cardealer_cc.go and go.mod files. Copy and paste these two files to another location on your computer.
  8. Create a folder and name it my_test_chaincode and move both files into the folder.
  9. Navigate to the my_test_chaincode folder and open a command prompt. Run the following commands:
    1. Run the go mod tidy command to generate a go.sum file.
    2. Run the go mod vendor command to download all code dependencies to the vendor directory.
  10. Select the my_test_chaincode folder and create an archive file named my_test_chaincode.zip.. The archive must contain the cardealer_cc.go, go.mod, and go.sum files and the vendor directory.

Task 2: Access 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.

Task 3: Install the Chaincode

  1. On the Deploy Chaincode (Advanced) - Step 1 page, enter my_label in the Package Label field.
  2. In the Chaincode Language field, confirm the default value is GoLang.
  3. In the Target Peers list, select peer0 and peer1.
  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

Task 4: Deploy the Chaincode

  1. On the Deploy Chaincode (Advanced) - Step 2 page, select default from the Channel list.
  2. In the Chaincode Name field, enter MyTestChaincode.
  3. In the Version field, confirm the default value is v1. Click Next.
  4. Description of step_2_deploy_chaincode.png follows
    Description of the illustration step_2_deploy_chaincode.png

Task 5: Confirm the Deployment

  1. Select the Chaincodes tab.
  2. In the Chaincode Summary table, locate the package ID that begins with my_label.

    Note:

    The following information is displayed in the table: the chaincode's package ID, that the chaincode is installed on two peers, and that the chaincode is deployed on one channel.
  3. Description of chaincode_summary.png follows
    Description of the illustration chaincode_summary.png
  4. In the chaincode's Installed on Peers column, click 2.
  5. In the Installed on Peers Summary page, you should see peer0 and peer1 listed in the table.
  6. Description of peer_summary.png follows
    Description of the illustration peer_summary.png
  7. Click Deployed on Channels. You should see the default channel listed in the table, along with the chaincode name MyTestChaincode and version v1.
  8. Description of channel_summary.png follows
    Description of the illustration channel_summary.png

You can delete a chaincode if it is no longer needed. For more information, see Delete a Chaincode

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.