The previous blog posts introduced the Oracle Blockchain Cloud Service as well as providing the steps on how to configure the Network Founder Instance and a Participant Organization instance. We also explored how to perform the required Fabric network configurations, including the ones required for peers, channels, security, and other components.
Now, this blog post provides the steps required to perform the chaincode (smart contract) deployment and instantiation.
You can check the official documentation and the related steps by using a couple of resources provided by the official documentation: Typical Workflow to Deploy Chaincodes
This blog post then has the summarized steps that will allow you to deploy chaincode as well as enable the chaincode in REST proxy as required.
So without further ado, let’s configure our Blockchain network as per the Hyperledger Fabric requirements and conventions.
How to deploy Chaincode to Oracle Blockchain Cloud Service
The previous blog posts explained how to access your OBCS instances, please perform the same steps again.
Let’s start with the Network Founder role. You will need to access the network founder console in order to deploy the chaincode.
Besides, you also need to get the example chaincode source code (golang) and package it in a ZIP file. Just copy the source code file (carTrace.go) from the Gist below and then create a zip file that contains the source code file.
Select the Chaincode tab and then click the Deploy a New Chaincode button as shown below:
Select the Quick Deployment option as it suffices for the vast majority of chaincode deployment needs. The Advanced Deployment option gives you more flexibility regarding the deployment arguments but the Quick Deployment one is the usual path.
You will see the deployment options form. Provide the required information such as the Chaincode Name, Version, Channel, and REST Proxy. Select and upload the Chaincode deployment file as shown below. Click the Submit button.
Confirm that you want to deploy your chaincode as it cannot be removed after deployment, similar to channels as per the Hyperledger Fabric contract.
The deployment process starts as shown below. The deployment process takes a while as several steps need to be performed in the background, including compilation, container provisioning, and others. You will see a progress bar with the Instantiating chaincode message first.
Then it will be updated and show the Enabling in REST proxy message as well as you can see below:
At last, a confirmation message will be shown:
You can then check the chaincode tab again and you will see the chaincode as deployed and listed as shown below.
At last, remember that you can also deploy chaincode by using the consoles of other Participant Organizations as required.
That’s it! After all the steps above are completed properly, your chaincode will be deployed and ready for our next step — invoke the chaincode methods via the REST API.
In the next blog post, we’ll provide the steps required to invoke the chaincode (smart contract) we’ve just deployed by means of a REST client, a REST proxy, and the related REST API. Stay tuned!
Oracle Developers and Oracle OCI Free Tier
Join our Oracle Developers channel on Slack to discuss Microservices, Java, JDBC, Oracle Cloud Infrastructure, Oracle Database, and other topics!
Build, test, and deploy your applications on Oracle Cloud — for free! Get access to OCI Cloud Free Tier!