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 (
peer0andpeer1) included with your instance and joined to thedefaultchannel. - The Go programming language installed on your local computer.
Task 1: Get the Example Chaincode
- Sign in to the Oracle Blockchain Platform service console using an administrative user ID.
- Click the Developer Tools tab.
- Click the Samples pane.
- In the Samples pane, locate the Car Dealer sample, and then click its Download sample here link.
- Save the
CarDealer.zipfile to your computer. - On your computer, locate and extract the
CarDealer.zipfile. - Expand the
CarDealerfolder, expandartifacts,expandsrc,expandgithub.com,expandgo,and then select thecardealer_cc.goandgo.modfiles. Copy and paste these two files to another location on your computer. - Create a folder and name it
my_test_chaincodeand move both files into the folder. - Navigate to the
my_test_chaincodefolder and open a command prompt. Run the following commands:- Run the
go mod tidycommand to generate ago.sumfile. - Run the
go mod vendorcommand to download all code dependencies to thevendordirectory.
- Run the
- Select the
my_test_chaincodefolder and create an archive file namedmy_test_chaincode.zip.. The archive must contain thecardealer_cc.go,go.mod, andgo.sumfiles and thevendordirectory.
Task 2: Access the Advanced Deployment Wizard
- In the console, select the Chaincodes tab. Click Deploy a New Chaincode.
- In the Deploy Chaincode dialog box, click Advanced Deployment.
Task 3: Install the Chaincode
- On the Deploy Chaincode (Advanced) - Step 1 page, enter
my_labelin the Package Label field. - In the Chaincode Language field, confirm the default
value is
GoLang. - In the Target Peers list, select
peer0andpeer1. - Click Upload Chaincode File, locate and
select the
my_test_chaincode.zipfile, and click Open. Click Next.
Task 4: Deploy the Chaincode
- On the Deploy Chaincode (Advanced) - Step 2 page, select
defaultfrom the Channel list. - In the Chaincode Name field, enter
MyTestChaincode. - In the Version field, confirm the default
value is
v1.Click Next.
Task 5: Confirm the Deployment
- Select the Chaincodes tab.
- 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. - In the chaincode's Installed on Peers column, click 2.
- In the Installed on Peers Summary page, you
should see
peer0andpeer1listed in the table. - Click Deployed on Channels. You should see the
defaultchannel listed in the table, along with the chaincode nameMyTestChaincodeand versionv1.
You can delete a chaincode if it is no longer needed. For more information, see Delete a Chaincode
Related Links
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.
Deploying an Example Chaincode in Oracle Blockchain Platform
F34753-03
November 2022
Copyright © 2021-2022, Oracle and/or its affiliates.